diff --git a/Source/MidiComponent.cpp b/Source/MidiComponent.cpp index 4e1861c..6ce5ee5 100644 --- a/Source/MidiComponent.cpp +++ b/Source/MidiComponent.cpp @@ -38,6 +38,13 @@ MidiComponent::MidiComponent(OscirenderAudioProcessor& p, OscirenderAudioProcess envelope.addListener(&audioProcessor); envelope.setGrid(EnvelopeComponent::GridBoth, EnvelopeComponent::GridNone, 0.1, 0.25); + if (juce::JUCEApplicationBase::isStandaloneApp()) { + addAndMakeVisible(midiSettingsButton); + midiSettingsButton.onClick = [this]() { + pluginEditor.openAudioSettings(); + }; + } + audioProcessor.attackTime->addListener(this); audioProcessor.attackLevel->addListener(this); audioProcessor.attackShape->addListener(this); @@ -105,6 +112,9 @@ void MidiComponent::resized() { midiToggle.setBounds(topRow.removeFromLeft(120)); topRow.removeFromLeft(80); voicesSlider.setBounds(topRow.removeFromLeft(250)); + if (midiSettingsButton.isVisible()) { + midiSettingsButton.setBounds(topRow.removeFromRight(160)); + } area.removeFromTop(5); keyboard.setBounds(area.removeFromBottom(50)); envelope.setBounds(area); diff --git a/Source/MidiComponent.h b/Source/MidiComponent.h index 3469967..ff272b1 100644 --- a/Source/MidiComponent.h +++ b/Source/MidiComponent.h @@ -22,6 +22,7 @@ private: juce::ToggleButton midiToggle{"Enable MIDI"}; juce::Slider voicesSlider; juce::Label voicesLabel; + juce::TextButton midiSettingsButton{"Audio/MIDI Settings..."}; juce::MidiKeyboardComponent keyboard{audioProcessor.keyboardState, juce::MidiKeyboardComponent::horizontalKeyboard}; EnvelopeContainerComponent envelope; diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index b10d96e..e71ab95 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -58,7 +58,7 @@ OscirenderAudioProcessorEditor::OscirenderAudioProcessorEditor(OscirenderAudioPr audioProcessor.broadcaster.addChangeListener(this); } - if (audioProcessor.wrapperType == juce::AudioProcessor::WrapperType::wrapperType_Standalone) { + if (juce::JUCEApplicationBase::isStandaloneApp()) { if (juce::TopLevelWindow::getNumTopLevelWindows() == 1) { juce::TopLevelWindow* w = juce::TopLevelWindow::getTopLevelWindow(0); juce::DocumentWindow* dw = dynamic_cast(w); @@ -68,6 +68,11 @@ OscirenderAudioProcessorEditor::OscirenderAudioProcessorEditor(OscirenderAudioPr dw->setUsingNativeTitleBar(true); } } + + juce::StandalonePluginHolder* standalone = juce::StandalonePluginHolder::getInstance(); + if (standalone != nullptr) { + standalone->getMuteInputValue().setValue(false); + } } setSize(1100, 750); diff --git a/Source/audio/ShapeVoice.cpp b/Source/audio/ShapeVoice.cpp index 846cfeb..b992387 100644 --- a/Source/audio/ShapeVoice.cpp +++ b/Source/audio/ShapeVoice.cpp @@ -156,6 +156,9 @@ void ShapeVoice::renderNextBlock(juce::AudioSampleBuffer& outputBuffer, int star if (!renderingSample && frameDrawn >= drawnFrameLength) { if (sound.load() != nullptr && currentlyPlaying) { frameLength = sound.load()->updateFrame(frame); + frameDrawn = 0.0; + shapeDrawn = 0.0; + currentShape = 0; } frameDrawn = 0.0; shapeDrawn = 0.0; diff --git a/Source/components/AudioRecordingComponent.h b/Source/components/AudioRecordingComponent.h index 9f30bdd..23561f2 100644 --- a/Source/components/AudioRecordingComponent.h +++ b/Source/components/AudioRecordingComponent.h @@ -287,10 +287,13 @@ private: | juce::FileBrowserComponent::warnAboutOverwriting, [this](const juce::FileChooser& c) { if (juce::FileInputStream inputStream(lastRecording); inputStream.openedOk()) { - if (const auto outputStream = c.getURLResult().getLocalFile().createOutputStream()) { - outputStream->setPosition(0); - outputStream->truncate(); - outputStream->writeFromInputStream(inputStream, -1); + juce::URL url = c.getURLResult(); + if (url.isLocalFile()) { + if (const auto outputStream = url.getLocalFile().createOutputStream()) { + outputStream->setPosition(0); + outputStream->truncate(); + outputStream->writeFromInputStream(inputStream, -1); + } } } diff --git a/Source/obj/ObjectServer.cpp b/Source/obj/ObjectServer.cpp index e9503f5..57d7a6c 100644 --- a/Source/obj/ObjectServer.cpp +++ b/Source/obj/ObjectServer.cpp @@ -38,9 +38,11 @@ void ObjectServer::run() { std::memcpy(message.get() + i, buffer, bytesRead); i += bytesRead; - if (message[i] == '\n') { - message[i] = '\0'; - break; + for (int j = i - bytesRead; j < i; j++) { + if (message[j] == '\n') { + message[j] = '\0'; + break; + } } } diff --git a/osci-render.jucer b/osci-render.jucer index 93a1af8..d953602 100644 --- a/osci-render.jucer +++ b/osci-render.jucer @@ -5,7 +5,7 @@ pluginCharacteristicsValue="pluginProducesMidiOut,pluginWantsMidiIn" pluginManufacturer="jameshball" aaxIdentifier="sh.ball.oscirender" cppLanguageStandard="20" projectLineFeed=" " headerPath="./include" - version="2.0.7" companyName="James H Ball" companyWebsite="https://osci-render.com" + version="2.0.8" companyName="James H Ball" companyWebsite="https://osci-render.com" companyEmail="james@ball.sh">