I solved it calling a method of the "userdata" object instead of emitting a signal so:
//! Executed when a sound finish playing
FMOD_RESULT F_CALLBACK endCallback(FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type,
unsigned int commanddata1, unsigned int commanddata2)
{
(void)commanddata1; // Unused (to avoid warnings)
(void)commanddata2; // Unused (to avoid warnings)
WaveWidget* wave;
switch(type)
{
case FMOD_CHANNEL_CALLBACKTYPE_END:
{
FMOD_RESULT result;
FMOD::Channel *currentChannel = (FMOD::Channel *)channel;
void *ud = NULL;
result = currentChannel->getUserData( &ud ); // Here I get the userdata
wave = (WaveWidget*)ud; // I cast it
wave->stopTimer(); // Call userdata method
//emit AudioDevice::getInstance()->soundStopped(); //inform that sound is stopped
break;
}
default:
break;
}
return FMOD_OK;
}
//! Executed when a sound finish playing
FMOD_RESULT F_CALLBACK endCallback(FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type,
unsigned int commanddata1, unsigned int commanddata2)
{
(void)commanddata1; // Unused (to avoid warnings)
(void)commanddata2; // Unused (to avoid warnings)
WaveWidget* wave;
switch(type)
{
case FMOD_CHANNEL_CALLBACKTYPE_END:
{
FMOD_RESULT result;
FMOD::Channel *currentChannel = (FMOD::Channel *)channel;
void *ud = NULL;
result = currentChannel->getUserData( &ud ); // Here I get the userdata
wave = (WaveWidget*)ud; // I cast it
wave->stopTimer(); // Call userdata method
//emit AudioDevice::getInstance()->soundStopped(); //inform that sound is stopped
break;
}
default:
break;
}
return FMOD_OK;
}
To copy to clipboard, switch view to plain text mode
Bye
Bookmarks