From 35550de5dc40673d9a96eee6194e3148881bd330 Mon Sep 17 00:00:00 2001 From: Pascal Gauthier Date: Sun, 7 Jun 2015 23:11:07 -0400 Subject: [PATCH] Window and Linux fixes --- README.md | 8 +++++--- Source/CartManager.cpp | 24 +++++++++++++++++------- Source/CartManager.h | 5 +++-- Source/Dexed.h | 4 ++-- Source/PluginData.cpp | 12 ++++++++---- Source/PluginEditor.cpp | 2 ++ 6 files changed, 37 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 64af96c..d0286fe 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,14 @@ in the source folder) stays on the Apache 2.0 license to able to collaborate bet Changelog --------- -#### Version 0.8.2 -* Cartridge Manager +#### Version 0.9.0 * Apple AU support +* Cartridge Manager +* Store action also can update the currently loaded cartridge * Basic theming * Fixed the UI corruption when more than one Dexed instance was loaded -* Fixed wrong display value issues +* Fixed wrong display value issues (coarse and fine) + #### Version 0.8.0 * New UI by [AZur Studio](http://bji.yukihotaru.com/) diff --git a/Source/CartManager.cpp b/Source/CartManager.cpp index fe58aa9..a7be1ca 100644 --- a/Source/CartManager.cpp +++ b/Source/CartManager.cpp @@ -47,7 +47,6 @@ CartManager::CartManager(DexedAudioProcessorEditor *editor) : TopLevelWindow("Ca activeCart->setBounds(28, 441, 800, 96); activeCart->addListener(this); - memset(browserSysex, 0, 4096); addAndMakeVisible(browserCart = new ProgramListBox("browserpgm", 2)); browserCart->setBounds(635, 18, 200, 384); browserCart->addListener(this); @@ -81,11 +80,11 @@ CartManager::CartManager(DexedAudioProcessorEditor *editor) : TopLevelWindow("Ca fileMgrButton->addListener(this); addAndMakeVisible(getDXPgmButton = new TextButton("GET DX7 PGM")); - getDXPgmButton->setBounds(668, 545, 95, 30); + getDXPgmButton->setBounds(656, 545, 100, 30); getDXPgmButton->addListener(this); addAndMakeVisible(getDXCartButton = new TextButton("GET DX7 CART")); - getDXCartButton->setBounds(761, 545, 95, 30); + getDXCartButton->setBounds(755, 545, 100, 30); getDXCartButton->addListener(this); } @@ -111,10 +110,10 @@ void CartManager::programSelected(ProgramListBox *source, int pos) { mainWindow->processor->setCurrentProgram(pos); mainWindow->processor->updateHostDisplay(); } else { - if ( browserSysex == nullptr ) + if ( source->getCurrentCart() == nullptr ) return; char unpackPgm[161]; - unpackProgramFromSysex(unpackPgm, browserSysex, pos); + unpackProgramFromSysex(unpackPgm, source->getCurrentCart(), pos); activeCart->setSelected(-1); browserCart->setSelected(pos); repaint(); @@ -148,17 +147,21 @@ void CartManager::buttonClicked(juce::Button *buttonThatWasClicked) { } if ( buttonThatWasClicked == getDXPgmButton ) { - if ( mainWindow->processor->sysexComm.isOutputActive() ) { + if ( mainWindow->processor->sysexComm.isInputActive() && mainWindow->processor->sysexComm.isOutputActive() ) { unsigned char msg[] = { 0xF0, 0x43, 0x20, 0x00, 0xF7 }; mainWindow->processor->sysexComm.send(MidiMessage(msg, 5)); + } else { + showSysexConfigMsg(); } return; } if ( buttonThatWasClicked == getDXCartButton ) { - if ( mainWindow->processor->sysexComm.isOutputActive() ) { + if ( mainWindow->processor->sysexComm.isInputActive() && mainWindow->processor->sysexComm.isOutputActive() ) { unsigned char msg[] = { 0xF0, 0x43, 0x20, 0x01, 0xF7 }; mainWindow->processor->sysexComm.send(MidiMessage(msg, 5)); + } else { + showSysexConfigMsg(); } return; } @@ -228,6 +231,7 @@ void CartManager::selectionChanged() { fp_in.read((char *)syx_data, 4104); fp_in.close(); + char browserSysex[4104]; memcpy(browserSysex, syx_data+6, 4096); int checksum = sysexChecksum(((char *) &browserSysex), 4096); @@ -312,6 +316,12 @@ void CartManager::initialFocus() { cartBrowser->grabKeyboardFocus(); } +void CartManager::showSysexConfigMsg() { + AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, "Warning", "The DX7 midi interface is not configured correctly.\n\n" + "These buttons are used to 'ask' the DX7 to send the current program/cartridge.\n\n" + "In order to use this correctly, you need to connect your midi in and midi out of your DX7 to a midi interface and configure this midi interface with the [PARM] dialog."); +} + // unused stuff from FileBrowserListener void CartManager::browserRootChanged (const File& newRoot) {} diff --git a/Source/CartManager.h b/Source/CartManager.h index 681a452..7ccf9d2 100644 --- a/Source/CartManager.h +++ b/Source/CartManager.h @@ -47,8 +47,9 @@ class CartManager : public TopLevelWindow, public ButtonListener, public DragAn File cartDir; DexedAudioProcessorEditor *mainWindow; - - char browserSysex[4096]; + + void showSysexConfigMsg(); + public: CartManager(DexedAudioProcessorEditor *editor); virtual ~CartManager(); diff --git a/Source/Dexed.h b/Source/Dexed.h index 695c75a..5ec89f6 100644 --- a/Source/Dexed.h +++ b/Source/Dexed.h @@ -24,14 +24,14 @@ void dexed_trace(const char *source, const char *fmt, ...); #ifdef DEBUG - #define DEXED_VERSION "0.8.2 DEBUG" + #define DEXED_VERSION "0.9.0 DEBUG" #ifdef _MSC_VER #define TRACE(fmt, ...) dexed_trace(__FUNCTION__,fmt,##__VA_ARGS__) #else #define TRACE(fmt, ...) dexed_trace(__PRETTY_FUNCTION__,fmt,##__VA_ARGS__) #endif #else - #define DEXED_VERSION "0.8.2" + #define DEXED_VERSION "0.9.0 BETA" #define TRACE(fmt, ...) #endif diff --git a/Source/PluginData.cpp b/Source/PluginData.cpp index 93199f9..4da4fe8 100644 --- a/Source/PluginData.cpp +++ b/Source/PluginData.cpp @@ -250,18 +250,21 @@ void DexedAudioProcessor::setupStartupCart() { File startup = dexedCartDir.getChildFile("Dexed_01.syx"); if ( startup.exists() ) { - ScopedPointer fis = startup.createInputStream(); + FileInputStream *fis = startup.createInputStream(); if ( fis == nullptr ) { TRACE("unable to open default cartridge"); return; } fis->read(syx_data, 4104); + delete fis; } else { // The user deleted the file :/, load from the builtin zip file. MemoryInputStream *mis = new MemoryInputStream(BinaryData::builtin_pgm_zip, BinaryData::builtin_pgm_zipSize, false); - ScopedPointer builtin_pgm = new ZipFile(mis, true); - ScopedPointer is = builtin_pgm->createStreamForEntry(builtin_pgm->getIndexOfFileName(("Dexed_01.syx"))); + ZipFile *builtin_pgm = new ZipFile(mis, true); + InputStream *is = builtin_pgm->createStreamForEntry(builtin_pgm->getIndexOfFileName(("Dexed_01.syx"))); is->read(syx_data, 4104); + delete is; + delete builtin_pgm; } importSysex((char *) &syx_data); } @@ -459,7 +462,7 @@ void DexedAudioProcessor::resolvAppDir() { synprezFmDir.createDirectory(); MemoryInputStream *mis = new MemoryInputStream(BinaryData::builtin_pgm_zip, BinaryData::builtin_pgm_zipSize, false); - ScopedPointer builtin_pgm = new ZipFile(mis, true); + ZipFile *builtin_pgm = new ZipFile(mis, true); for(int i=0;igetNumEntries();i++) { if ( builtin_pgm->getEntry(i)->filename == "Dexed_01.syx" ) { @@ -468,5 +471,6 @@ void DexedAudioProcessor::resolvAppDir() { builtin_pgm->uncompressEntry(i, synprezFmDir); } } + delete builtin_pgm; } } diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index f1c732a..d224395 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -163,6 +163,8 @@ void DexedAudioProcessorEditor::loadCart(File file) { } void DexedAudioProcessorEditor::saveCart() { + File startFileName = processor->activeFileCartridge.exists() ? processor->activeFileCartridge : processor->dexedCartDir; + FileChooser fc ("Export DX sysex...", processor->dexedCartDir, "*.syx", 1); if ( fc.browseForFileToSave(true) ) { String f = fc.getResults().getReference(0).getFullPathName();