diff --git a/Resources/svg/left_arrow.svg b/Resources/svg/left_arrow.svg
new file mode 100644
index 0000000..75dcd62
--- /dev/null
+++ b/Resources/svg/left_arrow.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Resources/svg/right_arrow.svg b/Resources/svg/right_arrow.svg
new file mode 100644
index 0000000..a763cfd
--- /dev/null
+++ b/Resources/svg/right_arrow.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Source/MainComponent.cpp b/Source/MainComponent.cpp
index 5224870..b26fd04 100644
--- a/Source/MainComponent.cpp
+++ b/Source/MainComponent.cpp
@@ -48,9 +48,39 @@ MainComponent::MainComponent(OscirenderAudioProcessor& p, OscirenderAudioProcess
inputEnabled.onClick = [this] {
audioProcessor.inputEnabled->setBoolValueNotifyingHost(!audioProcessor.inputEnabled->getBoolValue());
};
+ inputEnabled.setTooltip("Enable to use input audio, instead of osci-render's generated audio.");
+
addAndMakeVisible(fileLabel);
updateFileLabel();
+ addAndMakeVisible(leftArrow);
+ leftArrow.onClick = [this] {
+ juce::SpinLock::ScopedLockType parserLock(audioProcessor.parsersLock);
+ juce::SpinLock::ScopedLockType effectsLock(audioProcessor.effectsLock);
+
+ int index = audioProcessor.getCurrentFileIndex();
+
+ if (index > 0) {
+ audioProcessor.changeCurrentFile(index - 1);
+ pluginEditor.fileUpdated(audioProcessor.getCurrentFileName());
+ }
+ };
+ leftArrow.setTooltip("Change to previous file (k).");
+
+ addAndMakeVisible(rightArrow);
+ rightArrow.onClick = [this] {
+ juce::SpinLock::ScopedLockType parserLock(audioProcessor.parsersLock);
+ juce::SpinLock::ScopedLockType effectsLock(audioProcessor.effectsLock);
+
+ int index = audioProcessor.getCurrentFileIndex();
+
+ if (index < audioProcessor.numFiles() - 1) {
+ audioProcessor.changeCurrentFile(index + 1);
+ pluginEditor.fileUpdated(audioProcessor.getCurrentFileName());
+ }
+ };
+ rightArrow.setTooltip("Change to next file (j).");
+
addAndMakeVisible(fileName);
fileType.addItem(".lua", 1);
@@ -138,6 +168,9 @@ MainComponent::~MainComponent() {
}
void MainComponent::updateFileLabel() {
+ showLeftArrow = audioProcessor.getCurrentFileIndex() > 0;
+ showRightArrow = audioProcessor.getCurrentFileIndex() < audioProcessor.numFiles() - 1;
+
if (audioProcessor.objectServerRendering) {
fileLabel.setText("Rendering from Blender", juce::dontSendNotification);
} else if (audioProcessor.getCurrentFileIndex() == -1) {
@@ -145,6 +178,8 @@ void MainComponent::updateFileLabel() {
} else {
fileLabel.setText(audioProcessor.getCurrentFileName(), juce::dontSendNotification);
}
+
+ resized();
}
void MainComponent::resized() {
@@ -169,6 +204,20 @@ void MainComponent::resized() {
closeFileButton.setBounds(juce::Rectangle());
}
+ if (showLeftArrow) {
+ leftArrow.setBounds(row.removeFromLeft(15));
+ row.removeFromLeft(rowPadding);
+ } else {
+ row.removeFromLeft(15 + rowPadding);
+ leftArrow.setBounds(0, 0, 0, 0);
+ }
+ if (showRightArrow) {
+ rightArrow.setBounds(row.removeFromRight(15));
+ row.removeFromRight(rowPadding);
+ } else {
+ rightArrow.setBounds(0, 0, 0, 0);
+ }
+
fileLabel.setBounds(row);
bounds.removeFromTop(padding);
diff --git a/Source/MainComponent.h b/Source/MainComponent.h
index 66bd9ca..9df7730 100644
--- a/Source/MainComponent.h
+++ b/Source/MainComponent.h
@@ -28,6 +28,10 @@ private:
SvgButton closeFileButton{"closeFile", juce::String(BinaryData::delete_svg), juce::Colours::red};
SvgButton inputEnabled{"inputEnabled", juce::String(BinaryData::microphone_svg), juce::Colours::white, juce::Colours::red, audioProcessor.inputEnabled};
juce::Label fileLabel;
+ SvgButton leftArrow{"leftArrow", juce::String(BinaryData::left_arrow_svg), juce::Colours::white};
+ SvgButton rightArrow{"rightArrow", juce::String(BinaryData::right_arrow_svg), juce::Colours::white};
+ bool showLeftArrow = false;
+ bool showRightArrow = false;
juce::TextEditor fileName;
juce::ComboBox fileType;
diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp
index e64241e..d5b476e 100644
--- a/Source/PluginEditor.cpp
+++ b/Source/PluginEditor.cpp
@@ -127,25 +127,22 @@ void OscirenderAudioProcessorEditor::initialiseCodeEditors() {
void OscirenderAudioProcessorEditor::paint(juce::Graphics& g) {
g.fillAll(getLookAndFeel().findColour(juce::ResizableWindow::backgroundColourId));
+ auto ds = juce::DropShadow(juce::Colours::black, 5, juce::Point(0, 0));
+
if (!usingNativeMenuBar) {
// add drop shadow to the menu bar
- auto ds = juce::DropShadow(juce::Colours::black, 5, juce::Point(0, 0));
ds.drawForRectangle(g, menuBar.getBounds());
}
- // draw drop shadow around code editor if visible
- juce::SpinLock::ScopedLockType lock(audioProcessor.parsersLock);
-
- int originalIndex = audioProcessor.getCurrentFileIndex();
- int index = editingCustomFunction ? 0 : audioProcessor.getCurrentFileIndex() + 1;
- if ((originalIndex != -1 || editingCustomFunction) && index < codeEditors.size() && codeEditors[index]->isVisible()) {
- auto ds = juce::DropShadow(juce::Colours::black, 5, juce::Point(0, 0));
- ds.drawForRectangle(g, codeEditors[index]->getBounds());
-
- if (editingCustomFunction || audioProcessor.getFileName(originalIndex).fromLastOccurrenceOf(".", true, false) == ".lua") {
- ds.drawForRectangle(g, lua.getBounds());
- }
- }
+ for (int i = 0; i < codeEditors.size(); i++) {
+ if (codeEditors[i]->getBounds().getWidth() > 0 && codeEditors[i]->getBounds().getHeight() > 0) {
+ ds.drawForRectangle(g, codeEditors[i]->getBounds());
+ }
+ }
+
+ if (lua.getBounds().getWidth() > 0 && lua.getBounds().getHeight() > 0) {
+ ds.drawForRectangle(g, lua.getBounds());
+ }
}
void OscirenderAudioProcessorEditor::resized() {
diff --git a/Source/parser/FileParser.cpp b/Source/parser/FileParser.cpp
index c3195aa..94c0b34 100644
--- a/Source/parser/FileParser.cpp
+++ b/Source/parser/FileParser.cpp
@@ -54,11 +54,14 @@ Point FileParser::nextSample(lua_State*& L, const LuaVariables vars, long& step,
if (lua != nullptr) {
auto values = lua->run(L, vars, step, phase);
- if (values.size() < 2) {
- return Point();
- }
- return Point(values[0], values[1], values[2]);
+ if (values.size() == 2) {
+ return Point(values[0], values[1], 0);
+ } else if (values.size() > 2) {
+ return Point(values[0], values[1], values[2]);
+ }
}
+
+ return Point();
}
void FileParser::closeLua(lua_State*& L) {
diff --git a/osci-render.jucer b/osci-render.jucer
index 29498ed..7880737 100644
--- a/osci-render.jucer
+++ b/osci-render.jucer
@@ -20,11 +20,13 @@
+
+