SFML community forums

Help => Audio => Topic started by: HeinzK on February 15, 2025, 10:21:57 am

Title: 2.6.2 to 3.0 WSAPI
Post by: HeinzK on February 15, 2025, 10:21:57 am
miniaudio WARNING: [WASAPI] Failed to find suitable device format for device info retrieval.Download-Protokoll:
//> SFML:
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
#include <SFML/Audio.hpp>
#include <SFML/OpenGL.hpp>
#include <SFML/Network.hpp>
What I have to do?
Title: Re: 2.6.2 to 3.0 WSAPI
Post by: eXpl0it3r on February 15, 2025, 03:57:04 pm
You get that just by including SFML headers or do you have any other code?

Do you have an audio device?
Title: Re: 2.6.2 to 3.0 WSAPI
Post by: HeinzK on February 15, 2025, 05:39:58 pm
I have used 2.6.2 and OpenAL so far.
Title: Re: 2.6.2 to 3.0 WSAPI
Post by: eXpl0it3r on February 15, 2025, 08:35:19 pm
Yeah, but I'm asking how the error occurs.
You posted some code for some header includes, is that all that is needed? Or do you have additional code?
Title: Re: 2.6.2 to 3.0 WSAPI
Post by: HeinzK on February 16, 2025, 10:12:18 am
.. yes, I need all headers and so far under 2.6.2 OPENAL.
.. Linker/Eingabe: .. openal32.lib ..
.. Question: 3.0.0 .. miniaudio .. is this a replacement for OpenAL, or is it integrated in SFML ?
.. Modified:
... ok, I have removed <openal32.lib> from the program and still have sound.
... but I still have the above warning in the 'output window', which I don't understand.
Title: Re: 2.6.2 to 3.0 WSAPI
Post by: eXpl0it3r on February 16, 2025, 01:59:29 pm
Yes, you don't need OpenAL anymore with SFML 3, as it's replaced by miniaudio, which is used a header-only library.

