Hi to all,
I' writing an audio editor using fmod and Qt.
Hi have a fmod callback that's called by the fmod engine when a sound is stopped to play and from it I would emit a signal.
Here the callback that's part of a class:
{
Q_OBJECT
public:
static 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)
SoundData* currentSound;
switch(type)
{
case FMOD_CHANNEL_CALLBACKTYPE_END:
{
FMOD_RESULT result;
FMOD::Channel *currentChannel = (FMOD::Channel *)channel;
void *ud = NULL;
result = currentChannel->getUserData( &ud );
currentSound = (SoundData*)ud;
/* inform that sound stopped */
emit( soundStopped() );// <------- THIS ONE
break;
}
default:
break;
}
return FMOD_OK;
}
public slots:
// Initialize the audio system
bool init();
signals:
void soundStopped();
..more code...
class AudioDevice : public QObject
{
Q_OBJECT
public:
static 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)
SoundData* currentSound;
switch(type)
{
case FMOD_CHANNEL_CALLBACKTYPE_END:
{
FMOD_RESULT result;
FMOD::Channel *currentChannel = (FMOD::Channel *)channel;
void *ud = NULL;
result = currentChannel->getUserData( &ud );
currentSound = (SoundData*)ud;
/* inform that sound stopped */
emit( soundStopped() );// <------- THIS ONE
break;
}
default:
break;
}
return FMOD_OK;
}
public slots:
// Initialize the audio system
bool init();
signals:
void soundStopped();
..more code...
To copy to clipboard, switch view to plain text mode
The compiler don't like the emit call.
It says
error C2352: 'AudioDevice::soundStopped' : illegal call of non-static member function
How can I do?
Best
Bookmarks