kopia lustrzana https://github.com/jameshball/osci-render
Merge pull request #67 from jameshball/blender
Fix Blender when using MIDI, and change default MIDI enabledpull/170/head
commit
09aebc63a9
|
@ -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());
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
};
|
Ładowanie…
Reference in New Issue