0
0

i am using this code
[code:2zav3gpp]
player.h
...

private:

void ERRCHECK ( FMOD_RESULT result ) ; 
FMOD::System * system; 
FMOD::Sound * sound; 
FMOD::Channel * channel; 
FMOD_RESULT result; 
FMOD_RESULT F_CALLBACK endCallBackFunc( void ); 

....
....
player.cpp
....
....
result = system->playSound(FMOD_CHANNEL_FREE, sound, false, &channel);
if ( result != FMOD_OK )
{
prinf ("error");
return false;
}
channel->setCallback(FMOD_CHANNEL_CALLBACKTYPE_END, 0, endCallBackFunc());

....
....

FMOD_RESULT F_CALLBACK player::endCallBackFunc( void )
{
printf("end track");
return FMOD_OK;
}

[/code:2zav3gpp]

this is code work, but a signal appears at the start of file but not at completion of playing. Why ?

  • You must to post comments
0
0

It looks like you have the parameters to setcallback in the wrong order. Swap the last two parameters.

  • You must to post comments
0
0

[quote="bluemonkmn":12hdwx9c]It looks like you have the parameters to setcallback in the wrong order. Swap the last two parameters.[/quote:12hdwx9c]

Hm no i think thats not the fact…

@modex: Have a look at this part of your code:
[quote:12hdwx9c][code:12hdwx9c]channel->setCallback(FMOD_CHANNEL_CALLBACKTYPE_END, 0, endCallBackFunc()); [/code:12hdwx9c][/quote:12hdwx9c]
You should leave out the brackets i:12hdwx9c[/i:12hdwx9c] , because you must pass the [u:12hdwx9c]address[/u:12hdwx9c] of the function. Here you’ve made a call to ‘endCallBackFunc’.

(And because of returning FMOD_OK in ‘endCallBackFunc’, which is actually defined as zero, it doesn’t crash during runtime ๐Ÿ˜‰ . )

  • You must to post comments
0
0

I agree that what you say is a problem, but isn’t the parameter order also a problem? Is the C# version of this function defined differently than the C++ version? In the C# version, the callback function goes in the middle parameter.

  • You must to post comments
0
0

@bluemonkmn: Oh yea, you are right – Sorry! I checked it ๐Ÿ˜‰ . So, leave out the brackets, swap the last parameters and it should work 8) .

  • You must to post comments
0
0

I think there’s also a problem with the signature of the callback function itself. It’s defined with no parameters in the given example, but it needs to conform to FMOD_CHANNEL_CALLBACK, which looks like:
[code:vj2jq7oy]FMOD_RESULT F_CALLBACK FMOD_CHANNEL_CALLBACK(
FMOD_CHANNEL * channel,
FMOD_CHANNEL_CALLBACKTYPE type,
int command,
unsigned int commanddata1,
unsigned int commanddata2
)[/code:vj2jq7oy]

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.