Browse Source

Fixed some issues with IO channel counts in the StandaloneFilterWindow

tags/2021-05-28
Tom Poole 7 years ago
parent
commit
a2a3f32d8f
4 changed files with 40 additions and 17 deletions
  1. +6
    -6
      examples/audio plugin demo/Source/PluginProcessor.cpp
  2. +6
    -2
      modules/juce_audio_basics/synthesisers/juce_Synthesiser.h
  3. +27
    -8
      modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h
  4. +1
    -1
      modules/juce_audio_processors/processors/juce_AudioProcessor.h

+ 6
- 6
examples/audio plugin demo/Source/PluginProcessor.cpp View File

@@ -134,6 +134,12 @@ void JuceDemoPluginAudioProcessor::process (AudioBuffer<FloatType>& buffer,
{
const int numSamples = buffer.getNumSamples();
// In case we have more outputs than inputs, we'll clear any output
// channels that didn't contain input data, (because these aren't
// guaranteed to be empty - they may contain garbage).
for (int i = getTotalNumInputChannels(); i < getTotalNumOutputChannels(); ++i)
buffer.clear (i, 0, numSamples);
// Now pass any incoming midi messages to our keyboard state object, and let it
// add messages to the buffer if the user is clicking on the on-screen keys
keyboardState.processNextMidiBuffer (midiMessages, 0, numSamples, true);
@@ -144,12 +150,6 @@ void JuceDemoPluginAudioProcessor::process (AudioBuffer<FloatType>& buffer,
// Apply our delay effect to the new output..
applyDelay (buffer, delayBuffer);
// In case we have more outputs than inputs, we'll clear any output
// channels that didn't contain input data, (because these aren't
// guaranteed to be empty - they may contain garbage).
for (int i = getTotalNumInputChannels(); i < getTotalNumOutputChannels(); ++i)
buffer.clear (i, 0, numSamples);
applyGain (buffer, delayBuffer); // apply our gain-change to the outgoing data..
// Now ask the host for the current time so we can store it to be displayed later...


+ 6
- 2
modules/juce_audio_basics/synthesisers/juce_Synthesiser.h View File

@@ -523,13 +523,17 @@ public:
const MidiBuffer& inputMidi,
int startSample,
int numSamples)
{ processNextBlock (outputAudio, inputMidi, startSample, numSamples); }
{
processNextBlock (outputAudio, inputMidi, startSample, numSamples);
}
inline void renderNextBlock (AudioBuffer<double>& outputAudio,
const MidiBuffer& inputMidi,
int startSample,
int numSamples)
{ processNextBlock (outputAudio, inputMidi, startSample, numSamples); }
{
processNextBlock (outputAudio, inputMidi, startSample, numSamples);
}
/** Returns the current target sample rate at which rendering is being done.
Subclasses may need to know this so that they can pitch things correctly.


+ 27
- 8
modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h View File

@@ -247,21 +247,40 @@ public:
{
DialogWindow::LaunchOptions o;
auto totalInChannels = processor->getMainBusNumInputChannels();
auto totalOutChannels = processor->getMainBusNumOutputChannels();
int minNumInputs = std::numeric_limits<int>::max(), maxNumInputs = 0,
minNumOutputs = std::numeric_limits<int>::max(), maxNumOutputs = 0;
if (channelConfiguration.size() > 0)
{
auto defaultConfig = channelConfiguration.getReference (0);
totalInChannels = defaultConfig.numIns;
totalOutChannels = defaultConfig.numOuts;
minNumInputs = jmin (minNumInputs, (int) defaultConfig.numIns);
maxNumInputs = jmax (maxNumInputs, (int) defaultConfig.numIns);
minNumOutputs = jmin (minNumOutputs, (int) defaultConfig.numOuts);
maxNumOutputs = jmax (maxNumOutputs, (int) defaultConfig.numOuts);
}
if (auto* bus = processor->getBus (true, 0))
{
auto defaultNumChannels = bus->getDefaultLayout().size();
minNumInputs = jmin (minNumInputs, defaultNumChannels);
maxNumInputs = jmax (maxNumInputs, defaultNumChannels);
}
if (auto* bus = processor->getBus (false, 0))
{
auto defaultNumChannels = bus->getDefaultLayout().size();
minNumOutputs = jmin (minNumOutputs, defaultNumChannels);
maxNumOutputs = jmax (maxNumOutputs, defaultNumChannels);
}
minNumInputs = jmin (minNumInputs, maxNumInputs);
minNumOutputs = jmin (minNumOutputs, maxNumOutputs);
o.content.setOwned (new SettingsComponent (*this, deviceManager,
totalInChannels,
totalInChannels,
totalOutChannels,
totalOutChannels));
minNumInputs,
maxNumInputs,
minNumOutputs,
maxNumOutputs));
o.content->setSize (500, 550);
o.dialogTitle = TRANS("Audio/MIDI Settings");


+ 1
- 1
modules/juce_audio_processors/processors/juce_AudioProcessor.h View File

@@ -357,7 +357,7 @@ public:
//==============================================================================
/** The bus's current layout. This will be AudioChannelSet::disabled() if the current
layout is dfisabled.
layout is disabled.
@see AudioChannelSet
*/
const AudioChannelSet& getCurrentLayout() const noexcept { return layout; }


Loading…
Cancel
Save