OpenShot Library | libopenshot  0.3.2
AudioBufferSource.h
Go to the documentation of this file.
1 
9 // Copyright (c) 2008-2019 OpenShot Studios, LLC
10 //
11 // SPDX-License-Identifier: LGPL-3.0-or-later
12 
13 #ifndef OPENSHOT_AUDIOBUFFERSOURCE_H
14 #define OPENSHOT_AUDIOBUFFERSOURCE_H
15 
16 #include <AppConfig.h>
17 #include <juce_audio_basics/juce_audio_basics.h>
18 
19 namespace openshot
20 {
27  class AudioBufferSource : public juce::PositionableAudioSource
28  {
29  private:
30  int position;
31  bool repeat;
33 
34  public:
38 
41 
44  void getNextAudioBlock (const juce::AudioSourceChannelInfo& info);
45 
47  void prepareToPlay(int, double);
48 
50  void releaseResources();
51 
54  void setNextReadPosition (juce::int64 newPosition);
55 
58 
61 
63  bool isLooping() const;
64 
67  void setLooping (bool shouldLoop);
68 
70  void setBuffer (juce::AudioBuffer<float> *audio_buffer);
71  };
72 
73 }
74 
75 #endif
openshot::AudioBufferSource::getNextReadPosition
juce::int64 getNextReadPosition() const
Get the next read position of this source.
Definition: AudioBufferSource.cpp:91
openshot::AudioBufferSource::getNextAudioBlock
void getNextAudioBlock(const juce::AudioSourceChannelInfo &info)
Get the next block of audio samples.
Definition: AudioBufferSource.cpp:31
openshot::AudioBufferSource::setLooping
void setLooping(bool shouldLoop)
Set if this audio source should repeat when it reaches the end.
Definition: AudioBufferSource.cpp:112
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:28
juce::AudioBuffer< float >
int64
#define int64
Definition: Clip.h:17
openshot::AudioBufferSource::isLooping
bool isLooping() const
Determines if this audio source should repeat when it reaches the end.
Definition: AudioBufferSource.cpp:105
openshot::AudioBufferSource::setNextReadPosition
void setNextReadPosition(juce::int64 newPosition)
Set the next read position of this source.
Definition: AudioBufferSource.cpp:83
openshot::AudioBufferSource::setBuffer
void setBuffer(juce::AudioBuffer< float > *audio_buffer)
Update the internal buffer used by this source.
Definition: AudioBufferSource.cpp:119
openshot::AudioBufferSource
This class is used to expose an AudioBuffer<float> as an AudioSource in JUCE.
Definition: AudioBufferSource.h:27
openshot::AudioBufferSource::releaseResources
void releaseResources()
Release all resources.
Definition: AudioBufferSource.cpp:80
openshot::AudioBufferSource::getTotalLength
juce::int64 getTotalLength() const
Get the total length (in samples) of this audio source.
Definition: AudioBufferSource.cpp:98
openshot::AudioBufferSource::prepareToPlay
void prepareToPlay(int, double)
Prepare to play this audio source.
Definition: AudioBufferSource.cpp:77
openshot::AudioBufferSource::~AudioBufferSource
~AudioBufferSource()
Destructor.
Definition: AudioBufferSource.cpp:24
openshot::AudioBufferSource::AudioBufferSource
AudioBufferSource(juce::AudioBuffer< float > *audio_buffer)
Default constructor.
Definition: AudioBufferSource.cpp:19