PortAudio consumer: new ASIO multi-channel audio output with video-scheduled dispatch#1720
Open
gmeisel01 wants to merge 1 commit intoCasparCG:masterfrom
Open
PortAudio consumer: new ASIO multi-channel audio output with video-scheduled dispatch#1720gmeisel01 wants to merge 1 commit intoCasparCG:masterfrom
gmeisel01 wants to merge 1 commit intoCasparCG:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a new PortAudio consumer providing ASIO multi-channel audio output, targeted at professional live event and LED wall deployments requiring more than 2 channels of audio output.
Architecture
Uses a lock-free FIFO ring buffer to bridge CasparCG's push model with PortAudio's pull callback model. Audio packets are video-scheduled (same approach as the OAL consumer fix) and written to the FIFO by a high-priority dispatch thread. The PortAudio callback reads from the FIFO on demand.
ASIO-only
Enumerates only ASIO devices with fuzzy name matching (space-insensitive). Requires ASIO drivers to be installed (hardware ASIO, ASIO4ALL, or FlexASIO). Logs a clear error with installation guidance if no ASIO device is found.
Auto-tuning latency compensation
Enabled by default. Measures timing error after each dispatch and adjusts compensation every 10 seconds (200+ samples, 75% correction factor). Correctly handles the systematic offset introduced by ASIO hardware buffer latency, which varies by device and buffer size.
Configuration (casparcg.config)
device-name— ASIO device name (fuzzy matched, uses default if omitted)output-channels— number of output channels (default 2)buffer-size-frames— ASIO buffer size in frames (default 128)latency-compensation-ms— initial latency compensation (default 40ms, auto-tuned at runtime)fifo-ms— FIFO buffer size in milliseconds (default 50ms)auto-tune-latency— enable/disable auto-tuning (default true)