pull/1/head
asb2m10 11 years ago
parent 2403fc93fa
commit 4b886212c4
  1. BIN
      Builds/MacOSX/Dexed.xcodeproj/project.xcworkspace/xcuserdata/asb2m10.xcuserdatad/UserInterfaceState.xcuserstate
  2. 209
      Source/DXLookNFeel.cpp
  3. 10
      Source/DXLookNFeel.h
  4. 21
      Source/GlobalEditor.cpp
  5. 2
      Source/GlobalEditor.h
  6. 6
      Source/OperatorEditor.cpp
  7. 1
      Source/OperatorEditor.h
  8. 15
      Source/PluginParam.cpp
  9. 10
      Source/msfa/pitchenv.cc
  10. 3
      Source/msfa/pitchenv.h

@ -23,80 +23,48 @@
/** /**
* Algorithm arrangements, based on the DX1 display. * Algorithm arrangements, based on the DX1 display.
* Feedop 7 == custom draw
*/ */
const char algoArr[][14] = { static const char algoArr[][13] = {
// 1 2 3 4 5 6 7 8 9 A B C D F // 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, 6 }, // 1 { 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 }, // 2 { 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, 6 }, // 3 { 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, 7 }, // 4 { 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, 6 }, // 5 { 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, 7 }, // 6 { 0, 1, 3, -5, 0, 0, 0, 2, 4, -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 0, 4, 0, 0, 3, 5, 6, 0, 0, 0, 3 }, // 27 { 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, 5 }, // 28 { 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, 6 }, // 29 { 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, 5 }, // 30 { 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, 6 }, // 31 { 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, 6 } // 32 { 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() { AlgoDisplay::AlgoDisplay() {
algo = NULL; static char tmpAlgo = 0;
algo = &tmpAlgo;
} }
/** /**
@ -105,10 +73,6 @@ AlgoDisplay::AlgoDisplay() {
void AlgoDisplay::paint(Graphics &g) { void AlgoDisplay::paint(Graphics &g) {
int alg; int alg;
if ( algo == NULL ) {
return;
}
if ( *algo <= 31 ) { if ( *algo <= 31 ) {
alg = *algo; alg = *algo;
} else { } else {
@ -116,32 +80,31 @@ void AlgoDisplay::paint(Graphics &g) {
} }
const char *arr = algoArr[alg]; 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); g.fillRoundedRectangle (0.0f, 0.0f, (float) getWidth(), (float) getHeight(), 1.0f);
for(int i=0;i<13;i++) { for(int i=0;i<13;i++) {
char target = arr[i]; int target = arr[i];
bool feedback = target == arr[13];
if ( target == 0 ) if ( target == 0 )
continue; continue;
if ( i < 6 ) { if ( i < 6 ) {
drawOp(g, i, 3, target, feedback); drawOp(g, i, 3, target);
continue; continue;
} }
if ( i < 10 ){ if ( i < 10 ){
drawOp(g, (i-6)+1, 2, target, feedback); drawOp(g, (i-6)+1, 2, target);
continue; continue;
} }
if ( i < 12 ) { if ( i < 12 ) {
drawOp(g, (i-10)+2, 1, target, feedback); drawOp(g, (i-10)+2, 1, target);
continue; continue;
} }
// last one // last one
drawOp(g, (i-12)+3, 0, target, feedback); drawOp(g, (i-12)+3, 0, target);
} }
String algoTxt; String algoTxt;
@ -149,9 +112,9 @@ void AlgoDisplay::paint(Graphics &g) {
g.drawText(algoTxt, 5, 1, 21, 14, Justification::left, true); 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; String txt;
txt << num; txt << abs(num);
int offx = 24; int offx = 24;
int offy = 17; 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.fillRect(x*offx+4, y*offy+3, offx-2, offy-1);
g.setColour(Colour(0xFFFFFFFF)); g.setColour(Colour(0xFFFFFFFF));
g.drawText(txt, x*offx+3, y*offy+2, offx+2, offy+2, Justification::centred, true); 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)); g.setColour(Colour(0xFFFFFFFF));
int x1 = (x*offx) + 24; int x1 = (x*offx) + 24;
g.drawLine(x1+1, y*offy+3, x1+1, y*offy+offy+2, 3); 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) { void VuMeter::paint(Graphics &g) {
// taken from the drawLevelMeter ; // taken from the drawLevelMeter ;

@ -23,6 +23,7 @@
#include "../JuceLibraryCode/JuceHeader.h" #include "../JuceLibraryCode/JuceHeader.h"
#include "msfa/env.h" #include "msfa/env.h"
#include "msfa/pitchenv.h"
class EnvDisplay : public Component { class EnvDisplay : public Component {
Env env; Env env;
@ -34,15 +35,20 @@ public:
}; };
class PitchEnvDisplay : public Component { class PitchEnvDisplay : public Component {
Env env; char rvalues[8];
char render[96];
void renderDisplay();
public: public:
PitchEnvDisplay();
char *pvalues; char *pvalues;
void paint(Graphics &g); void paint(Graphics &g);
}; };
class AlgoDisplay : public Component { 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: public:
AlgoDisplay(); AlgoDisplay();

@ -159,8 +159,8 @@ GlobalEditor::GlobalEditor ()
addAndMakeVisible (lfoSync = new ToggleButton ("lfoSync")); addAndMakeVisible (lfoSync = new ToggleButton ("lfoSync"));
lfoSync->setButtonText (String::empty); lfoSync->setButtonText (String::empty);
addAndMakeVisible (component = new Component()); addAndMakeVisible (pitchEnvDisplay = new PitchEnvDisplay());
component->setName ("new component"); pitchEnvDisplay->setName ("pitchEnvDisplay");
//[UserPreSize] //[UserPreSize]
@ -202,7 +202,7 @@ GlobalEditor::~GlobalEditor()
oscSync = nullptr; oscSync = nullptr;
pitchModSens = nullptr; pitchModSens = nullptr;
lfoSync = nullptr; lfoSync = nullptr;
component = nullptr; pitchEnvDisplay = nullptr;
//[Destructor]. You can add your own custom destruction code here.. //[Destructor]. You can add your own custom destruction code here..
@ -254,7 +254,7 @@ void GlobalEditor::resized()
oscSync->setBounds (600, 64, 24, 24); oscSync->setBounds (600, 64, 24, 24);
pitchModSens->setBounds (728, 64, 24, 24); pitchModSens->setBounds (728, 64, 24, 24);
lfoSync->setBounds (624, 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] Add your own custom resize handling here..
//[/UserResized] //[/UserResized]
} }
@ -302,41 +302,49 @@ void GlobalEditor::sliderValueChanged (Slider* sliderThatWasMoved)
else if (sliderThatWasMoved == pitchRate2) else if (sliderThatWasMoved == pitchRate2)
{ {
//[UserSliderCode_pitchRate2] -- add your slider handling code here.. //[UserSliderCode_pitchRate2] -- add your slider handling code here..
pitchEnvDisplay->repaint();
//[/UserSliderCode_pitchRate2] //[/UserSliderCode_pitchRate2]
} }
else if (sliderThatWasMoved == pitchRate3) else if (sliderThatWasMoved == pitchRate3)
{ {
//[UserSliderCode_pitchRate3] -- add your slider handling code here.. //[UserSliderCode_pitchRate3] -- add your slider handling code here..
pitchEnvDisplay->repaint();
//[/UserSliderCode_pitchRate3] //[/UserSliderCode_pitchRate3]
} }
else if (sliderThatWasMoved == pitchRate4) else if (sliderThatWasMoved == pitchRate4)
{ {
//[UserSliderCode_pitchRate4] -- add your slider handling code here.. //[UserSliderCode_pitchRate4] -- add your slider handling code here..
pitchEnvDisplay->repaint();
//[/UserSliderCode_pitchRate4] //[/UserSliderCode_pitchRate4]
} }
else if (sliderThatWasMoved == pitchRate1) else if (sliderThatWasMoved == pitchRate1)
{ {
//[UserSliderCode_pitchRate1] -- add your slider handling code here.. //[UserSliderCode_pitchRate1] -- add your slider handling code here..
pitchEnvDisplay->repaint();
//[/UserSliderCode_pitchRate1] //[/UserSliderCode_pitchRate1]
} }
else if (sliderThatWasMoved == pitchLevel2) else if (sliderThatWasMoved == pitchLevel2)
{ {
//[UserSliderCode_pitchLevel2] -- add your slider handling code here.. //[UserSliderCode_pitchLevel2] -- add your slider handling code here..
pitchEnvDisplay->repaint();
//[/UserSliderCode_pitchLevel2] //[/UserSliderCode_pitchLevel2]
} }
else if (sliderThatWasMoved == pitchLevel3) else if (sliderThatWasMoved == pitchLevel3)
{ {
//[UserSliderCode_pitchLevel3] -- add your slider handling code here.. //[UserSliderCode_pitchLevel3] -- add your slider handling code here..
pitchEnvDisplay->repaint();
//[/UserSliderCode_pitchLevel3] //[/UserSliderCode_pitchLevel3]
} }
else if (sliderThatWasMoved == pitchLevel4) else if (sliderThatWasMoved == pitchLevel4)
{ {
//[UserSliderCode_pitchLevel4] -- add your slider handling code here.. //[UserSliderCode_pitchLevel4] -- add your slider handling code here..
pitchEnvDisplay->repaint();
//[/UserSliderCode_pitchLevel4] //[/UserSliderCode_pitchLevel4]
} }
else if (sliderThatWasMoved == pitchLevel1) else if (sliderThatWasMoved == pitchLevel1)
{ {
//[UserSliderCode_pitchLevel1] -- add your slider handling code here.. //[UserSliderCode_pitchLevel1] -- add your slider handling code here..
pitchEnvDisplay->repaint();
//[/UserSliderCode_pitchLevel1] //[/UserSliderCode_pitchLevel1]
} }
else if (sliderThatWasMoved == feedback) else if (sliderThatWasMoved == feedback)
@ -402,6 +410,7 @@ void GlobalEditor::bind(DexedAudioProcessor *parent) {
parent->fxCutoff->bind(cutoff); parent->fxCutoff->bind(cutoff);
parent->fxReso->bind(reso); parent->fxReso->bind(reso);
algoDisplay->algo = &(parent->data[134]); algoDisplay->algo = &(parent->data[134]);
pitchEnvDisplay->pvalues = &(parent->data[126]);
processor = parent; processor = parent;
} }
@ -517,8 +526,8 @@ BEGIN_JUCER_METADATA
<TOGGLEBUTTON name="lfoSync" id="ff92bb0a5a4f7187" memberName="lfoSync" virtualName="" <TOGGLEBUTTON name="lfoSync" id="ff92bb0a5a4f7187" memberName="lfoSync" virtualName=""
explicitFocusOrder="0" pos="624 64 24 24" buttonText="" connectedEdges="0" explicitFocusOrder="0" pos="624 64 24 24" buttonText="" connectedEdges="0"
needsCallback="0" radioGroupId="0" state="0"/> needsCallback="0" radioGroupId="0" state="0"/>
<GENERICCOMPONENT name="new component" id="9ddaae8ef924a038" memberName="component" <GENERICCOMPONENT name="pitchEnvDisplay" id="9ddaae8ef924a038" memberName="pitchEnvDisplay"
virtualName="" explicitFocusOrder="0" pos="752 8 96 32" class="Component" virtualName="" explicitFocusOrder="0" pos="752 8 96 32" class="PitchEnvDisplay"
params=""/> params=""/>
</JUCER_COMPONENT> </JUCER_COMPONENT>

@ -90,7 +90,7 @@ private:
ScopedPointer<ToggleButton> oscSync; ScopedPointer<ToggleButton> oscSync;
ScopedPointer<Slider> pitchModSens; ScopedPointer<Slider> pitchModSens;
ScopedPointer<ToggleButton> lfoSync; ScopedPointer<ToggleButton> lfoSync;
ScopedPointer<Component> component; ScopedPointer<PitchEnvDisplay> pitchEnvDisplay;
//============================================================================== //==============================================================================

@ -445,6 +445,8 @@ void OperatorEditor::bind(DexedAudioProcessor *parent, int op) {
parent->opCtrl[op].sclLeftDepth->bind(sclLeftLevel); parent->opCtrl[op].sclLeftDepth->bind(sclLeftLevel);
parent->opCtrl[op].sclRightDepth->bind(sclRightLevel); parent->opCtrl[op].sclRightDepth->bind(sclRightLevel);
parent->opCtrl[op].sclRate->bind(sclRateScaling); 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; txtFreq << " " << det;
} }
khzDisplay->setText(txtFreq, NotificationType::dontSendNotification); khzDisplay->setText(txtFreq, NotificationType::dontSendNotification);
envDisplay->repaint(); envDisplay->repaint();
} }
void OperatorEditor::updateEnv() {
//envDisplay->update(s_)
}
//[/MiscUserCode] //[/MiscUserCode]

@ -51,7 +51,6 @@ public:
void bind(DexedAudioProcessor *processor, int num); void bind(DexedAudioProcessor *processor, int num);
void updateGain(float v); void updateGain(float v);
void updateDisplay(); void updateDisplay();
void updateEnv();
//[/UserMethods] //[/UserMethods]
void paint (Graphics& g); void paint (Graphics& g);

@ -297,7 +297,7 @@ void DexedAudioProcessor::initCtrl() {
String opMode; String opMode;
opMode << opName << " MODE"; 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); ctrl.add(opCtrl[opVal].opMode);
String coarse; String coarse;
@ -322,14 +322,12 @@ void DexedAudioProcessor::initCtrl() {
String sclLeftDepth; String sclLeftDepth;
sclLeftDepth << opName << " L SCALE DEPTH"; sclLeftDepth << opName << " L SCALE DEPTH";
opCtrl[opVal].sclLeftDepth = new CtrlDX(sclLeftDepth, 100, opCtrl[opVal].sclLeftDepth = new CtrlDX(sclLeftDepth, 100, opTarget + 9);
opTarget + 9);
ctrl.add(opCtrl[opVal].sclLeftDepth); ctrl.add(opCtrl[opVal].sclLeftDepth);
String sclRightDepth; String sclRightDepth;
sclRightDepth << opName << " R SCALE DEPTH"; sclRightDepth << opName << " R SCALE DEPTH";
opCtrl[opVal].sclRightDepth = new CtrlDX(sclRightDepth, 100, opCtrl[opVal].sclRightDepth = new CtrlDX(sclRightDepth, 100, opTarget + 10);
opTarget + 10);
ctrl.add(opCtrl[opVal].sclRightDepth); ctrl.add(opCtrl[opVal].sclRightDepth);
String sclLeftCurve; String sclLeftCurve;
@ -339,18 +337,17 @@ void DexedAudioProcessor::initCtrl() {
String sclRightCurve; String sclRightCurve;
sclRightCurve << opName << " R KEY SCALE"; sclRightCurve << opName << " R KEY SCALE";
opCtrl[opVal].sclRightCurve = new CtrlDX(sclRightCurve, 4, opCtrl[opVal].sclRightCurve = new CtrlDX(sclRightCurve, 4, opTarget + 12);
opTarget + 12);
ctrl.add(opCtrl[opVal].sclRightCurve); ctrl.add(opCtrl[opVal].sclRightCurve);
String sclRate; String sclRate;
sclRate << opName << " RATE SCALING"; 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); ctrl.add(opCtrl[opVal].sclRate);
String ampModSens; String ampModSens;
ampModSens << opName << " A MOD SENS."; 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); ctrl.add(opCtrl[opVal].ampModSens);
String velModSens; String velModSens;

@ -23,7 +23,7 @@ void PitchEnv::init(double sample_rate) {
unit_ = N * (1 << 24) / (21.3 * sample_rate) + 0.5; 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, 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, 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, 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 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, -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, -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, -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]; rates_[i] = r[i];
levels_[i] = l[i]; levels_[i] = l[i];
} }
level_ = pitchtab[l[3]] << 19; level_ = pitchenv_tab[l[3]] << 19;
down_ = true; down_ = true;
advance(0); advance(0);
} }
@ -82,10 +82,10 @@ void PitchEnv::advance(int newix) {
ix_ = newix; ix_ = newix;
if (ix_ < 4) { if (ix_ < 4) {
int newlevel = levels_[ix_]; int newlevel = levels_[ix_];
targetlevel_ = pitchtab[newlevel] << 19; targetlevel_ = pitchenv_tab[newlevel] << 19;
rising_ = (targetlevel_ > level_); rising_ = (targetlevel_ > level_);
inc_ = ratetab[rates_[ix_]] * unit_; inc_ = pitchenv_rate[rates_[ix_]] * unit_;
} }
} }

@ -45,5 +45,8 @@ class PitchEnv {
void advance(int newix); void advance(int newix);
}; };
extern const uint8_t pitchenv_rate[];
extern const int8_t pitchenv_tab[];
#endif // __PITCHENV_H #endif // __PITCHENV_H

Loading…
Cancel
Save