Skip to content

Add PortAudio non-blocking stream support#31

Draft
kareandersen wants to merge 1 commit intofrno7:mainfrom
kareandersen:portaudio_nonblocking
Draft

Add PortAudio non-blocking stream support#31
kareandersen wants to merge 1 commit intofrno7:mainfrom
kareandersen:portaudio_nonblocking

Conversation

@kareandersen
Copy link
Copy Markdown
Contributor

@kareandersen kareandersen commented Apr 7, 2025

  • Supports non-blocking (callback based) streams
  • Still supports blocking io
  • Now we can suspend/resume properly on Linux in the text-mode player, restart the tune etc. without issues (tested to the best of my ability)
  • WIP on tweaking the latency

@kareandersen
Copy link
Copy Markdown
Contributor Author

kareandersen commented Apr 10, 2025

Ok, let's see if we can tweak the latency for both non-blocking and blocking scenarios. It may not be possible to make a "perfect" solution for all systems, instead it may be an idea to let the user override the latency (perhaps even interactively in the text-mode player).

I just had a quick read through at the BufferingLatencyAndTimingImplementationGuidelines wiki page and found it to be a very well written and informative wall of text.

The current code is simply accepting the value provided for the default device's defaultLowOutputLatency, which may be ok - but I have not yet had a look at what the actual value provided is and if it is indeed based on buffer length or other factors. What I have noticed is that I can sometimes get glitches with the ALSA backend (possibly due to a configuration issue on the host machine) but not on PortAudio (which could also be explained by the relatively huge buffer I set up).

I'll poke around a bit and see what's up on multiple systems while digging into the documentation.

Edit: Let's keep this in the scope here too: Latency rationale documentation commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant