Je suis habitué à créer des sons comme ceci:Comment créer un tableau de SystemSoundID? En utilisant le cadre AudioToolbox
NSString *explosionsoundpath = [[NSBundle mainBundle] pathForResource:@"explosion" ofType:@"caf"];
CFURLRef explosionurl = (CFURLRef) [NSURL fileURLWithPath:explosionsoundpath];
AudioServicesCreateSystemSoundID (explosionurl, &explosion1a);
AudioServicesCreateSystemSoundID (explosionurl, &explosion1b);
où explosion1a et explosion1b sont variables d'instance déclarées dans le fichier .h avec:
SystemSoundID explosion1a;
Chaque fois que je tente de faire de cette processus dans un tableau comme celui-ci
NSString *plasmasoundpath = [[NSBundle mainBundle] pathForResource:@"plasmasound" ofType:@"caf"];
CFURLRef plasmaurl = (CFURLRef) [NSURL fileURLWithPath:plasmasoundpath];
SystemSoundID plasmalaunch1;
AudioServicesCreateSystemSoundID (plasmaurl, &plasmalaunch1);
[self.plasmasounds addObject:plasmalaunch1];
je reçois un avertissement:
"Passing argument 1 of addObject makes pointer from integer without a cast.
Si je mets le symbole & avant plasmalaunch1 dans l'argument addObject je reçois un
incompatible pointer type warning.
Je suis en train de créer un tableau d'effets sonores que je peux jouer plus tard en appelant:
SystemSoundID sound = [self.plasmasounds objectAtIndex:i];
AudioServicesPlaySystemSound(sound);
Des conseils sur la façon de faire ce travail (ou une meilleure façon de résoudre ce problème) apprécié!
Pourquoi est-ce un wiki communautaire? –