ValleyBell / libvgm

A more modular rewrite of most components from VGMPlay. will include sub-libraries for audio output, sound emulation and VGM playback
irc://irc.digibase.ca/#vgmrips
136 stars 33 forks source link

player error: Driver Init Error: F0 #104

Open cd4053 opened 1 year ago

cd4053 commented 1 year ago

OS: Windows 10 22H2 (19045.2364)

Compilation steps (MSYS2/MINGW) after git clone:

mkdir build && cd build
cmake .. -G"MSYS Makefiles"

Error:

player song.vgm
Opening Audio Device ...
Using driver XAudio2.
WaveOut: Driver Init Error: F0

Using the vgmplay-libvgm (vgmplay) works just fine.

ValleyBell commented 1 year ago

I finally set up my MSYS toolchain and tried this. Unfortunately I can't reproduce this error.

user@host MINGW64 /d/VStudio-Programme/VC2010/libvgm
$ mkdir build-msys && cd build-msys

user@host MINGW64 /d/VStudio-Programme/VC2010/libvgm/build-msys
$ cmake .. -G"MSYS Makefiles"
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/msys64/mingw64/bin/cc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/msys64/mingw64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Found ZLIB: C:/msys64/mingw64/lib/libz.a (found version "1.2.13")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found Iconv: C:/msys64/mingw64/lib/libiconv.a
-- Configuring done
-- Generating done
-- Build files have been written to: D:/VStudio-Programme/VC2010/libvgm/build-msys

user@host MINGW64 /d/VStudio-Programme/VC2010/libvgm/build-msys
$ make -j4 player
[  1%] Building C object utils/CMakeFiles/vgm-utils.dir/DataLoader.c.obj
...
[100%] Linking CXX executable bin/player.exe
[100%] Built target player

user@host MINGW64 /d/VStudio-Programme/VC2010/libvgm/build-msys
$ bin/player.exe ../demofiles/C6280__Batman_01\ Title.vgz
Opening Audio Device ...
Using driver XAudio2.
Opening Device 0 ...
Loading C6280__Batman_01 Title.vgz ...  VGM v161, Total Length: 32.73 s, Loop Length: 32.21 s
Song Title: Title
Done.ng 3.02 / 64.95 ...

Can you try another audio driver? Just change the value in the following line to 0 or 1 or 2.

https://github.com/ValleyBell/libvgm/blob/c250212538dd48d3965826ad7fe669bb0f348cbd/player.cpp#L90


EDIT: Error 0xF0 is AERR_API_ERR. This can happen in multiple places in the XAudio2 driver. Maybe you can modify AudDrv_XAudio2.cpp to print messages before throwing the error so I can identify where it happens?
I'm still not sure why it should fail, as I'm using Windows 10 22H2 as well.

cd4053 commented 1 year ago

Hi, thank you for looking into this.

Bellow, the results changing libvgm/player.cpp at current commit c250212:

static INT32 AudioOutDrv = 0;

bin/player.exe ../1.vgm
Opening Audio Device ...
Using driver WinMM.
Opening Device 0 ...
Loading 1.vgm ...  VGM v150, Total Length: 69.65 s, Loop Length: 61.36 s
Song Title: Stage 4-1 ~Gotham City Streets 2~ & Stage 5 ~ In the Sky Over Gotham City~
Playing 35.21 / 131.01 ...

static INT32 AudioOutDrv = 1;

bin/player.exe ../1.vgm
Opening Audio Device ...
Using driver DirectSound.
Opening Device 0 ...
Loading 1.vgm ...  VGM v150, Total Length: 69.65 s, Loop Length: 61.36 s
Song Title: Stage 4-1 ~Gotham City Streets 2~ & Stage 5 ~ In the Sky Over Gotham City~
Playing 35.21 / 131.01 ...

static INT32 AudioOutDrv = 2;

bin/player.exe ../1.vgm
Opening Audio Device ...
Using driver XAudio2.
WaveOut: Driver Init Error: F0

Sorry, I'm not a software developer, can you guide me on how edit AudDrv_XAudio2.cpp so it can output debug messages? Thank you.

gzaffin commented 1 year ago

Debugging with VS2022 I see that XAudio2Create fails XAudio2Create_fails

because called CoCreateInstance fails CoCreateInstance_fails

ValleyBell commented 1 year ago

umm... "Class not registered"???
It looks like certain Windows 10 versions don't support XAudio2. That's news to me.

I should definitely make a separate error code for that case and print a proper error message.

gzaffin commented 1 year ago

I noticed that in a laptop with Windows 7 I've got XAudio2_7.dll, XAudio2_6.dll, XAudio2_5.dll, XAudio2_4.dll, XAudio2_3.dll, XAudio2_2.dll, XAudio2_1.dll and XAudio2_0.dll . There is no problem in using XAudio2 with this Windows 7 setup. On the other hand in a laptop with Windows 11 I've got XAudio2_9.dll and XAudio2_8.dll . I cannot make libvgm use XAudio2 with this setup. This can be, possibly, a matter of incompatibility among XAudio2 versions.

gzaffin commented 11 months ago

I had a bit of spare time and I went on debugging XAudio2 of libvgm on Windows 11.
Screenshot 2023-07-19 001827