0
0

I am stuck writing a small program:
Windows 7, C++, VS 10
THe program is designed to playback and display info for audio files that are drag/dropped on the window.

I dont know how to debug the issue because its crashing inside system->update.

I suspect there is something very basically wrong with how i have structured my code, but i dont know.

I wrote my own version of ‘RUN’ to call mainLoop() (see below)
My mainLoop() does nothing but call system->update().
The FMOD doc says that update should be called from the same thread as all the fmod calls, but I’m
not sure if my myApp stuff is on the same thread as my windowing stuff.

any help would be greatly appreciated.
[code:1o6g9z2k]
int CMyApp::Run()
{
// This idle loop is copied from MFC with changes to call mainLoop constantly

   // for tracking the idle time state
   BOOL bIdle = TRUE;
   LONG lIdleCount = 0;

   _AFX_THREAD_STATE* pState = AfxGetThreadState();
   // acquire and dispatch messages until a WM_QUIT message is received.
   for (;;)
   {
          // phase1: loop while no messages
          while (!::PeekMessage(&(pState)->m_msgCur, NULL, NULL, NULL, PM_NOREMOVE))
          {
                 // call OnIdle while in bIdle state
                 if (bIdle && !OnIdle(lIdleCount++))
                       bIdle = FALSE; // assume "no idle" state

                 // call game loop
                 if (1)
                 {
                    mainLoop(); // <----- this is your loop
                 }
          }

    // phase2: pump messages while available
           if (!PumpMessage())  // PumpMessage(bIdle, lIdleCount)
    {
               return ExitInstance();
    }
   }

}
[/code:1o6g9z2k]

here is my callback handler:
[code:1o6g9z2k]
FMOD_RESULT F_CALLBACK mycallback(FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type, void *commanddata1, void *commanddata2)
{

// clean up ending sound
if (type == FMOD_CHANNEL_CALLBACKTYPE_END)  //FMOD_CHANNEL_CALLBACKTYPE_END
{
    FMOD::Sound * tmpSound;
    FMOD::Channel *cppchannel = (FMOD::Channel *)channel;

    cppchannel->getCurrentSound(&(tmpSound));
    FMOD_RESULT res = tmpSound->release();
    ERRCHECK(res);

}
return FMOD_OK;

}
[/code:1o6g9z2k]

  • You must to post comments
0
0

as far as I know, its not allowed to release anything fmod specifig in a fmod call back,

the documentation says the following in every release func

"Note: Do not call this function from an event callback! "

  • tom
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.