0
0

I have an interesting problem with fmod. I have a program that plays several .mod files in series, and calls IsPlaying() on the channel to detect when it’s done to start up the next one in the playlist. All of this is fine, until I unplug my USB headset, where it continues to return TRUE for IsPlaying forever. Is there some way I can detect that my headset has been unplugged, and have FMOD or my program restart the playback? This is on fmod 4.06.

  • You must to post comments
0
0

[quote:2d802u8e]until I unplug my USB headset[/quote:2d802u8e]

The USB headsets have their own built in sound card, and I think the default output device is modified when a USB headset is plugged in.

Maybe you can set a callback to detect this case when the output device disappears? I can’t test this, but I would have tried with FMOD_OUTPUT_CLOSECALLBACK. Although I doubt that it will work.

One other possible hack is to monitor the number of available devices and see if that changes using System::getNumDrivers(). You will have to close and init the system again if this changes, which means that you need to recreate all sounds and channels as well. Some work there, but it should be doable.

Good luck!

  • You must to post comments
0
0

Here are my findings.
1. When I unplug my headset, nothing changes. IsPlaying still reports 1 forever.
2. When a file is paused, IsPlaying reports 1. strange.
3. GetPosition just sits there, not changing. I suppose I can detect on that, because it’s not likely that a .mod file will have the exact same position in 2 seconds.
I still find this to be less than optimal – is this a limitation of the windows OS that fmod runs with, or the hardware/APIs?

  • You must to post comments
0
0

Are you sure that it’s returning 1 and not having an error, which causes it to leave the existing 1 unaffected? Are you checking for error return values when you call FMOD?

  • You must to post comments
0
0

[quote="tspivey":3fwikcd5]
2. When a file is paused, IsPlaying reports 1. strange.
[/quote:3fwikcd5]

I think this is as it should be. A file is playing until it is finished or stopped with Channel::stop().
You can use the Channel::getPaused() method to check if a channel is paused or not.

Did you have any luck detecting the loss of your sound device? Do you get any error codes from IsPlaying() or any of the other methods?

Btw, is this case handled by windows media player or winamp? Will winamp continue to play, but on a different device?

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.