Expose internal device properties from audio backend#69
Merged
gen2brain merged 1 commit intoMay 13, 2026
Merged
Conversation
After initialization, miniaudio's ma_device struct contains both the requested and the actual (internal) format, channel count, and sample rate for capture and playback. The internal values reflect what the audio backend actually negotiated, which can differ from what the application requested. A common case is ALSA's dsnoop plugin, which locks the hardware at a fixed sample rate and silently resamples. The existing SampleRate() method returns the requested rate, hiding the mismatch. The new CaptureInternalSampleRate() and PlaybackInternalSampleRate() methods let callers detect this. New methods: - CaptureInternalSampleRate / PlaybackInternalSampleRate - CaptureInternalFormat / PlaybackInternalFormat - CaptureInternalChannels / PlaybackInternalChannels
Owner
|
Merged, thanks. |
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.
After device initialization, miniaudio stores both the requested and the
actual (internal) format, channel count, and sample rate in ma_device. The
internal values reflect what the audio backend negotiated, which can differ
from what the application asked for.
A practical example: ALSA's dsnoop plugin locks the hardware at a fixed
sample rate (typically 48 kHz) and silently resamples everything else.
The existing SampleRate() returns the requested rate, so callers have no
way to detect the mismatch. CaptureInternalSampleRate() reads
capture.internalSampleRate from the underlying ma_device struct, giving
the actual hardware rate.
This adds six read-only accessors, three per direction (capture/playback):
All are non-breaking additions that follow the same pattern as the existing
PlaybackFormat(), CaptureChannels(), etc.