iPhone

playing NSSound asynchronously

zombie45 2014. 1. 27. 15:09

there seem to be almost no posts on playing one NSSound multiple times aynchrosnously

well this is how


below sound is NSSound object

NSSound *sound;


- (void)playSound {

    [[[sound copy] autorelease] play];

}


by copying the object you can play one sound many times overlapping

use method below to do something when the sound stops ad set sound as delegate


- (void)sound:(NSSound *)asound didFinishPlaying:(BOOL)aBool {

[asound stop]

}


반응형