Merge pull request #67 from jameshball/blender

Fix Blender when using MIDI, and change default MIDI enabled
pull/170/head
James H Ball 2023-09-10 19:13:06 +01:00 zatwierdzone przez GitHub
commit 09aebc63a9
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
7 zmienionych plików z 14 dodań i 8 usunięć

Wyświetl plik

@ -4,6 +4,8 @@
MidiComponent::MidiComponent(OscirenderAudioProcessor& p, OscirenderAudioProcessorEditor& editor) : audioProcessor(p), pluginEditor(editor) {
addAndMakeVisible(midiToggle);
addAndMakeVisible(keyboard);
midiToggle.setToggleState(audioProcessor.midiEnabled->getBoolValue(), juce::dontSendNotification);
midiToggle.onClick = [this]() {
audioProcessor.midiEnabled->setBoolValueNotifyingHost(midiToggle.getToggleState());

Wyświetl plik

@ -177,7 +177,7 @@ public:
std::shared_ptr<DelayEffect> delayEffect = std::make_shared<DelayEffect>();
std::shared_ptr<PerspectiveEffect> perspectiveEffect = std::make_shared<PerspectiveEffect>(VERSION_HINT);
BooleanParameter* midiEnabled = new BooleanParameter("MIDI Enabled", "midiEnabled", VERSION_HINT, false);
BooleanParameter* midiEnabled = new BooleanParameter("MIDI Enabled", "midiEnabled", VERSION_HINT, !juce::JUCEApplicationBase::isStandaloneApp());
std::atomic<float> frequency = 440.0f;
juce::SpinLock parsersLock;

Wyświetl plik

@ -26,8 +26,12 @@ bool ShapeSound::appliesToChannel(int channel) {
return true;
}
void ShapeSound::addFrame(std::vector<std::unique_ptr<Shape>>& frame) {
frames.push(std::move(frame));
void ShapeSound::addFrame(std::vector<std::unique_ptr<Shape>>& frame, bool force) {
if (force) {
frames.push(std::move(frame));
} else {
frames.try_push(std::move(frame));
}
}
double ShapeSound::updateFrame(std::vector<std::unique_ptr<Shape>>& frame) {

Wyświetl plik

@ -13,7 +13,7 @@ public:
bool appliesToNote(int note) override;
bool appliesToChannel(int channel) override;
void addFrame(std::vector<std::unique_ptr<Shape>>& frame) override;
void addFrame(std::vector<std::unique_ptr<Shape>>& frame, bool force = true) override;
double updateFrame(std::vector<std::unique_ptr<Shape>>& frame);
std::shared_ptr<FileParser> parser;

Wyświetl plik

@ -135,7 +135,7 @@ void ShapeVoice::renderNextBlock(juce::AudioSampleBuffer& outputBuffer, int star
double drawnFrameLength = traceMaxEnabled ? actualTraceMax * frameLength : frameLength;
if (!renderingSample && frameDrawn >= drawnFrameLength) {
if (sound.load() != nullptr) {
if (sound.load() != nullptr && currentlyPlaying) {
frameLength = sound.load()->updateFrame(frame);
}
// TODO: updateFrame already iterates over all the shapes,

Wyświetl plik

@ -22,7 +22,7 @@ void ObjectServer::run() {
if (connection != nullptr) {
audioProcessor.setObjectServerRendering(true);
while (!threadShouldExit()) {
while (!threadShouldExit() && connection->isConnected()) {
if (connection->waitUntilReady(true, 200) == 1) {
int i = 0;
@ -177,7 +177,7 @@ void ObjectServer::run() {
}
}
audioProcessor.objectServerSound->addFrame(frame);
audioProcessor.objectServerSound->addFrame(frame, false);
}
}
}

Wyświetl plik

@ -6,5 +6,5 @@
class FrameConsumer {
public:
virtual void addFrame(std::vector<std::unique_ptr<Shape>>& frame) = 0;
virtual void addFrame(std::vector<std::unique_ptr<Shape>>& frame, bool force = true) = 0;
};