kopia lustrzana https://github.com/jameshball/osci-render
Add tooltips and change references
rodzic
27a2d12f42
commit
bbdd98d34f
|
@ -11,17 +11,22 @@ LineArtComponent::LineArtComponent(OscirenderAudioProcessor& p, OscirenderAudioP
|
||||||
addAndMakeVisible(offsetLabel);
|
addAndMakeVisible(offsetLabel);
|
||||||
addAndMakeVisible(offsetBox);
|
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);
|
rateBox.setJustification(juce::Justification::left);
|
||||||
|
|
||||||
offsetLabel.setText("Offset", juce::dontSendNotification);
|
offsetLabel.setText("Start Frame", juce::dontSendNotification);
|
||||||
offsetBox.setJustification(juce::Justification::left);
|
offsetBox.setJustification(juce::Justification::left);
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
|
||||||
auto updateAnimation = [this]() {
|
auto updateAnimation = [this]() {
|
||||||
audioProcessor.animateLineArt->setValueNotifyingHost(animate.getToggleState());
|
audioProcessor.animateLineArt->setValueNotifyingHost(animate.getToggleState());
|
||||||
audioProcessor.syncMIDIAnimation->setValueNotifyingHost(sync.getToggleState());
|
audioProcessor.animationSyncBPM->setValueNotifyingHost(sync.getToggleState());
|
||||||
audioProcessor.animationRate->setUnnormalisedValueNotifyingHost(rateBox.getValue());
|
audioProcessor.animationRate->setUnnormalisedValueNotifyingHost(rateBox.getValue());
|
||||||
audioProcessor.animationOffset->setUnnormalisedValueNotifyingHost(offsetBox.getValue());
|
audioProcessor.animationOffset->setUnnormalisedValueNotifyingHost(offsetBox.getValue());
|
||||||
};
|
};
|
||||||
|
@ -32,7 +37,7 @@ LineArtComponent::LineArtComponent(OscirenderAudioProcessor& p, OscirenderAudioP
|
||||||
offsetBox.onFocusLost = updateAnimation;
|
offsetBox.onFocusLost = updateAnimation;
|
||||||
|
|
||||||
audioProcessor.animateLineArt->addListener(this);
|
audioProcessor.animateLineArt->addListener(this);
|
||||||
audioProcessor.syncMIDIAnimation->addListener(this);
|
audioProcessor.animationSyncBPM->addListener(this);
|
||||||
audioProcessor.animationRate->addListener(this);
|
audioProcessor.animationRate->addListener(this);
|
||||||
audioProcessor.animationOffset->addListener(this);
|
audioProcessor.animationOffset->addListener(this);
|
||||||
}
|
}
|
||||||
|
@ -40,7 +45,7 @@ LineArtComponent::LineArtComponent(OscirenderAudioProcessor& p, OscirenderAudioP
|
||||||
LineArtComponent::~LineArtComponent() {
|
LineArtComponent::~LineArtComponent() {
|
||||||
audioProcessor.animationOffset->removeListener(this);
|
audioProcessor.animationOffset->removeListener(this);
|
||||||
audioProcessor.animationRate->removeListener(this);
|
audioProcessor.animationRate->removeListener(this);
|
||||||
audioProcessor.syncMIDIAnimation->removeListener(this);
|
audioProcessor.animationSyncBPM->removeListener(this);
|
||||||
audioProcessor.animateLineArt->removeListener(this);
|
audioProcessor.animateLineArt->removeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,12 +59,12 @@ void LineArtComponent::resized() {
|
||||||
area.removeFromTop(rowSpace);
|
area.removeFromTop(rowSpace);
|
||||||
|
|
||||||
animateBounds = area.removeFromTop(rowHeight);
|
animateBounds = area.removeFromTop(rowHeight);
|
||||||
rateLabel.setBounds(animateBounds.removeFromLeft(80));
|
rateLabel.setBounds(animateBounds.removeFromLeft(140));
|
||||||
rateBox.setBounds(animateBounds.removeFromLeft(60));
|
rateBox.setBounds(animateBounds.removeFromLeft(60));
|
||||||
area.removeFromTop(rowSpace);
|
area.removeFromTop(rowSpace);
|
||||||
|
|
||||||
animateBounds = area.removeFromTop(rowHeight);
|
animateBounds = area.removeFromTop(rowHeight);
|
||||||
offsetLabel.setBounds(animateBounds.removeFromLeft(80));
|
offsetLabel.setBounds(animateBounds.removeFromLeft(140));
|
||||||
offsetBox.setBounds(animateBounds.removeFromLeft(60));
|
offsetBox.setBounds(animateBounds.removeFromLeft(60));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,10 +72,17 @@ void LineArtComponent::update() {
|
||||||
rateBox.setValue(audioProcessor.animationRate->getValueUnnormalised(), false, 2);
|
rateBox.setValue(audioProcessor.animationRate->getValueUnnormalised(), false, 2);
|
||||||
offsetBox.setValue(audioProcessor.animationOffset->getValueUnnormalised(), false, 2);
|
offsetBox.setValue(audioProcessor.animationOffset->getValueUnnormalised(), false, 2);
|
||||||
animate.setToggleState(audioProcessor.animateLineArt->getValue(), false);
|
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) {
|
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();
|
triggerAsyncUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ private:
|
||||||
OscirenderAudioProcessorEditor& pluginEditor;
|
OscirenderAudioProcessorEditor& pluginEditor;
|
||||||
|
|
||||||
juce::ToggleButton animate{"Animate"};
|
juce::ToggleButton animate{"Animate"};
|
||||||
juce::ToggleButton sync{"MIDI Sync"};
|
juce::ToggleButton sync{"BPM Sync"};
|
||||||
juce::Label rateLabel{ "Framerate","Framerate"};
|
juce::Label rateLabel{ "Framerate","Framerate"};
|
||||||
juce::Label offsetLabel{ "Offset","Offset" };
|
juce::Label offsetLabel{ "Offset","Offset" };
|
||||||
DoubleTextBox rateBox{ audioProcessor.animationRate->min, audioProcessor.animationRate->max };
|
DoubleTextBox rateBox{ audioProcessor.animationRate->min, audioProcessor.animationRate->max };
|
||||||
|
|
|
@ -168,7 +168,7 @@ OscirenderAudioProcessor::OscirenderAudioProcessor()
|
||||||
booleanParameters.push_back(midiEnabled);
|
booleanParameters.push_back(midiEnabled);
|
||||||
booleanParameters.push_back(inputEnabled);
|
booleanParameters.push_back(inputEnabled);
|
||||||
booleanParameters.push_back(animateLineArt);
|
booleanParameters.push_back(animateLineArt);
|
||||||
booleanParameters.push_back(syncMIDIAnimation);
|
booleanParameters.push_back(animationSyncBPM);
|
||||||
|
|
||||||
for (auto parameter : booleanParameters) {
|
for (auto parameter : booleanParameters) {
|
||||||
addParameter(parameter);
|
addParameter(parameter);
|
||||||
|
@ -654,7 +654,7 @@ void OscirenderAudioProcessor::processBlock(juce::AudioBuffer<float>& buffer, ju
|
||||||
* if (animateLineArt && (sample % (int)(sampleRate / 200) == 0)) {
|
* if (animateLineArt && (sample % (int)(sampleRate / 200) == 0)) {
|
||||||
*/
|
*/
|
||||||
if (animateLineArt->getValue()) {
|
if (animateLineArt->getValue()) {
|
||||||
if (syncMIDIAnimation->getValue()) {
|
if (animationSyncBPM->getValue()) {
|
||||||
animationTime = playTimeBeats;
|
animationTime = playTimeBeats;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -199,7 +199,7 @@ public:
|
||||||
IntParameter* voices = new IntParameter("Voices", "voices", VERSION_HINT, 4, 1, 16);
|
IntParameter* voices = new IntParameter("Voices", "voices", VERSION_HINT, 4, 1, 16);
|
||||||
|
|
||||||
BooleanParameter* animateLineArt = new BooleanParameter("Animate", "animateLineArt", VERSION_HINT, true);
|
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* 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);
|
FloatParameter* animationOffset = new FloatParameter("Animation Offset", "animationOffset", VERSION_HINT, 0, -8192, 8192, 0.1);
|
||||||
double animationTime = 0.f;
|
double animationTime = 0.f;
|
||||||
|
|
|
@ -83,9 +83,8 @@ void LineArtParser::parseJsonFrames(juce::String jsonStr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LineArtParser::setFrame(int fNum) {
|
void LineArtParser::setFrame(int fNum) {
|
||||||
// Ensure that the frame number is within the bounds of the number of frames
|
// Ensure that the frame number to set is within the bounds of the animation
|
||||||
// This weird modulo trick is to handle negative numbers
|
frameNumber = fNum % numFrames;
|
||||||
frameNumber = (numFrames + (fNum % numFrames)) % numFrames;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::unique_ptr<Shape>> LineArtParser::draw() {
|
std::vector<std::unique_ptr<Shape>> LineArtParser::draw() {
|
||||||
|
|
Plik binarny nie jest wyświetlany.
Ładowanie…
Reference in New Issue