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

Unable to change WDM-KS sample rate #159

Closed
jmag9999 opened this issue Oct 6, 2022 · 8 comments
Closed

Unable to change WDM-KS sample rate #159

jmag9999 opened this issue Oct 6, 2022 · 8 comments
Labels
bug portaudio Requires changes in PortAudio upstream.
Milestone

Comments

@jmag9999
Copy link

jmag9999 commented Oct 6, 2022

When using FlexASIO within REW, the sample selection goes blank when selecing WMD-KS. All other modes appear to work. When using WMD-KS, the audio input/output continues to work, but the sample rate remains on the last used rate and is no longer selectable. I have attached my log after REW startup as well as the PortAudioDevices output.

More Info
https://www.avnirvana.com/threads/flexasio-and-wmd-ks-sample-rate-selection-disappears.11015/[](url)

FlexASIO.log
PortAudioDevices.txt

@dechamps
Copy link
Owner

dechamps commented Oct 6, 2022

The log suggests WDM-KS is not working at all:

--- ENTERING CONTEXT: canSampleRate()
Checking for sample rate: 44100
Checking if input supports this sample rate
CFlexASIO::OpenStream(inputEnabled = 1, outputEnabled = 0, sampleRate = 44100, framesPerBuffer = 0, callback = 00007FFD9A4E4CF0, callbackUserData = 0000000000000000)
Opening PortAudio stream with...
...input parameters: PortAudio stream parameters for device index 18, 2 channels, sample format 2147483649 [Float32, NonInterleaved], suggested latency 0s
...output parameters: none
...sample rate: 44100 Hz
...frames per buffer: 0
...stream flags: 8 [PrimeOutputBuffersUsingStreamCallback]
...stream callback: 00007FFD9A4E4CF0 (user data 0000000000000000)
[PortAudio] OpenStream:sampleRate = 44100.000000
[PortAudio] OpenStream:framesPerBuffer = 0
[PortAudio] Pin create result = 0x00000000
[PortAudio] Capture pin frames: 0
[PortAudio] Input frames chosen:0
[PortAudio] Failed to get buffer with notification
[PortAudio] Failed to get buffer without notification
[PortAudio] Buffer size on 128 byte boundary, still fails :(
[PortAudio] Failed to get input buffer (WaveRT)
Input does not support this sample rate: unable to open PortAudio stream: Unanticipated host error
Checking if output supports this sample rate
CFlexASIO::OpenStream(inputEnabled = 0, outputEnabled = 1, sampleRate = 44100, framesPerBuffer = 0, callback = 00007FFD9A4E4CF0, callbackUserData = 0000000000000000)
Opening PortAudio stream with...
...input parameters: none
...output parameters: PortAudio stream parameters for device index 24, 2 channels, sample format 2147483649 [Float32, NonInterleaved], suggested latency 0s
...sample rate: 44100 Hz
...frames per buffer: 0
...stream flags: 8 [PrimeOutputBuffersUsingStreamCallback]
...stream callback: 00007FFD9A4E4CF0 (user data 0000000000000000)
[PortAudio] OpenStream:sampleRate = 44100.000000
[PortAudio] OpenStream:framesPerBuffer = 0
[PortAudio] Pin create result = 0x00000000
[PortAudio] Render pin frames: 0
[PortAudio] Output frames chosen:0
[PortAudio] Failed to get buffer with notification
[PortAudio] Failed to get buffer without notification
[PortAudio] Buffer size on 128 byte boundary, still fails :(
[PortAudio] Failed to get output buffer (with notification)
Output does not support this sample rate: unable to open PortAudio stream: Unanticipated host error
Sample rate 44100 is unavailable
--- EXITING CONTEXT: canSampleRate() [OK]

It looks like the input and output devices you are using, Line (E1DA Cosmos ADC PCM32/384) and Speakers (E50), are also the default Windows audio devices:

Found backend: PortAudio host API index 2 (name: 'Windows WASAPI', type: 13 [WASAPI], default input device: 15, default output device: 12)
Found device: PortAudio device index 12 (name: 'Speakers (E50)'
Found device: PortAudio device index 15 (name: 'Line (E1DA Cosmos ADC PCM32/384)'
Found device: PortAudio device index 18 (name: 'Line (E1DA Cosmos ADC PCM32/384)'
Found device: PortAudio device index 24 (name: 'Speakers (E50)'

As explained in the FAQ, WDM-KS is unlikely to work when pointed to the default Windows audio devices, as that usually means the devices are already in use. WDM-KS usually cannot open devices that are in use.

Does it work if you change your default audio devices to something else in your Windows audio settings?

When using WMD-KS, the audio input/output continues to work, but the sample rate remains on the last used rate and is no longer selectable.

As far as I can tell WDM-KS is not working at all, period. Most likely it's REW misleading you - the backend did not actually change and you are still using the previous backend you were using, not WDM-KS.

@jmag9999
Copy link
Author

jmag9999 commented Oct 6, 2022

In the log above, I did not start the generator or the input recording. I just opened REW and configured the devices. I will try changing the default audio devices. I am pretty confident that REW is using WDM-KS, as the SINAD measurements do change when only changing the backend. I can do another log with generator and input working if that helps.

@dechamps
Copy link
Owner

dechamps commented Oct 6, 2022

I can do another log with generator and input working if that helps.

A log of WDM-KS actually working would be interesting to see, yes.

@jmag9999
Copy link
Author

jmag9999 commented Oct 6, 2022

OK, here is a new log with both input and output working. Changing the default devices did not seem to help.

FlexASIO.log

@dechamps
Copy link
Owner

dechamps commented Oct 6, 2022

You are correct - it is indeed successfully running WDM-KS:

--- ENTERING CONTEXT: createBuffers()
Request to create buffers for 2 channels, size 4096 samples
Allocated 2 buffer sets, 1/1 (I/O) channels per buffer set, 4096 samples per channel, 4/4 (I/O) bytes per sample, memory range: 0000000019A4AFE0-0000000019A5AFE0
ASIO buffer #0 is input channel 0 - first half: 0000000019A4AFE0-0000000019A4EFE0 - second half: 0000000019A52FE0-0000000019A56FE0
ASIO buffer #1 is output channel 0 - first half: 0000000019A4EFE0-0000000019A52FE0 - second half: 0000000019A56FE0-0000000019A5AFE0
CFlexASIO::OpenStream(inputEnabled = 1, outputEnabled = 1, sampleRate = 192000, framesPerBuffer = 4096, callback = 00007FFDA3B33A71, callbackUserData = 000000001BB539F0)
Opening PortAudio stream with...
...input parameters: PortAudio stream parameters for device index 18, 2 channels, sample format 2147483649 [Float32, NonInterleaved], suggested latency 0.064s
...output parameters: PortAudio stream parameters for device index 24, 2 channels, sample format 2147483649 [Float32, NonInterleaved], suggested latency 0.064s
...sample rate: 192000 Hz
...frames per buffer: 4096
...stream flags: 8 [PrimeOutputBuffersUsingStreamCallback]
...stream callback: 00007FFDA3B33A71 (user data 000000001BB539F0)
[PortAudio] OpenStream:sampleRate = 192000.000000
[PortAudio] OpenStream:framesPerBuffer = 4096
[PortAudio] Pin create result = 0x00000000
[PortAudio] Capture pin frames: 0
[PortAudio] Pin create result = 0x00000000
[PortAudio] Render pin frames: 0
[PortAudio] Input frames chosen:12288
[PortAudio] Output frames chosen:12288
[PortAudio] PinGetBuffer: SubType_kNotification
[PortAudio] Input buffer start = 000000001BDE0000, size = 196608
[PortAudio] PinGetBuffer: SubType_kNotification
[PortAudio] Output buffer start = 000000001BE10000, size = 196608, membarrier = 0
[PortAudio] BytesPerInputFrame = 8
[PortAudio] BytesPerOutputFrame = 8
[PortAudio] Failed to register position register
[PortAudio] Failed to register capture position register, using PinGetAudioPositionViaIOCTLWrite
[PortAudio] Failed to register position register
[PortAudio] Failed to register rendering position register, using PinGetAudioPositionViaIOCTLRead
PortAudio stream opened: 000000001BB742F0

It's surprising that WDM-KS works when streaming but not when probing for sample rates. I will have to take a closer look when I have some time.

@dechamps dechamps added the bug label Oct 10, 2022
@dechamps dechamps changed the title When using WMD-KS Provider, sample rates are not provided to REW When using WDM-KS backend, sample rates are not provided to REW Oct 10, 2022
@dechamps
Copy link
Owner

dechamps commented Jan 20, 2023

@GoldenSound reported the same problem in #178. It seems to affect devices using WaveRT-based drivers regardless of the ASIO Host Application (I was able to reproduce in FlexASIOTest). The underlying cause appears to be the PortAudio WDM-KS backend being unable to open streams with paFramesPerBufferUnspecified.

@dechamps dechamps added the portaudio Requires changes in PortAudio upstream. label Jan 20, 2023
@dechamps dechamps changed the title When using WDM-KS backend, sample rates are not provided to REW Unable to change WDM-KS sample rate Jan 20, 2023
@dechamps dechamps pinned this issue Jan 20, 2023
@dechamps
Copy link
Owner

After some more experiments it looks like I was slightly off on the trigger - it's not paFramesPerBufferUnspecified that causes this, it's PaStreamParameters::suggestedLatency being set to zero. Anyway, I reported the bug to downstream in PortAudio/portaudio#761.

@dechamps
Copy link
Owner

This is fixed in FlexASIO 1.10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug portaudio Requires changes in PortAudio upstream.
Projects
None yet
Development

No branches or pull requests

2 participants