Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WASAPI Exclusive failing to initialize because sample type is wrongly detected as Float32 #106

Closed
dechamps opened this issue Jan 4, 2021 · 2 comments
Labels

Comments

@dechamps
Copy link
Owner

dechamps commented Jan 4, 2021

In #105 @XBagon provided the following log:

Selecting input device
Searching for a PortAudio device named 'FireFly_808U Line 1/2 (Phonic FireFly-808 Universal WDM)' with host API index 2
Selected input device: PortAudio device index 70 (name: 'FireFly_808U Line 1/2 (Phonic FireFly-808 Universal WDM)', host API: 2, default sple rate: 44100, max input channels: 2, max output channels: 0, input latency: 0.003 (low) 0.01 (high), output latency: 0 (low) 0 (high))
Selecting output device
Searching for a PortAudio device named 'Speakers (Realtek(R) Audio)' with host API index 2
Selected output device: PortAudio device index 51 (name: 'Speakers (Realtek(R) Audio)', host API: 2, default sample rate: 44100, max inputhannels: 0, max output channels: 2, input latency: 0 (low) 0 (high), output latency: 0.003 (low) 0.0101587 (high))
Selecting input sample type
WASAPI Exclusive mode detected, selecting sample type from WASAPI device default format
WASAPI device default format: WAVEFORMAT with format tag 65534 [EXTENSIBLE], 2 channels, 44100 samples/second, 352800 average bytes/secondblock alignment 8 bytes, 32 bits per sample, 24 valid bits per sample, channel mask 3 [Front Left, Front Right], subformat {00000001-0000-10-8000-00AA00389B71} [PCM]
Selected input sample type: ASIO 19 [ASIOSTFloat32LSB], PortAudio 1 [Float32], size 4
Selecting output sample type
WASAPI Exclusive mode detected, selecting sample type from WASAPI device default format
WASAPI device default format: WAVEFORMAT with format tag 65534 [EXTENSIBLE], 2 channels, 44100 samples/second, 352800 average bytes/secondblock alignment 8 bytes, 32 bits per sample, 24 valid bits per sample, channel mask 3 [Front Left, Front Right], subformat {00000001-0000-10-8000-00AA00389B71} [PCM]
Selected output sample type: ASIO 19 [ASIOSTFloat32LSB], PortAudio 1 [Float32], size 4

This doesn't make sense - FlexASIO is autodetecting the sample type as Float32, even though the WASAPI default format says Int24.

I was able to reproduce with basic audio devices and FlexASIOTest, but in my case the problem did not occur on the input side:

Selecting input device
Using default device with index 14
Selected input device: PortAudio device index 14 (name: 'Microphone (Realtek High Definition Audio)', host API: 2, default sample rate: 48000, max input channels: 2, max output channels: 0, input latency: 0.003 (low) 0.01 (high), output latency: 0 (low) 0 (high))
Selecting output device
Using default device with index 12
Selected output device: PortAudio device index 12 (name: 'Speakers (Realtek High Definition Audio)', host API: 2, default sample rate: 48000, max input channels: 0, max output channels: 2, input latency: 0 (low) 0 (high), output latency: 0.003 (low) 0.01 (high))
Selecting input sample type
WASAPI Exclusive mode detected, selecting sample type from WASAPI device default format
WASAPI device default format: WAVEFORMAT with format tag 65534 [EXTENSIBLE], 2 channels, 48000 samples/second, 192000 average bytes/second, block alignment 4 bytes, 16 bits per sample, 16 valid bits per sample, channel mask 3 [Front Left, Front Right], subformat {00000001-0000-0010-8000-00AA00389B71} [PCM]
Selected input sample type: ASIO 16 [ASIOSTInt16LSB], PortAudio 8 [Int16], size 2
Selecting output sample type
WASAPI Exclusive mode detected, selecting sample type from WASAPI device default format
WASAPI device default format: WAVEFORMAT with format tag 65534 [EXTENSIBLE], 2 channels, 48000 samples/second, 384000 average bytes/second, block alignment 8 bytes, 32 bits per sample, 24 valid bits per sample, channel mask 3 [Front Left, Front Right], subformat {00000001-0000-0010-8000-00AA00389B71} [PCM]
Selected output sample type: ASIO 19 [ASIOSTFloat32LSB], PortAudio 1 [Float32], size 4

For now, a workaround is to explicitly specify the sample type using the sampleType option.

This might be a regression in FlexASIO 1.7, or it might just be that the issue was hidden in previous versions due to implicit sample type conversion (which does not happen by default in 1.7 anymore).

@dechamps
Copy link
Owner Author

dechamps commented Jan 4, 2021

Found the bug: https://github.com/dechamps/FlexASIO/blob/flexasio-1.7/src/flexasio/FlexASIO/flexasio.cpp#L244-L250

This can accidentally match PCM 24-bit-in-32-bit-container as Float32.

@dechamps
Copy link
Owner Author

dechamps commented Jan 4, 2021

This is fixed in FlexASIO 1.7a.

@dechamps dechamps unpinned this issue Oct 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant