PortAudio / portaudio

PortAudio is a cross-platform, open-source C language library for real-time audio input and output.
Other
1.52k stars 306 forks source link

Question about PortAudio, ASIO, and virtual sound devices #868

Open star69rem opened 11 months ago

star69rem commented 11 months ago

It seems that virtual sound devices such as Dante Virtual Sound Card and ASIO4ALL return a device count of 0 with ASIO using PortAudio. Is this known/intended? I just want to make sure there isn't something wrong with my compilation of PortAudio with ASIO enabled.

RossBencina commented 11 months ago

Sounds like something is wrong. Certainly ASIO4ALL using PortAudio/ASIO returns the expected number of channels for me.

star69rem commented 11 months ago

I used cmake to generate a Visual Studio 2022 solution. The ASIO SDK was adjacent to the port audio folder, and the build indicated that it found it. Can you think of anything obvious I might have missed?

star69rem commented 11 months ago

If I provide a Visual Studio solution that I used to build the PortAudio static library, could anyone help me troubleshoot this?

RossBencina commented 11 months ago

Are the ASIO devices visible in any other ASIO application?

You can try putting the ASIO dir inside /src/ASIO but to be honest I don't know how our CMake code is handling this. Someone changed it without updating the docs, and I don't use CMake. These two tickets might help. https://github.com/PortAudio/portaudio/issues/518 https://github.com/PortAudio/portaudio/issues/731

star69rem commented 11 months ago

Yes, I can see the ASIO devices in Foobar 2000.

star69rem commented 11 months ago

This is the build log. It compiles successfully. Taking a step back, are devices enumerated differently with ASIO? I'm using Pa_GetHostApiCount, which gives me ASIO as one of the indexes. Pa_GetHostApiInfo just always returns 0 devices even though in Foobar I can see ASIO4ALL.

image

