Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

happybob

macrumors newbie
Original poster
Apr 18, 2009
17
0
Hi all, hoping I might be able to get some help. I have created a thread in the initialization which plays a very short sound (0.05 sec). I want the sound to be played multiple times whenever the screen is touched through the thread but it only works on the first execution of the thread. I want to avoid the reinitialization due to the fact I need to keep any processor lag to an absolute minimum.

Code:
thread = [[NSThread alloc] initWithTarget:self selector:@selector(playAudio) object:nil];

I play the sound as follows

Code:
[self.thread start];

Is there something I can add to make sure the thread is retained after being completed without having to reinitialize it?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.