From f0e35140370822cbb52b25bfa380fc90d2da6d3f Mon Sep 17 00:00:00 2001 From: Katherine Whitlock Date: Sun, 21 May 2023 22:35:38 -0400 Subject: [PATCH 1/2] Convert AudioHandle::Config to an aggregate type but keep default values --- src/hid/audio.h | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/hid/audio.h b/src/hid/audio.h index cfbe1aa8d..66451cd4a 100644 --- a/src/hid/audio.h +++ b/src/hid/audio.h @@ -27,27 +27,18 @@ class AudioHandle struct Config { /** number of samples to process per callback */ - size_t blocksize; + size_t blocksize = 48; /**< Sample rate of audio */ - SaiHandle::Config::SampleRate samplerate; + SaiHandle::Config::SampleRate samplerate = SaiHandle::Config::SampleRate::SAI_48KHZ; /** factor for adjustment before and after callback for hardware that may have extra headroom */ - float postgain; + float postgain = 1.f; /** factor for additional one-sided compensation to audio path for hardware that may * have unequal input/output ranges */ - float output_compensation; - - /** Sets default values for config struct */ - Config() - : blocksize(48), - samplerate(SaiHandle::Config::SampleRate::SAI_48KHZ), - postgain(1.f), - output_compensation(1.f) - { - } + float output_compensation = 1.f; }; enum class Result From f9d9548f680dd1c93bb1d7e1978c93c29ea9c66e Mon Sep 17 00:00:00 2001 From: Katherine Whitlock Date: Wed, 21 Feb 2024 15:16:31 -0500 Subject: [PATCH 2/2] Formatting --- src/hid/audio.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hid/audio.h b/src/hid/audio.h index 66451cd4a..47fbc4744 100644 --- a/src/hid/audio.h +++ b/src/hid/audio.h @@ -30,7 +30,8 @@ class AudioHandle size_t blocksize = 48; /**< Sample rate of audio */ - SaiHandle::Config::SampleRate samplerate = SaiHandle::Config::SampleRate::SAI_48KHZ; + SaiHandle::Config::SampleRate samplerate + = SaiHandle::Config::SampleRate::SAI_48KHZ; /** factor for adjustment before and after callback for hardware that may have extra headroom */ float postgain = 1.f;