..\src\common\pa_converters.c(344,32): warning : implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Wimplicit-const-int-float-conversion] ..\src\common\pa_converters.c(389,32): warning : implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Wimplicit-const-int-float-conversion] ..\src\common\pa_converters.c(508,32): warning : implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Wimplicit-const-int-float-conversion] ..\src\hostapi\dsound\pa_win_ds.c(346,13): warning : variable 'minLatencySeconds' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] ..\src\hostapi\dsound\pa_win_ds.c(351,12): message : uninitialized use occurs here ..\src\hostapi\dsound\pa_win_ds.c(346,10): message : remove the 'if' if its condition is always true ..\src\hostapi\dsound\pa_win_ds.c(332,29): message : initialize the variable 'minLatencySeconds' to silence this warning ..\src\hostapi\dsound\pa_win_ds.c(636,31): warning : suggest braces around initialization of subobject [-Wmissing-braces] ..\src\hostapi\dsound\pa_win_ds.c(639,31): warning : suggest braces around initialization of subobject [-Wmissing-braces] ..\src\hostapi\dsound\pa_win_ds.c(642,31): warning : suggest braces around initialization of subobject [-Wmissing-braces] ..\src\hostapi\dsound\pa_win_ds.c(731,61): warning : suggest braces around initialization of subobject [-Wmissing-braces] ..\src\hostapi\dsound\pa_win_ds.c(732,61): warning : suggest braces around initialization of subobject [-Wmissing-braces] ..\src\hostapi\dsound\pa_win_ds.c(1395,20): warning : variable 'inputSampleFormat' set but not used [-Wunused-but-set-variable] ..\src\hostapi\dsound\pa_win_ds.c(1395,39): warning : variable 'outputSampleFormat' set but not used [-Wunused-but-set-variable] ..\src\hostapi\dsound\pa_win_ds.c(1801,19): warning : unused variable 'minimumPollingPeriodFrames' [-Wunused-variable] ..\src\hostapi\dsound\pa_win_ds.c(1803,19): warning : unused variable 'pollingJitterFrames' [-Wunused-variable] ..\src\hostapi\dsound\pa_win_ds.c(2453,23): warning : variable 'outputLatency' set but not used [-Wunused-but-set-variable] ..\src\hostapi\dsound\pa_win_ds.c(2872,22): warning : unused variable 'result' [-Wunused-variable] ..\src\hostapi\dsound\pa_win_ds.c(2922,13): warning : variable 'hr' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] ..\src\hostapi\dsound\pa_win_ds.c(2928,13): message : uninitialized use occurs here ..\src\hostapi\dsound\pa_win_ds.c(2922,9): message : remove the 'if' if its condition is always true ..\src\hostapi\dsound\pa_win_ds.c(2908,24): message : initialize the variable 'hr' to silence this warning ..\src\hostapi\dsound\pa_win_ds.c(3076,22): warning : variable 'hr' set but not used [-Wunused-but-set-variable] ..\src\hostapi\wasapi\pa_win_wasapi.c(1614,17): warning : enumeration value 'eStreamOptionNone' not handled in switch [-Wswitch] ..\src\hostapi\wasapi\pa_win_wasapi.c(287,15): warning : unused variable 'pa_KSDATAFORMAT_SUBTYPE_ADPCM' [-Wunused-const-variable] ..\src\hostapi\wasapi\pa_win_wasapi.c(2442,16): warning : unused function 'UpdateDeviceList' [-Wunused-function] ..\src\hostapi\wdmks\pa_win_wdmks.c(1119,27): warning : unused variable 'nConn' [-Wunused-variable] ..\src\hostapi\wdmks\pa_win_wdmks.c(2205,31): warning : suggest braces around initialization of subobject [-Wmissing-braces] C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\mmreg.h(2469,66): message : expanded from macro 'DEFINE_WAVEFORMATEX_GUID' ..\src\hostapi\wdmks\pa_win_wdmks.c(164,29): message : expanded from macro 'DYNAMIC_GUID' ..\src\hostapi\wdmks\pa_win_wdmks.c(6508,24): warning : variable 'frameCount' set but not used [-Wunused-but-set-variable] ..\src\hostapi\wdmks\pa_win_wdmks.c(6589,14): warning : variable 'frameCount' set but not used [-Wunused-but-set-variable] ..\src\hostapi\wdmks\pa_win_wdmks.c(6592,20): warning : unused variable 'halfInputBuffer' [-Wunused-variable] ..\src\hostapi\wdmks\pa_win_wdmks.c(6643,20): warning : unused variable 'halfInputBuffer' [-Wunused-variable] ..\src\hostapi\wdmks\pa_win_wdmks.c(770,16): warning : unused function 'WdmSetPropertySimple' [-Wunused-function] ..\src\hostapi\wdmks\pa_win_wdmks.c(641,13): warning : unused function 'IsDeviceTheSame' [-Wunused-function] ..\src\hostapi\wmme\pa_win_wmme.c(2499,14): warning : variable 'framesPerBufferProcessorCall' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] ..\src\hostapi\wmme\pa_win_wmme.c(2511,21): message : uninitialized use occurs here ..\src\hostapi\wmme\pa_win_wmme.c(2499,10): message : remove the 'if' if its condition is always true ..\src\hostapi\wmme\pa_win_wmme.c(2311,47): message : initialize the variable 'framesPerBufferProcessorCall' to silence this warning ..\src\os\win\pa_win_waveformat.c(55,50): warning : suggest braces around initialization of subobject [-Wmissing-braces] ..\src\os\win\pa_win_wdmks_utils.c(73,50): warning : suggest braces around initialization of subobject [-Wmissing-braces] C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\ksmedia.h(726,34): message : expanded from macro 'STATIC_KSDATAFORMAT_TYPE_AUDIO' ..\src\os\win\pa_win_wdmks_utils.c(76,58): warning : suggest braces around initialization of subobject [-Wmissing-braces] C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\mmreg.h(2482,5): message : expanded from macro 'STATIC_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT' C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\mmreg.h(2469,66): message : expanded from macro 'DEFINE_WAVEFORMATEX_GUID' ..\src\os\win\pa_win_wdmks_utils.c(79,51): warning : suggest braces around initialization of subobject [-Wmissing-braces] C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\mmreg.h(2474,5): message : expanded from macro 'STATIC_KSDATAFORMAT_SUBTYPE_PCM' C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\mmreg.h(2469,66): message : expanded from macro 'DEFINE_WAVEFORMATEX_GUID' ..\src\os\win\pa_win_wdmks_utils.c(82,60): warning : suggest braces around initialization of subobject [-Wmissing-braces] C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\mmreg.h(2489,34): message : expanded from macro 'STATIC_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX' ..\src\os\win\pa_win_wdmks_utils.c(85,49): warning : suggest braces around initialization of subobject [-Wmissing-braces] C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\ks.h(1022,34): message : expanded from macro 'STATIC_KSMEDIUMSETID_Standard' ..\src\os\win\pa_win_wdmks_utils.c(88,52): warning : suggest braces around initialization of subobject [-Wmissing-braces] C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\ks.h(998,34): message : expanded from macro 'STATIC_KSINTERFACESETID_Standard' ..\src\os\win\pa_win_wdmks_utils.c(91,42): warning : suggest braces around initialization of subobject [-Wmissing-braces] C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\ks.h(1032,34): message : expanded from macro 'STATIC_KSPROPSETID_Pin' ..\src\hostapi\asio\ASIOSDK\host\pc\asiolist.cpp(137,9): warning : variable 'fin' set but not used [-Wunused-but-set-variable] ..\src\hostapi\asio\pa_asio.cpp(2960,36): warning : increment of object of volatile-qualified type 'volatile long' is deprecated [-Wdeprecated-volatile] ..\src\hostapi\asio\pa_asio.cpp(3921,13): warning : unused variable 'result' [-Wunused-variable] ..\src\hostapi\asio\pa_asio.cpp(1898,13): warning : unused function 'IsUsingExternalClockSource' [-Wunused-function] portaudio.vcxproj -> C:\msys64\portaudio\msvc\x64\Debug\portaudio.lib

