Closed PortAudio-admin closed 5 years ago
Comment by @dechamps
It seems that we will enter POLL mode (instead of EVENT mode) because the following condition is true:
((INT32)(params->suggestedLatency*100000.0) != 0/*0.01 msec granularity*/)
This will only be true if suggestedLatency
is less than 10 s. Which is basically zero.
The commit that introduces this code is 9c7974c7
, which states:
"advanced Event driven mode and extended the range of host buffer size which can operate in this mode up up to 20.66 ms, e.g. your device buffer size will vary in range 3 - 20.66 ms, if goes above then Poll driven mode is switched on automatically"
This seems to contradict the code.
Comment by @dechamps
@dmitrykos who might know something about this, since he wrote the aforementioned commit.
Comment by @dmitrykos
@edechamps, that was most probably a protection against some reported Vista's bug, may be in WOW64 mode when if Event mode was active the callback was never called by the OS.
My proposal is - try to omit this check completely
((INT32)(params->suggestedLatency*100000.0) != 0/*0.01 msec granularity*/)
and see if users report any problems.
I made tests on built-in audio (ALC) with UAC2 and several UAC1 USB DACs - all seems ok, no problem with callback. May be it does not make sense to keep this check any more and makes sense to let users fine tune latency with fine granulation. In my tests I was testing 3,6,9,11 ... 21 latencies with no problem at all.
I will create a merge request with this issue.
> This seems to contradict the code.
Yes, those changes were made on the fly. Let's normalize this area.
Comment by @dechamps
@dmitrykos Agreed :) I think we should try to use EVENT as much as possible as that seems to be the most efficient way of doing things.
(One thing that I've also noticed is that EVENT is never used in full-duplex mode. Not sure if that's a fundamental limitation of how the code works of if that's something that's easily fixable.)
Comment by @dmitrykos
Created merge request (http://app.assembla.com/spaces/portaudio/git/merge_requests/7097201), if all is ok, will merge it into a master.
Issue closed by @dmitrykos
Comment by @dmitrykos
> Not sure if that's a fundamental limitation of how the code works of if that's something that's easily fixable
@edechamps, there were numerous problems with Event mode when callbacks were not called, and etc. Basically it did not work on Vista. So the most feasible way was to force always Poll mode. You could try to relax that check and test in your application, if you have full-duplex behavior, and see if it works. If it is then may be enabling Event on Windows 10+ would make sense after thorough testing.
Issue created by @dechamps
Using PortAudio latest master (
0cdb346
):Opening a device in WASAPI Exclusive mode with
framesPerBuffer
= 480 andsuggestedLatency
= 0.0:The same, but with
suggestedLatency
= 0.001:This behaviour is surprising - changing the suggested latency from zero to just 1 ms had the effect of putting the WASAPI code into a completely different mode (PULL instead of EVENT) and made the resulting stream latency jump from 10 ms to 20 ms.