Skip to content

Commit

Permalink
Merge pull request #19 from djamps/master
Browse files Browse the repository at this point in the history
Add non-slew volume and DC source control
  • Loading branch information
MCUdude committed Aug 2, 2021
2 parents edfac6c + 51335c9 commit f2a7be9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/SigmaDSP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,32 @@ void SigmaDSP::volume_slew(uint16_t startMemoryAddress, float dB, uint8_t slew)
safeload_write(startMemoryAddress, volume, slewrate);
}

/**
* @brief Controls a volume control block without slew
* Can be used with various gain controls
*
* @param startMemoryAddress DSP memory address
* @param dB Volume to set in dB
*/
void SigmaDSP::volume(uint16_t startMemoryAddress, float dB)
{
float volume = pow(10, dB / 20); // 10^(dB / 20)

safeload_write(startMemoryAddress, volume);
}

/**
* @brief Control index filters (bass, treble, ect)
* in 28 0 format. Please see:
* https://ez.analog.com/dsp/sigmadsp/f/q-a/165704/tone-control-using-adau1701-sigma-studio
*
* @param startMemoryAddress DSP memory address
* @param Integer value in control field min -(number of steps/2) to +(number of steps/2)
*/
void SigmaDSP::dcSource(uint16_t startMemoryAddress, uint32_t value)
{
safeload_write(startMemoryAddress, value);
}

/**
* @brief Controls the dynamic bass boost level block in dB. This function lets you only set
Expand Down
2 changes: 2 additions & 0 deletions src/SigmaDSP.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ class SigmaDSP
void gain(uint16_t startMemoryAddress, int8_t gainVal, uint8_t channels = 1) { gain(startMemoryAddress, (int32_t)gainVal, channels); }

void volume_slew(uint16_t startMemoryAddress, float dB, uint8_t slew = 12);
void volume(uint16_t startMemoryAddress, float dB);
void dcSource(uint16_t startMemoryAddress, uint32_t value);
void dynamicBass(uint16_t startMemoryAddress, float dB);
void dynamicBass(uint16_t startMemoryAddress, float dB, uint16_t frequency);
void dynamicBass(uint16_t startMemoryAddress, float dB, uint16_t frequency, int16_t threshold, uint16_t time_constant);
Expand Down

0 comments on commit f2a7be9

Please sign in to comment.