Skip to content

Commit

Permalink
Merge pull request #218 from jameshball/3d-audio
Browse files Browse the repository at this point in the history
Refactor audio pipeline + effects to operate in 3D instead of 2D, many QoL improvements
  • Loading branch information
jameshball committed Feb 24, 2024
2 parents 11a58a7 + 9ab8a44 commit 292d8fe
Show file tree
Hide file tree
Showing 142 changed files with 8,759 additions and 1,235 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- release
- 3d-audio
jobs:
build-linux:
name: Build Linux
Expand All @@ -18,7 +19,9 @@ jobs:
- name: "Run script"
run: |
export OS="linux"
./ci/build.sh
source ./ci/setup-env.sh
source ./ci/test.sh
source ./ci/build.sh
shell: bash
- name: Upload Artifact
uses: actions/upload-artifact@v3
Expand All @@ -40,7 +43,9 @@ jobs:
- name: "Run script"
run: |
export OS="mac"
./ci/build.sh
source ./ci/setup-env.sh
source ./ci/test.sh
source ./ci/build.sh
shell: bash
- name: Upload Artifact
uses: actions/upload-artifact@v3
Expand All @@ -62,7 +67,9 @@ jobs:
- name: "Run script"
run: |
export OS="win"
./ci/build.sh
source ./ci/setup-env.sh
source ./ci/test.sh
source ./ci/build.sh
shell: bash
- name: Upload Artifact
uses: actions/upload-artifact@v3
Expand Down
1 change: 1 addition & 0 deletions Resources/svg/delete.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Resources/svg/left_arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Resources/svg/random.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Resources/svg/right_arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 15 additions & 1 deletion Source/EffectsComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ EffectsComponent::EffectsComponent(OscirenderAudioProcessor& p, OscirenderAudioP
};
addAndMakeVisible(addBtn);*/

addAndMakeVisible(randomiseButton);

randomiseButton.setTooltip("Randomise all effect parameter values, randomise which effects are enabled, and randomise their order.");

randomiseButton.onClick = [this] {
itemData.randomise();
listBox.updateContent();
};