star69rem commented 11 months ago

Also, I tried using the mvsc solution to build. Same results as with cmake.

RossBencina commented 10 months ago

The build log looks okish. Certainly pa_asio.cpp is being built.

Could you try building the pa_devs program, run it and give us the program output please?

hockinsk commented 1 week ago

I'm having a related issue with my portaudio build via sounddevice library and standard build too. portaudio (via sounddevice) seems to see some ASIO devices but not others, although in my case it is seeing some virtual ASIO at least. Ironically the very ASIO driver I need it to use is JackRouter which is Jack Audio's virtual ASIO driver so non-Jack aware audio apps can still connect to jackd server over ASIO. JackRouter ASIO isn't listed by portaudio here:

0 Microsoft Sound Mapper - Output, MME (0 in, 2 out) < 1 Speakers (Apogee Groove), MME (0 in, 2 out) 2 Primary Sound Driver, Windows DirectSound (0 in, 2 out) 3 Speakers (Apogee Groove), Windows DirectSound (0 in, 2 out) 4 Apogee USB ASIO Driver, ASIO (0 in, 2 out) 5 NDI Virtual Soundcard, ASIO (64 in, 64 out) 6 Realtek ASIO, ASIO (2 in, 2 out) 7 ReaRoute ASIO (x64), ASIO (16 in, 16 out) 8 Steinberg built-in ASIO Driver, ASIO (0 in, 2 out) 9 VB-Matrix VASIO-128, ASIO (128 in, 128 out) 10 VB-Matrix VASIO-64A, ASIO (64 in, 64 out) 11 VB-Matrix VASIO-64B, ASIO (64 in, 64 out) 12 VB-Matrix VASIO-8, ASIO (8 in, 8 out) 13 Speakers (Apogee Groove), Windows WASAPI (0 in, 2 out) 14 Speakers (Groove Output), Windows WDM-KS (0 in, 2 out)

If I look at the ASIO device list on any ASIO application I see JackRouter ASIO listed as an option as expected:

image