Thanks so much for making your wonderful class available to use,
its amazing and very convenient!
I had a little problem with the array deleting sounds while enumerating,
( the sound clips are narration played over BG music so are longer than a sound effect, maybe thats the problem...)
being super new to coding ill add my solution (it wont be as elegant as your code)
but maybe it will help someone, or at least make you aware of the issue
hope I did the right thing! - it dosnt seem to crash anymore
Thanks so much for making your wonderful class available to use, its amazing and very convenient!
I had a little problem with the array deleting sounds while enumerating, ( the sound clips are narration played over BG music so are longer than a sound effect, maybe thats the problem...)
being super new to coding ill add my solution (it wont be as elegant as your code) but maybe it will help someone, or at least make you aware of the issue
hope I did the right thing! - it dosnt seem to crash anymore
with many thanks N :)
(void)stopSound:(id)soundOrName fadeOut:(BOOL)fadeOut { if ([soundOrName isKindOfClass:[Sound class]]) { if (fadeOut) { [(Sound )soundOrName fadeOut:soundFadeDuration]; } else { [(Sound )soundOrName stop]; }
}
if ([[soundOrName pathExtension] isEqualToString:@""]) { soundOrName = [soundOrName stringByAppendingPathExtension:@"caf"]; }
for (Sound *sound in [currentSounds reverseObjectEnumerator]) { if ([sound.name isEqualToString:soundOrName] || [[sound.url path] isEqualToString:soundOrName]) { if (fadeOut) { [sound fadeOut:soundFadeDuration]; } else { [sound stop]; } [currentSounds removeObject:sound]; } } }