本文整理汇总了C++中AudioChannelSet::size方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioChannelSet::size方法的具体用法?C++ AudioChannelSet::size怎么用?C++ AudioChannelSet::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AudioChannelSet
的用法示例。
在下文中一共展示了AudioChannelSet::size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InternalPlugin
InternalPlugin (const PluginDescription& descr,
const AudioChannelSet& channelSetToUse = AudioChannelSet::stereo())
: AudioPluginInstance (getBusProperties (descr.numInputChannels == 0, channelSetToUse)),
name (descr.fileOrIdentifier.upToFirstOccurrenceOf (":", false, false)),
state (descr.fileOrIdentifier.fromFirstOccurrenceOf (":", false, false)),
isGenerator (descr.numInputChannels == 0),
hasMidi (descr.isInstrument),
channelSet (channelSetToUse)
{
jassert (channelSetToUse.size() == descr.numOutputChannels);
}
示例2: setPreferredBusArrangement
//==============================================================================
bool setPreferredBusArrangement (bool isInputBus, int busIndex,
const AudioChannelSet& preferred) override
{
const int numChannels = preferred.size();
// do not allow disabling channels
if (numChannels == 0) return false;
// always have the same channel layout on both input and output on the main bus
if (! AudioProcessor::setPreferredBusArrangement (! isInputBus, busIndex, preferred))
return false;
return AudioProcessor::setPreferredBusArrangement (isInputBus, busIndex, preferred);
}
示例3: setPreferredBusArrangement
//==============================================================================
bool setPreferredBusArrangement (bool isInputBus, int busIndex,
const AudioChannelSet& preferred) override
{
const int numChannels = preferred.size();
const bool isMainBus = (busIndex == 0);
// do not allow disabling the main output bus
if (isMainBus && preferred.isDisabled()) return false;
// only support mono or stereo (or disabling) buses
if (numChannels > 2) return false;
// pass the call on to the base class
return AudioProcessor::setPreferredBusArrangement (isInputBus, busIndex, preferred);
}
示例4: setPreferredBusArrangement
bool EQPluginProcessor::setPreferredBusArrangement (bool isInput, int bus, const AudioChannelSet& preferredSet)
{
// Reject any bus arrangements that are not compatible with your plugin
const int numChannels = preferredSet.size ();
#if JucePlugin_IsMidiEffect
if (numChannels != 0) return false;
#elif JucePlugin_IsSynth
if (isInput || (numChannels != 1 && numChannels != 2)) return false;
#else
if (numChannels != 1 && numChannels != 2) return false;
if (!AudioProcessor::setPreferredBusArrangement (!isInput, bus, preferredSet)) return false;
#endif
return AudioProcessor::setPreferredBusArrangement (isInput, bus, preferredSet) &&
mAudealizeAudioProcessor->setPreferredBusArrangement (isInput, bus, preferredSet);
}
示例5: setPreferredBusArrangement
//==============================================================================
bool AudioProcessor::setPreferredBusArrangement (bool isInput, int busIndex, const AudioChannelSet& preferredSet)
{
const int oldNumInputs = getTotalNumInputChannels();
const int oldNumOutputs = getTotalNumOutputChannels();
Array<AudioProcessorBus>& buses = isInput ? busArrangement.inputBuses : busArrangement.outputBuses;
const int numBuses = buses.size();
if (! isPositiveAndBelow (busIndex, numBuses))
return false;
#ifdef JucePlugin_MaxNumInputChannels
if (isInput && preferredSet.size() > JucePlugin_MaxNumInputChannels)
return false;
#endif
#ifdef JucePlugin_MaxNumOutputChannels
if (! isInput && preferredSet.size() > JucePlugin_MaxNumOutputChannels)
return false;
#endif
AudioProcessorBus& bus = buses.getReference (busIndex);
#ifdef JucePlugin_PreferredChannelConfigurations
// the user is using the deprecated way to specify channel configurations
if (numBuses > 0 && busIndex == 0)
{
const short channelConfigs[][2] = { JucePlugin_PreferredChannelConfigurations };
const int numChannelConfigs = sizeof (channelConfigs) / sizeof (*channelConfigs);
// we need the main bus in the opposite direction
Array<AudioProcessorBus>& oppositeBuses = isInput ? busArrangement.outputBuses : busArrangement.inputBuses;
AudioProcessorBus* oppositeBus = (busIndex < oppositeBuses.size()) ? &oppositeBuses.getReference (0) : nullptr;
// get the target number of channels
const int mainBusNumChannels = preferredSet.size();
const int mainBusOppositeChannels = (oppositeBus != nullptr) ? oppositeBus->channels.size() : 0;
const int dir = isInput ? 0 : 1;
// find a compatible channel configuration on the opposite bus which is the closest match
// to the current number of channels on that bus
int distance = std::numeric_limits<int>::max();
int bestConfiguration = -1;
for (int i = 0; i < numChannelConfigs; ++i)
{
// is the configuration compatible with the preferred set
if (channelConfigs[i][dir] == mainBusNumChannels)
{
const int configChannels = channelConfigs[i][dir^1];
const int channelDifference = std::abs (configChannels - mainBusOppositeChannels);
if (channelDifference < distance)
{
distance = channelDifference;
bestConfiguration = configChannels;
// we can exit if we found a perfect match
if (distance == 0)
break;
}
}
}
// unable to find a good configuration
if (bestConfiguration == -1)
return false;
// did the number of channels change on the opposite bus?
if (mainBusOppositeChannels != bestConfiguration && oppositeBus != nullptr)
{
// if the channels on the opposite bus are the same as the preferred set
// then also copy over the layout information. If not, then assume
// a cononical channel layout
if (bestConfiguration == mainBusNumChannels)
oppositeBus->channels = preferredSet;
else
oppositeBus->channels = AudioChannelSet::canonicalChannelSet (bestConfiguration);
}
}
#endif
bus.channels = preferredSet;
if (oldNumInputs != getTotalNumInputChannels() || oldNumOutputs != getTotalNumOutputChannels())
{
updateSpeakerFormatStrings();
numChannelsChanged();
}
return true;
}