openshot-audio  0.1.6
juce_AudioSourcePlayer.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_AUDIOSOURCEPLAYER_H_INCLUDED
26 #define JUCE_AUDIOSOURCEPLAYER_H_INCLUDED
27 
28 
29 //==============================================================================
38 {
39 public:
40  //==============================================================================
43 
49  virtual ~AudioSourcePlayer();
50 
51  //==============================================================================
65  void setSource (AudioSource* newSource);
66 
70  AudioSource* getCurrentSource() const noexcept { return source; }
71 
75  void setGain (float newGain) noexcept;
76 
80  float getGain() const noexcept { return gain; }
81 
82  //==============================================================================
84  void audioDeviceIOCallback (const float** inputChannelData,
85  int totalNumInputChannels,
86  float** outputChannelData,
87  int totalNumOutputChannels,
88  int numSamples) override;
89 
91  void audioDeviceAboutToStart (AudioIODevice* device) override;
92 
94  void audioDeviceStopped() override;
95 
97  void prepareToPlay (double sampleRate, int blockSize);
98 
99 private:
100  //==============================================================================
101  CriticalSection readLock;
102  AudioSource* source;
103  double sampleRate;
104  int bufferSize;
105  float* channels [128];
106  float* outputChans [128];
107  const float* inputChans [128];
108  AudioSampleBuffer tempBuffer;
109  float lastGain, gain;
110 
112 };
113 
114 
115 #endif // JUCE_AUDIOSOURCEPLAYER_H_INCLUDED
Definition: juce_AudioSampleBuffer.h:34
Definition: juce_AudioSource.h:110
Definition: juce_AudioIODevice.h:42
#define noexcept
Definition: juce_CompilerSupport.h:141
virtual void audioDeviceIOCallback(const float **inputChannelData, int numInputChannels, float **outputChannelData, int numOutputChannels, int numSamples)=0
#define JUCE_API
Definition: juce_StandardHeader.h:139
Definition: juce_CriticalSection.h:47
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Definition: juce_PlatformDefs.h:198
virtual void audioDeviceAboutToStart(AudioIODevice *device)=0
float getGain() const noexcept
Definition: juce_AudioSourcePlayer.h:80
virtual void audioDeviceStopped()=0
AudioSource * getCurrentSource() const noexcept
Definition: juce_AudioSourcePlayer.h:70
Definition: juce_AudioIODevice.h:132
Definition: juce_AudioSourcePlayer.h:37