diff --git a/Builds/MacOSX/Dexed.xcodeproj/project.xcworkspace/xcuserdata/asb2m10.xcuserdatad/UserInterfaceState.xcuserstate b/Builds/MacOSX/Dexed.xcodeproj/project.xcworkspace/xcuserdata/asb2m10.xcuserdatad/UserInterfaceState.xcuserstate index 7d7bf60..b9259ca 100644 Binary files a/Builds/MacOSX/Dexed.xcodeproj/project.xcworkspace/xcuserdata/asb2m10.xcuserdatad/UserInterfaceState.xcuserstate and b/Builds/MacOSX/Dexed.xcodeproj/project.xcworkspace/xcuserdata/asb2m10.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Source/DXLookNFeel.cpp b/Source/DXLookNFeel.cpp index f6d8eb5..97d0c26 100644 --- a/Source/DXLookNFeel.cpp +++ b/Source/DXLookNFeel.cpp @@ -23,80 +23,48 @@ /** * Algorithm arrangements, based on the DX1 display. - * Feedop 7 == custom draw */ -const char algoArr[][14] = { - // 1 2 3 4 5 6 7 8 9 A B C D F - { 0, 0, 1, 3, 0, 0, 0, 2, 4, 0, 0, 5, 6, 6 }, // 1 - { 0, 0, 1, 3, 0, 0, 0, 2, 4, 0, 0, 5, 6, 2 }, // 2 - { 0, 0, 1, 4, 0, 0, 0, 2, 5, 0, 3, 6, 0, 6 }, // 3 - { 0, 0, 1, 4, 0, 0, 0, 2, 5, 0, 3, 6, 0, 7 }, // 4 - { 0, 1, 3, 5, 0, 0, 0, 2, 4, 6, 0, 0, 0, 6 }, // 5 - { 0, 1, 3, 5, 0, 0, 0, 2, 4, 6, 0, 0, 0, 7 }, // 6 - { 0, 1, 3, 0, 0, 0, 2, 4, 5, 0, 0, 6, 0, 2 }, // 7 - { 0, 1, 3, 0, 0, 0, 2, 4, 5, 0, 0, 6, 0, 4 }, // 8 - { 0, 1, 3, 0, 0, 0, 2, 4, 5, 0, 0, 0, 0, 2 }, // 9 - { 0, 0, 0, 4, 1, 0, 5, 6, 2, 0, 0, 3, 0, 3 }, // 10 - { 0, 0, 0, 4, 1, 0, 5, 6, 2, 0, 0, 3, 0, 6 }, // 11 - { 0, 0, 3, 0, 1, 0, 4, 5, 6, 2, 0, 0, 0, 2 }, // 12 - { 0, 0, 3, 0, 1, 0, 4, 5, 6, 2, 0, 0, 0, 6 }, // 13 - // 1 2 3 4 5 6 7 8 9 A B C D F - { 0, 0, 1, 3, 0, 0, 0, 2, 4, 0, 5, 6, 0, 6 }, // 14 - { 0, 0, 1, 3, 0, 0, 0, 2, 4, 0, 5, 6, 0, 2 }, // 15 - { 0, 0, 1, 0, 0, 0, 2, 3, 5, 0, 4, 6, 0, 6 }, // 16 - { 0, 0, 1, 0, 0, 0, 2, 3, 5, 0, 4, 6, 0, 2 }, // 17 - { 0, 0, 1, 0, 0, 0, 2, 3, 4, 0, 0, 5, 6, 3 }, // 18 - { 0, 0, 1, 4, 5, 0, 0, 2, 6, 0, 3, 0, 0, 6 }, // 19 - { 0, 1, 2, 0, 4, 0, 3, 0, 5, 6, 0, 0, 0, 3 }, // 20 - { 0, 1, 2, 4, 5, 0, 3, 0, 6, 0, 0, 0, 0, 3 }, // 21 - { 0, 1, 3, 4, 5, 0, 2, 0, 6, 0, 0, 0, 0, 6 }, // 22 - { 0, 1, 2, 4, 5, 0, 0, 3, 6, 0, 0, 0, 0, 6 }, // 23 - { 1, 2, 3, 4, 5, 0, 0, 0, 6, 0, 0, 0, 0, 6 }, // 24 - { 1, 2, 3, 4, 5, 0, 0, 0, 6, 0, 0, 0, 0, 6 }, // 25 - { 0, 1, 2, 0, 4, 0, 0, 3, 5, 6, 0, 0, 0, 6 }, // 26 - // 1 2 3 4 5 6 7 8 9 A B C D F - { 0, 1, 2, 0, 4, 0, 0, 3, 5, 6, 0, 0, 0, 3 }, // 27 - { 0, 1, 3, 6, 0, 0, 2, 4, 0, 0, 5, 0, 0, 5 }, // 28 - { 0, 1, 2, 3, 5, 0, 0, 0, 4, 6, 0, 0, 0, 6 }, // 29 - { 0, 1, 2, 3, 6, 0, 0, 0, 4, 0, 0, 5, 0, 5 }, // 30 - { 1, 2, 3, 4, 5, 0, 0, 0, 0, 6, 0, 0, 0, 6 }, // 31 - { 1, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0, 6 } // 32 +static const char algoArr[][13] = { + // 1 2 3 4 5 6 7 8 9 A B C D + { 0, 0, 1, 3, 0, 0, 0, 2, 4, 0, 0, 5, -6 }, // 1 + { 0, 0, 1, 3, 0, 0, 0, -2, 4, 0, 0, 5, 6 }, // 2 + { 0, 0, 1, 4, 0, 0, 0, 2, 5, 0, 3, -6, 0 }, // 3 + { 0, 0, 1, -4, 0, 0, 0, 2, -5, 0, 3, -6, 0 }, // 4 + { 0, 1, 3, 5, 0, 0, 0, 2, 4, -6, 0, 0, 0 }, // 5 + { 0, 1, 3, -5, 0, 0, 0, 2, 4, -6, 0, 0, 0 }, // 6 + { 0, 1, 3, 0, 0, 0, -2, 4, 5, 0, 0, 6, 0 }, // 7 + { 0, 1, 3, 0, 0, 0, 2, -4, 5, 0, 0, 6, 0 }, // 8 + { 0, 1, 3, 0, 0, 0, -2, 4, 5, 0, 0, 0, 0 }, // 9 + { 0, 0, 0, 4, 1, 0, 5, 6, 2, 0, 0, -3, 0 }, // 10 + { 0, 0, 0, 4, 1, 0, 5, -6, 2, 0, 0, 3, 0 }, // 11 + { 0, 0, 3, 0, 1, 0, 4, 5, 6, -2, 0, 0, 0 }, // 12 + { 0, 0, 3, 0, 1, 0, 4, 5, -6, 2, 0, 0, 0 }, // 13 + // 1 2 3 4 5 6 7 8 9 A B C D + { 0, 0, 1, 3, 0, 0, 0, 2, 4, 0, 5, -6, 0 }, // 14 + { 0, 0, 1, 3, 0, 0, 0, -2, 4, 0, 5, 6, 0 }, // 15 + { 0, 0, 1, 0, 0, 0, 2, 3, 5, 0, 4, -6, 0 }, // 16 + { 0, 0, 1, 0, 0, 0, -2, 3, 5, 0, 4, 6, 0 }, // 17 + { 0, 0, 1, 0, 0, 0, 2, -3, 4, 0, 0, 5, 6 }, // 18 + { 0, 0, 1, 4, 5, 0, 0, 2, -6, 0, 3, 0, 0 }, // 19 + { 0, 1, 2, 0, 4, 0, -3, 0, 5, 6, 0, 0, 0 }, // 20 + { 0, 1, 2, 4, 5, 0, -3, 0, 6, 0, 0, 0, 0 }, // 21 + { 0, 1, 3, 4, 5, 0, 2, 0, -6, 0, 0, 0, 0 }, // 22 + { 0, 1, 2, 4, 5, 0, 0, 3, -6, 0, 0, 0, 0 }, // 23 + { 1, 2, 3, 4, 5, 0, 0, 0, -6, 0, 0, 0, 0 }, // 24 + { 1, 2, 3, 4, 5, 0, 0, 0, -6, 0, 0, 0, 0 }, // 25 + { 0, 1, 2, 0, 4, 0, 0, 3, 5, -6, 0, 0, 0 }, // 26 + // 1 2 3 4 5 6 7 8 9 A B C D + { 0, 1, 2, 0, 4, 0, 0, -3, 5, 6, 0, 0, 0 }, // 27 + { 0, 1, 3, 6, 0, 0, 2, 4, 0, 0, -5, 0, 0 }, // 28 + { 0, 1, 2, 3, 5, 0, 0, 0, 4, -6, 0, 0, 0 }, // 29 + { 0, 1, 2, 3, 6, 0, 0, 0, 4, 0, 0, -5, 0 }, // 30 + { 1, 2, 3, 4, 5, 0, 0, 0, 0, -6, 0, 0, 0 }, // 31 + { 1, 2, 3, 4, 5, -6, 0, 0, 0, 0, 0, 0, 0 } // 32 }; -void EnvDisplay::paint(Graphics &g) { - int rate[4]; - int level[4]; - - g.setColour(Colours::black.withAlpha(0.5f)); - g.fillRoundedRectangle (0.0f, 0.0f, (float) getWidth(), (float) getHeight(), 1.0f); - g.setColour(Colours::white); - - for (int i = 0; i < 4; i++) { - rate[i] = s_rate[i]->getValue(); - level[i] = s_level[i]->getValue(); - } - - env.init(rate, level, 99 << 5, 0); - env.keydown(true); - for (int i = 0; i < 72; i++) { - int32_t pos = env.getsample(); - for (int j = 0; j < 16; j++) { - env.getsample(); - } - g.setPixel(i, 32 - (sqrt(pos) / 512)); - } - env.keydown(false); - for (int i = 0; i < 24; i++) { - int32_t pos = env.getsample(); - for (int j = 0; j < 16; j++) { - env.getsample(); - } - g.setPixel(i + 72, 32 - (sqrt(pos) / 512)); - } -} - AlgoDisplay::AlgoDisplay() { - algo = NULL; + static char tmpAlgo = 0; + algo = &tmpAlgo; } /** @@ -105,10 +73,6 @@ AlgoDisplay::AlgoDisplay() { void AlgoDisplay::paint(Graphics &g) { int alg; - if ( algo == NULL ) { - return; - } - if ( *algo <= 31 ) { alg = *algo; } else { @@ -116,32 +80,31 @@ void AlgoDisplay::paint(Graphics &g) { } const char *arr = algoArr[alg]; - g.setColour (Colours::black.withAlpha(0.5f)); + g.setColour (Colours::black.withAlpha(0.1f)); g.fillRoundedRectangle (0.0f, 0.0f, (float) getWidth(), (float) getHeight(), 1.0f); for(int i=0;i<13;i++) { - char target = arr[i]; - bool feedback = target == arr[13]; + int target = arr[i]; if ( target == 0 ) continue; if ( i < 6 ) { - drawOp(g, i, 3, target, feedback); + drawOp(g, i, 3, target); continue; } if ( i < 10 ){ - drawOp(g, (i-6)+1, 2, target, feedback); + drawOp(g, (i-6)+1, 2, target); continue; } if ( i < 12 ) { - drawOp(g, (i-10)+2, 1, target, feedback); + drawOp(g, (i-10)+2, 1, target); continue; } // last one - drawOp(g, (i-12)+3, 0, target, feedback); + drawOp(g, (i-12)+3, 0, target); } String algoTxt; @@ -149,9 +112,9 @@ void AlgoDisplay::paint(Graphics &g) { g.drawText(algoTxt, 5, 1, 21, 14, Justification::left, true); } -void AlgoDisplay::drawOp(Graphics &g, int x, int y, int num, bool feedback) { +void AlgoDisplay::drawOp(Graphics &g, int x, int y, int num) { String txt; - txt << num; + txt << abs(num); int offx = 24; int offy = 17; @@ -160,13 +123,91 @@ void AlgoDisplay::drawOp(Graphics &g, int x, int y, int num, bool feedback) { g.fillRect(x*offx+4, y*offy+3, offx-2, offy-1); g.setColour(Colour(0xFFFFFFFF)); g.drawText(txt, x*offx+3, y*offy+2, offx+2, offy+2, Justification::centred, true); - if ( feedback ) { + if ( num < 0 ) { g.setColour(Colour(0xFFFFFFFF)); int x1 = (x*offx) + 24; g.drawLine(x1+1, y*offy+3, x1+1, y*offy+offy+2, 3); } } +void EnvDisplay::paint(Graphics &g) { + int rate[4]; + int level[4]; + + g.setColour(Colours::black.withAlpha(0.1f)); + g.fillRoundedRectangle (0.0f, 0.0f, (float) getWidth(), (float) getHeight(), 1.0f); + g.setColour(Colours::white); + + for (int i = 0; i < 4; i++) { + rate[i] = s_rate[i]->getValue(); + level[i] = s_level[i]->getValue(); + } + + env.init(rate, level, 99 << 5, 0); + env.keydown(true); + for (int i = 0; i < 72; i++) { + int32_t pos = env.getsample(); + for (int j = 0; j < 16; j++) { + env.getsample(); + } + g.setPixel(i, 32 - (sqrt(pos) / 512)); + } + env.keydown(false); + for (int i = 0; i < 24; i++) { + int32_t pos = env.getsample(); + for (int j = 0; j < 16; j++) { + env.getsample(); + } + g.setPixel(i + 72, 32 - (sqrt(pos) / 512)); + } +} + +PitchEnvDisplay::PitchEnvDisplay() { + static char tmpDisplay[8]; + memset(&tmpDisplay, 0x00, 8); + pvalues = (char *) &tmpDisplay; +} + +void PitchEnvDisplay::paint(Graphics &g) { + g.setColour(Colours::black.withAlpha(0.1f)); + g.fillRoundedRectangle (0.0f, 0.0f, (float) getWidth(), (float) getHeight(), 1.0f); + g.setColour(Colours::white); + + char *levels = pvalues; + char *rates = pvalues + 4; + + float dist[4]; + float total; + + int old = pitchenv_tab[levels[3]] + 128; + // find the scale + + for(int i=0;i<4;i++) { + int nw = pitchenv_tab[levels[i]] + 128; + dist[i] = abs(old - nw) / pitchenv_rate[rates[i]]; + total += dist[i]; + old = nw; + } + + + // TODO : this is WIP + int ratio = 96 / total; + + int oldx = 0; + int oldy = (pitchenv_tab[levels[3]] + 128) / 10; + + for(int i=0;i<4;i++) { + int newx = dist[i] * ratio + oldx; + int newy = (pitchenv_tab[levels[i]] + 128) / 10; + + g.drawLine(oldx, oldy, newx, newy, 2); + + oldx = newx; + oldy = newy; + } +} + + void VuMeter::paint(Graphics &g) { // taken from the drawLevelMeter ; diff --git a/Source/DXLookNFeel.h b/Source/DXLookNFeel.h index b453fad..2312014 100644 --- a/Source/DXLookNFeel.h +++ b/Source/DXLookNFeel.h @@ -23,6 +23,7 @@ #include "../JuceLibraryCode/JuceHeader.h" #include "msfa/env.h" +#include "msfa/pitchenv.h" class EnvDisplay : public Component { Env env; @@ -34,15 +35,20 @@ public: }; class PitchEnvDisplay : public Component { - Env env; + char rvalues[8]; + char render[96]; + + void renderDisplay(); public: + PitchEnvDisplay(); + char *pvalues; void paint(Graphics &g); }; class AlgoDisplay : public Component { - void drawOp(Graphics &g, int x, int y, int num, bool feedback); + void drawOp(Graphics &g, int x, int y, int num); public: AlgoDisplay(); diff --git a/Source/GlobalEditor.cpp b/Source/GlobalEditor.cpp index dbc5e69..df9b500 100644 --- a/Source/GlobalEditor.cpp +++ b/Source/GlobalEditor.cpp @@ -159,8 +159,8 @@ GlobalEditor::GlobalEditor () addAndMakeVisible (lfoSync = new ToggleButton ("lfoSync")); lfoSync->setButtonText (String::empty); - addAndMakeVisible (component = new Component()); - component->setName ("new component"); + addAndMakeVisible (pitchEnvDisplay = new PitchEnvDisplay()); + pitchEnvDisplay->setName ("pitchEnvDisplay"); //[UserPreSize] @@ -202,7 +202,7 @@ GlobalEditor::~GlobalEditor() oscSync = nullptr; pitchModSens = nullptr; lfoSync = nullptr; - component = nullptr; + pitchEnvDisplay = nullptr; //[Destructor]. You can add your own custom destruction code here.. @@ -254,7 +254,7 @@ void GlobalEditor::resized() oscSync->setBounds (600, 64, 24, 24); pitchModSens->setBounds (728, 64, 24, 24); lfoSync->setBounds (624, 64, 24, 24); - component->setBounds (752, 8, 96, 32); + pitchEnvDisplay->setBounds (752, 8, 96, 32); //[UserResized] Add your own custom resize handling here.. //[/UserResized] } @@ -302,41 +302,49 @@ void GlobalEditor::sliderValueChanged (Slider* sliderThatWasMoved) else if (sliderThatWasMoved == pitchRate2) { //[UserSliderCode_pitchRate2] -- add your slider handling code here.. + pitchEnvDisplay->repaint(); //[/UserSliderCode_pitchRate2] } else if (sliderThatWasMoved == pitchRate3) { //[UserSliderCode_pitchRate3] -- add your slider handling code here.. + pitchEnvDisplay->repaint(); //[/UserSliderCode_pitchRate3] } else if (sliderThatWasMoved == pitchRate4) { //[UserSliderCode_pitchRate4] -- add your slider handling code here.. + pitchEnvDisplay->repaint(); //[/UserSliderCode_pitchRate4] } else if (sliderThatWasMoved == pitchRate1) { //[UserSliderCode_pitchRate1] -- add your slider handling code here.. + pitchEnvDisplay->repaint(); //[/UserSliderCode_pitchRate1] } else if (sliderThatWasMoved == pitchLevel2) { //[UserSliderCode_pitchLevel2] -- add your slider handling code here.. + pitchEnvDisplay->repaint(); //[/UserSliderCode_pitchLevel2] } else if (sliderThatWasMoved == pitchLevel3) { //[UserSliderCode_pitchLevel3] -- add your slider handling code here.. + pitchEnvDisplay->repaint(); //[/UserSliderCode_pitchLevel3] } else if (sliderThatWasMoved == pitchLevel4) { //[UserSliderCode_pitchLevel4] -- add your slider handling code here.. + pitchEnvDisplay->repaint(); //[/UserSliderCode_pitchLevel4] } else if (sliderThatWasMoved == pitchLevel1) { //[UserSliderCode_pitchLevel1] -- add your slider handling code here.. + pitchEnvDisplay->repaint(); //[/UserSliderCode_pitchLevel1] } else if (sliderThatWasMoved == feedback) @@ -402,6 +410,7 @@ void GlobalEditor::bind(DexedAudioProcessor *parent) { parent->fxCutoff->bind(cutoff); parent->fxReso->bind(reso); algoDisplay->algo = &(parent->data[134]); + pitchEnvDisplay->pvalues = &(parent->data[126]); processor = parent; } @@ -517,8 +526,8 @@ BEGIN_JUCER_METADATA - diff --git a/Source/GlobalEditor.h b/Source/GlobalEditor.h index 003960f..139a4f5 100644 --- a/Source/GlobalEditor.h +++ b/Source/GlobalEditor.h @@ -90,7 +90,7 @@ private: ScopedPointer oscSync; ScopedPointer pitchModSens; ScopedPointer lfoSync; - ScopedPointer component; + ScopedPointer pitchEnvDisplay; //============================================================================== diff --git a/Source/OperatorEditor.cpp b/Source/OperatorEditor.cpp index f1a9919..7996748 100644 --- a/Source/OperatorEditor.cpp +++ b/Source/OperatorEditor.cpp @@ -445,6 +445,8 @@ void OperatorEditor::bind(DexedAudioProcessor *parent, int op) { parent->opCtrl[op].sclLeftDepth->bind(sclLeftLevel); parent->opCtrl[op].sclRightDepth->bind(sclRightLevel); parent->opCtrl[op].sclRate->bind(sclRateScaling); + parent->opCtrl[op].ampModSens->bind(ampModSens); + parent->opCtrl[op].velModSens->bind(keyVelSens); } @@ -477,13 +479,9 @@ void OperatorEditor::updateDisplay() { txtFreq << " " << det; } khzDisplay->setText(txtFreq, NotificationType::dontSendNotification); - envDisplay->repaint(); } -void OperatorEditor::updateEnv() { - //envDisplay->update(s_) -} //[/MiscUserCode] diff --git a/Source/OperatorEditor.h b/Source/OperatorEditor.h index 6f3cbe4..d5f0171 100644 --- a/Source/OperatorEditor.h +++ b/Source/OperatorEditor.h @@ -51,7 +51,6 @@ public: void bind(DexedAudioProcessor *processor, int num); void updateGain(float v); void updateDisplay(); - void updateEnv(); //[/UserMethods] void paint (Graphics& g); diff --git a/Source/PluginParam.cpp b/Source/PluginParam.cpp index 093cdfd..90419fa 100755 --- a/Source/PluginParam.cpp +++ b/Source/PluginParam.cpp @@ -297,7 +297,7 @@ void DexedAudioProcessor::initCtrl() { String opMode; opMode << opName << " MODE"; - opCtrl[opVal].opMode = new CtrlDX(opMode, 1, opTarget + 17); + opCtrl[opVal].opMode = new CtrlDX(opMode, 2, opTarget + 17); ctrl.add(opCtrl[opVal].opMode); String coarse; @@ -322,14 +322,12 @@ void DexedAudioProcessor::initCtrl() { String sclLeftDepth; sclLeftDepth << opName << " L SCALE DEPTH"; - opCtrl[opVal].sclLeftDepth = new CtrlDX(sclLeftDepth, 100, - opTarget + 9); + opCtrl[opVal].sclLeftDepth = new CtrlDX(sclLeftDepth, 100, opTarget + 9); ctrl.add(opCtrl[opVal].sclLeftDepth); String sclRightDepth; sclRightDepth << opName << " R SCALE DEPTH"; - opCtrl[opVal].sclRightDepth = new CtrlDX(sclRightDepth, 100, - opTarget + 10); + opCtrl[opVal].sclRightDepth = new CtrlDX(sclRightDepth, 100, opTarget + 10); ctrl.add(opCtrl[opVal].sclRightDepth); String sclLeftCurve; @@ -339,18 +337,17 @@ void DexedAudioProcessor::initCtrl() { String sclRightCurve; sclRightCurve << opName << " R KEY SCALE"; - opCtrl[opVal].sclRightCurve = new CtrlDX(sclRightCurve, 4, - opTarget + 12); + opCtrl[opVal].sclRightCurve = new CtrlDX(sclRightCurve, 4, opTarget + 12); ctrl.add(opCtrl[opVal].sclRightCurve); String sclRate; sclRate << opName << " RATE SCALING"; - opCtrl[opVal].sclRate = new CtrlDX(sclRate, 7, opTarget + 13); + opCtrl[opVal].sclRate = new CtrlDX(sclRate, 8, opTarget + 13); ctrl.add(opCtrl[opVal].sclRate); String ampModSens; ampModSens << opName << " A MOD SENS."; - opCtrl[opVal].ampModSens = new CtrlDX(ampModSens, 3, opTarget + 14); + opCtrl[opVal].ampModSens = new CtrlDX(ampModSens, 4, opTarget + 14); ctrl.add(opCtrl[opVal].ampModSens); String velModSens; diff --git a/Source/msfa/pitchenv.cc b/Source/msfa/pitchenv.cc index 707aefc..5d83528 100644 --- a/Source/msfa/pitchenv.cc +++ b/Source/msfa/pitchenv.cc @@ -23,7 +23,7 @@ void PitchEnv::init(double sample_rate) { unit_ = N * (1 << 24) / (21.3 * sample_rate) + 0.5; } -static uint8_t ratetab[] = { +const uint8_t pitchenv_rate[] = { 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 33, 34, 36, 37, 38, 39, 41, 42, 44, 46, 47, @@ -32,7 +32,7 @@ static uint8_t ratetab[] = { 153, 159, 165, 171, 178, 185, 193, 202, 211, 232, 243, 254, 255 }; -static int8_t pitchtab[] = { +const int8_t pitchenv_tab[] = { -128, -116, -104, -95, -85, -76, -68, -61, -56, -52, -49, -46, -43, -41, -39, -37, -35, -33, -32, -31, -30, -29, -28, -27, -26, -25, -24, -23, -22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, @@ -47,7 +47,7 @@ void PitchEnv::set(const int r[4], const int l[4]) { rates_[i] = r[i]; levels_[i] = l[i]; } - level_ = pitchtab[l[3]] << 19; + level_ = pitchenv_tab[l[3]] << 19; down_ = true; advance(0); } @@ -82,10 +82,10 @@ void PitchEnv::advance(int newix) { ix_ = newix; if (ix_ < 4) { int newlevel = levels_[ix_]; - targetlevel_ = pitchtab[newlevel] << 19; + targetlevel_ = pitchenv_tab[newlevel] << 19; rising_ = (targetlevel_ > level_); - inc_ = ratetab[rates_[ix_]] * unit_; + inc_ = pitchenv_rate[rates_[ix_]] * unit_; } } diff --git a/Source/msfa/pitchenv.h b/Source/msfa/pitchenv.h index 28c5c2b..ff80d27 100755 --- a/Source/msfa/pitchenv.h +++ b/Source/msfa/pitchenv.h @@ -45,5 +45,8 @@ class PitchEnv { void advance(int newix); }; -#endif // __PITCHENV_H +extern const uint8_t pitchenv_rate[]; +extern const int8_t pitchenv_tab[]; + + #endif // __PITCHENV_H