openshot-audio  0.1.2
juce_ChannelRemappingAudioSource.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission is granted to use this software under the terms of either:
8  a) the GPL v2 (or any later version)
9  b) the Affero GPL v3
10 
11  Details of these licenses can be found at: www.gnu.org/licenses
12 
13  JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17  ------------------------------------------------------------------------------
18 
19  To release a closed-source product which uses JUCE, commercial licenses are
20  available: visit www.juce.com for more information.
21 
22  ==============================================================================
23 */
24 
25 #ifndef JUCE_CHANNELREMAPPINGAUDIOSOURCE_H_INCLUDED
26 #define JUCE_CHANNELREMAPPINGAUDIOSOURCE_H_INCLUDED
27 
28 
29 //==============================================================================
45 {
46 public:
47  //==============================================================================
57  bool deleteSourceWhenDeleted);
58 
61 
62  //==============================================================================
66  void setNumberOfChannelsToProduce (int requiredNumberOfChannels);
67 
73  void clearAllMappings();
74 
85  void setInputChannelMapping (int destChannelIndex,
86  int sourceChannelIndex);
87 
98  void setOutputChannelMapping (int sourceChannelIndex,
99  int destChannelIndex);
100 
104  int getRemappedInputChannel (int inputChannelIndex) const;
105 
109  int getRemappedOutputChannel (int outputChannelIndex) const;
110 
111 
112  //==============================================================================
116  XmlElement* createXml() const;
117 
121  void restoreFromXml (const XmlElement&);
122 
123  //==============================================================================
124  void prepareToPlay (int samplesPerBlockExpected, double sampleRate) override;
125  void releaseResources() override;
126  void getNextAudioBlock (const AudioSourceChannelInfo&) override;
127 
128 
129 private:
130  //==============================================================================
132  Array<int> remappedInputs, remappedOutputs;
133  int requiredNumberOfChannels;
134 
135  AudioSampleBuffer buffer;
136  AudioSourceChannelInfo remappedInfo;
137  CriticalSection lock;
138 
140 };
141 
142 
143 #endif // JUCE_CHANNELREMAPPINGAUDIOSOURCE_H_INCLUDED
Definition: juce_AudioSampleBuffer.h:34
Definition: juce_AudioSource.h:110
void setInputChannelMapping(int destChannelIndex, int sourceChannelIndex)
Definition: juce_ChannelRemappingAudioSource.cpp:51
int getRemappedInputChannel(int inputChannelIndex) const
Definition: juce_ChannelRemappingAudioSource.cpp:71
Definition: juce_ChannelRemappingAudioSource.h:44
void prepareToPlay(int samplesPerBlockExpected, double sampleRate) override
Definition: juce_ChannelRemappingAudioSource.cpp:92
void clearAllMappings()
Definition: juce_ChannelRemappingAudioSource.cpp:43
void setNumberOfChannelsToProduce(int requiredNumberOfChannels)
Definition: juce_ChannelRemappingAudioSource.cpp:37
void releaseResources() override
Definition: juce_ChannelRemappingAudioSource.cpp:97
int getRemappedOutputChannel(int outputChannelIndex) const
Definition: juce_ChannelRemappingAudioSource.cpp:81
void getNextAudioBlock(const AudioSourceChannelInfo &) override
Definition: juce_ChannelRemappingAudioSource.cpp:102
Definition: juce_CriticalSection.h:47
void restoreFromXml(const XmlElement &)
Definition: juce_ChannelRemappingAudioSource.cpp:166
Definition: juce_AudioSource.h:33
Definition: juce_XmlElement.h:142
void setOutputChannelMapping(int sourceChannelIndex, int destChannelIndex)
Definition: juce_ChannelRemappingAudioSource.cpp:61
Definition: juce_Array.h:60
ChannelRemappingAudioSource(AudioSource *source, bool deleteSourceWhenDeleted)
Definition: juce_ChannelRemappingAudioSource.cpp:25
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Definition: juce_PlatformDefs.h:198
XmlElement * createXml() const
Definition: juce_ChannelRemappingAudioSource.cpp:147
~ChannelRemappingAudioSource()
Definition: juce_ChannelRemappingAudioSource.cpp:34