0
0

hi.
i am trying to make a plugin for a popular instant messaging software using fmod to play short sounds. However the sounds dont ever play and on inspection of the GetError function, it would appear that one of the functions has an invalid parameter and i dont know which function or which parameter. Here is my fmod code:

[code:2f94vycn]
FSOUND_Init(44100,2,FSOUND_INIT_GLOBALFOCUS);
...
FSOUND_STREAM* song = FSOUND_Stream_OpenFile(file, FSOUND_2D, 0);
int channel = FSOUND_Stream_Play(1, song);
MessageBox(NULL,FMOD_ErrorString(FSOUND_GetError()),"FSOUND Error",0);
...
FSOUND_Close();
[/code:2f94vycn]

This code always produces error code 14 – invalid parameters – in the messagebox. file is char[256], and has been verified as pointing to a valid mp3 file. I have been stuck on this for several days and am sure it must be something simple that ive missed. Hope someone can help.

Thanks
optimism_

  • You must to post comments
0
0

this does stop the message box from popping up so presumably there is no obvious error however the sound doesnt play at all =/

[edit] incidently i only added the MessageBox() because the sound was failing to play [/edit]

  • You must to post comments
0
0

[code:29igw1ox]
FSOUND_STREAM* song = FSOUND_Stream_OpenFile(file, 0, 0);
if(!song){
MessageBox(NULL, FMOD_ErrorString(FSOUND_GetError()),"FSOUND Error",0);
}
int channel = FSOUND_Stream_Play(FSOUND_FREE, song);
if(channel < 0){
MessageBox(NULL,FMOD_ErrorString(FSOUND_GetError()),"FSOUND Error",0);
}
while(FSOUND_IsPlaying(channel)){
Sleep(500);
}
FSOUND_Stream_Close(song);
[/code:29igw1ox]

here is my current code, making adjustments for the FSOUND_FREE. I also have a loop to prevent Close() being called too early. Yet still when i run the code i get no message boxes, but the sound doesnt play. Its driving me insane cos i can’t see why its failing.

  • You must to post comments
0
0

Well, perhaps you should ensure proper device initializations. On two test programs I have coded so far, besides calling FSOUND_Init(), I checked the API sample programs and more or less they ensure device initializations through FSOUND_SetOutput(), FSOUND_SetDriver( ), and finally FSOUND_Init().

I am not sure if that may be the problem but it might help. So far, starting the device with those steps has given me no issues at all (expect for when I debug my program and incidentally leave it’s instance open :roll: , which at a second execution time gives me no sound output at all because I didn’t step through the shutdown code of the previous one but that’s just me I guess 😳 ). Anyway, I hope that helps.

  • You must to post comments
0
0

wow thanks it works 😀 tyvm for that

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.