1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-15 00:24:19 +00:00

Replaced some uses of the now-deprecated AudioProcessor::getTotalNumInputChannels()

This commit is contained in:
jules 2015-12-23 09:43:10 +00:00
parent f7524d0d09
commit baab7546f4
8 changed files with 54 additions and 51 deletions

View file

@ -498,8 +498,8 @@ public:
midiTransport = new CEffectMIDITransport (&mMIDIWorld);
midiEvents.ensureSize (2048);
channels.calloc (jmax (juceFilter->getNumInputChannels(),
juceFilter->getNumOutputChannels()));
channels.calloc (jmax (juceFilter->getTotalNumInputChannels(),
juceFilter->getTotalNumOutputChannels()));
juceFilter->setPlayHead (this);
juceFilter->addListener (this);
@ -539,14 +539,14 @@ public:
#if JUCE_DEBUG || JUCE_LOG_ASSERTIONS
const int numMidiEventsComingIn = midiEvents.getNumEvents();
(void) numMidiEventsComingIn;
ignoreUnused (numMidiEventsComingIn);
#endif
{
const ScopedLock sl (juceFilter->getCallbackLock());
const int numIn = juceFilter->getNumInputChannels();
const int numOut = juceFilter->getNumOutputChannels();
const int numIn = juceFilter->getTotalNumInputChannels();
const int numOut = juceFilter->getTotalNumOutputChannels();
const int totalChans = jmax (numIn, numOut);
if (juceFilter->isSuspended())

View file

@ -379,8 +379,8 @@ public:
desc.category = AudioUnitFormatHelpers::getCategory (componentDesc.componentType);
desc.manufacturerName = manufacturer;
desc.version = version;
desc.numInputChannels = getNumInputChannels();
desc.numOutputChannels = getNumOutputChannels();
desc.numInputChannels = getTotalNumInputChannels();
desc.numOutputChannels = getTotalNumOutputChannels();
desc.isInstrument = (componentDesc.componentType == kAudioUnitType_MusicDevice);
}
@ -578,7 +578,7 @@ public:
else
{
// Plugin not working correctly, so just bypass..
for (int i = 0; i < getNumOutputChannels(); ++i)
for (int i = getTotalNumOutputChannels(); --i >= 0;)
buffer.clear (i, 0, buffer.getNumSamples());
}
@ -597,7 +597,7 @@ public:
//==============================================================================
const String getInputChannelName (int index) const override
{
if (isPositiveAndBelow (index, getNumInputChannels()))
if (isPositiveAndBelow (index, getTotalNumInputChannels()))
return "Input " + String (index + 1);
return String();
@ -605,14 +605,14 @@ public:
const String getOutputChannelName (int index) const override
{
if (isPositiveAndBelow (index, getNumOutputChannels()))
if (isPositiveAndBelow (index, getTotalNumOutputChannels()))
return "Output " + String (index + 1);
return String();
}
bool isInputChannelStereoPair (int index) const override { return isPositiveAndBelow (index, getNumInputChannels()); }
bool isOutputChannelStereoPair (int index) const override { return isPositiveAndBelow (index, getNumOutputChannels()); }
bool isInputChannelStereoPair (int index) const override { return isPositiveAndBelow (index, getTotalNumInputChannels()); }
bool isOutputChannelStereoPair (int index) const override { return isPositiveAndBelow (index, getTotalNumOutputChannels()); }
//==============================================================================
int getNumParameters() override { return parameters.size(); }

View file

@ -225,8 +225,8 @@ public:
desc.category = getCategory();
desc.manufacturerName = plugin != nullptr ? String (plugin->Maker) : String();
desc.version = getVersion();
desc.numInputChannels = getNumInputChannels();
desc.numOutputChannels = getNumOutputChannels();
desc.numInputChannels = getTotalNumInputChannels();
desc.numOutputChannels = getTotalNumOutputChannels();
desc.isInstrument = false;
}
@ -327,16 +327,16 @@ public:
jassertfalse; // no callback to use?
}
for (int i = getNumInputChannels(); i < getNumOutputChannels(); ++i)
for (int i = getTotalNumInputChannels(), e = getTotalNumOutputChannels(); i < e; ++i)
buffer.clear (i, 0, numSamples);
}
bool isInputChannelStereoPair (int index) const { return isPositiveAndBelow (index, getNumInputChannels()); }
bool isOutputChannelStereoPair (int index) const { return isPositiveAndBelow (index, getNumInputChannels()); }
bool isInputChannelStereoPair (int index) const { return isPositiveAndBelow (index, getTotalNumInputChannels()); }
bool isOutputChannelStereoPair (int index) const { return isPositiveAndBelow (index, getTotalNumOutputChannels()); }
const String getInputChannelName (const int index) const
{
if (isPositiveAndBelow (index, getNumInputChannels()))
if (isPositiveAndBelow (index, getTotalNumInputChannels()))
return String (plugin->PortNames [inputs [index]]).trim();
return String();
@ -344,7 +344,7 @@ public:
const String getOutputChannelName (const int index) const
{
if (isPositiveAndBelow (index, getNumInputChannels()))
if (isPositiveAndBelow (index, getTotalNumInputChannels()))
return String (plugin->PortNames [outputs [index]]).trim();
return String();

View file

@ -1665,8 +1665,8 @@ public:
createPluginDescription (description, module->file,
company, module->name,
*info, info2, infoW,
getNumInputChannels(),
getNumOutputChannels());
getTotalNumInputChannels(),
getTotalNumOutputChannels());
}
void* getPlatformSpecificData() override { return component; }
@ -1808,7 +1808,7 @@ public:
updateTimingInformation (data, getSampleRate());
for (int i = getNumInputChannels(); i < buffer.getNumChannels(); ++i)
for (int i = getTotalNumInputChannels(); i < buffer.getNumChannels(); ++i)
buffer.clear (i, 0, numSamples);
associateTo (data, buffer);
@ -1845,18 +1845,14 @@ public:
bool isInputChannelStereoPair (int channelIndex) const override
{
if (channelIndex < 0 || channelIndex >= getNumInputChannels())
return false;
return getBusInfo (true, true).channelCount == 2;
return isPositiveAndBelow (channelIndex, getTotalNumInputChannels())
&& getBusInfo (true, true).channelCount == 2;
}
bool isOutputChannelStereoPair (int channelIndex) const override
{
if (channelIndex < 0 || channelIndex >= getNumOutputChannels())
return false;
return getBusInfo (false, true).channelCount == 2;
return isPositiveAndBelow (channelIndex, getTotalNumOutputChannels())
&& getBusInfo (false, true).channelCount == 2;
}
bool acceptsMidi() const override { return getBusInfo (true, false).channelCount > 0; }

