Skip to content
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

Allow enabling and disabling operators, closes #111 #118

Merged
merged 8 commits into from
Apr 20, 2022
Merged
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
2 changes: 2 additions & 0 deletions src/dexedadapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include <circle/spinlock.h>
#include <stdint.h>

#define DEXED_OP_ENABLE (DEXED_OP_OSC_DETUNE + 1)

// Some Dexed methods require to be guarded from being interrupted
// by other Dexed calls. This is done herein.

Expand Down
22 changes: 22 additions & 0 deletions src/minidexed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt,
m_nNoteShift[i] = 0;

m_nReverbSend[i] = 0;
m_uchOPMask[i] = 0b111111; // All operators on

m_pTG[i] = new CDexedAdapter (CConfig::MaxNotes, pConfig->GetSampleRate ());
assert (m_pTG[i]);
Expand Down Expand Up @@ -676,6 +677,22 @@ void CMiniDexed::SetVoiceParameter (uint8_t uchOffset, uint8_t uchValue, unsigne

if (nOP < 6)
{
if (uchOffset == DEXED_OP_ENABLE)
{
if (uchValue)
{
m_uchOPMask[nTG] |= 1 << nOP;
}
else
{
m_uchOPMask[nTG] &= ~(1 << nOP);
}

m_pTG[nTG]->setOPAll (m_uchOPMask[nTG]);

return;
}

nOP = 5 - nOP; // OPs are in reverse order
}

Expand All @@ -693,6 +710,11 @@ uint8_t CMiniDexed::GetVoiceParameter (uint8_t uchOffset, unsigned nOP, unsigned

if (nOP < 6)
{
if (uchOffset == DEXED_OP_ENABLE)
{
return !!(m_uchOPMask[nTG] & (1 << nOP));
}

nOP = 5 - nOP; // OPs are in reverse order
}

Expand Down
3 changes: 2 additions & 1 deletion src/minidexed.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ class CMiniDexed

private:
int16_t ApplyNoteLimits (int16_t pitch, unsigned nTG); // returns < 0 to ignore note

uint8_t m_uchOPMask[CConfig::ToneGenerators];

void ProcessSound (void);

#ifdef ARM_ALLOW_MULTI_CORE
Expand Down
4 changes: 3 additions & 1 deletion src/uimenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ const CUIMenu::TMenuItem CUIMenu::s_OperatorMenu[] =
{"Rate Scaling",EditOPParameter, 0, DEXED_OP_OSC_RATE_SCALE},
{"A Mod Sens.", EditOPParameter, 0, DEXED_OP_AMP_MOD_SENS},
{"K Vel. Sens.",EditOPParameter, 0, DEXED_OP_KEY_VEL_SENS},
{"Enable", EditOPParameter, 0, DEXED_OP_ENABLE},
{0}
};

Expand Down Expand Up @@ -235,7 +236,8 @@ const CUIMenu::TParameter CUIMenu::s_OPParameter[] =
{0, 1, 1, ToOscillatorMode}, // DEXED_OP_OSC_MODE
{0, 31, 1}, // DEXED_OP_FREQ_COARSE
{0, 99, 1}, // DEXED_OP_FREQ_FINE
{0, 14, 1, ToOscillatorDetune} // DEXED_OP_OSC_DETUNE
{0, 14, 1, ToOscillatorDetune}, // DEXED_OP_OSC_DETUNE
{0, 1, 1, ToOnOff} // DEXED_OP_ENABLE
};

const char CUIMenu::s_NoteName[100][4] =
Expand Down