0
0

FMOD Ex 4.04.47 (Win32)
MSDEV: 2005
Language: C++

I must be missing something. I have done call backs many times but I can’t seem to get the compiler to accept this call back. What am I doing wrong?

[code:qm3i5y66]

// Declaration
FMOD_RESULT F_CALLBACK clsAudioManager::event3DAmbientCallback(FMOD::Event *event, FMOD::EVENT_CALLBACKTYPE type, void *param1, void *param2, void *userdata)

....

// Usage
// Set this Event callback.
mEvent->setCallback( &clsAudioManager::event3DAmbientCallback, mAmbientEventItem );

[/code:qm3i5y66]

The [i:qm3i5y66]setCallback()[/i:qm3i5y66] call is occuring within the same class.

When I compile it yields this error in the compiler:

[quote="Microsoft Compiler":qm3i5y66]

1>—— Build started: Project: Client, Configuration: Release Win32 ——
1>Compiling…
1>clsAudioManager4.cpp
1>.\Managers\clsAudioManager\clsAudioManager4.cpp(94) : error C2664: ‘FMOD::Event::setCallback’ : cannot convert parameter 1 from ‘FMOD_RESULT (__stdcall clsAudioManager::* )(FMOD::Event *,FMOD::EVENT_CALLBACKTYPE,void *,void *,void *)’ to ‘FMOD::EVENT_CALLBACK’
1> There is no context in which this conversion is possible

[/quote:qm3i5y66]

  • You must to post comments
0
0

I found it. 😳

[code:1jgeop9f]

static FMOD_RESULT F_CALLBACK event3DAmbientCallback(FMOD::Event *event, FMOD::EVENT_CALLBACKTYPE type, void *param1, void *param2, void *userdata);

[/code:1jgeop9f]

note that I needed [i:1jgeop9f]static[/i:1jgeop9f] in the definition statement. This is required for C++ (at least in MS Dev).

  • You must to post comments
0
0

[quote="Van":305mz2bv]note that I needed [i:305mz2bv]static[/i:305mz2bv] in the definition statement. This is required for C++ (at least in MS Dev).[/quote:305mz2bv] Only for class member functions: the pointer [i:305mz2bv]this[/i:305mz2bv] is a parameter added automatically to your function, and it’s not added when the function is static 😉

  • You must to post comments
0
0

Ok, now we are having a problem with the setCallback not calling the callback or more precisely, the FMOD::Event is not [i:1rgpk4pa]stopping[/i:1rgpk4pa] with the [b:1rgpk4pa]Velocity Loop Behavior[/b:1rgpk4pa] set to [i:1rgpk4pa]’one shot and stop event’ [/i:1rgpk4pa] in the FMOD Designer.

[quote="help file":1rgpk4pa]

[b:1rgpk4pa]EVENT_STATE[/b:1rgpk4pa]

[i:1rgpk4pa]EVENT_STATE_PLAYING[/i:1rgpk4pa] Event has been started. This will still be true even if the’re are no sound active. Event::stop must be called or the event must stop itself using a ‘one shot and stop event’ parameter mode.

[/quote:1rgpk4pa]

I found this post:
http://52.88.2.202/forum/viewtopic.php … stop+event

and followed this statement:

[quote="brett":1rgpk4pa]
If you want an event to stop using parameters, turn off the ‘one shot’ property, and instead use the parameter loop behaviour ‘one shot and stop event’
[/quote:1rgpk4pa]

However that didn’t seem to work for us. The Event is not stopping and calling the callback. :(

When the event first starts, it calls the callback twice but never calls it again. The state of the Event is active (though not playing a sound). Am I missing something?

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.