OpenShot Library | libopenshot-audio
0.2.0
|
27 const bool deleteSourceWhenDeleted)
28 : source (source_, deleteSourceWhenDeleted),
29 requiredNumberOfChannels (2)
31 remappedInfo.
buffer = &buffer;
41 requiredNumberOfChannels = requiredNumberOfChannels_;
48 remappedInputs.
clear();
49 remappedOutputs.
clear();
56 while (remappedInputs.
size() < destIndex)
57 remappedInputs.
add (-1);
59 remappedInputs.
set (destIndex, sourceIndex);
66 while (remappedOutputs.
size() < sourceIndex)
67 remappedOutputs.
add (-1);
69 remappedOutputs.
set (sourceIndex, destIndex);
76 if (inputChannelIndex >= 0 && inputChannelIndex < remappedInputs.
size())
86 if (outputChannelIndex >= 0 && outputChannelIndex < remappedOutputs.
size())
87 return remappedOutputs .
getUnchecked (outputChannelIndex);
95 source->prepareToPlay (samplesPerBlockExpected, sampleRate);
100 source->releaseResources();
107 buffer.
setSize (requiredNumberOfChannels, bufferToFill.
numSamples,
false,
false,
true);
115 if (remappedChan >= 0 && remappedChan < numChans)
130 source->getNextAudioBlock (remappedInfo);
134 for (
int i = 0; i < requiredNumberOfChannels; ++i)
138 if (remappedChan >= 0 && remappedChan < numChans)
155 for (
int i = 0; i < remappedInputs.
size(); ++i)
158 for (
int i = 0; i < remappedOutputs.
size(); ++i)
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());
A special array for holding a list of strings.
void releaseResources() override
Allows the source to release anything it no longer needs after playback has stopped.
void getNextAudioBlock(const AudioSourceChannelInfo &) override
Called repeatedly to fetch subsequent blocks of audio data.
void restoreFromXml(const XmlElement &)
Restores the mappings from an XML object created by createXML().
void setAttribute(const Identifier &attributeName, const String &newValue)
Adds a named attribute to the element.
int getRemappedInputChannel(int inputChannelIndex) const
Returns the channel from our input that will be sent to channel inputChannelIndex of our input audio ...
void clearActiveBufferRegion() const
Convenient method to clear the buffer if the source is not producing any data.
Base class for objects that can produce a continuous stream of audio.
void setNumberOfChannelsToProduce(int requiredNumberOfChannels)
Specifies a number of channels that this audio source must produce from its getNextAudioBlock() callb...
int size() const noexcept
Returns the current number of elements in the array.
int getRemappedOutputChannel(int outputChannelIndex) const
Returns the output channel to which channel outputChannelIndex of our input audio source will be sent...
void setSize(int newNumChannels, int newNumSamples, bool keepExistingContent=false, bool clearExtraSpace=false, bool avoidReallocating=false)
Changes the buffer's size or number of channels.
void add(const ElementType &newElement)
Appends a new element at the end of the array.
Used to build a tree of elements representing an XML document.
void addFrom(int destChannel, int destStartSample, const AudioBuffer &source, int sourceChannel, int sourceStartSample, int numSamples, Type gainToApplyToSource=Type(1)) noexcept
Adds samples from another buffer to this one.
void clear()
Removes all elements from the array.
int startSample
The first sample in the buffer from which the callback is expected to write data.
int numSamples
The number of samples in the buffer which the callback is expected to fill with data.
int size() const noexcept
Returns the number of strings in the array.
void copyFrom(int destChannel, int destStartSample, const AudioBuffer &source, int sourceChannel, int sourceStartSample, int numSamples) noexcept
Copies samples from another buffer to this one.
int getNumChannels() const noexcept
Returns the number of channels of audio data that this buffer contains.
ChannelRemappingAudioSource(AudioSource *source, bool deleteSourceWhenDeleted)
Creates a remapping source that will pass on audio from the given input.
ElementType getUnchecked(int index) const
Returns one of the elements in the array, without checking the index passed in.
~ChannelRemappingAudioSource() override
Destructor.
XmlElement * createXml() const
Returns an XML object to encapsulate the state of the mappings.
AudioBuffer< float > * buffer
The destination buffer to fill with audio data.
Used by AudioSource::getNextAudioBlock().
void setOutputChannelMapping(int sourceChannelIndex, int destChannelIndex)
Creates an output channel mapping.
void prepareToPlay(int samplesPerBlockExpected, double sampleRate) override
Tells the source to prepare for playing.
Automatically locks and unlocks a mutex object.
void clearAllMappings()
Clears any mapped channels.
int addTokens(StringRef stringToTokenise, bool preserveQuotedStrings)
Breaks up a string into tokens and adds them to this array.
void setInputChannelMapping(int destChannelIndex, int sourceChannelIndex)
Creates an input channel mapping.
String trimEnd() const
Returns a copy of this string with any whitespace characters removed from the end.
void set(int indexToChange, ParameterType newValue)
Replaces an element with a new value.
void clear() noexcept
Clears all the samples in all channels.
const String & getStringAttribute(StringRef attributeName) const noexcept
Returns the value of a named attribute.
bool hasTagName(StringRef possibleTagName) const noexcept
Tests whether this element has a particular tag name.