Loading...
Searching...
No Matches
juce_ChannelRemappingAudioSource.h
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2022 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
To use, copy, modify, and/or distribute this software for any purpose with or
without fee is hereby granted provided that the above copyright notice and
this permission notice appear in all copies.
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
namespace juce
{
//==============================================================================
class ChannelRemappingAudioSource : public AudioSource
{
public:
//==============================================================================
ChannelRemappingAudioSource (AudioSource* source,
bool deleteSourceWhenDeleted);
~ChannelRemappingAudioSource() override;
//==============================================================================
void setNumberOfChannelsToProduce (int requiredNumberOfChannels);
void clearAllMappings();
void setInputChannelMapping (int destChannelIndex,
int sourceChannelIndex);
void setOutputChannelMapping (int sourceChannelIndex,
int destChannelIndex);
int getRemappedInputChannel (int inputChannelIndex) const;
int getRemappedOutputChannel (int outputChannelIndex) const;
//==============================================================================
std::unique_ptr<XmlElement> createXml() const;
void restoreFromXml (const XmlElement&);
//==============================================================================
void prepareToPlay (int samplesPerBlockExpected, double sampleRate) override;
void releaseResources() override;
void getNextAudioBlock (const AudioSourceChannelInfo&) override;
private:
//==============================================================================
OptionalScopedPointer<AudioSource> source;
Array<int> remappedInputs, remappedOutputs;
int requiredNumberOfChannels;
AudioBuffer<float> buffer;
AudioSourceChannelInfo remappedInfo;
CriticalSection lock;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ChannelRemappingAudioSource)
};
} // namespace juce
juce::Array
Definition juce_Array.h:56
juce::AudioBuffer
Definition juce_AudioSampleBuffer.h:34
juce::AudioSource::AudioSource
AudioSource()=default
juce::ChannelRemappingAudioSource::setOutputChannelMapping
void setOutputChannelMapping(int sourceChannelIndex, int destChannelIndex)
Definition juce_ChannelRemappingAudioSource.cpp:62
juce::ChannelRemappingAudioSource::getNextAudioBlock
void getNextAudioBlock(const AudioSourceChannelInfo &) override
Definition juce_ChannelRemappingAudioSource.cpp:103
juce::ChannelRemappingAudioSource::~ChannelRemappingAudioSource
~ChannelRemappingAudioSource() override
Definition juce_ChannelRemappingAudioSource.cpp:35
juce::ChannelRemappingAudioSource::prepareToPlay
void prepareToPlay(int samplesPerBlockExpected, double sampleRate) override
Definition juce_ChannelRemappingAudioSource.cpp:93
juce::ChannelRemappingAudioSource::setNumberOfChannelsToProduce
void setNumberOfChannelsToProduce(int requiredNumberOfChannels)
Definition juce_ChannelRemappingAudioSource.cpp:38
juce::ChannelRemappingAudioSource::restoreFromXml
void restoreFromXml(const XmlElement &)
Definition juce_ChannelRemappingAudioSource.cpp:167
juce::ChannelRemappingAudioSource::clearAllMappings
void clearAllMappings()
Definition juce_ChannelRemappingAudioSource.cpp:44
juce::ChannelRemappingAudioSource::releaseResources
void releaseResources() override
Definition juce_ChannelRemappingAudioSource.cpp:98
juce::ChannelRemappingAudioSource::getRemappedInputChannel
int getRemappedInputChannel(int inputChannelIndex) const
Definition juce_ChannelRemappingAudioSource.cpp:72
juce::ChannelRemappingAudioSource::getRemappedOutputChannel
int getRemappedOutputChannel(int outputChannelIndex) const
Definition juce_ChannelRemappingAudioSource.cpp:82
juce::ChannelRemappingAudioSource::ChannelRemappingAudioSource
ChannelRemappingAudioSource(AudioSource *source, bool deleteSourceWhenDeleted)
Definition juce_ChannelRemappingAudioSource.cpp:26
juce::ChannelRemappingAudioSource::createXml
std::unique_ptr< XmlElement > createXml() const
Definition juce_ChannelRemappingAudioSource.cpp:148
juce::ChannelRemappingAudioSource::setInputChannelMapping
void setInputChannelMapping(int destChannelIndex, int sourceChannelIndex)
Definition juce_ChannelRemappingAudioSource.cpp:52
juce::CriticalSection
Definition juce_CriticalSection.h:43
juce::OptionalScopedPointer
Definition juce_OptionalScopedPointer.h:38
juce::XmlElement
Definition juce_XmlElement.h:83
juce::AudioSourceChannelInfo
Definition juce_AudioSource.h:33