View file

@ -815,8 +815,8 @@ public:
}
desc.version = getVersion();
desc.numInputChannels = getNumInputChannels();
desc.numOutputChannels = getNumOutputChannels();
desc.numInputChannels = getTotalNumInputChannels();
desc.numOutputChannels = getTotalNumOutputChannels();
desc.isInstrument = (effect != nullptr && (effect->flags & effFlagsIsSynth) != 0);
}
@ -1017,7 +1017,7 @@ public:
//==============================================================================
const String getInputChannelName (int index) const override
{
if (index >= 0 && index < getNumInputChannels())
if (isValidChannel (index, true))
{
VstPinProperties pinProps;
if (dispatch (effGetInputProperties, index, 0, &pinProps, 0.0f) != 0)
@ -1029,7 +1029,7 @@ public:
bool isInputChannelStereoPair (int index) const override
{
if (index < 0 || index >= getNumInputChannels())
if (! isValidChannel (index, true))
return false;
VstPinProperties pinProps;
@ -1041,7 +1041,7 @@ public:
const String getOutputChannelName (int index) const override
{
if (index >= 0 && index < getNumOutputChannels())
if (isValidChannel (index, false))
{
VstPinProperties pinProps;
if (dispatch (effGetOutputProperties, index, 0, &pinProps, 0.0f) != 0)
@ -1053,7 +1053,7 @@ public:
bool isOutputChannelStereoPair (int index) const override
{
if (index < 0 || index >= getNumOutputChannels())
if (! isValidChannel (index, false))
return false;
VstPinProperties pinProps;
@ -1063,9 +1063,10 @@ public:
return true;
}
bool isValidChannel (int index, bool isInput) const
bool isValidChannel (int index, bool isInput) const noexcept
{
return isPositiveAndBelow (index, isInput ? getNumInputChannels() : getNumOutputChannels());
return isPositiveAndBelow (index, isInput ? getTotalNumInputChannels()
: getTotalNumOutputChannels());
}
//==============================================================================
@ -1686,7 +1687,7 @@ private:
else
{
// Not initialised, so just bypass..
for (int i = 0; i < getNumOutputChannels(); ++i)
for (int i = getTotalNumOutputChannels(); --i >= 0;)
buffer.clear (i, 0, buffer.getNumSamples());
}