I'm trying to understand the source of your error. What's the code that triggers the error (welche Quellcode löst die Warnung aus)?
Title: Re: 2.6.2 to 3.0 WSAPI
Post by: HeinzK on February 16, 2025, 02:23:39 pm
.. the trigger is: loadFromFile
(https://www.zwianer.de/$PCSpiel$/Images/WSAPIproblem.png)
.. and I have discovered the following line in my output window:
avcore\audiocore\client\audioclient\audioclientcore.cpp(469)\AUDIOSES.DLL!00007FF847113A1A: (caller: 00007FF8470C8F5F) ReturnHr(1) tid(3d7c) 8889000E
.. to ..
avcore\audiocore\client\audioclient\audioclientcore.cpp(469)\AUDIOSES.DLL!00007FF847113A1A: (caller: 00007FF8470C8F5F) ReturnHr(213) tid(3d7c) 8889000E
Title: Re: 2.6.2 to 3.0 WSAPI
Post by: eXpl0it3r on February 16, 2025, 02:30:26 pm
Do you compile the audio part of your game in a separate DLL (AUDIOSES.DLL)?
Title: Re: 2.6.2 to 3.0 WSAPI
Post by: HeinzK on February 16, 2025, 02:51:28 pm
.. no ..
Title: Re: 2.6.2 to 3.0 WSAPI
Post by: eXpl0it3r on February 16, 2025, 03:21:10 pm
Do you use any special audio hardware?

Do you know what aduioses.dll is or where that avcore reference is coming from?
Title: Re: 2.6.2 to 3.0 WSAPI
Post by: HeinzK on February 16, 2025, 03:49:41 pm
Lautsprecher(Realtek High Definition Audio)
Treiberdatum: 03.11.2016
Treiberversion: 6.0.1.7977
.. I do not know this dll
Modified:
.. I have found the file, but I still know where it comes from.
(https://www.zwianer.de/$PCSpiel$/Images/AudioSES.png)
Title: Re: 2.6.2 to 3.0 WSAPI
Post by: eXpl0it3r on February 16, 2025, 07:55:06 pm
You might want to check if you have any driver updates for your audio card. The DLL being from 2016 might be a bit too old.

As for the warning itself, it's coming from miniaudio, so one would need to check with them why it fails to open the device.

Are you running any audio application in the back, like Reaper or similar which could have requested exclusive access of a device?
Title: Re: 2.6.2 to 3.0 WSAPI
Post by: HeinzK on February 17, 2025, 08:54:58 am
.. driver is up to date.
.. No audio application in the background.
.. The sound works despite the warning.
Title: Re: 2.6.2 to 3.0 WSAPI
Post by: eXpl0it3r on February 17, 2025, 09:09:33 am
Do you get the same error if you run any of the SFML examples that use audio?

Can you provide the code that causes the warning?
Title: Re: 2.6.2 to 3.0 WSAPI
Post by: HeinzK on February 17, 2025, 10:03:38 am
.. no, no further warnings or error messages ... neither in the debug nor in the release.
.. I have a time problem at the moment, but I will try.
Title: Re: 2.6.2 to 3.0 WSAPI
Post by: eXpl0it3r on February 18, 2025, 07:21:44 am
Someone else just reported that same warning and it turned out, that they destroyed the only sf::Sound instance while still trying to play aduio, which will destroy the audio device likely leading to the given warning.

Make sure your sf::Sound and sf::Music instances exist for as long as you're using them to play audio.
Title: Re: 2.6.2 to 3.0 WSAPI
Post by: HeinzK on February 18, 2025, 09:13:44 am
(https://www.zwianer.de/$PCSpiel$/Images/WSAPIproblem3.png)
Title: Re: 2.6.2 to 3.0 WSAPI
Post by: eXpl0it3r on February 19, 2025, 08:40:47 am
With so much manual memory & lifetime management, it's going to be really hard to tell what is correct and what could cause some lost reference (i.e. memory leak).

If you can rebuild SFML, you could uncomment the // #define MA_DEBUG_OUTPUT line in Miniaudio.cpp (https://github.com/SFML/SFML/blob/master/src/SFML/Audio/Miniaudio.cpp#L31) which will give you more information on what miniaudio is doing.
Title: Re: 2.6.2 to 3.0 WSAPI
Post by: Hapax on February 19, 2025, 07:22:06 pm
Does this work (without that error)?
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>

int main()
{
        sf::SoundBuffer* pSb{};
        sf::Sound* pSd{};

        pSb = new sf::SoundBuffer{};
        if (!pSb->loadFromFile("D:/resources/audio/music/Shiny Toy Guns - You Are The One.ogg"))
                return EXIT_FAILURE;

        pSd = new sf::Sound(*pSb);

        pSd->play();



        sf::RenderWindow window(sf::VideoMode({ 960u, 540u }), "");
        while (window.isOpen())
        {
                while (const auto event{ window.pollEvent() })
                {
                        if (event->is<sf::Event::Closed>())
                                window.close();
                        else if (const auto * keyPressed{ event->getIf<sf::Event::KeyPressed>() })
                        {
                                switch (keyPressed->code)
                                {
                                case sf::Keyboard::Key::Escape:
                                        window.close();
                                        break;
                                }
                        }
                }



                window.clear();
                //window.draw();
                window.display();
        }
}
 

It's based on your code and seems to be what it does.
Obviously, you'd need to insert a filename that is valid for you ;)
Title: Re: 2.6.2 to 3.0 WSAPI
Post by: HeinzK on February 25, 2025, 02:03:54 pm
... I have added a text output to the sound loading loop.
... the sounds are all present and work after loading during the game.
... the warning comes 3* and only after the first sound:
Quote
Sound<V:/VCke/_KKlang/_KKrach/SoundLaden1.ogg>
miniaudio WARNING: [WASAPI] Failed to find suitable device format for device info retrieval.
miniaudio WARNING: [WASAPI] Failed to find suitable device format for device info retrieval.
miniaudio WARNING: [WASAPI] Failed to find suitable device format for device info retrieval.
Sound<V:/VCke/_KKlang/_KKrach/Warnung.ogg>
Sound<V:/VCke/_KKlang/_KKrach/Achtung.ogg>
Title: Re: 2.6.2 to 3.0 WSAPI
Post by: eXpl0it3r on February 25, 2025, 09:49:48 pm
We lack some information to determine the underlying issue.

I suggest to try Hapax's example code and see if it produces the same error.

Does this work (without that error)?
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>

int main()
{
        sf::SoundBuffer* pSb{};
        sf::Sound* pSd{};

        pSb = new sf::SoundBuffer{};
        if (!pSb->loadFromFile("D:/resources/audio/music/Shiny Toy Guns - You Are The One.ogg"))
                return EXIT_FAILURE;

        pSd = new sf::Sound(*pSb);

        pSd->play();



        sf::RenderWindow window(sf::VideoMode({ 960u, 540u }), "");
        while (window.isOpen())
        {
                while (const auto event{ window.pollEvent() })
                {
                        if (event->is<sf::Event::Closed>())
                                window.close();
                        else if (const auto * keyPressed{ event->getIf<sf::Event::KeyPressed>() })
                        {
                                switch (keyPressed->code)
                                {
                                case sf::Keyboard::Key::Escape:
                                        window.close();
                                        break;
                                }
                        }
                }



                window.clear();
                //window.draw();
                window.display();
        }
}
 

It's based on your code and seems to be what it does.
Obviously, you'd need to insert a filename that is valid for you ;)


And otherwise try to enable miniaudio debug information to get more clarity on what's going on:

If you can rebuild SFML, you could uncomment the // #define MA_DEBUG_OUTPUT line in Miniaudio.cpp (https://github.com/SFML/SFML/blob/master/src/SFML/Audio/Miniaudio.cpp#L31) which will give you more information on what miniaudio is doing.
Title: Re: 2.6.2 to 3.0 WSAPI
Post by: HeinzK on February 26, 2025, 10:24:59 am
... I use SFML via LIB and INCLUDE, so I have no access to miniaudio.cpp.
... the current programming with SFML is a Hoppy project to which I have only limited access at the moment.
... since everything works despite the warning, I'm happy with it at the moment.
... thanks for the information and the help.