Preset bank & VST state loading

pull/1/head
asb2m10 11 years ago
parent 9bc7fc9003
commit 79914447a9
  1. 6
      Builds/MacOSX/Dexed.xcodeproj/project.pbxproj
  2. BIN
      Builds/MacOSX/Dexed.xcodeproj/project.xcworkspace/xcuserdata/asb2m10.xcuserdatad/UserInterfaceState.xcuserstate
  3. 3
      Builds/VisualStudio2012/Dexed.vcxproj
  4. 5
      Builds/VisualStudio2012/Dexed.vcxproj.filters
  5. 3
      Dexed.jucer
  6. 1473
      JuceLibraryCode/BinaryData.cpp
  7. 7
      JuceLibraryCode/BinaryData.h
  8. BIN
      Resources/background.png
  9. BIN
      Resources/builtin_pgm.zip
  10. BIN
      Resources/startup.syx
  11. 21
      Source/DXLookNFeel.cpp
  12. 28
      Source/GlobalEditor.cpp
  13. 1
      Source/GlobalEditor.h
  14. 80
      Source/PluginEditor.cpp
  15. 6
      Source/PluginEditor.h
  16. 42
      Source/PluginParam.cpp
  17. 3
      Source/PluginParam.h
  18. 3
      Source/PluginProcessor.cpp
  19. 12
      Source/PluginProcessor.h

