31#ifndef OPENSHOT_AUDIOREADERSOURCE_H
32#define OPENSHOT_AUDIOREADERSOURCE_H
36#include <OpenShotAudio.h>
53 juce::AudioSampleBuffer *buffer;
58 std::shared_ptr<Frame> frame;
59 int64_t frame_position;
60 double estimated_frame;
61 int estimated_samples_per_frame;
64 void GetMoreSamplesFromReader();
67 juce::AudioSampleBuffer* reverse_buffer(juce::AudioSampleBuffer* buffer);
108 void setBuffer (juce::AudioSampleBuffer *audio_buffer);
113 std::shared_ptr<Frame>
getFrame()
const {
return frame; }
119 void setSpeed(
int new_speed) { speed = new_speed; }
129 void Seek(int64_t new_position) { frame_number = new_position; estimated_frame = new_position; }
Header file for ReaderBase class.
This class is used to expose any ReaderBase derived class as an AudioSource in JUCE.
juce::int64 getNextReadPosition() const
Get the next read position of this source.
void Seek(int64_t new_position)
Seek to a specific frame.
AudioReaderSource(ReaderBase *audio_reader, int64_t starting_frame_number, int buffer_size)
Constructor that reads samples from a reader.
int getSpeed() const
Get Speed (The speed and direction to playback a reader (1=normal, 2=fast, 3=faster,...
int64_t getEstimatedFrame() const
Get the estimate frame that is playing at this moment.
void setNextReadPosition(juce::int64 newPosition)
Set the next read position of this source.
void releaseResources()
Release all resources.
void Reader(ReaderBase *audio_reader)
Set Reader.
const ReaderInfo & getReaderInfo() const
bool isLooping() const
Determines if this audio source should repeat when it reaches the end.
juce::int64 getTotalLength() const
Get the total length (in samples) of this audio source.
void setSpeed(int new_speed)
Set Speed (The speed and direction to playback a reader (1=normal, 2=fast, 3=faster,...
void setLooping(bool shouldLoop)
Set if this audio source should repeat when it reaches the end.
void prepareToPlay(int, double)
Prepare to play this audio source.
ReaderBase * Reader() const
Get Reader.
void setBuffer(juce::AudioSampleBuffer *audio_buffer)
Update the internal buffer used by this source.
void getNextAudioBlock(const juce::AudioSourceChannelInfo &info)
Get the next block of audio samples.
std::shared_ptr< Frame > getFrame() const
Return the current frame object.
~AudioReaderSource()
Destructor.
This abstract class is the base class, used by all readers in libopenshot.
openshot::ReaderInfo info
Information about the current media file.
This namespace is the default namespace for all code in the openshot library.
This struct contains info about a media file, such as height, width, frames per second,...