0
0

i’m storing my sounds in a NSMutableDictionary so that i’m able to access them via an NSString argument. storing them in the dictionary requires that i convert the sound to NSValue. when i attempt to convert back, from NSValue to FMOD::Sound, it doesn’t give me any errors, but then when i attempt to play the sound it gives me an error (FMOD error! (37) An invalid parameter was passed to this function).

creating the sounds / storing my sounds in the dictionary
[code:161zkkeo]
[[NSString stringWithFormat:@"%@/click.wav", [[NSBundle mainBundle] resourcePath]] getCString:buffer maxLength:200 encoding:NSASCIIStringEncoding];
result = system->createSound(buffer, FMOD_SOFTWARE, NULL, &forwardSound);
ERRCHECK(result);

[[NSString stringWithFormat:@"%@/back.wav", [[NSBundle mainBundle] resourcePath]] getCString:buffer maxLength:200 encoding:NSASCIIStringEncoding];
result = system->createSound(buffer, FMOD_SOFTWARE, NULL, &backSound);
ERRCHECK(result);

[soundLibrary initWithObjectsAndKeys: [NSValue valueWithPointer:forwardSound], @"forward", [NSValue valueWithPointer:backSound], @"back", nil];
[/code:161zkkeo]

calling the soundManager to play the sound[code:161zkkeo][soundManager playSoundWithKey:@"forward"];[/code:161zkkeo]

the soundManager method which handles the playing of a sound (tSound is declared in the .h)
[code:161zkkeo]- (void)playSoundWithKey:(NSString *)key {

tSound = (FMOD::Sound *)[[soundLibrary objectForKey:key] pointerValue];

FMOD_RESULT result = FMOD_OK;
result = system->playSound(FMOD_CHANNEL_FREE, tSound, false, &channel);
ERRCHECK(result);

}[/code:161zkkeo]

any ideas? thanks in advance!

  • You must to post comments
0
0

the problem was that i wasn’t properly initializing my nsmutabledictionary which is holding the nsvalue objects. there was no issue with my method of converting fmod::sound and nsvalue.

  • You must to post comments
0
0

thanks for the response. i thought that’s what my code was doing, but i’ll have to debug this portion a little more thoroughly to figure out what is happening exactly. i was hoping there was a glaring error in my code 😕 i’ll post here again if i figure it out.

  • You must to post comments
0
0

Make sure that the pointer that you get out of the NSValue is the same as what you put in. If you are calling System::playSound with the same pointer that you got back from System::createSound then I can’t see why you would be having any issues.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.