State fix size and Synprez naming

pull/1/head
asb2m10 11 years ago
parent d9800f1617
commit 166e39da57
  1. BIN
      Builds/MacOSX/Dexed.xcodeproj/project.xcworkspace/xcuserdata/asb2m10.xcuserdatad/UserInterfaceState.xcuserstate
  2. 2427
      JuceLibraryCode/BinaryData.cpp
  3. BIN
      Resources/builtin_pgm.zip
  4. 10
      Source/DXLookNFeel.cpp
  5. 31
      Source/PluginParam.cpp
  6. 5
      Source/PluginProcessor.cpp
  7. 5
      Source/PluginProcessor.h

File diff suppressed because it is too large Load Diff

Binary file not shown.

@ -30,13 +30,13 @@ static const char algoArr[][13] = {
{ 0, 0, 1, 3, 0, 0, 0, -2, 4, 0, 0, 5, 6 }, // 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 }, // 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 }, // 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 }, // 5 { 0, 1, 3, 5, 0, 0, 2, 4, -6, 0, 0, 0, 0 }, // 5
{ 0, 1, 3, -5, 0, 0, 0, 2, 4, -6, 0, 0, 0 }, // 6 { 0, 1, 3, -5, 0, 0, 2, 4, -6, 0, 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 }, // 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, 6, 0 }, // 8
{ 0, 1, 3, 0, 0, 0, -2, 4, 5, 0, 0, 0, 0 }, // 9 { 0, 1, 3, 0, 0, 0, -2, 4, 5, 0, 0, 6, 0 }, // 9
{ 0, 0, 0, 4, 1, 0, 5, 6, 2, 0, 0, -3, 0 }, // 10 { 0, 0, 4, 1, 0, 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, 4, 1, 0, 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 }, // 12
{ 0, 0, 3, 0, 1, 0, 4, 5, -6, 2, 0, 0, 0 }, // 13 { 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 // 1 2 3 4 5 6 7 8 9 A B C D

@ -408,6 +408,21 @@ void DexedAudioProcessor::exportSysex(char *dest) {
memcpy(dest+4102, footer, 2); memcpy(dest+4102, footer, 2);
} }
/**
* This function normalize data that comes from corrupted sysex data.
* It used to avoid engine crashing upon extrem values
*/
char normparm(char value, char max) {
if ( value <= max )
return value;
// if this is beyond the max, we expect a 0-255 range, normalize this
// to the expected return value; and this value as a random data.
return ((float)value)/255 * max;
}
void DexedAudioProcessor::unpackProgram(int idx) { void DexedAudioProcessor::unpackProgram(int idx) {
char *bulk = sysex + (idx * 128); char *bulk = sysex + (idx * 128);
@ -553,7 +568,12 @@ int DexedAudioProcessor::getCurrentProgram() {
void DexedAudioProcessor::setCurrentProgram(int index) { void DexedAudioProcessor::setCurrentProgram(int index) {
TRACE("setting program %d state", index); TRACE("setting program %d state", index);
if ( lastStateSave + 2 < time(NULL) ) {
if ( lastStateSave + 2 > time(NULL) ) {
TRACE("skipping save, storage recall to close");
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;
@ -562,7 +582,6 @@ void DexedAudioProcessor::setCurrentProgram(int index) {
index = index > 31 ? 31 : index; index = index > 31 ? 31 : index;
unpackProgram(index); unpackProgram(index);
lfo.reset(data + 137); lfo.reset(data + 137);
}
currentProgram = index; currentProgram = index;
updateUI(); updateUI();
} }
@ -584,12 +603,10 @@ const String DexedAudioProcessor::getParameterText(int index) {
return ctrl[index]->getValueDisplay(); return ctrl[index]->getValueDisplay();
} }
#define CURRENT_PLUGINSTATE_VERSION 2
#define CURRENT_PLUGINSTATE_VERSION 1
struct PluginState { struct PluginState {
int version; int version;
uint8_t sysex[4011]; uint8_t sysex[4104];
uint8_t program[161]; uint8_t program[161];
float cutoff; float cutoff;
float reso; float reso;
@ -631,7 +648,7 @@ void DexedAudioProcessor::setStateInformation(const void* source, int sizeInByte
} }
if ( sizeInBytes > sizeof(PluginState) ) { if ( sizeInBytes > sizeof(PluginState) ) {
TRACE("hmmm, too big plugin state size %d", sizeInBytes); TRACE("too big plugin state size %d", sizeInBytes);
sizeInBytes = sizeof(PluginState); sizeInBytes = sizeof(PluginState);
} }

@ -49,6 +49,7 @@ DexedAudioProcessor::DexedAudioProcessor() {
initCtrl(); initCtrl();
setCurrentProgram(0); setCurrentProgram(0);
sendSysexChange = true; sendSysexChange = true;
normalizeDxVelocity = false;
} }
DexedAudioProcessor::~DexedAudioProcessor() { DexedAudioProcessor::~DexedAudioProcessor() {
@ -254,6 +255,10 @@ void DexedAudioProcessor::keydown(uint8_t pitch, uint8_t velo) {
return; return;
} }
if ( normalizeDxVelocity ) {
velo = ((float)velo) * 0.7874015; // 100/127
}
int note = currentNote; int note = currentNote;
for (int i = 0; i < MAX_ACTIVE_NOTES; i++) { for (int i = 0; i < MAX_ACTIVE_NOTES; i++) {
if (!voices[note].keydown) { if (!voices[note].keydown) {

@ -80,6 +80,9 @@ class DexedAudioProcessor : public AudioProcessor
*/ */
bool refreshVoice; bool refreshVoice;
bool normalizeDxVelocity;
bool sendSysexChange;
MidiBuffer midiOut; MidiBuffer midiOut;
void processMidiMessage(MidiMessage *msg); void processMidiMessage(MidiMessage *msg);
@ -94,7 +97,7 @@ public :
static const int REFRESH_COMP = 1 << 1; static const int REFRESH_COMP = 1 << 1;
int refreshUI; int refreshUI;
bool sendSysexChange;
char data[161]; char data[161];
ScopedPointer<ZipFile> builtin_pgm; ScopedPointer<ZipFile> builtin_pgm;

Loading…
Cancel
Save