Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Any Sound/Music will not play after audio device is unplugged.  (Read 1841 times)

0 Members and 1 Guest are viewing this topic.

devydevdev

  • Newbie
  • *
  • Posts: 2
    • View Profile
Hello,

After many hours trying to fix it I've given up and decided to come here!

Music plays just fine, but once I unplug my headset and then plug it back in, nothing will sound.

Under a clean project with just the example code, unplugging an audio device has no impact on the internal state of the Music object, and will remain playing it as if nothing occurred (m_samplesProcessed will increase normally), However, on my project, unplugging the audio device causes the Music object to suddenly stop processing samples, not only that, but the variable m_isStreaming will be set to false, the m_endBuffers will change and calling the function GetPlayingOffset will return some wacky numbers, often outside of the boundary.

EDIT: I should mention, that any Music objects created after unplugging and plugging the device will also not sound, their status will remain as playing but its m_samplesProcessed will remain at 0. Basically, absolutely nothing will emit a sound after i've unplugged/plugged.

Do you guys have any clue why this might be occurring?

Thanks!!!
« Last Edit: July 16, 2015, 02:37:46 am by devydevdev »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
Re: Any Sound/Music will not play after audio device is unplugged.
« Reply #1 on: July 16, 2015, 08:44:16 am »
Sounds like a driver issue.

What OS are you on?
Does your OS switch driver if you unplug your headphones?
How do other application handle the unplugging?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

devydevdev

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Any Sound/Music will not play after audio device is unplugged.
« Reply #2 on: July 16, 2015, 06:45:32 pm »
I'm on Windows 8.

I doubt it's the OS since the minimal project I made worked just fine on the same OS. The project where it doesn't work doesn't even poll for device changes or anything, but somehow every single sfml sound and music object get messed up after this occurs.

My next step is to find the full source code for sfml and make a project with it which is referenced in our game, and go step by step to see what the hell is happening.