pull/1/head
asb2m10 11 years ago
parent 9b4b92753e
commit 0768632125
  1. BIN
      Builds/MacOSX/Dexed.xcodeproj/project.xcworkspace/xcuserdata/asb2m10.xcuserdatad/UserInterfaceState.xcuserstate
  2. 48
      Source/DXLookNFeel.cpp
  3. 14
      Source/DXLookNFeel.h
  4. 80
      Source/PluginEditor.cpp
  5. 216
      Source/PluginParam.cpp
  6. 44
      Source/PluginProcessor.cpp

@ -22,31 +22,31 @@
#include "PluginProcessor.h" #include "PluginProcessor.h"
void EnvDisplay::paint(Graphics &g) { void EnvDisplay::paint(Graphics &g) {
int rate[4]; int rate[4];
int level[4]; int level[4];
for(int i=0;i<4;i++) { for (int i = 0; i < 4; i++) {
rate[i] = s_rate[i]->getValue(); rate[i] = s_rate[i]->getValue();
level[i] = s_level[i]->getValue(); level[i] = s_level[i]->getValue();
} }
env.init(rate, level, 99 << 5, 0); env.init(rate, level, 99 << 5, 0);
env.keydown(true); env.keydown(true);
for (int i=0;i<72;i++) { for (int i = 0; i < 72; i++) {
int32_t pos = env.getsample(); int32_t pos = env.getsample();
for(int j=0;j<16;j++) { for (int j = 0; j < 16; j++) {
env.getsample(); env.getsample();
} }
g.setPixel(i, 32 - (sqrt(pos) / 512)); g.setPixel(i, 32 - (sqrt(pos) / 512));
} }
env.keydown(false); env.keydown(false);
for (int i=0;i<24;i++) { for (int i = 0; i < 24; i++) {
int32_t pos = env.getsample(); int32_t pos = env.getsample();
for(int j=0;j<16;j++) { for (int j = 0; j < 16; j++) {
env.getsample(); env.getsample();
} }
g.setPixel(i+72, 32 - (sqrt(pos) / 512)); g.setPixel(i + 72, 32 - (sqrt(pos) / 512));
} }
} }
void AlgoDisplay::updateUI() { void AlgoDisplay::updateUI() {
@ -58,7 +58,7 @@ void AlgoDisplay::paint(Graphics &g) {
} }
DXLookNFeel::DXLookNFeel() { DXLookNFeel::DXLookNFeel() {
setColour(TextButton::buttonColourId,Colour(0xFF0FC00F)); setColour(TextButton::buttonColourId,Colour(0xFF0FC00F));
setColour(Slider::rotarySliderOutlineColourId,Colour(0xFF0FC00F)); setColour(Slider::rotarySliderOutlineColourId,Colour(0xFF0FC00F));
setColour(Slider::rotarySliderFillColourId,Colour(0xFFFFFFFF)); setColour(Slider::rotarySliderFillColourId,Colour(0xFFFFFFFF));
} }

@ -25,19 +25,19 @@
#include "msfa/env.h" #include "msfa/env.h"
class EnvDisplay : public Component { class EnvDisplay : public Component {
Env env; Env env;
public: public:
Slider *s_rate[4]; Slider *s_rate[4];
Slider *s_level[4]; Slider *s_level[4];
void paint(Graphics &g); void paint(Graphics &g);
}; };
class AlgoDisplay : public Component { class AlgoDisplay : public Component {
int algo; int algo;
public: public:
void paint(Graphics &g); void paint(Graphics &g);
void updateUI(); void updateUI();
}; };
class DXLookNFeel : public LookAndFeel_V3 { class DXLookNFeel : public LookAndFeel_V3 {

@ -129,45 +129,45 @@ void DexedAudioProcessorEditor::paint (Graphics& g) {
void DexedAudioProcessorEditor::buttonClicked(Button *buttonThatWasClicked) { void DexedAudioProcessorEditor::buttonClicked(Button *buttonThatWasClicked) {
if (buttonThatWasClicked == loadButton) { if (buttonThatWasClicked == loadButton) {
FileChooser fc ("Import original DX sysex...", File::nonexistent, "*.syx;*.SYX", 1); FileChooser fc ("Import original DX sysex...", File::nonexistent, "*.syx;*.SYX", 1);
if ( fc.browseForFileToOpen()) { if ( fc.browseForFileToOpen()) {
String f = fc.getResults().getReference(0).getFullPathName(); String f = fc.getResults().getReference(0).getFullPathName();
uint8_t syx_data[4104]; uint8_t syx_data[4104];
ifstream fp_in; ifstream fp_in;
fp_in.open(f.toRawUTF8(), ifstream::in); fp_in.open(f.toRawUTF8(), ifstream::in);
if (fp_in.fail()) { if (fp_in.fail()) {
AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon,
"Error", "Error",
"Unable to open: " + f); "Unable to open: " + f);
return; return;
} }
fp_in.read((char *)syx_data, 4104); fp_in.read((char *)syx_data, 4104);
processor->importSysex((char *) &syx_data); processor->importSysex((char *) &syx_data);
presets.clear(NotificationType::dontSendNotification); presets.clear(NotificationType::dontSendNotification);
for(int i=0;i<processor->getNumPrograms();i++) { for(int i=0;i<processor->getNumPrograms();i++) {
String id; String id;
id << (i+1) << ". " << processor->getProgramName(i); id << (i+1) << ". " << processor->getProgramName(i);
presets.addItem(id, i+1); presets.addItem(id, i+1);
} }
presets.setSelectedId(processor->getCurrentProgram()+1, NotificationType::dontSendNotification); presets.setSelectedId(processor->getCurrentProgram()+1, NotificationType::dontSendNotification);
processor->setCurrentProgram(0); processor->setCurrentProgram(0);
processor->updateHostDisplay(); processor->updateHostDisplay();
} }
return; return;
} }
if (buttonThatWasClicked == aboutButton) { if (buttonThatWasClicked == aboutButton) {
AlertWindow::showMessageBoxAsync(AlertWindow::NoIcon, "DEXED - DX Emulator", "(c) 2013 Pascal Gauthier\nUnder the GPL v2" AlertWindow::showMessageBoxAsync(AlertWindow::NoIcon, "DEXED - DX Emulator", "(c) 2013 Pascal Gauthier\nUnder the GPL v2"
"\nBased on Music Synthesizer for Android\n"); "\nBased on Music Synthesizer for Android\n");
return; return;
} }
AlertWindow::showMessageBoxAsync(AlertWindow::WarningIcon, "Sorry", "Soon !"); AlertWindow::showMessageBoxAsync(AlertWindow::WarningIcon, "Sorry", "Soon !");
} }
void DexedAudioProcessorEditor::comboBoxChanged (ComboBox* comboBoxThatHasChanged) { void DexedAudioProcessorEditor::comboBoxChanged (ComboBox* comboBoxThatHasChanged) {
@ -182,7 +182,7 @@ void DexedAudioProcessorEditor::timerCallback() {
return; return;
for(int i=0;i<6;i++) { for(int i=0;i<6;i++) {
operators[i].updateGain(sqrt(env[5-i]) / 8196); operators[i].updateGain(sqrt(env[5 - i]) / 8196);
} }
} }

@ -49,27 +49,26 @@ void Ctrl::bind(ComboBox *c) {
} }
void Ctrl::unbind() { void Ctrl::unbind() {
if ( slider != NULL ) { if (slider != NULL) {
slider->removeListener(this); slider->removeListener(this);
slider = NULL; slider = NULL;
} }
if ( button != NULL ) { if (button != NULL) {
button->removeListener(this); button->removeListener(this);
button = NULL; button = NULL;
} }
if ( comboBox != NULL ) { if (comboBox != NULL) {
comboBox->removeListener(this); comboBox->removeListener(this);
comboBox = NULL; comboBox = NULL;
} }
} }
// ************************************************************************ // ************************************************************************
// CtrlInt ================================================================ // CtrlInt ================================================================
CtrlDX::CtrlDX(String name, int steps, int offset, bool starts1) : CtrlDX::CtrlDX(String name, int steps, int offset, bool starts1) :
Ctrl(name) { Ctrl(name) {
add1 = starts1 == 1; add1 = starts1 == 1;
this->steps = steps; this->steps = steps;
value = 0; value = 0;
@ -85,19 +84,19 @@ void CtrlDX::setValuePlugin(float f) {
} }
void CtrlDX::setValue(int v) { void CtrlDX::setValue(int v) {
if ( v >= steps ) { if (v >= steps) {
TRACE("WARNING: value too big %s : %d", label.toRawUTF8(), v); TRACE("WARNING: value too big %s : %d", label.toRawUTF8(), v);
v = steps-1; v = steps - 1;
} }
value = v; value = v;
if ( dxOffset >= 0 ) { if (dxOffset >= 0) {
if ( parent != NULL ) if (parent != NULL)
parent->setDxValue(dxOffset, v); parent->setDxValue(dxOffset, v);
} }
} }
int CtrlDX::getValue() { int CtrlDX::getValue() {
if ( dxOffset >= 0 ) if (dxOffset >= 0)
value = parent->data[dxOffset]; value = parent->data[dxOffset];
return value; return value;
} }
@ -110,39 +109,42 @@ String CtrlDX::getValueDisplay() {
void CtrlDX::publishValue(int value) { void CtrlDX::publishValue(int value) {
parent->beginParameterChangeGesture(idx); parent->beginParameterChangeGesture(idx);
parent->setParameterNotifyingHost(idx, (((float)value) / steps)); parent->setParameterNotifyingHost(idx, (((float) value) / steps));
parent->endParameterChangeGesture(idx); parent->endParameterChangeGesture(idx);
} }
void CtrlDX::sliderValueChanged(Slider* moved) { void CtrlDX::sliderValueChanged(Slider* moved) {
publishValue(((int)moved->getValue() - add1)); publishValue(((int) moved->getValue() - add1));
} }
void CtrlDX::buttonClicked (Button* clicked) { void CtrlDX::buttonClicked(Button* clicked) {
publishValue(clicked->getToggleStateValue() == 1 ? 1 : 0); publishValue(clicked->getToggleStateValue() == 1 ? 1 : 0);
} }
void CtrlDX::comboBoxChanged (ComboBox* combo) { void CtrlDX::comboBoxChanged(ComboBox* combo) {
publishValue(combo->getSelectedId()-1); publishValue(combo->getSelectedId() - 1);
} }
void CtrlDX::updateComponent() { void CtrlDX::updateComponent() {
//TRACE("setting for %s %d", label.toRawUTF8(), getValue()); //TRACE("setting for %s %d", label.toRawUTF8(), getValue());
if ( slider != NULL ) { if (slider != NULL) {
slider->setValue(getValue() + add1, NotificationType::dontSendNotification); slider->setValue(getValue() + add1,
NotificationType::dontSendNotification);
} }
if ( button != NULL ) { if (button != NULL) {
if ( getValue() == 0 ) { if (getValue() == 0) {
button->setToggleState(false, NotificationType::dontSendNotification); button->setToggleState(false,
NotificationType::dontSendNotification);
} else { } else {
button->setToggleState(true, NotificationType::dontSendNotification); button->setToggleState(true,
NotificationType::dontSendNotification);
} }
} }
if ( comboBox != NULL ) { if (comboBox != NULL) {
int cvalue = getValue() + 1; int cvalue = getValue() + 1;
if ( comboBox->getNumItems() <= cvalue ) { if (comboBox->getNumItems() <= cvalue) {
cvalue = comboBox->getNumItems(); cvalue = comboBox->getNumItems();
} }
comboBox->setSelectedId(cvalue, NotificationType::dontSendNotification); comboBox->setSelectedId(cvalue, NotificationType::dontSendNotification);
@ -153,97 +155,101 @@ void CtrlDX::updateComponent() {
// Patcher ================================================================ // Patcher ================================================================
void DexedAudioProcessor::initCtrl() { void DexedAudioProcessor::initCtrl() {
importSysex(BinaryData::startup_syx); importSysex(BinaryData::startup_syx);
// fill operator values; // fill operator values;
for(int i=0;i<6;i++) { for (int i = 0; i < 6; i++) {
//// In the Sysex, OP6 comes first, then OP5... //// In the Sysex, OP6 comes first, then OP5...
//int opTarget = (5-i) * 21; //int opTarget = (5-i) * 21;
int opTarget = i * 21; int opTarget = i * 21;
int opVal = 5-i; int opVal = 5 - i;
String opName; String opName;
opName << "OP" << (opVal+1); opName << "OP" << (opVal + 1);
for(int j=0;j<4;j++) { for (int j = 0; j < 4; j++) {
String opRate; String opRate;
opRate << opName << "-EGR" << (j+1); opRate << opName << "-EGR" << (j + 1);
opCtrl[opVal].egRate[j] = new CtrlDX(opRate, 100, opTarget+j); opCtrl[opVal].egRate[j] = new CtrlDX(opRate, 100, opTarget + j);
ctrl.add(opCtrl[opVal].egRate[j]); ctrl.add(opCtrl[opVal].egRate[j]);
String opLevel; String opLevel;
opLevel << opName << "-EGL" << (j+1); opLevel << opName << "-EGL" << (j + 1);
opCtrl[opVal].egLevel[j] = new CtrlDX(opLevel, 100, opTarget+j+4); opCtrl[opVal].egLevel[j] = new CtrlDX(opLevel, 100,
opTarget + j + 4);
ctrl.add(opCtrl[opVal].egLevel[j]); ctrl.add(opCtrl[opVal].egLevel[j]);
} }
String opVol; String opVol;
opVol << opName << "-LEVEL"; opVol << opName << "-LEVEL";
opCtrl[opVal].level = new CtrlDX(opVol, 100, opTarget+16); opCtrl[opVal].level = new CtrlDX(opVol, 100, opTarget + 16);
ctrl.add(opCtrl[opVal].level); ctrl.add(opCtrl[opVal].level);
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, 1, opTarget + 17);
ctrl.add(opCtrl[opVal].opMode); ctrl.add(opCtrl[opVal].opMode);
String coarse; String coarse;
coarse << opName << "-COARSE"; coarse << opName << "-COARSE";
opCtrl[opVal].coarse = new CtrlDX(coarse, 32, opTarget+18); opCtrl[opVal].coarse = new CtrlDX(coarse, 32, opTarget + 18);
ctrl.add(opCtrl[opVal].coarse); ctrl.add(opCtrl[opVal].coarse);
String fine; String fine;
fine << opName << "-FINE"; fine << opName << "-FINE";
opCtrl[opVal].fine = new CtrlDX(fine, 100, opTarget+19); opCtrl[opVal].fine = new CtrlDX(fine, 100, opTarget + 19);
ctrl.add(opCtrl[opVal].fine); ctrl.add(opCtrl[opVal].fine);
String detune; String detune;
detune << opName << "-DETUNE"; detune << opName << "-DETUNE";
opCtrl[opVal].detune = new CtrlDX(detune, 15, opTarget+20); opCtrl[opVal].detune = new CtrlDX(detune, 15, opTarget + 20);
ctrl.add(opCtrl[opVal].detune); ctrl.add(opCtrl[opVal].detune);
String sclBrkPt; String sclBrkPt;
sclBrkPt << opName << "-SCL_BRK_PNT"; sclBrkPt << opName << "-SCL_BRK_PNT";
opCtrl[opVal].sclBrkPt = new CtrlDX(sclBrkPt, 100, opTarget+8); opCtrl[opVal].sclBrkPt = new CtrlDX(sclBrkPt, 100, opTarget + 8);
ctrl.add(opCtrl[opVal].sclBrkPt); ctrl.add(opCtrl[opVal].sclBrkPt);
String sclLeftDepth; String sclLeftDepth;
sclLeftDepth << opName << "-SCL_LFT_DEPTH"; sclLeftDepth << opName << "-SCL_LFT_DEPTH";
opCtrl[opVal].sclLeftDepth = new CtrlDX(sclLeftDepth, 100, opTarget+9); opCtrl[opVal].sclLeftDepth = new CtrlDX(sclLeftDepth, 100,
opTarget + 9);
ctrl.add(opCtrl[opVal].sclLeftDepth); ctrl.add(opCtrl[opVal].sclLeftDepth);
String sclRightDepth; String sclRightDepth;
sclRightDepth << opName << "-SCL_RHT_DEPTH"; sclRightDepth << opName << "-SCL_RHT_DEPTH";
opCtrl[opVal].sclRightDepth = new CtrlDX(sclRightDepth, 100, opTarget+10); opCtrl[opVal].sclRightDepth = new CtrlDX(sclRightDepth, 100,
opTarget + 10);
ctrl.add(opCtrl[opVal].sclRightDepth); ctrl.add(opCtrl[opVal].sclRightDepth);
String sclLeftCurve; String sclLeftCurve;
sclLeftCurve << opName << "-SCL_LFT_CURVE"; sclLeftCurve << opName << "-SCL_LFT_CURVE";
opCtrl[opVal].sclLeftCurve = new CtrlDX(sclLeftCurve, 4, opTarget+11); opCtrl[opVal].sclLeftCurve = new CtrlDX(sclLeftCurve, 4, opTarget + 11);
ctrl.add(opCtrl[opVal].sclLeftCurve); ctrl.add(opCtrl[opVal].sclLeftCurve);
String sclRightCurve; String sclRightCurve;
sclRightCurve << opName << "-SCL_RHT_CURVE"; sclRightCurve << opName << "-SCL_RHT_CURVE";
opCtrl[opVal].sclRightCurve = new CtrlDX(sclRightCurve, 4, opTarget+12); opCtrl[opVal].sclRightCurve = new CtrlDX(sclRightCurve, 4,
opTarget + 12);
ctrl.add(opCtrl[opVal].sclRightCurve); ctrl.add(opCtrl[opVal].sclRightCurve);
String sclRate; String sclRate;
sclRate << opName << "-SCL_RATE"; sclRate << opName << "-SCL_RATE";
opCtrl[opVal].sclRate = new CtrlDX(sclRate, 7, opTarget+13); opCtrl[opVal].sclRate = new CtrlDX(sclRate, 7, opTarget + 13);
ctrl.add(opCtrl[opVal].sclRate); ctrl.add(opCtrl[opVal].sclRate);
String ampModSens; String ampModSens;
ampModSens << opName << "-AMP_MODSENS"; ampModSens << opName << "-AMP_MODSENS";
opCtrl[opVal].ampModSens = new CtrlDX(ampModSens, 3, opTarget+14); opCtrl[opVal].ampModSens = new CtrlDX(ampModSens, 3, opTarget + 14);
ctrl.add(opCtrl[opVal].ampModSens); ctrl.add(opCtrl[opVal].ampModSens);
String velModSens; String velModSens;
velModSens << opName << "-VEL_MODSENS"; velModSens << opName << "-VEL_MODSENS";
opCtrl[opVal].velModSens = new CtrlDX(velModSens, 8, opTarget+15); opCtrl[opVal].velModSens = new CtrlDX(velModSens, 8, opTarget + 15);
ctrl.add(opCtrl[opVal].velModSens); ctrl.add(opCtrl[opVal].velModSens);
} }
algo = new CtrlDX("Algorithm", 32, 134, true); algo = new CtrlDX("Algorithm", 32, 134, true);
ctrl.add(algo); ctrl.add(algo);
lfoRate = new CtrlDX("LFO-Rate", 100, 137); lfoRate = new CtrlDX("LFO-Rate", 100, 137);
ctrl.add(lfoRate); ctrl.add(lfoRate);
lfoDelay = new CtrlDX("LFO-Delay", 100, 138); lfoDelay = new CtrlDX("LFO-Delay", 100, 138);
@ -260,27 +266,34 @@ void DexedAudioProcessor::initCtrl() {
lfoWaveform = new CtrlDX("LFO-Waveform", 5, 142); lfoWaveform = new CtrlDX("LFO-Waveform", 5, 142);
ctrl.add(lfoWaveform); ctrl.add(lfoWaveform);
for(int i=0;i<ctrl.size();i++) { for (int i = 0; i < ctrl.size(); i++) {
ctrl[i]->idx = i; ctrl[i]->idx = i;
ctrl[i]->parent = this; ctrl[i]->parent = this;
} }
} }
int DexedAudioProcessor::importSysex(const char *imported) { int DexedAudioProcessor::importSysex(const char *imported) {
memcpy(sysex, imported+6, 4104); memcpy(sysex, imported + 6, 4104);
for(int i=0;i<32;i++) { for (int i = 0; i < 32; i++) {
memcpy(patchNames[i], sysex + ((i*128)+118), 11); memcpy(patchNames[i], sysex + ((i * 128) + 118), 11);
for(int j=0;j<10;j++) { for (int j = 0; j < 10; j++) {
char c = (unsigned char)patchNames[i][j]; char c = (unsigned char) patchNames[i][j];
switch (c) { switch (c) {
case 92: c = 'Y'; break; /* yen */ case 92:
case 126: c = '>'; break; /* >> */ c = 'Y';
case 127: c = '<'; break; /* << */ break; /* yen */
case 126:
c = '>';
break; /* >> */
case 127:
c = '<';
break; /* << */
default: default:
if (c < 32 || c > 127) c = 32; if (c < 32 || c > 127)
break; c = 32;
break;
} }
patchNames[i][j] = c; patchNames[i][j] = c;
} }
@ -291,7 +304,7 @@ int DexedAudioProcessor::importSysex(const char *imported) {
void DexedAudioProcessor::unpackProgram(int idx) { void DexedAudioProcessor::unpackProgram(int idx) {
char *bulk = sysex + (idx * 128); char *bulk = sysex + (idx * 128);
for (int op = 0; op < 6; op++) { for (int op = 0; op < 6; op++) {
// eg rate and level, brk pt, depth, scaling // eg rate and level, brk pt, depth, scaling
memcpy(data + op * 21, bulk + op * 17, 11); memcpy(data + op * 21, bulk + op * 17, 11);
@ -308,7 +321,7 @@ void DexedAudioProcessor::unpackProgram(int idx) {
data[op * 21 + 17] = fcoarse_mode & 1; data[op * 21 + 17] = fcoarse_mode & 1;
data[op * 21 + 18] = fcoarse_mode >> 1; data[op * 21 + 18] = fcoarse_mode >> 1;
data[op * 21 + 19] = bulk[op * 17 + 16]; // fine freq data[op * 21 + 19] = bulk[op * 17 + 16]; // fine freq
data[op * 21 + 20] = detune_rs >> 3; data[op * 21 + 20] = detune_rs >> 3;
} }
memcpy(data + 126, bulk + 102, 9); // pitch env, algo memcpy(data + 126, bulk + 102, 9); // pitch env, algo
char oks_fb = bulk[111]; char oks_fb = bulk[111];
@ -328,7 +341,6 @@ void DexedAudioProcessor::unpackProgram(int idx) {
data[160] = 1; data[160] = 1;
} }
void DexedAudioProcessor::updateProgramFromSysex(const uint8 *rawdata) { void DexedAudioProcessor::updateProgramFromSysex(const uint8 *rawdata) {
} }
@ -336,18 +348,18 @@ void DexedAudioProcessor::updateProgramFromSysex(const uint8 *rawdata) {
void DexedAudioProcessor::setDxValue(int offset, int v) { void DexedAudioProcessor::setDxValue(int offset, int v) {
TRACE("setting dx %d %d", offset, v); TRACE("setting dx %d %d", offset, v);
refreshVoice = true; refreshVoice = true;
if ( offset >= 0 ) if (offset >= 0)
data[offset] = v; data[offset] = v;
if ( !sendSysexChange ) if (!sendSysexChange)
return; return;
uint8 msg[7] = { 0xF0, 0x43, 0x10, offset > 127, 0, (uint8) v, 0xF7 }; uint8 msg[7] = { 0xF0, 0x43, 0x10, offset > 127, 0, (uint8) v, 0xF7 };
msg[4] = offset & 0x7F; msg[4] = offset & 0x7F;
midiOut.addEvent(msg, 7, 0); midiOut.addEvent(msg, 7, 0);
} }
void DexedAudioProcessor::unbindUI() { void DexedAudioProcessor::unbindUI() {
for(int i=0;i<ctrl.size();i++) { for (int i = 0; i < ctrl.size(); i++) {
ctrl[i]->unbind(); ctrl[i]->unbind();
} }
} }
@ -357,11 +369,11 @@ int DexedAudioProcessor::getNumParameters() {
return ctrl.size(); return ctrl.size();
} }
float DexedAudioProcessor::getParameter (int index) { float DexedAudioProcessor::getParameter(int index) {
return ctrl[index]->getValuePlugin(); return ctrl[index]->getValuePlugin();
} }
void DexedAudioProcessor::setParameter (int index, float newValue) { void DexedAudioProcessor::setParameter(int index, float newValue) {
ctrl[index]->setValuePlugin(newValue); ctrl[index]->setValuePlugin(newValue);
} }
@ -373,15 +385,15 @@ int DexedAudioProcessor::getCurrentProgram() {
return currentProgram; return currentProgram;
} }
void DexedAudioProcessor::setCurrentProgram (int index) { void DexedAudioProcessor::setCurrentProgram(int index) {
/*// VST has a naughty problem of calling setCurrentProgram after a host has loaded /*// VST has a naughty problem of calling setCurrentProgram after a host has loaded
// an edited preset. We ignore the 16th value, since we want to keep the user values // an edited preset. We ignore the 16th value, since we want to keep the user values
if ( index == 32 ) { if ( index == 32 ) {
return; return;
}*/ }*/
for(int i=0;i<MAX_ACTIVE_NOTES;i++) { for (int i = 0; i < MAX_ACTIVE_NOTES; i++) {
if ( voices[i].keydown == false && voices[i].live == true ) { if (voices[i].keydown == false && voices[i].live == true) {
voices[i].live = false; voices[i].live = false;
} }
} }
@ -392,50 +404,48 @@ void DexedAudioProcessor::setCurrentProgram (int index) {
updateUI(); updateUI();
} }
const String DexedAudioProcessor::getProgramName (int index) { const String DexedAudioProcessor::getProgramName(int index) {
if ( index >= 32 ) if (index >= 32)
index = 31; index = 31;
return String(patchNames[index]); return String(patchNames[index]);
} }
void DexedAudioProcessor::changeProgramName (int index, const String& newName) { void DexedAudioProcessor::changeProgramName(int index, const String& newName) {
} }
const String DexedAudioProcessor::getParameterName(int index) {
const String DexedAudioProcessor::getParameterName (int index) {
return ctrl[index]->label; return ctrl[index]->label;
} }
const String DexedAudioProcessor::getParameterText (int index) { const String DexedAudioProcessor::getParameterText(int index) {
return ctrl[index]->getValueDisplay(); return ctrl[index]->getValueDisplay();
} }
//============================================================================== //==============================================================================
void DexedAudioProcessor::getStateInformation (MemoryBlock& destData) { void DexedAudioProcessor::getStateInformation(MemoryBlock& destData) {
// You should use this method to store your parameters in the memory block. // You should use this method to store your parameters in the memory block.
// You could do that either as raw data, or use the XML or ValueTree classes // You could do that either as raw data, or use the XML or ValueTree classes
// as intermediaries to make it easy to save and load complex data.*/ // as intermediaries to make it easy to save and load complex data.*/
destData.insert(data, 161, 0); destData.insert(data, 161, 0);
} }
void DexedAudioProcessor::setStateInformation (const void* source, int sizeInBytes) { void DexedAudioProcessor::setStateInformation(const void* source,
int sizeInBytes) {
// You should use this method to restore your parameters from this memory block, // You should use this method to restore your parameters from this memory block,
// whose contents will have been created by the getStateInformation() call. // whose contents will have been created by the getStateInformation() call.
memcpy((void *)data, source, sizeInBytes); memcpy((void *) data, source, sizeInBytes);
updateUI(); updateUI();
} }
//============================================================================== //==============================================================================
void DexedAudioProcessor::getCurrentProgramStateInformation (MemoryBlock& destData) { void DexedAudioProcessor::getCurrentProgramStateInformation(
MemoryBlock& destData) {
destData.insert(data, 161, 0); destData.insert(data, 161, 0);
} }
void DexedAudioProcessor::setCurrentProgramStateInformation (const void* source, int sizeInBytes) { void DexedAudioProcessor::setCurrentProgramStateInformation(const void* source,
memcpy((void *)data, source, sizeInBytes); int sizeInBytes) {
memcpy((void *) data, source, sizeInBytes);
updateUI(); updateUI();
} }

@ -146,7 +146,7 @@ void DexedAudioProcessor::processBlock(AudioSampleBuffer& buffer, MidiBuffer& mi
} }
if ( ! midiOut.isEmpty() ) { if ( ! midiOut.isEmpty() ) {
midiMessages.swapWith(midiOut); midiMessages.swapWith(midiOut);
} }
} }
@ -158,28 +158,28 @@ AudioProcessor* JUCE_CALLTYPE createPluginFilter() {
} }
void DexedAudioProcessor::processMidiMessage(MidiMessage *msg) { void DexedAudioProcessor::processMidiMessage(MidiMessage *msg) {
if ( msg->isSysEx() ) { if ( msg->isSysEx() ) {
TRACE("SYSEX RECEIVED"); TRACE("SYSEX RECEIVED");
const uint8 *buf = msg->getSysExData(); const uint8 *buf = msg->getSysExData();
int sz = msg->getSysExDataSize(); int sz = msg->getSysExDataSize();
if ( sz < 3 ) if ( sz < 3 )
return; return;
// test if it is a Yamaha Sysex // test if it is a Yamaha Sysex
if ( buf[0] != 0x43 ) if ( buf[0] != 0x43 )
return; return;
// single voice dump // single voice dump
if ( buf[2] == 0 ) { if ( buf[2] == 0 ) {
if ( sz < 155 ) { if ( sz < 155 ) {
TRACE("wrong single voice datasize %d", buf[2]); TRACE("wrong single voice datasize %d", buf[2]);
return; return;
} }
updateProgramFromSysex(buf+5); updateProgramFromSysex(buf+5);
} }
return; return;
} }
const uint8 *buf = msg->getRawData(); const uint8 *buf = msg->getRawData();
uint8_t cmd = buf[0]; uint8_t cmd = buf[0];

Loading…
Cancel
Save