From 11ba322a89814787f9cf369ab64f50bcfc474ceb Mon Sep 17 00:00:00 2001 From: Chip Audette Date: Wed, 6 Mar 2024 14:46:14 -0500 Subject: [PATCH] control_aic3206: clarify that volume_dB() changes the DAC volume, not the headphone amp --- src/control_aic3206.cpp | 3 ++- src/control_aic3206.h | 6 +++--- src/output_i2s_f32.cpp | 5 ++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/control_aic3206.cpp b/src/control_aic3206.cpp index 5513d4c..9ce3de8 100644 --- a/src/control_aic3206.cpp +++ b/src/control_aic3206.cpp @@ -481,7 +481,7 @@ bool AudioControlAIC3206::enableAutoMuteDAC(bool enable, uint8_t mute_delay_code return enable; } -// -63.6 to +24 dB in 0.5dB steps. uses signed 8-bit +// Changes the DAC ouput volume from -63.6 dB to +24 dB in 0.5dB steps. uses signed 8-bit float AudioControlAIC3206::applyLimitsOnVolumeSetting(float vol_dB) { // Constrain to limits if (vol_dB > 24.0) { @@ -494,6 +494,7 @@ float AudioControlAIC3206::applyLimitsOnVolumeSetting(float vol_dB) { } return vol_dB; } +// Changes the DAC ouput volume from -63.6 dB to +24 dB in 0.5dB steps. float AudioControlAIC3206::volume_dB(float orig_vol_dB, int Ichan) { // 0 = Left; 1 = right; float vol_dB = applyLimitsOnVolumeSetting(orig_vol_dB); if (abs(vol_dB - orig_vol_dB) > 0.01) { diff --git a/src/control_aic3206.h b/src/control_aic3206.h index a2723a6..1613666 100644 --- a/src/control_aic3206.h +++ b/src/control_aic3206.h @@ -78,9 +78,9 @@ class AudioControlAIC3206: public TeensyAudioControl virtual bool disable(void); bool outputSelect(int n, bool flag_full = true); //flag_full is whether to do a full reconfiguration. True is more complete but false is faster. bool volume(float n); - static float applyLimitsOnVolumeSetting(float vol_dB); - float volume_dB(float vol_dB); //set both channels to the same volume - float volume_dB(float vol_left_dB, float vol_right_dB); //set both channels, but to their own values + static float applyLimitsOnVolumeSetting(float vol_dB); //uses limits (using the limits on the DAC gain in the AIC) + float volume_dB(float vol_dB); //set both channels to the same volume (via the DAC output volume) + float volume_dB(float vol_left_dB, float vol_right_dB); //set both channels (via the DAC output volume), but to their own values float volume_dB(float vol_left_dB, int chan); //set each channel seperately (0 = left; 1 = right) int muteDAC(int chan = BOTH_CHAN); //mutes the output DAC int unmuteDAC(int chan = BOTH_CHAN); //unmutes the output DAC diff --git a/src/output_i2s_f32.cpp b/src/output_i2s_f32.cpp index 7a8b4fe..5b55f74 100644 --- a/src/output_i2s_f32.cpp +++ b/src/output_i2s_f32.cpp @@ -844,6 +844,8 @@ void AudioOutputI2S_F32::config_i2s(float fs_Hz) { config_i2s(false, fs_Hz); } void AudioOutputI2S_F32::config_i2s(bool transferUsing32bit, float fs_Hz) { #if defined(KINETISK) || defined(KINETISL) + //Tympan Revs A-D will be here (based on Teensy 3.6, which is Kinetis K) + SIM_SCGC6 |= SIM_SCGC6_I2S; SIM_SCGC7 |= SIM_SCGC7_DMA; SIM_SCGC6 |= SIM_SCGC6_DMAMUX; @@ -887,7 +889,8 @@ void AudioOutputI2S_F32::config_i2s(bool transferUsing32bit, float fs_Hz) #elif defined(__IMXRT1062__) - + //Tympan Revs E-F will be here (based on Teensy 4.1, which is IMXRT1062) + CCM_CCGR5 |= CCM_CCGR5_SAI1(CCM_CCGR_ON); // if either transmitter or receiver is enabled, do nothing