@ -117,6 +117,7 @@
14AF9F1F28D50F8E47606660 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Slider.h"; path = "../../JuceLibraryCode/modules/juce_gui_basics/widgets/juce_Slider.h"; sourceTree = "SOURCE_ROOT"; };
153D4DE95D01307F844AA15B = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_VST3PluginFormat.h"; path = "../../JuceLibraryCode/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.h"; sourceTree = "SOURCE_ROOT"; };
1585F30843449EA6EA078288 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_ThreadWithProgressWindow.cpp"; path = "../../JuceLibraryCode/modules/juce_gui_basics/windows/juce_ThreadWithProgressWindow.cpp"; sourceTree = "SOURCE_ROOT"; };
15B75D829C40872D542A38B8 = { isa = PBXFileReference; lastKnownFileType = file.zip; name = "builtin_pgm.zip"; path = "../../Resources/builtin_pgm.zip"; sourceTree = "SOURCE_ROOT"; };
1600EDBEE9B363CBAB68CD43 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_StringPool.cpp"; path = "../../JuceLibraryCode/modules/juce_core/text/juce_StringPool.cpp"; sourceTree = "SOURCE_ROOT"; };
1635BBF869518BAA7A88A6A0 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_FileSearchPathListComponent.h"; path = "../../JuceLibraryCode/modules/juce_gui_basics/filebrowser/juce_FileSearchPathListComponent.h"; sourceTree = "SOURCE_ROOT"; };
163C2312B370BA53F482B84B = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_TabbedButtonBar.h"; path = "../../JuceLibraryCode/modules/juce_gui_basics/layout/juce_TabbedButtonBar.h"; sourceTree = "SOURCE_ROOT"; };
@ -143,7 +144,6 @@
1D31136D1C9D959792023095 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_RelativeTime.cpp"; path = "../../JuceLibraryCode/modules/juce_core/time/juce_RelativeTime.cpp"; sourceTree = "SOURCE_ROOT"; };
1D798858682A27299589F4E5 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_ComponentListener.cpp"; path = "../../JuceLibraryCode/modules/juce_gui_basics/components/juce_ComponentListener.cpp"; sourceTree = "SOURCE_ROOT"; };
1D95A78059DCCC7B58782F07 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_AudioSampleBuffer.h"; path = "../../JuceLibraryCode/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h"; sourceTree = "SOURCE_ROOT"; };
1DC9D8AC8B4311052BC86115 = { isa = PBXFileReference; lastKnownFileType = image.png; name = background.png; path = ../../Resources/background.png; sourceTree = "SOURCE_ROOT"; };
1E1A0627C2977D5FCB8440CC = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_LookAndFeel.h"; path = "../../JuceLibraryCode/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.h"; sourceTree = "SOURCE_ROOT"; };
1EB6398B6F537A4302092240 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_TextEditorKeyMapper.h"; path = "../../JuceLibraryCode/modules/juce_gui_basics/keyboard/juce_TextEditorKeyMapper.h"; sourceTree = "SOURCE_ROOT"; };
1F51658DEF590741920719FF = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_MACAddress.cpp"; path = "../../JuceLibraryCode/modules/juce_core/network/juce_MACAddress.cpp"; sourceTree = "SOURCE_ROOT"; };
@ -774,7 +774,6 @@
E8A7578ED10948AB49EE2997 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_FileTreeComponent.h"; path = "../../JuceLibraryCode/modules/juce_gui_basics/filebrowser/juce_FileTreeComponent.h"; sourceTree = "SOURCE_ROOT"; };
E90C9A775597228F1F127252 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_EdgeTable.cpp"; path = "../../JuceLibraryCode/modules/juce_graphics/geometry/juce_EdgeTable.cpp"; sourceTree = "SOURCE_ROOT"; };
E912092604DBF571BDC08D60 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_DrawableRectangle.cpp"; path = "../../JuceLibraryCode/modules/juce_gui_basics/drawables/juce_DrawableRectangle.cpp"; sourceTree = "SOURCE_ROOT"; };
E93431088B4E40AC9A48D817 = { isa = PBXFileReference; lastKnownFileType = file.syx; name = startup.syx; path = ../../Resources/startup.syx; sourceTree = "SOURCE_ROOT"; };
E99DD30E1F2706D62695EB8C = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Colours.h"; path = "../../JuceLibraryCode/modules/juce_graphics/colour/juce_Colours.h"; sourceTree = "SOURCE_ROOT"; };
E9BA26E4F993EBFB0E36B18C = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_RelativePointPath.h"; path = "../../JuceLibraryCode/modules/juce_gui_basics/positioning/juce_RelativePointPath.h"; sourceTree = "SOURCE_ROOT"; };
E9E4792648C00B4A23C1A39D = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_DrawableShape.h"; path = "../../JuceLibraryCode/modules/juce_gui_basics/drawables/juce_DrawableShape.h"; sourceTree = "SOURCE_ROOT"; };
@ -854,8 +853,7 @@
FF5B77AA3517B4637F862BD3 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_RelativeCoordinatePositioner.cpp"; path = "../../JuceLibraryCode/modules/juce_gui_basics/positioning/juce_RelativeCoordinatePositioner.cpp"; sourceTree = "SOURCE_ROOT"; };
FF6607118B29435E76806DFA = { isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Dexed.component; sourceTree = "BUILT_PRODUCTS_DIR"; };
F472964B0FFEE5615B72CE3D = { isa = PBXGroup; children = (
1DC9D8AC8B4311052BC86115,
E93431088B4E40AC9A48D817 ); name = Resources; sourceTree = "<group>"; };
15B75D829C40872D542A38B8 ); name = Resources; sourceTree = "<group>"; };
BDC5059F1563FD8DD69AD324 = { isa = PBXGroup; children = (
3715DFDD7A1B12083F051F5A,
8F395B738E7AB81A0333AF96,

@ -1518,8 +1518,7 @@
<ClInclude Include="..\..\JuceLibraryCode\JuceHeader.h"/>
</ItemGroup>
<ItemGroup>
<None Include="..\..\Resources\background.png"/>
<None Include="..\..\Resources\startup.syx"/>
<None Include="..\..\Resources\builtin_pgm.zip"/>
<None Include="..\..\..\JUCE\modules\juce_audio_basics\juce_module_info"/>
<None Include="..\..\..\JUCE\modules\juce_audio_plugin_client\juce_module_info"/>
<None Include="..\..\..\JUCE\modules\juce_audio_processors\juce_module_info"/>

@ -2600,10 +2600,7 @@
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\Resources\background.png">
<Filter>Dexed\Resources</Filter>
</None>
<None Include="..\..\Resources\startup.syx">
<None Include="..\..\Resources\builtin_pgm.zip">
<Filter>Dexed\Resources</Filter>
</None>
<None Include="..\..\..\JUCE\modules\juce_audio_basics\juce_module_info">

@ -11,8 +11,7 @@
jucerVersion="3.1.0" companyName="Digital Suburban">
<MAINGROUP id="kHXTgw" name="Dexed">
<GROUP id="{F12593AE-639A-6F59-5819-ACE25AF86F95}" name="Resources">
<FILE id="oUNugM" name="background.png" compile="0" resource="1" file="Resources/background.png"/>
<FILE id="CGMSPp" name="startup.syx" compile="0" resource="1" file="Resources/startup.syx"/>
<FILE id="gfRTZ1" name="builtin_pgm.zip" compile="0" resource="1" file="Resources/builtin_pgm.zip"/>
</GROUP>
<GROUP id="{EA38D88A-6B79-E394-8B57-FA22D50C4D86}" name="Source">
<FILE id="thAIGQ" name="GlobalEditor.cpp" compile="1" resource="0"

File diff suppressed because it is too large Load Diff

@ -6,11 +6,8 @@
namespace BinaryData
{
extern const char* background_png;
const int background_pngSize = 12012;
extern const char* startup_syx;
const int startup_syxSize = 4104;
extern const char* builtin_pgm_zip;
const int builtin_pgm_zipSize = 88890;
// Points to the start of a list of resource names.
extern const char* namedResourceList[];

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Binary file not shown.

@ -67,6 +67,10 @@ 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();
@ -111,6 +115,9 @@ void AlgoDisplay::paint(Graphics &g) {
alg = 31;
}
const char *arr = algoArr[alg];
g.setColour (Colours::black.withAlpha(0.5f));
g.fillRoundedRectangle (0.0f, 0.0f, (float) getWidth(), (float) getHeight(), 1.0f);
for(int i=0;i<13;i++) {
char target = arr[i];
@ -137,20 +144,26 @@ void AlgoDisplay::paint(Graphics &g) {
drawOp(g, (i-12)+3, 0, target, feedback);
}
String algoTxt;
algoTxt << (alg+1);
g.drawText(algoTxt, 0, 0, 21, 14, Justification::left, true);
}
void AlgoDisplay::drawOp(Graphics &g, int x, int y, int num, bool feedback) {
String txt;
txt << num;
int offx = 25;
int offy = 18;
g.setColour(Colour(0xFF0FC00F));
g.fillRect(x*21+1, y*14+1, 19, 13);
g.fillRect(x*offx+1, y*offy+1, offx-2, offy-1);
g.setColour(Colour(0xFFFFFFFF));
g.drawText(txt, x*21, y*14, 21, 14, Justification::centred, true);
g.drawText(txt, x*offx, y*offy, offx, offy, Justification::centred, true);
if ( feedback ) {
g.setColour(Colour(0xFFFFFFFF));
int x1 = (x*21) + 19;
g.drawLine(x1, y*14+1, x1, y*14+14, 3);
int x1 = (x*offx) + 23;
g.drawLine(x1, y*offy+1, x1, y*offy+offy, 3);
}
}

@ -32,7 +32,7 @@ GlobalEditor::GlobalEditor ()
addAndMakeVisible (algo = new Slider ("algo"));
algo->setRange (1, 32, 1);
algo->setSliderStyle (Slider::Rotary);
algo->setTextBoxStyle (Slider::TextBoxLeft, true, 80, 20);
algo->setTextBoxStyle (Slider::NoTextBox, true, 80, 20);
algo->addListener (this);
addAndMakeVisible (lfoType = new ComboBox ("new combo box"));
@ -159,6 +159,9 @@ GlobalEditor::GlobalEditor ()
addAndMakeVisible (lfoSync = new ToggleButton ("lfoSync"));
lfoSync->setButtonText (String::empty);
addAndMakeVisible (component = new Component());
component->setName ("new component");
//[UserPreSize]
//[/UserPreSize]
@ -199,6 +202,7 @@ GlobalEditor::~GlobalEditor()
oscSync = nullptr;
pitchModSens = nullptr;
lfoSync = nullptr;
component = nullptr;
//[Destructor]. You can add your own custom destruction code here..
@ -228,7 +232,7 @@ void GlobalEditor::paint (Graphics& g)
void GlobalEditor::resized()
{
algo->setBounds (480, 64, 80, 24);
algo->setBounds (568, 32, 24, 24);
lfoType->setBounds (624, 40, 96, 16);
lfoSpeed->setBounds (624, 16, 96, 16);
lfoAmDepth->setBounds (696, 64, 24, 24);
@ -236,7 +240,7 @@ void GlobalEditor::resized()
lfoDelay->setBounds (672, 64, 24, 24);
cutoff->setBounds (8, 40, 48, 48);
reso->setBounds (64, 40, 48, 48);
algoDisplay->setBounds (480, 8, 126, 56);
algoDisplay->setBounds (416, 8, 150, 72);
pitchRate2->setBounds (776, 64, 32, 24);
pitchRate3->setBounds (800, 64, 32, 24);
pitchRate4->setBounds (824, 64, 32, 24);
@ -245,11 +249,12 @@ void GlobalEditor::resized()
pitchLevel3->setBounds (800, 40, 32, 24);
pitchLevel4->setBounds (824, 40, 32, 24);
pitchLevel1->setBounds (752, 40, 32, 24);
feedback->setBounds (560, 64, 24, 24);
feedback->setBounds (568, 56, 24, 24);
transpose->setBounds (728, 0, 24, 56);
oscSync->setBounds (584, 64, 24, 24);
oscSync->setBounds (600, 64, 24, 24);
pitchModSens->setBounds (728, 64, 24, 24);
lfoSync->setBounds (624, 64, 24, 24);
component->setBounds (752, 8, 96, 32);
//[UserResized] Add your own custom resize handling here..
//[/UserResized]
}
@ -428,8 +433,8 @@ BEGIN_JUCER_METADATA
fixedSize="1" initialWidth="855" initialHeight="90">
<BACKGROUND backgroundColour="ffffff"/>
<SLIDER name="algo" id="8a226ddf9bbff752" memberName="algo" virtualName=""
explicitFocusOrder="0" pos="480 64 80 24" min="1" max="32" int="1"
style="Rotary" textBoxPos="TextBoxLeft" textBoxEditable="0" textBoxWidth="80"
explicitFocusOrder="0" pos="568 32 24 24" min="1" max="32" int="1"
style="Rotary" textBoxPos="NoTextBox" textBoxEditable="0" textBoxWidth="80"
textBoxHeight="20" skewFactor="1"/>
<COMBOBOX name="new combo box" id="31018596af3b34e9" memberName="lfoType"
virtualName="" explicitFocusOrder="0" pos="624 40 96 16" editable="0"
@ -460,7 +465,7 @@ BEGIN_JUCER_METADATA
style="Rotary" textBoxPos="NoTextBox" textBoxEditable="1" textBoxWidth="80"
textBoxHeight="20" skewFactor="1"/>
<GENERICCOMPONENT name="algoDisplay" id="b26fb9e3b5f0bc37" memberName="algoDisplay"
virtualName="" explicitFocusOrder="0" pos="480 8 126 56" class="AlgoDisplay"
virtualName="" explicitFocusOrder="0" pos="416 8 150 72" class="AlgoDisplay"
params=""/>
<SLIDER name="pitchRate2" id="73f386b3c91d3de4" memberName="pitchRate2"
virtualName="" explicitFocusOrder="0" pos="776 64 32 24" min="0"
@ -495,7 +500,7 @@ BEGIN_JUCER_METADATA
max="99" int="1" style="Rotary" textBoxPos="NoTextBox" textBoxEditable="1"
textBoxWidth="80" textBoxHeight="20" skewFactor="1"/>
<SLIDER name="feedback" id="4fac1940c29ab8c" memberName="feedback" virtualName=""
explicitFocusOrder="0" pos="560 64 24 24" min="0" max="7" int="1"
explicitFocusOrder="0" pos="568 56 24 24" min="0" max="7" int="1"
style="Rotary" textBoxPos="NoTextBox" textBoxEditable="1" textBoxWidth="80"
textBoxHeight="20" skewFactor="1"/>
<SLIDER name="transpose" id="7d1266b1c1534947" memberName="transpose"
@ -503,7 +508,7 @@ BEGIN_JUCER_METADATA
max="49" int="0" style="LinearVertical" textBoxPos="NoTextBox"
textBoxEditable="1" textBoxWidth="80" textBoxHeight="20" skewFactor="1"/>
<TOGGLEBUTTON name="oscSync" id="8f3fe641537cd00" memberName="oscSync" virtualName=""
explicitFocusOrder="0" pos="584 64 24 24" buttonText="" connectedEdges="0"
explicitFocusOrder="0" pos="600 64 24 24" buttonText="" connectedEdges="0"
needsCallback="0" radioGroupId="0" state="0"/>
<SLIDER name="pitchModSens" id="904f73df85a9f886" memberName="pitchModSens"
virtualName="" explicitFocusOrder="0" pos="728 64 24 24" min="0"
@ -512,6 +517,9 @@ BEGIN_JUCER_METADATA
<TOGGLEBUTTON name="lfoSync" id="ff92bb0a5a4f7187" memberName="lfoSync" virtualName=""
explicitFocusOrder="0" pos="624 64 24 24" buttonText="" connectedEdges="0"
needsCallback="0" radioGroupId="0" state="0"/>
<GENERICCOMPONENT name="new component" id="9ddaae8ef924a038" memberName="component"
virtualName="" explicitFocusOrder="0" pos="752 8 96 32" class="Component"
params=""/>
</JUCER_COMPONENT>
END_JUCER_METADATA

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

@ -34,41 +34,43 @@ DexedAudioProcessorEditor::DexedAudioProcessorEditor (DexedAudioProcessor* owner
LookAndFeel::setDefaultLookAndFeel(&dx_lnf);
// This is where our plugin's editor size is set.
setSize (865, 420);
processor = ownerFilter;
cachedImage_background_png = ImageCache::getFromMemory (BinaryData::background_png, BinaryData::background_pngSize);
addAndMakeVisible (cartButton = new TextButton("CART"));
cartButton->setButtonText ("CART");
cartButton->addListener (this);
cartButton->setBounds(5, 5, 50, 18);
addAndMakeVisible (loadButton = new TextButton("LOAD"));
loadButton->setButtonText ("LOAD");
loadButton->addListener (this);
loadButton->setBounds(5, 5, 50, 18);
loadButton->setBounds(57, 5, 50, 18);
addAndMakeVisible( saveButton = new TextButton("SAVE"));
addAndMakeVisible(saveButton = new TextButton("SAVE"));
saveButton->setButtonText ("SAVE");
saveButton->addListener (this);
saveButton->setBounds (57, 5, 50, 18);
addAndMakeVisible( storeButton = new TextButton("STORE"));
saveButton->setBounds (109, 5, 50, 18);
addAndMakeVisible (&presets);
presets.setEditableText (false);
presets.setJustificationType (Justification::centredLeft);
presets.setTextWhenNothingSelected (String::empty);
presets.setBounds(163, 5, 180, 18);
rebuildPresetCombobox();
presets.addListener(this);
addAndMakeVisible(storeButton = new TextButton("STORE"));
storeButton->setButtonText ("STORE");
storeButton->addListener (this);
storeButton->setBounds (300, 5, 50, 18);
storeButton->setBounds (347, 5, 50, 18);
addAndMakeVisible( aboutButton = new TextButton("ABOUT"));
addAndMakeVisible(aboutButton = new TextButton("ABOUT"));
aboutButton->setButtonText ("ABOUT");
aboutButton->addListener (this);
aboutButton->setBounds (805, 5, 50, 18);
addAndMakeVisible (&presets);
presets.setEditableText (false);
presets.setJustificationType (Justification::centredLeft);
presets.setTextWhenNothingSelected (String::empty);
presets.setBounds(115, 5, 180, 18);
rebuildPresetCombobox();
presets.addListener(this);
// OPERATORS
addAndMakeVisible(&(operators[0]));
@ -107,9 +109,9 @@ DexedAudioProcessorEditor::DexedAudioProcessorEditor (DexedAudioProcessor* owner
addAndMakeVisible(&global);
global.setBounds(5,235,855,90);
global.bind(processor);
updateUI();
startTimer(100);
updateUI();
startTimer(100);
}
DexedAudioProcessorEditor::~DexedAudioProcessorEditor() {
@ -118,9 +120,12 @@ DexedAudioProcessorEditor::~DexedAudioProcessorEditor() {
}
//==============================================================================
void DexedAudioProcessorEditor::paint (Graphics& g) {
g.drawImage (cachedImage_background_png, 0, 0, 865, 420,
0, 0, cachedImage_background_png.getWidth(), cachedImage_background_png.getHeight());
void DexedAudioProcessorEditor::paint (Graphics& g) {
g.setColour(Colour(0xFF744420));
g.fillRoundedRectangle(0.0f, 0.0f, (float) getWidth(), (float) getHeight(), 0);
g.setColour(Colour(0xFFA87B67));
g.fillRoundedRectangle(0.0f, 30, (float) getWidth(), 200, 0);
}
void DexedAudioProcessorEditor::buttonClicked(Button *buttonThatWasClicked) {
@ -143,9 +148,7 @@ void DexedAudioProcessorEditor::buttonClicked(Button *buttonThatWasClicked) {
processor->importSysex((char *) &syx_data);
processor->setCurrentProgram(0);
rebuildPresetCombobox();
presets.setSelectedId(processor->getCurrentProgram()+1, NotificationType::dontSendNotification);
processor->setCurrentProgram(0);
processor->updateHostDisplay();
}
@ -204,6 +207,31 @@ void DexedAudioProcessorEditor::buttonClicked(Button *buttonThatWasClicked) {
return;
}
if (buttonThatWasClicked == cartButton) {
StringArray cart;
for(int i=0;i<processor->builtin_pgm->getNumEntries();i++) {
const ZipFile::ZipEntry *e = processor->builtin_pgm->getEntry(i);
cart.add(e->filename.dropLastCharacters(4));
}
AlertWindow dialog(String("Builtin cartridges"), "", AlertWindow::NoIcon, this);
dialog.addComboBox(String("cart"), cart);
dialog.addButton("OK", 0, KeyPress(KeyPress::returnKey));
dialog.addButton("Cancel", 1, KeyPress(KeyPress::escapeKey));
if ( dialog.runModalLoop() == 0 ) {
ComboBox *select = dialog.getComboBoxComponent(String("cart"));
int idx = select->getSelectedItemIndex();
processor->loadBuiltin(idx);
processor->setCurrentProgram(0);
rebuildPresetCombobox();
presets.setSelectedId(processor->getCurrentProgram()+1, NotificationType::dontSendNotification);
processor->updateHostDisplay();
}
return;
}
if (buttonThatWasClicked == aboutButton) {
AlertWindow::showMessageBoxAsync(AlertWindow::NoIcon, "DEXED - DX Emulator 0.3", "https://github.com/asb2m10/dexed\n"
"(c) 2013 Pascal Gauthier\nUnder the GPL v2\n\n"

@ -38,7 +38,8 @@ class DexedAudioProcessorEditor : public AudioProcessorEditor,
ComboBox presets;
MidiKeyboardComponent midiKeyboard;
DXLookNFeel dx_lnf;
ScopedPointer<TextButton> cartButton;
ScopedPointer<TextButton> loadButton;
ScopedPointer<TextButton> saveButton;
ScopedPointer<TextButton> storeButton;
@ -61,9 +62,6 @@ public:
void updateUI();
void rebuildPresetCombobox();
Image cachedImage_background_png;
};

@ -18,10 +18,14 @@
* Boston, MA 02110-1301 USA.
*/
#include <time.h>
#include "PluginParam.h"
#include "PluginProcessor.h"
#include "PluginEditor.h"
// ************************************************************************
//
Ctrl::Ctrl(String name) {
@ -145,6 +149,10 @@ int CtrlDX::getValue() {
return dxValue;
}
int CtrlDX::getOffset() {
return dxOffset;
}
String CtrlDX::getValueDisplay() {
String ret;
ret << ( getValue() + displayValue );
@ -199,7 +207,12 @@ void CtrlDX::updateComponent() {
*
*/
void DexedAudioProcessor::initCtrl() {
importSysex(BinaryData::startup_syx);
MemoryInputStream *mis = new MemoryInputStream(BinaryData::builtin_pgm_zip, BinaryData::builtin_pgm_zipSize, false);
builtin_pgm = new ZipFile(mis, true);
builtin_pgm->sortEntriesByFilename();
loadBuiltin(0);
currentProgram = 0;
fxCutoff = new CtrlFloat("Cutoff", &fx.uiCutoff);
@ -397,10 +410,7 @@ void DexedAudioProcessor::exportSysex(char *dest) {
memcpy(dest+4102, footer, 2);
}
/*
*/
void DexedAudioProcessor::unpackProgram(int idx) {
char *bulk = sysex + (idx * 128);
@ -494,6 +504,21 @@ void DexedAudioProcessor::setDxValue(int offset, int v) {
midiOut.addEvent(msg, 7, 0);
}
void DexedAudioProcessor::loadBuiltin(int idx) {
InputStream *is = builtin_pgm->createStreamForEntry(idx);
if ( is == NULL ) {
TRACE("ENTRY IN ZIP NOT FOUND");
return;
}
uint8_t syx_data[4104];
is->read(&syx_data, 4104);
delete is;
importSysex((char *) &syx_data);
}
void DexedAudioProcessor::unbindUI() {
for (int i = 0; i < ctrl.size(); i++) {
ctrl[i]->unbind();
@ -522,8 +547,8 @@ int DexedAudioProcessor::getCurrentProgram() {
}
void DexedAudioProcessor::setCurrentProgram(int index) {
TRACE("setting program %d state %d", index, bypassVstChangeProgram);
if ( bypassVstChangeProgram ) {
TRACE("setting program %d state", index);
if ( lastStateSave + 2 < time(NULL) ) {
for (int i = 0; i < MAX_ACTIVE_NOTES; i++) {
if (voices[i].keydown == false && voices[i].live == true) {
voices[i].live = false;
@ -533,7 +558,6 @@ void DexedAudioProcessor::setCurrentProgram(int index) {
unpackProgram(index);
lfo.reset(data + 137);
}
bypassVstChangeProgram = 1;
currentProgram = index;
updateUI();
}
@ -588,7 +612,6 @@ void DexedAudioProcessor::setStateInformation(const void* source, int sizeInByte
// used to LOAD plugin state
PluginState state;
bypassVstChangeProgram = 0;
if ( sizeInBytes < sizeof(PluginState) ) {
TRACE("too small plugin state size %d", sizeInBytes);
@ -607,7 +630,8 @@ void DexedAudioProcessor::setStateInformation(const void* source, int sizeInByte
fx.uiCutoff = state.cutoff;
fx.uiReso = state.reso;
// TODO: this should only be set if it is a VST
lastStateSave = (long) time(NULL);
TRACE("setting VST STATE");
updateUI();
}

@ -92,7 +92,8 @@ public:
void setValue(int value);
int getValue();
String getValueDisplay();
int getOffset();
void sliderValueChanged (Slider* moved);
void comboBoxChanged (ComboBox* combo);
void updateComponent();

@ -42,12 +42,13 @@ DexedAudioProcessor::DexedAudioProcessor() {
Tanh::init();
Sin::init();
lastStateSave = 0;
currentNote = -1;
workBlock = NULL;
initCtrl();
setCurrentProgram(0);
sendSysexChange = true;
bypassVstChangeProgram = 1;
}
DexedAudioProcessor::~DexedAudioProcessor() {

@ -65,12 +65,9 @@ class DexedAudioProcessor : public AudioProcessor
char patchNames[32][13];
/**
* This flag is used to ignore change program when a VST chunk has been loaded.
* This is because the VST host will set the chunk value THEN change the program
* number. By doing this, it erase the current state of the program to the
* original one in the cartrige.
* The last time the state was save, to be able to bypass a VST host bug.
*/
bool bypassVstChangeProgram;
long lastStateSave;
/**
* PlugFX
@ -99,7 +96,8 @@ public :
int refreshUI;
bool sendSysexChange;
char data[161];
ScopedPointer<ZipFile> builtin_pgm;
Array<Ctrl*> ctrl;
OperatorCtrl opCtrl[6];
@ -141,7 +139,7 @@ public :
void packProgram(int idx, const char *name);
void unpackProgram(int idx);
void updateProgramFromSysex(const uint8 *rawdata);
void loadBuiltin(int idx);
//==============================================================================
const String getName() const;
int getNumParameters();

Loading…
Cancel
Save