Skip to content

Commit

Permalink
control_aic3206: clarify that volume_dB() changes the DAC volume, not…
Browse files Browse the repository at this point in the history
… the headphone amp
  • Loading branch information
chipaudette committed Mar 6, 2024
1 parent c9ae403 commit 11ba322
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/control_aic3206.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions src/control_aic3206.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/output_i2s_f32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 11ba322

Please sign in to comment.