I'm used to creating sounds like this:
NSString *explosionsoundpath = [[NSBundle mainBundle] pathForResource:@"explosion" ofType:@"caf"];
CFURLRef explosionurl = (CFURLRef ) [NSURL fileURLWithPath:explosionsoundpath];
AudioServicesCreateSystemSoundID (explosionurl, &explosion1a);
AudioServicesCreateSystemSoundID (explosionurl, &explosion1b);
where explosion1a and explosion1b are instance variables declared in the .h file with:
SystemSoundID explosion1a;
Whenever I try to make this process in an array like this
NSString *plasmasoundpath = [[NSBundle mainBundle] pathForResource:@"plasmasound" ofType:@"caf"];
CFURLRef plasmaurl = (CFURLRef ) [NSURL fileURLWithPath:plasmasoundpath];
SystemSoundID plasmalaunch1;
AudioServicesCreateSystemSoundID (plasmaurl, &plasmalaunch1);
[self.plasmasounds addObject:plasmalaunch1];
I get a warning:
"Passing argument 1 of addObject makes pointer from integer without a cast.
If I put the & symbol before plasmalaunch1 in the addObject argument I get an
incompatible pointer type warning.
I'm trying to create an array of sound effects which I can later play by calling:
SystemSoundID sound = [self.plasmasounds objectAtIndex:i];
AudioServicesPlaySystemSound(sound);
Advice on how to make this work (or a better way to solve this problem) appreciated!