From 63aa06b04487ec20ec81e8fc20f206af0b9737b4 Mon Sep 17 00:00:00 2001 From: bsutherland Date: Mon, 30 Nov 2015 23:29:58 +0900 Subject: [PATCH] Remove record to DRO, add export to SBI. UI needs work. --- Source/PluginGui.cpp | 70 ++++++++++++++++++++++---------------- Source/PluginGui.h | 3 +- Source/PluginProcessor.cpp | 21 ++++++++++++ Source/PluginProcessor.h | 1 + 4 files changed, 64 insertions(+), 31 deletions(-) diff --git a/Source/PluginGui.cpp b/Source/PluginGui.cpp index f506663..bc565c9 100644 --- a/Source/PluginGui.cpp +++ b/Source/PluginGui.cpp @@ -7,7 +7,7 @@ the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded and re-saved. - Created with Introjucer version: 3.1.1 + Created with Introjucer version: 3.1.0 ------------------------------------------------------------------------------ @@ -895,7 +895,7 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter) addAndMakeVisible (recordButton = new ToggleButton ("record button")); recordButton->setTooltip (TRANS("Start recording all register writes to a DRO file - an OPL recording file format defined by DOSBox")); - recordButton->setButtonText (TRANS("Record to DRO")); + recordButton->setButtonText (TRANS("Record to DRO (not working yet)")); recordButton->addListener (this); recordButton->setColour (ToggleButton::textColourId, Colour (0xff007f00)); @@ -922,6 +922,12 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter) percussionLabel->setColour (TextEditor::textColourId, Colours::black); percussionLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + addAndMakeVisible (exportButton = new TextButton ("export button")); + exportButton->setButtonText (TRANS("Export .SBI instrument")); + exportButton->addListener (this); + exportButton->setColour (TextButton::buttonColourId, Colour (0xff007f00)); + exportButton->setColour (TextButton::buttonOnColourId, Colours::lime); + //[UserPreSize] frequencyComboBox->setColour (ComboBox::textColourId, Colour (COLOUR_MID)); @@ -1149,6 +1155,7 @@ PluginGui::~PluginGui() recordButton = nullptr; percussionComboBox = nullptr; percussionLabel = nullptr; + exportButton = nullptr; //[Destructor]. You can add your own custom destruction code here.. @@ -1252,9 +1259,10 @@ void PluginGui::resized() emulatorSlider->setBounds (200, 32, 40, 24); emulatorLabel->setBounds (112, 32, 72, 24); emulatorLabel2->setBounds (248, 32, 72, 24); - recordButton->setBounds (40, 456, 128, 24); + recordButton->setBounds (24, 560, 296, 24); percussionComboBox->setBounds (256, 488, 112, 24); percussionLabel->setBounds (40, 488, 163, 24); + exportButton->setBounds (40, 456, 168, 24); //[UserResized] Add your own custom resize handling here.. for (unsigned int i = 0; i < channels.size(); ++i) channels[i]->setBounds(456+44*i+4, 36, 20, 20); @@ -1576,30 +1584,28 @@ void PluginGui::buttonClicked (Button* buttonThatWasClicked) else if (buttonThatWasClicked == recordButton) { //[UserButtonCode_recordButton] -- add your button handler code here.. - recordButton->setToggleState(false, dontSendNotification); - if (!processor->isAnyInstanceRecording()) { - WildcardFileFilter wildcardFilter ("*.dro", String::empty, "DRO files"); - FileBrowserComponent browser (FileBrowserComponent::saveMode, - File::nonexistent, - &wildcardFilter, - nullptr); - FileChooserDialogBox dialogBox ("Record to", - "Specify DRO output file", - browser, - true, - Colours::darkgreen); - if (dialogBox.show()) - { - File selectedFile = browser.getSelectedFile(0); - processor->startRecording(&selectedFile); - setRecordButtonState(true); - } - } else { - setRecordButtonState(false); - processor->stopRecording(); - } //[/UserButtonCode_recordButton] } + else if (buttonThatWasClicked == exportButton) + { + //[UserButtonCode_exportButton] -- add your button handler code here.. + WildcardFileFilter wildcardFilter("*.sbi", String::empty, "SBI files"); + FileBrowserComponent browser(FileBrowserComponent::saveMode, + File::nonexistent, + &wildcardFilter, + nullptr); + FileChooserDialogBox dialogBox("Export to", + "Specify SBI output file", + browser, + true, + Colours::darkgreen); + if (dialogBox.show()) + { + File selectedFile = browser.getSelectedFile(0); + processor->saveInstrumentToFile(selectedFile.getFullPathName()); + } + //[/UserButtonCode_exportButton] + } //[UserbuttonClicked_Post] //[/UserbuttonClicked_Post] @@ -1918,8 +1924,8 @@ BEGIN_JUCER_METADATA