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

Author Topic: Can I disable/reenable SFML audio?  (Read 2421 times)

0 Members and 1 Guest are viewing this topic.

danw

  • Newbie
  • *
  • Posts: 8
    • View Profile
Can I disable/reenable SFML audio?
« on: September 19, 2016, 11:52:35 pm »
I have my own audio code using WASAPI for low latency audio, which is a necessity for my program.

Before I get too far into converting my project to SFML, I want to be sure that this isn't going to be a conflict.

I don't see any requirement to "enable" audio support, so it seems like audio is always enabled in SFML?

Also, can I point SFML at my own audio rendering function?  I want users to choose whether to use the WASAPI exclusive audio mode, or shared audio, in case the exclusive audio does not work for them for some reason. All of my audio is generated real-time by a renderer function.  For shared audio mode, I would like SFML to call my audio renderer function, rather than dealing with sf::Sound or sf::Music objects.

danw

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Can I disable/reenable SFML audio?
« Reply #1 on: September 19, 2016, 11:58:34 pm »
Oh, I think this answers my question about using my own renderer: http://www.sfml-dev.org/tutorials/2.4/audio-streams.php

But I'm still not sure if I can disable and re-enable SFML's audio.

danw

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Can I disable/reenable SFML audio?
« Reply #2 on: September 20, 2016, 05:30:18 am »
I managed to make a test and WASAPI audio does seem to work with SFML.  I don't think I need to disable anything.  Cheers.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 878
    • View Profile
Re: Can I disable/reenable SFML audio?
« Reply #3 on: September 20, 2016, 03:05:56 pm »
If you're not using the Audio module, there shouldn't be any interference and even if you use it, you should still be able to use other libraries in parallel as long as you won't need exclusive access.

danw

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Can I disable/reenable SFML audio?
« Reply #4 on: September 22, 2016, 09:16:53 pm »
Here is some info that might hopefully help somebody in the future.

I found that I couldn't use anything in the sfml-audio.dll at all, I suppose because SFML's audio thread must have been interfering with my own WASAPI audio thread, which of course needs to run very fast at very high priority.  What was happening is that my audio was glitching semi-frequently.

I fixed this by removing sfml-audio.dll and anything that was using it.

So, that means I couldn't use sf::SoundBuffer for the purpose of loading audio files, but that functionality is easy to find elsewhere.

 

anything