-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Fix up PortAudio backend #7444
base: master
Are you sure you want to change the base?
Fix up PortAudio backend #7444
Conversation
If PortAudio is not found, then nothing should be defined here anyways.
We should do this for any of the other applicable audio devices in the future (to encourage separation of GUI and Core).
Returning paComplete from the audio callback, as well as using our own stop variable may conflict in complex ways. One such example is if the stop boolean is set and the device is required to read the nullptr buffer when the audio FIFO thread is closing. Also, PortAudio's says using paComplete and paAbort is an alternative technique to calling Pa_StopStream, so using both isn't necessary and thus avoids streams being stopped or started unexpectedly.
Made a misunderstanding. Pa_StopStream requires that we return paComplete when we are done to tell it that no more new buffers are being rendered for now and it can play any pending audio buffers.
No need for AudioEngine::clip since PortAudio already clips the signal for us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
que paso
How does one test this? Should I play two demo tracks and look at the latency? |
Here's my config, @sakertooth, with recent files and directory paths obscured: <?xml version="1.0"?>
<!DOCTYPE lmms-config-file>
<lmms version="1.3.0-alpha.1.740+g303215f8b" configversion="3">
<MidiJack device="lmms"/>
<app loopmarkermode="dual" nanhandler="1" openlastproject="0" nommpz="0" sololegacybehavior="0" configured="1" displaydbfs="1" disablebackup="0" language="sr"/>
<audioengine mididev="WinMM MIDI" framesperaudiobuffer="256" audiodev="SDL (Simple DirectMedia Layer)"/>
<audiojack clientname="lmms" channels="2"/>
<audioportaudio backend="" device=""/>
<audiosdl inputdevice="" device=""/>
<midi midiautoassign="none" autoquantize="0"/>
<paths ladspadir="..." workingdir="..." stkdir="data:/stk/rawwaves/" defaultsf2="..." sf2dir="..." vstdir="..." theme="data:/themes/default/" backgroundtheme="" gigdir="..."/>
<tooltips disabled="0"/>
<ui saveinterval="2" enablerunningautosave="0" displaywaveform="1" vstembedmethod="none" animateafp="1" smoothscroll="0" sidebaronright="0" trackdeletionwarning="0" printnotelabels="1" mixerchanneldeletionwarning="1" compacttrackbuttons="0" disableautoquit="0" vstalwaysontop="0" oneinstrumenttrackwindow="0" enableautosave="0" letpreviewsfinish="0"/>
<recentfiles>
...
</recentfiles>
</lmms> This is the file I'm experiementing with, a near 10 minute export of the Crunk demo: https://drive.google.com/file/d/1ppBXKGC5JHaCH6DYNScw659xhyCiJCAQ/view?usp=sharing I urge you to try it out for yourself, but I'll be sending the GDB output of both this PR and the nightly, once I get both of them compiled. |
Fixes a latency bug caused by suggesting the wrong (supposedly?) latency to PortAudio, which caused stuttering on certain occasions. We now fetch an appropriate latency for the device using
PaDeviceInfo::defaultLowInputLatency
andPaDeviceInfo::defaultLowOutputLatency
.Removes the
m_stopped
variable and stops the stream using only a return ofpaComplete
in the audio callback and a call toPa_StopStream
to avoid potential conflicts.Also cleaned up the code a bit. Moved the GUI specific widget code in the GUI namespace, completely removed the PortAudio v18 code, among other things.
Testing on Windows will be appreciated. I am curious to see if this fixed any issues relating to PortAudio for anyone else.