Confirm loading sysex cart if the header is corrupted

pull/1/head
asb2m10 9 years ago
parent 371e06d655
commit 6b69a5bcc1
  1. 2
      README.md
  2. 20
      Source/EngineMkI.cpp
  3. 7
      Source/PluginData.h
  4. 12
      Source/PluginEditor.cpp

@ -18,6 +18,8 @@ in the source folder) stays on the Apache 2.0 license to able to collaborate bet
Changelog Changelog
--------- ---------
#### Version 0.9.2 #### Version 0.9.2
* Added operator mute switch
* Added Tune (MASTER TUNE ADJ) knob
* Single click program select * Single click program select
* Fix sysex issue with wrong machine ID * Fix sysex issue with wrong machine ID

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015 Pascal Gauthier. * Copyright (C) 2015-2016 Pascal Gauthier.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -246,6 +246,7 @@ void EngineMkI::render(int32_t *output, FmOpParams *params, int algorithm,
} }
} }
const FmAlgorithm EngineMkI::algo2[32] = { const FmAlgorithm EngineMkI::algo2[32] = {
{ { 0xc1, 0x11, 0x11, 0x14, 0x01, 0x14 } }, // 1 { { 0xc1, 0x11, 0x11, 0x14, 0x01, 0x14 } }, // 1
{ { 0x01, 0x11, 0x11, 0x14, 0xc1, 0x14 } }, // 2 { { 0x01, 0x11, 0x11, 0x14, 0xc1, 0x14 } }, // 2
@ -307,7 +308,7 @@ void EngineMkI::compute_fb3(int32_t *output, FmOpParams *parms, int32_t gain01,
for (int i = 0; i < N; i++) { for (int i = 0; i < N; i++) {
// op 0 // op 0
gain[0] += dgain[0]; gain[0] += dgain[0];
int32_t scaled_fb = (y0 + y) >> (fb_shift + 6); // tsk tsk tsk: this needs some tuning int32_t scaled_fb = (y0 + y) >> (fb_shift + 1); // tsk tsk tsk: this needs some tuning
y0 = y; y0 = y;
y = Sin::lookup(phase[0] + scaled_fb); y = Sin::lookup(phase[0] + scaled_fb);
y = ((int64_t)y * (int64_t)gain[0]) >> 24; y = ((int64_t)y * (int64_t)gain[0]) >> 24;
@ -352,7 +353,7 @@ void EngineMkI::compute_fb2(int32_t *output, FmOpParams *parms, int32_t gain01,
for (int i = 0; i < N; i++) { for (int i = 0; i < N; i++) {
// op 0 // op 0
gain[0] += dgain[0]; gain[0] += dgain[0];
int32_t scaled_fb = (y0 + y) >> (fb_shift + 2); // tsk tsk tsk: this needs some tuning int32_t scaled_fb = (y0 + y) >> (fb_shift + 1);
y0 = y; y0 = y;
y = Sin::lookup(phase[0] + scaled_fb); y = Sin::lookup(phase[0] + scaled_fb);
y = ((int64_t)y * (int64_t)gain[0]) >> 24; y = ((int64_t)y * (int64_t)gain[0]) >> 24;
@ -371,7 +372,8 @@ void EngineMkI::compute_fb2(int32_t *output, FmOpParams *parms, int32_t gain01,
/* /*
void EngineMkI::render(int32_t *output, FmOpParams *params, int algorithm, int32_t *fb_buf, int feedback_shift) { void EngineMkI::render(int32_t *output, FmOpParams *params, int algorithm, int32_t *fb_buf, int feedback_shift) {
const int kLevelThresh = 507; const uint16_t ENV_MAX = 1<<ENV_BITDEPTH;
const int kLevelThresh = ENV_MAX-100;
const FmAlgorithm alg = algo2[algorithm]; const FmAlgorithm alg = algo2[algorithm];
bool has_contents[3] = { true, false, false }; bool has_contents[3] = { true, false, false };
@ -382,11 +384,11 @@ void EngineMkI::render(int32_t *output, FmOpParams *params, int algorithm, int32
int inbus = (flags >> 4) & 3; int inbus = (flags >> 4) & 3;
int outbus = flags & 3; int outbus = flags & 3;
int32_t *outptr = (outbus == 0) ? output : buf_[outbus - 1].get(); int32_t *outptr = (outbus == 0) ? output : buf_[outbus - 1].get();
int32_t gain1 = param.gain_out == 0 ? 511 : param.gain_out; int32_t gain1 = param.gain_out == 0 ? (ENV_MAX-1) : param.gain_out;
int32_t gain2 = 512-(param.level_in >> 19); int32_t gain2 = ENV_MAX-(param.level_in >> (28-ENV_BITDEPTH));
param.gain_out = gain2; param.gain_out = gain2;
if (gain1 >= kLevelThresh || gain2 >= kLevelThresh) { if (gain1 <= kLevelThresh || gain2 <= kLevelThresh) {
if (!has_contents[outbus]) { if (!has_contents[outbus]) {
add = false; add = false;
@ -433,5 +435,5 @@ void EngineMkI::render(int32_t *output, FmOpParams *params, int algorithm, int32
} }
param.phase += param.freq << LG_N; param.phase += param.freq << LG_N;
} }
} }*/
*/

@ -1,6 +1,6 @@
/** /**
* *
* Copyright (c) 2014-2015 Pascal Gauthier. * Copyright (c) 2014-2016 Pascal Gauthier.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -99,6 +99,7 @@ public:
} }
int load(const uint8_t *stream, int size) { int load(const uint8_t *stream, int size) {
const uint8 voiceHeaderBroken[] = { 0xF0, 0x43, 0x00, 0x00, 0x20, 0x00 };
uint8 voiceHeader[] = SYSEX_HEADER; uint8 voiceHeader[] = SYSEX_HEADER;
uint8 tmp[65535]; uint8 tmp[65535];
uint8 *pos = tmp; uint8 *pos = tmp;
@ -115,11 +116,13 @@ public:
if ( status != 0 ) if ( status != 0 )
return status; return status;
memcpy(voiceData, pos+6, 4096); memcpy(voiceData, pos+6, 4096);
TRACE("SYSEX Header not found, loading random data");
return 2; return 2;
} }
pos[3] = 0; pos[3] = 0;
if ( memcmp(pos, voiceHeader, 6) == 0 ) { if ( memcmp(pos, voiceHeader, 6) == 0 || memcmp(pos, voiceHeaderBroken, 6) == 0) {
TRACE("SYSEX voice header found at %d", pos);
memcpy(voiceData, pos, SYSEX_SIZE); memcpy(voiceData, pos, SYSEX_SIZE);
if ( sysexChecksum(voiceData + 6, 4096) == pos[4102] ) if ( sysexChecksum(voiceData + 6, 4096) == pos[4102] )
status = 0; status = 0;

@ -115,13 +115,23 @@ void DexedAudioProcessorEditor::cartShow() {
void DexedAudioProcessorEditor::loadCart(File file) { void DexedAudioProcessorEditor::loadCart(File file) {
Cartridge cart; Cartridge cart;
if ( cart.load(file) < 0 ) { int rc = cart.load(file);
if ( rc < 0 ) {
AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon,
"Error", "Error",
"Unable to open: " + file.getFullPathName()); "Unable to open: " + file.getFullPathName());
return; return;
} }
if ( rc != 0 ) {
rc = AlertWindow::showOkCancelBox(AlertWindow::QuestionIcon, "Unable to find DX7 sysex cartridge in file",
"This sysex file is not for the DX7 or it is corrupted. "
"Do you still want to load this file as random data ?");
if ( rc == 0 )
return;
}
processor->loadCartridge(cart); processor->loadCartridge(cart);
rebuildProgramCombobox(); rebuildProgramCombobox();
processor->setCurrentProgram(0); processor->setCurrentProgram(0);

Loading…
Cancel
Save