Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change channel limit from 2 to 32. #228

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pedalboard/BufferUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ juce::AudioBuffer<T> copyPyArrayIntoJuceBuffer(

if (numChannels == 0) {
throw std::runtime_error("No channels passed!");
} else if (numChannels > 2) {
throw std::runtime_error("More than two channels received!");
} else if (numChannels > 32) {
throw std::runtime_error("More than 32 channels received!");
}

juce::AudioBuffer<T> ioBuffer(numChannels, numSamples);
Expand Down Expand Up @@ -173,8 +173,8 @@ const juce::AudioBuffer<T> convertPyArrayIntoJuceBuffer(

if (numChannels == 0) {
throw std::runtime_error("No channels passed!");
} else if (numChannels > 2) {
throw std::runtime_error("More than two channels received!");
} else if (numChannels > 32) {
throw std::runtime_error("More than 32 channels received!");
}

T **channelPointers = (T **)alloca(numChannels * sizeof(T *));
Expand Down
2 changes: 2 additions & 0 deletions tests/plugins/effect/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*/Builds*
*/JuceLibraryCode*
40 changes: 40 additions & 0 deletions tests/plugins/effect/UnityGainNChannel/Source/PluginEditor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
==============================================================================

This file contains the basic framework code for a JUCE plugin editor.

==============================================================================
*/

#include "PluginProcessor.h"
#include "PluginEditor.h"

//==============================================================================
UnityGainNChannelAudioProcessorEditor::UnityGainNChannelAudioProcessorEditor (UnityGainNChannelAudioProcessor& p)
: AudioProcessorEditor (&p), audioProcessor (p)
{
// Make sure that before the constructor has finished, you've set the
// editor's size to whatever you need it to be.
setSize (400, 300);
}

UnityGainNChannelAudioProcessorEditor::~UnityGainNChannelAudioProcessorEditor()
{
}

//==============================================================================
void UnityGainNChannelAudioProcessorEditor::paint (juce::Graphics& g)
{
// (Our component is opaque, so we must completely fill the background with a solid colour)
g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));

g.setColour (juce::Colours::white);
g.setFont (15.0f);
g.drawFittedText ("Hello World!", getLocalBounds(), juce::Justification::centred, 1);
}

void UnityGainNChannelAudioProcessorEditor::resized()
{
// This is generally where you'll want to lay out the positions of any
// subcomponents in your editor..
}
33 changes: 33 additions & 0 deletions tests/plugins/effect/UnityGainNChannel/Source/PluginEditor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
==============================================================================

This file contains the basic framework code for a JUCE plugin editor.

==============================================================================
*/

#pragma once

#include <JuceHeader.h>
#include "PluginProcessor.h"

//==============================================================================
/**
*/
class UnityGainNChannelAudioProcessorEditor : public juce::AudioProcessorEditor
{
public:
UnityGainNChannelAudioProcessorEditor (UnityGainNChannelAudioProcessor&);
~UnityGainNChannelAudioProcessorEditor() override;

//==============================================================================
void paint (juce::Graphics&) override;
void resized() override;

private:
// This reference is provided as a quick way for your editor to
// access the processor object that created it.
UnityGainNChannelAudioProcessor& audioProcessor;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (UnityGainNChannelAudioProcessorEditor)
};
168 changes: 168 additions & 0 deletions tests/plugins/effect/UnityGainNChannel/Source/PluginProcessor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
/*
==============================================================================

This file contains the basic framework code for a JUCE plugin processor.

==============================================================================
*/

#include "PluginProcessor.h"
#include "PluginEditor.h"

//==============================================================================
UnityGainNChannelAudioProcessor::UnityGainNChannelAudioProcessor()
#ifndef JucePlugin_PreferredChannelConfigurations
: AudioProcessor (BusesProperties()
#if ! JucePlugin_IsMidiEffect
#if ! JucePlugin_IsSynth
.withInput ("Input", juce::AudioChannelSet::discreteChannels(32), true)
#endif
.withOutput ("Output", juce::AudioChannelSet::discreteChannels(32), true)
#endif
)
#endif
{
}

UnityGainNChannelAudioProcessor::~UnityGainNChannelAudioProcessor()
{
}

//==============================================================================
const juce::String UnityGainNChannelAudioProcessor::getName() const
{
return JucePlugin_Name;
}

