ValveSoftware / steam-audio

Steam Audio
https://valvesoftware.github.io/steam-audio/
Apache License 2.0
2.27k stars 158 forks source link

Possible problem with the official example #271

Closed rogerlasch closed 1 year ago

rogerlasch commented 1 year ago

Hello! I'm new to Steam Audio and I have a question about the official example on this page: I followed the recommendations, imported an audio, converted it to mono, and saved it with the following options:

I also imported this audio to test and was able to hear the sound without any problems.

Then, I copied the code from the example above and compiled it. After that, I ran the application, and it generated the output file for me. I then tried to play it in Audacity. However, whenever I hit play, I don't hear anything, no sound at all. Was this the expected outcome? This has really left me quite confused. I compiled using Visual Studio 2022 on Windows 11.

dawgcodes commented 1 year ago

Hello I think maybe you have to update Visual Studio if it doesn't work please write me thank you

rogerlasch commented 1 year ago

Hi, your tip didn't work.

Below I leave the versions of the software I'm using and the step by step of how I'm testing it.

Microsoft Windows 11 Home Single Language Version 22H2 (Operating System Compilation 22621.2134)

Build tools:

** Visual Studio 2022 Developer Command Prompt v17.7.2

SteamAudio 4.4.0

Steps to reproduce the problem:

Download the compiled binaries from:

Open Audacity and import any sound. For this example, I used the sound: "C:\windows\media\Alarm01.wav"

Save the file, and adjust the name to "inputaudio.raw" if necessary...

Now, in the root of the steamaudio folder create the code file "main.cpp" Inside it, copy the full code of the official example at:

It may vary depending on the version... When opened, something like this should appear:

"


Visual Studio 2022 Developer Command Prompt v17.7.2 Copyright (c) 2022 Microsoft Corporation


[vcvarsall.bat] Environment initialized for: 'x64' "

Now navigate to the steamaudio folder with the cd command... In my case until "downloads\steamaudio"

Compile the program with the following commands:

In audacity, go to the file menu, import, and "import audio without formatting (RAW)"

Configure import properties for

When the import is finished, and you press play, no sound will be heard.

Thank you!

lakulish commented 1 year ago

This is indeed a bug in the sample code. The fix involves replacing:

    IPLHRTFSettings hrtfSettings;
    hrtfSettings.type = IPL_HRTFTYPE_DEFAULT;

with:

    IPLHRTFSettings hrtfSettings{};
    hrtfSettings.type = IPL_HRTFTYPE_DEFAULT;
    hrtfSettings.volume = 1.0f;

in main. Let us know if this fixes the issue.

rogerlasch commented 1 year ago

Hi! That was exactly what was missing. Now it works correctly and as expected. Thank you!