27 const bool deleteSourceWhenDeleted)
28 : source (
source_, deleteSourceWhenDeleted),
29 requiredNumberOfChannels (2)
31 remappedInfo.
buffer = &buffer;
48 remappedInputs.
clear();
49 remappedOutputs.
clear();
57 remappedInputs.
add (-1);
67 remappedOutputs.
add (-1);
100 source->releaseResources();
130 source->getNextAudioBlock (remappedInfo);
134 for (
int i = 0; i < requiredNumberOfChannels; ++i)
155 for (
int i = 0; i < remappedInputs.
size(); ++i)
158 for (
int i = 0; i < remappedOutputs.
size(); ++i)
161 e->setAttribute (
"inputs",
ins.trimEnd());
162 e->setAttribute (
"outputs",
outs.trimEnd());
169 if (
e.hasTagName (
"MAPPINGS"))
176 ins.addTokens (
e.getStringAttribute (
"inputs"),
false);
177 outs.addTokens (
e.getStringAttribute (
"outputs"),
false);
179 for (
int i = 0; i <
ins.
size(); ++i)
180 remappedInputs.
add (
ins[i].getIntValue());
182 for (
int i = 0; i <
outs.
size(); ++i)
183 remappedOutputs.
add (
outs[i].getIntValue());
Holds a resizable array of primitive or copy-by-value objects.
ElementType getUnchecked(int index) const
Returns one of the elements in the array, without checking the index passed in.
int size() const noexcept
Returns the current number of elements in the array.
void add(const ElementType &newElement)
Appends a new element at the end of the array.
void set(int indexToChange, ParameterType newValue)
Replaces an element with a new value.
void clear()
Removes all elements from the array.
void setSize(int newNumChannels, int newNumSamples, bool keepExistingContent=false, bool clearExtraSpace=false, bool avoidReallocating=false)
Changes the buffer's size or number of channels.
int getNumChannels() const noexcept
Returns the number of channels of audio data that this buffer contains.
void clear() noexcept
Clears all the samples in all channels.
void copyFrom(int destChannel, int destStartSample, const AudioBuffer &source, int sourceChannel, int sourceStartSample, int numSamples) noexcept
Copies samples from another buffer to this one.
Base class for objects that can produce a continuous stream of audio.
void setOutputChannelMapping(int sourceChannelIndex, int destChannelIndex)
Creates an output channel mapping.
void getNextAudioBlock(const AudioSourceChannelInfo &) override
Called repeatedly to fetch subsequent blocks of audio data.
~ChannelRemappingAudioSource() override
Destructor.
void prepareToPlay(int samplesPerBlockExpected, double sampleRate) override
Tells the source to prepare for playing.
void setNumberOfChannelsToProduce(int requiredNumberOfChannels)
Specifies a number of channels that this audio source must produce from its getNextAudioBlock() callb...
XmlElement * createXml() const
Returns an XML object to encapsulate the state of the mappings.
void restoreFromXml(const XmlElement &)
Restores the mappings from an XML object created by createXML().
void clearAllMappings()
Clears any mapped channels.
void releaseResources() override
Allows the source to release anything it no longer needs after playback has stopped.
int getRemappedInputChannel(int inputChannelIndex) const
Returns the channel from our input that will be sent to channel inputChannelIndex of our input audio ...
int getRemappedOutputChannel(int outputChannelIndex) const
Returns the output channel to which channel outputChannelIndex of our input audio source will be sent...
ChannelRemappingAudioSource(AudioSource *source, bool deleteSourceWhenDeleted)
Creates a remapping source that will pass on audio from the given input.
void setInputChannelMapping(int destChannelIndex, int sourceChannelIndex)
Creates an input channel mapping.
A special array for holding a list of strings.
Used to build a tree of elements representing an XML document.
Used by AudioSource::getNextAudioBlock().
int numSamples
The number of samples in the buffer which the callback is expected to fill with data.
AudioBuffer< float > * buffer
The destination buffer to fill with audio data.
int startSample
The first sample in the buffer from which the callback is expected to write data.