[client] audio: preserve native playback formats

This commit is contained in:
Geoffrey McRae
2026-08-10 03:45:52 +10:00
parent ff665c2031
commit fa8a95569a
6 changed files with 267 additions and 65 deletions

View File

@@ -37,6 +37,8 @@ typedef enum LG_AudioSampleFormat
/* IEEE 754 little-endian floating-point samples. */
LG_AUDIO_FMT_F32_LE,
LG_AUDIO_FMT_F64_LE,
/* Native-endian floating point for client-side processing. */
LG_AUDIO_FMT_F32_NE,
}
LG_AudioSampleFormat;

View File

@@ -46,12 +46,11 @@ struct LG_AudioDevOps
struct
{
/* setup the stream for playback but don't start it yet, returning false
* if the stream could not be configured. If backend resampling is
/* Setup the stream for playback but don't start it yet, returning false
* if the stream could not be configured. The pull function returns the
* exact interleaved format supplied here. If backend resampling is
* requested, resamplerEnabled reports whether it was activated for this
* stream.
* Note: the pull function returns f32 samples
*/
* stream. */
bool (*setup)(const LG_AudioFormat * format, int requestedPeriodFrames,
bool requestResampler, bool * resamplerEnabled,
int * maxPeriodFrames, int * startFrames, LG_AudioPullFn pullFn);
@@ -69,8 +68,10 @@ struct LG_AudioDevOps
void (*mute)(bool mute);
/* [optional] update the active backend resampler's output/input ratio.
* Called from the backend's playback callback and must be realtime safe. */
bool (*setRate)(double ratio);
* The backend replaces ratio with the value it selected for the next
* pull. Called from the backend's playback callback and must be realtime
* safe. */
bool (*setRate)(double * ratio);
/* return the current total playback latency in microseconds */
uint64_t (*latency)(void);