Skip to content

Implement Unison Mode using multiple additional TGs #892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ class CConfig // Configuration for MiniDexed
#if (RASPPI==4 || RASPPI==5)
// Pi 4 and 5 quad core
// These are max values, default is to support 8 in total with optional 16 TGs
static const unsigned TGsCore1 = 2; // process 2 TGs on core 1
static const unsigned TGsCore23 = 3; // process 3 TGs on core 2 and 3 each
static const unsigned TGsCore1Opt = 2; // process optional additional 2 TGs on core 1
static const unsigned TGsCore23Opt = 3; // process optional additional 3 TGs on core 2 and 3 each
static const unsigned TGsCore1 = 2*4; // process 2 TGs on core 1
static const unsigned TGsCore23 = 3*4; // process 3 TGs on core 2 and 3 each
static const unsigned TGsCore1Opt = 2*4; // process optional additional 2 TGs on core 1
static const unsigned TGsCore23Opt = 3*4; // process optional additional 3 TGs on core 2 and 3 each
static const unsigned MinToneGenerators = TGsCore1 + 2*TGsCore23;
static const unsigned AllToneGenerators = TGsCore1 + TGsCore1Opt + 2*TGsCore23 + 2*TGsCore23Opt;
static const unsigned DefToneGenerators = MinToneGenerators;
#else
// Pi 2 or 3 quad core
static const unsigned TGsCore1 = 2; // process 2 TGs on core 1
static const unsigned TGsCore23 = 3; // process 3 TGs on core 2 and 3 each
static const unsigned TGsCore1 = 2*4; // process 2 TGs on core 1
static const unsigned TGsCore23 = 3*4; // process 3 TGs on core 2 and 3 each
static const unsigned TGsCore1Opt = 0;
static const unsigned TGsCore23Opt = 0;
static const unsigned MinToneGenerators = TGsCore1 + 2*TGsCore23;
Expand Down
16 changes: 16 additions & 0 deletions src/effect_mixer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,22 @@ template <int NN> class AudioMixer
multiplier[channel] = powf(gain, 4); // see: https://www.dr-lex.be/info-stuff/volumecontrols.html#ideal2
}

// Add a raw parameter to allow bypassing the powf(gain, 4) curve
void gain(uint8_t channel, float32_t gain, bool raw)
{
if (channel >= NN) return;

if (gain > MAX_GAIN)
gain = MAX_GAIN;
else if (gain < MIN_GAIN)
gain = MIN_GAIN;
if (raw) {
multiplier[channel] = gain;
} else {
multiplier[channel] = powf(gain, 4); // see: https://www.dr-lex.be/info-stuff/volumecontrols.html#ideal2
}
}

void gain(float32_t gain)
{
for (uint8_t i = 0; i < NN; i++)
Expand Down
Loading