diff --git a/Source/LineArtComponent.cpp b/Source/LineArtComponent.cpp index 51d7f10..dc42ca3 100644 --- a/Source/LineArtComponent.cpp +++ b/Source/LineArtComponent.cpp @@ -11,17 +11,22 @@ LineArtComponent::LineArtComponent(OscirenderAudioProcessor& p, OscirenderAudioP addAndMakeVisible(offsetLabel); addAndMakeVisible(offsetBox); - rateLabel.setText("Framerate", juce::dontSendNotification); + animate.setTooltip("Enable or disable animation for line art files"); + sync.setTooltip("Synchronize the animation's framerate with the BPM of the transport stream"); + rateBox.setTooltip("Set the animation's framerate in frames per second"); + offsetBox.setTooltip("Offset the animation's start point by a specified number of frames"); + + rateLabel.setText("Frames per Second", juce::dontSendNotification); rateBox.setJustification(juce::Justification::left); - offsetLabel.setText("Offset", juce::dontSendNotification); + offsetLabel.setText("Start Frame", juce::dontSendNotification); offsetBox.setJustification(juce::Justification::left); update(); auto updateAnimation = [this]() { audioProcessor.animateLineArt->setValueNotifyingHost(animate.getToggleState()); - audioProcessor.syncMIDIAnimation->setValueNotifyingHost(sync.getToggleState()); + audioProcessor.animationSyncBPM->setValueNotifyingHost(sync.getToggleState()); audioProcessor.animationRate->setUnnormalisedValueNotifyingHost(rateBox.getValue()); audioProcessor.animationOffset->setUnnormalisedValueNotifyingHost(offsetBox.getValue()); }; @@ -32,7 +37,7 @@ LineArtComponent::LineArtComponent(OscirenderAudioProcessor& p, OscirenderAudioP offsetBox.onFocusLost = updateAnimation; audioProcessor.animateLineArt->addListener(this); - audioProcessor.syncMIDIAnimation->addListener(this); + audioProcessor.animationSyncBPM->addListener(this); audioProcessor.animationRate->addListener(this); audioProcessor.animationOffset->addListener(this); } @@ -40,7 +45,7 @@ LineArtComponent::LineArtComponent(OscirenderAudioProcessor& p, OscirenderAudioP LineArtComponent::~LineArtComponent() { audioProcessor.animationOffset->removeListener(this); audioProcessor.animationRate->removeListener(this); - audioProcessor.syncMIDIAnimation->removeListener(this); + audioProcessor.animationSyncBPM->removeListener(this); audioProcessor.animateLineArt->removeListener(this); } @@ -54,12 +59,12 @@ void LineArtComponent::resized() { area.removeFromTop(rowSpace); animateBounds = area.removeFromTop(rowHeight); - rateLabel.setBounds(animateBounds.removeFromLeft(80)); + rateLabel.setBounds(animateBounds.removeFromLeft(140)); rateBox.setBounds(animateBounds.removeFromLeft(60)); area.removeFromTop(rowSpace); animateBounds = area.removeFromTop(rowHeight); - offsetLabel.setBounds(animateBounds.removeFromLeft(80)); + offsetLabel.setBounds(animateBounds.removeFromLeft(140)); offsetBox.setBounds(animateBounds.removeFromLeft(60)); } @@ -67,10 +72,17 @@ void LineArtComponent::update() { rateBox.setValue(audioProcessor.animationRate->getValueUnnormalised(), false, 2); offsetBox.setValue(audioProcessor.animationOffset->getValueUnnormalised(), false, 2); animate.setToggleState(audioProcessor.animateLineArt->getValue(), false); - sync.setToggleState(audioProcessor.syncMIDIAnimation->getValue(), false); + sync.setToggleState(audioProcessor.animationSyncBPM->getValue(), false); } void LineArtComponent::parameterValueChanged(int parameterIndex, float newValue) { + if (sync.getToggleState()) { + rateLabel.setText("Frames per Beat", juce::dontSendNotification); + rateBox.setTooltip("Set the animation's framerate in frames per beat"); + } else { + rateLabel.setText("Frames per Second", juce::dontSendNotification); + rateBox.setTooltip("Set the animation's framerate in frames per second"); + } triggerAsyncUpdate(); } diff --git a/Source/LineArtComponent.h b/Source/LineArtComponent.h index 44d66f9..eda67ed 100644 --- a/Source/LineArtComponent.h +++ b/Source/LineArtComponent.h @@ -20,7 +20,7 @@ private: OscirenderAudioProcessorEditor& pluginEditor; juce::ToggleButton animate{"Animate"}; - juce::ToggleButton sync{"MIDI Sync"}; + juce::ToggleButton sync{"BPM Sync"}; juce::Label rateLabel{ "Framerate","Framerate"}; juce::Label offsetLabel{ "Offset","Offset" }; DoubleTextBox rateBox{ audioProcessor.animationRate->min, audioProcessor.animationRate->max }; diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 52fbaf6..febd2f8 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -168,7 +168,7 @@ OscirenderAudioProcessor::OscirenderAudioProcessor() booleanParameters.push_back(midiEnabled); booleanParameters.push_back(inputEnabled); booleanParameters.push_back(animateLineArt); - booleanParameters.push_back(syncMIDIAnimation); + booleanParameters.push_back(animationSyncBPM); for (auto parameter : booleanParameters) { addParameter(parameter); @@ -654,7 +654,7 @@ void OscirenderAudioProcessor::processBlock(juce::AudioBuffer& buffer, ju * if (animateLineArt && (sample % (int)(sampleRate / 200) == 0)) { */ if (animateLineArt->getValue()) { - if (syncMIDIAnimation->getValue()) { + if (animationSyncBPM->getValue()) { animationTime = playTimeBeats; } else { diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index 707ad53..07d336a 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -199,7 +199,7 @@ public: IntParameter* voices = new IntParameter("Voices", "voices", VERSION_HINT, 4, 1, 16); BooleanParameter* animateLineArt = new BooleanParameter("Animate", "animateLineArt", VERSION_HINT, true); - BooleanParameter* syncMIDIAnimation = new BooleanParameter("Sync Animation", "syncMIDIAnimation", VERSION_HINT, false); + BooleanParameter* animationSyncBPM = new BooleanParameter("Sync To BPM", "animationSyncBPM", VERSION_HINT, false); FloatParameter* animationRate = new FloatParameter("Animation Rate", "animationRate", VERSION_HINT, 30, -256, 256, 0.01); FloatParameter* animationOffset = new FloatParameter("Animation Offset", "animationOffset", VERSION_HINT, 0, -8192, 8192, 0.1); double animationTime = 0.f; diff --git a/Source/gpla/LineArtParser.cpp b/Source/gpla/LineArtParser.cpp index 1bce9e7..40889db 100644 --- a/Source/gpla/LineArtParser.cpp +++ b/Source/gpla/LineArtParser.cpp @@ -83,9 +83,8 @@ void LineArtParser::parseJsonFrames(juce::String jsonStr) { } void LineArtParser::setFrame(int fNum) { - // Ensure that the frame number is within the bounds of the number of frames - // This weird modulo trick is to handle negative numbers - frameNumber = (numFrames + (fNum % numFrames)) % numFrames; + // Ensure that the frame number to set is within the bounds of the animation + frameNumber = fNum % numFrames; } std::vector> LineArtParser::draw() { diff --git a/blender/osci_render.zip b/blender/osci_render.zip new file mode 100644 index 0000000..5cb369d Binary files /dev/null and b/blender/osci_render.zip differ