0
0

Sometimes when players quit my game, they are blocked for several seconds or more by the internal release() on my live Internet music stream, which is FMOD_NONBLOCKING.

I gather this is expected. However, given that I just want to shut down, is there anything that can be done to avoid it? Or do I need to pop up a dialog saying "waiting for FMOD audio to close…"?

Thanks

Tom

  • You must to post comments
0
0

Interesting… was it always the case though? If it does the same then my code is redundant… Pretty sure it was not before. Bof, it’s not hurting so I’ll leave it.

  • You must to post comments
0
0

As far as I know it has always been that way.

  • You must to post comments
0
0

If you want sound release to be immediate query the sounds open state and only release when it is FMOD_OPENSTATE_READY, the "netstream" example does this (for reference).

  • You must to post comments
0
0

This just shifts the delay into the while loop. What I want is to halt whatever it is doing immediately, so that I can shut down audio in a reasonable timeframe, i.e. not several seconds.

Presumably anybody streaming audio from the Internet will have this same problem; inability to close fmod is a reasonable amount of time during the buffering state.

  • You must to post comments
0
0

Is there anything I can do about this? My users are shutting down my fullscreen directx game and sometimes it stalls for long enough to make them think it has frozen.

  • You must to post comments
0
0

try this from my free function, nevermind the casting for the sound address
[code:1x5vy6zr]
DWORD t = GetTickCount()+5000;
do
{
FMOD_OPENSTATE openstate = FMOD_OPENSTATE_READY;
UINT result = FMOD_Sound_GetOpenState((FMOD_SOUND*)(DWORD)sound,&openstate, 0, 0);

    if (openstate == FMOD_OPENSTATE_READY || openstate == FMOD_OPENSTATE_ERROR || result != FMOD_OK || GetTickCount()>t)
    {
        break;
    }
    FMODUpdate(); //system::update
    Sleep(10);
} while (1);
FMOD_Sound_Release((FMOD_SOUND*)(DWORD)sound);

[/code:1x5vy6zr]

YOU DO HAVE TO STOP all the channels using the sound beforehand.

  • You must to post comments
0
0

Looking at that code snippet, it will still stall at release if there is a timeout.

[quote:1jpxhf77]My users are shutting down my fullscreen directx game and sometimes it stalls for long enough to make them think it has frozen.[/quote:1jpxhf77]
I would say the best option would be to show an animated message box telling the user the system is shutting down. Please keep in mind your app can be doing other things while you’re waiting for the open state to change, so it wont block your app.

-Pete

  • You must to post comments
0
0

OK,

But I hope you can improve on that so that it is possible to close down FMOD quickly and synchronously. Is there any technical barrier to that? Presumably you just need to set a "bail" flag in a thread or something…

  • You must to post comments
0
0

You’re right this could be improved. I have added this to our tracker.

  • You must to post comments
0
0

[quote="peter":1cyetoi1]Looking at that code snippet, it will still stall at release if there is a timeout.

-Pete[/quote:1cyetoi1]

Originaly, I would catch the timeout in a separate condition in the loop and just exit without release. I would get crashes here and there but it would quit quicly with no problems 90% of the time.

After a few fmod updates I realised that it was enough to bypass the problem and I could live with the few seconds of delay releasing a hung sound. Wich rarely happens now. The loop seems to be enough to settle things.

It’s better to stop, wait ’till things settle down and release than stoping and releasing right away.

I’m pretty confident in that little loop. Though it would be best if this was handled by the core

  • You must to post comments
0
0

Internally FMOD is just polling the state just like the code you posted, that’s why it stalls. I would expect that replacing that whole code block with just Sound_Release wouldn’t change the behaviour. The only benifit of using getState before calling release is to allow the user to update their game while waiting for sound to be ready.

  • You must to post comments
Showing 11 results
Your Answer

Please first to submit.