0
0

hi all

I just wanna write an "one shot" sound play function that user need not care about the matter of FMOD::Sound release, my method is releasing the sound object in the callback function with type of FMOD_CHANNEL_CALLBACKTYPE_END, but when I call xxxSound->release(),an exception occur, and the visual c++’s call stack shows:
=> fmodex.dll!0095f684()
=> fmodex.dll!009607ef()
……………

but if I don’t release the sound which has ended immediately, say, if I just only release the sound objects that I’ve saved previously in the callback function, there will seldom have exceptions.

It is said in the help that [u:2yl6wod9]"Currently callbacks are driven by System::update and will only occur when this function is called. This has the main advantage of far less complication due to thread issues, and allows all FMOD commands, including loading sounds and playing new sounds from the callback". [/u:2yl6wod9]but it does not mention of "release sounds".

so, can I release a sound object when it ends in the channel’s callback function immediately?

thanks a lot!

  • You must to post comments
0
0

hi,
my problem has been solved, the phenomenon in my first post is because of muti-thread conflicting.
my solution is, in callback function I just save the sound objects that should be released in a vector, and then release them at somewhere in my main thread, and it works well.

so, I think the help of fmodex misleads me so much, should it be corrected? :roll: thank you!

the remarks of Channel::setCallback:
[quote:3jkst448]Currently callbacks are driven by System::update and will only occur when this function is called. This has the main advantage of far less complication due to thread issues, and allows all FMOD commands, including loading sounds and playing new sounds from the callback.[/quote:3jkst448]

  • You must to post comments
0
0

normally you call System::update from the main thread, if you start putting fmod calls in various threads then you void that advantage.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.