bool UnityGainNChannelAudioProcessor::acceptsMidi() const
{
#if JucePlugin_WantsMidiInput
return true;
#else
return false;
#endif
}

bool UnityGainNChannelAudioProcessor::producesMidi() const
{
#if JucePlugin_ProducesMidiOutput
return true;
#else
return false;
#endif
}

bool UnityGainNChannelAudioProcessor::isMidiEffect() const
{
#if JucePlugin_IsMidiEffect
return true;
#else
return false;
#endif
}

double UnityGainNChannelAudioProcessor::getTailLengthSeconds() const
{
return 0.0;
}

int UnityGainNChannelAudioProcessor::getNumPrograms()
{
return 1; // NB: some hosts don't cope very well if you tell them there are 0 programs,
// so this should be at least 1, even if you're not really implementing programs.
}

int UnityGainNChannelAudioProcessor::getCurrentProgram()
{
return 0;
}

void UnityGainNChannelAudioProcessor::setCurrentProgram (int index)
{
}

const juce::String UnityGainNChannelAudioProcessor::getProgramName (int index)
{
return {};
}

void UnityGainNChannelAudioProcessor::changeProgramName (int index, const juce::String& newName)
{
}

//==============================================================================
void UnityGainNChannelAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock)
{
// Use this method as the place to do any pre-playback
// initialisation that you need..
}

void UnityGainNChannelAudioProcessor::releaseResources()
{
// When playback stops, you can use this as an opportunity to free up any
// spare memory, etc.
}

#ifndef JucePlugin_PreferredChannelConfigurations
bool UnityGainNChannelAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts) const
{
#if JucePlugin_IsMidiEffect
juce::ignoreUnused (layouts);
return true;
#else

// This checks if the input layout matches the output layout
#if ! JucePlugin_IsSynth
if (layouts.getMainOutputChannelSet() != layouts.getMainInputChannelSet())
return false;
#endif

return true;
#endif
}
#endif

void UnityGainNChannelAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer, juce::MidiBuffer& midiMessages)
{
juce::ScopedNoDenormals noDenormals;

for (auto i = 0; i < buffer.getNumSamples(); ++i)
{
for (auto j = 0; j < buffer.getNumChannels(); ++j)
{
*buffer.getWritePointer(j, i) = *buffer.getReadPointer(j, i);
}
}
}

//==============================================================================
bool UnityGainNChannelAudioProcessor::hasEditor() const
{
return true; // (change this to false if you choose to not supply an editor)
}

juce::AudioProcessorEditor* UnityGainNChannelAudioProcessor::createEditor()
{
return new UnityGainNChannelAudioProcessorEditor (*this);
}

//==============================================================================
void UnityGainNChannelAudioProcessor::getStateInformation (juce::MemoryBlock& destData)
{
// You should use this method to store your parameters in the memory block.
// You could do that either as raw data, or use the XML or ValueTree classes
// as intermediaries to make it easy to save and load complex data.
}

void UnityGainNChannelAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
// You should use this method to restore your parameters from this memory block,
// whose contents will have been created by the getStateInformation() call.
}

//==============================================================================
// This creates new instances of the plugin..
juce::AudioProcessor* JUCE_CALLTYPE createPluginFilter()
{
return new UnityGainNChannelAudioProcessor();
}
62 changes: 62 additions & 0 deletions tests/plugins/effect/UnityGainNChannel/Source/PluginProcessor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
==============================================================================

This file contains the basic framework code for a JUCE plugin processor.

==============================================================================
*/

#pragma once

#include <JuceHeader.h>

