0
0

I am having a problem with Sample_Free crashing.. I am using the below code to play a preview of a sample (in an editor). It works fine the first type, but if the code runs a second time then it gets an exception in Sample_Free()

[code:137llmkn]
FSOUND_StopSound(FSOUND_ALL);
FSOUND_Sample_Free(pjg->m_pSoundPreview);
pjg->m_pSoundPreview = FSOUND_Sample_Load(FSOUND_UNMANAGED, (char *)pbd->m_pdata, FSOUND_LOADMEMORY, pbd->m_cdata);
FSOUND_Sample_SetMode(pjg->m_pSoundPreview, FSOUND_LOOP_OFF);
FSOUND_PlaySound(FSOUND_FREE, pjg->m_pSoundPreview);
[/code:137llmkn]

I’ve tried both managed and unmanaged sample loads.

is there some threading issues between any of the commands (ie it still needs to run after the function call returns ??

Cheers

Chris

  • You must to post comments
0
0

you where right Brett, the sample was being free’d twice, (I was assuming since I was passing a pointer in , it would set it to NULL on completion).. anyway put in the appropriate wrappers around everything and it’s all fine..

sorry for troubling you..

  • You must to post comments
0
0

C passes parameters by value, so FMOD couldn’t have set your pointer variable to NULL even if it wanted to.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.