{
juce::MessageManagerLock lock;
audioProcessor.broadcaster.addChangeListener(this);
Expand All @@ -38,7 +47,12 @@ EffectsComponent::~EffectsComponent() {
}

void EffectsComponent::resized() {
auto area = getLocalBounds().withTrimmedTop(20).reduced(20);
auto area = getLocalBounds();
auto titleBar = area.removeFromTop(30);
titleBar.removeFromLeft(100);

randomiseButton.setBounds(titleBar.removeFromLeft(20));
area = area.reduced(20);
frequency.setBounds(area.removeFromTop(30));

area.removeFromTop(6);
Expand Down
3 changes: 3 additions & 0 deletions Source/EffectsComponent.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <JuceHeader.h>
#include "LookAndFeel.h"
#include "audio/BitCrushEffect.h"
#include "PluginProcessor.h"
#include "components/DraggableListBox.h"
Expand All @@ -20,6 +21,8 @@ class EffectsComponent : public juce::GroupComponent, public juce::ChangeListene

// juce::TextButton addBtn;

SvgButton randomiseButton{ "randomise", juce::String(BinaryData::random_svg), Colours::accentColor };

AudioEffectListBoxItemData itemData;
EffectsListBoxModel listBoxModel;
DraggableListBox listBox;
Expand Down
2 changes: 1 addition & 1 deletion Source/LegacyProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void OscirenderAudioProcessor::openLegacyProject(const juce::XmlElement* xml) {
if (perspectiveFunction != nullptr) {
auto stream = juce::MemoryOutputStream();
juce::Base64::convertFromBase64(stream, perspectiveFunction->getAllSubText());
perspectiveEffect->updateCode(stream.toString());
customEffect->updateCode(stream.toString());
}

auto fontFamilyXml = xml->getChildByName("fontFamily");
Expand Down
2 changes: 1 addition & 1 deletion Source/LuaComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "PluginEditor.h"

LuaComponent::LuaComponent(OscirenderAudioProcessor& p, OscirenderAudioProcessorEditor& editor) : audioProcessor(p), pluginEditor(editor), slidersModel(sliders, p) {
setText(".lua File Settings");
setText("Lua Settings");

sliders.setModel(&slidersModel);
sliders.setRowHeight(30);
Expand Down
64 changes: 61 additions & 3 deletions Source/MainComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ MainComponent::MainComponent(OscirenderAudioProcessor& p, OscirenderAudioProcess
};

addAndMakeVisible(closeFileButton);
closeFileButton.setButtonText("Close File");

closeFileButton.onClick = [this] {
juce::SpinLock::ScopedLockType lock(audioProcessor.parsersLock);
Expand All @@ -49,9 +48,40 @@ MainComponent::MainComponent(OscirenderAudioProcessor& p, OscirenderAudioProcess
inputEnabled.onClick = [this] {
audioProcessor.inputEnabled->setBoolValueNotifyingHost(!audioProcessor.inputEnabled->getBoolValue());
};
inputEnabled.setTooltip("Enable to use input audio, instead of the generated audio.");

addAndMakeVisible(fileLabel);
fileLabel.setJustificationType(juce::Justification::centred);
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);
Expand Down Expand Up @@ -109,6 +139,8 @@ MainComponent::MainComponent(OscirenderAudioProcessor& p, OscirenderAudioProcess
pluginEditor.removeChildComponent(&pluginEditor.visualiser);
addAndMakeVisible(pluginEditor.visualiser);
}
pluginEditor.visualiser.setFullScreen(pluginEditor.visualiserFullScreen);

pluginEditor.resized();
pluginEditor.repaint();
resized();
Expand Down Expand Up @@ -139,13 +171,18 @@ 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) {
fileLabel.setText("No file open", juce::dontSendNotification);
} else {
fileLabel.setText(audioProcessor.getCurrentFileName(), juce::dontSendNotification);
}

resized();
}

void MainComponent::resized() {
Expand All @@ -163,9 +200,30 @@ void MainComponent::resized() {
row.removeFromLeft(rowPadding);
inputEnabled.setBounds(row.removeFromLeft(20));
row.removeFromLeft(rowPadding);
if (audioProcessor.getCurrentFileIndex() != -1) {
closeFileButton.setBounds(row.removeFromRight(20));
row.removeFromRight(rowPadding);
} else {
closeFileButton.setBounds(juce::Rectangle<int>());
}

auto arrowLeftBounds = row.removeFromLeft(15);
if (showLeftArrow) {
leftArrow.setBounds(arrowLeftBounds);
} else {
leftArrow.setBounds(0, 0, 0, 0);
}
row.removeFromLeft(rowPadding);

auto arrowRightBounds = row.removeFromRight(15);
if (showRightArrow) {
rightArrow.setBounds(arrowRightBounds);
} else {
rightArrow.setBounds(0, 0, 0, 0);
}
row.removeFromRight(rowPadding);

fileLabel.setBounds(row);
bounds.removeFromTop(padding);
closeFileButton.setBounds(bounds.removeFromTop(buttonHeight).removeFromLeft(buttonWidth));

bounds.removeFromTop(padding);
row = bounds.removeFromTop(buttonHeight);
Expand Down
6 changes: 5 additions & 1 deletion Source/MainComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ class MainComponent : public juce::GroupComponent {

std::unique_ptr<juce::FileChooser> chooser;
juce::TextButton fileButton;
juce::TextButton closeFileButton;
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;
Expand Down
119 changes: 0 additions & 119 deletions Source/ObjComponent.cpp

This file was deleted.

35 changes: 0 additions & 35 deletions Source/ObjComponent.h

This file was deleted.

Loading

0 comments on commit 292d8fe

Please sign in to comment.