//==============================================================================
/**
*/
class UnityGainNChannelAudioProcessor : public juce::AudioProcessor
#if JucePlugin_Enable_ARA
, public juce::AudioProcessorARAExtension
#endif
{
public:
//==============================================================================
UnityGainNChannelAudioProcessor();
~UnityGainNChannelAudioProcessor() override;

//==============================================================================
void prepareToPlay (double sampleRate, int samplesPerBlock) override;
void releaseResources() override;

#ifndef JucePlugin_PreferredChannelConfigurations
bool isBusesLayoutSupported (const BusesLayout& layouts) const override;
#endif

void processBlock (juce::AudioBuffer<float>&, juce::MidiBuffer&) override;

//==============================================================================
juce::AudioProcessorEditor* createEditor() override;
bool hasEditor() const override;

//==============================================================================
const juce::String getName() const override;

bool acceptsMidi() const override;
bool producesMidi() const override;
bool isMidiEffect() const override;
double getTailLengthSeconds() const override;

//==============================================================================
int getNumPrograms() override;
int getCurrentProgram() override;
void setCurrentProgram (int index) override;
const juce::String getProgramName (int index) override;
void changeProgramName (int index, const juce::String& newName) override;

//==============================================================================
void getStateInformation (juce::MemoryBlock& destData) override;
void setStateInformation (const void* data, int sizeInBytes) override;

private:
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (UnityGainNChannelAudioProcessor)
};
55 changes: 55 additions & 0 deletions tests/plugins/effect/UnityGainNChannel/UnityGainNChannel.jucer
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>

<JUCERPROJECT id="BK6haA" name="UnityGainNChannel" projectType="audioplug"
useAppConfig="0" addUsingNamespaceToJuceHeader="0" displaySplashScreen="1"
jucerFormatVersion="1">
<MAINGROUP id="l4smPP" name="UnityGainNChannel">
<GROUP id="{0210CB18-7889-3D0B-F8A5-F554843C1CEC}" name="Source">
<FILE id="xRP3IP" name="PluginProcessor.cpp" compile="1" resource="0"
file="Source/PluginProcessor.cpp"/>
<FILE id="bnCQ1V" name="PluginProcessor.h" compile="0" resource="0"
file="Source/PluginProcessor.h"/>
<FILE id="gLKfHv" name="PluginEditor.cpp" compile="1" resource="0"
file="Source/PluginEditor.cpp"/>
<FILE id="Fb7ULJ" name="PluginEditor.h" compile="0" resource="0" file="Source/PluginEditor.h"/>
</GROUP>
</MAINGROUP>
<JUCEOPTIONS JUCE_STRICT_REFCOUNTEDPOINTER="1" JUCE_VST3_CAN_REPLACE_VST2="0"/>
<EXPORTFORMATS>
<VS2017 targetFolder="Builds/VisualStudio2017">
<CONFIGURATIONS>
<CONFIGURATION isDebug="1" name="Debug" targetName="UnityGainNChannel"/>
<CONFIGURATION isDebug="0" name="Release" targetName="UnityGainNChannel"/>
</CONFIGURATIONS>
<MODULEPATHS>
<MODULEPATH id="juce_audio_basics" path="../../../../../../../../JUCE/modules"/>
<MODULEPATH id="juce_audio_devices" path="../../../../../../../../JUCE/modules"/>
<MODULEPATH id="juce_audio_formats" path="../../../../../../../../JUCE/modules"/>
<MODULEPATH id="juce_audio_plugin_client" path="../../../../../../../../JUCE/modules"/>
<MODULEPATH id="juce_audio_processors" path="../../../../../../../../JUCE/modules"/>
<MODULEPATH id="juce_audio_utils" path="../../../../../../../../JUCE/modules"/>
<MODULEPATH id="juce_core" path="../../../../../../../../JUCE/modules"/>
<MODULEPATH id="juce_data_structures" path="../../../../../../../../JUCE/modules"/>
<MODULEPATH id="juce_events" path="../../../../../../../../JUCE/modules"/>
<MODULEPATH id="juce_graphics" path="../../../../../../../../JUCE/modules"/>
<MODULEPATH id="juce_gui_basics" path="../../../../../../../../JUCE/modules"/>
<MODULEPATH id="juce_gui_extra" path="../../../../../../../../JUCE/modules"/>
</MODULEPATHS>
</VS2017>
</EXPORTFORMATS>
<MODULES>
<MODULE id="juce_audio_basics" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULE id="juce_audio_devices" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULE id="juce_audio_formats" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULE id="juce_audio_plugin_client" showAllCode="1" useLocalCopy="0"
useGlobalPath="1"/>
<MODULE id="juce_audio_processors" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULE id="juce_audio_utils" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULE id="juce_core" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULE id="juce_data_structures" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULE id="juce_events" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULE id="juce_graphics" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULE id="juce_gui_basics" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULE id="juce_gui_extra" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
</MODULES>
</JUCERPROJECT>
Binary file not shown.
Loading