OpenShot Library | libopenshot  0.2.7
Public Member Functions | List of all members
openshot::AudioReaderSource Class Reference

This class is used to expose any ReaderBase derived class as an AudioSource in JUCE. More...

#include <AudioReaderSource.h>

Inheritance diagram for openshot::AudioReaderSource:

Public Member Functions

 AudioReaderSource (ReaderBase *audio_reader, int64_t starting_frame_number, int buffer_size)
 Constructor that reads samples from a reader. More...
 
int64_t getEstimatedFrame () const
 Get the estimate frame that is playing at this moment. More...
 
std::shared_ptr< FramegetFrame () const
 Return the current frame object. More...
 
void getNextAudioBlock (const juce::AudioSourceChannelInfo &info)
 Get the next block of audio samples. More...
 
juce::int64 getNextReadPosition () const
 Get the next read position of this source. More...
 
const ReaderInfogetReaderInfo () const
 
int getSpeed () const
 Get Speed (The speed and direction to playback a reader (1=normal, 2=fast, 3=faster, -1=rewind, etc...) More...
 
juce::int64 getTotalLength () const
 Get the total length (in samples) of this audio source. More...
 
bool isLooping () const
 Determines if this audio source should repeat when it reaches the end. More...
 
void prepareToPlay (int, double)
 Prepare to play this audio source. More...
 
ReaderBaseReader () const
 Get Reader. More...
 
void Reader (ReaderBase *audio_reader)
 Set Reader. More...
 
void releaseResources ()
 Release all resources. More...
 
void Seek (int64_t new_position)
 Seek to a specific frame. More...
 
void setBuffer (juce::AudioSampleBuffer *audio_buffer)
 Update the internal buffer used by this source. More...
 
void setLooping (bool shouldLoop)
 Set if this audio source should repeat when it reaches the end. More...
 
void setNextReadPosition (juce::int64 newPosition)
 Set the next read position of this source. More...
 
void setSpeed (int new_speed)
 Set Speed (The speed and direction to playback a reader (1=normal, 2=fast, 3=faster, -1=rewind, etc...) More...
 
 ~AudioReaderSource ()
 Destructor. More...
 

Detailed Description

This class is used to expose any ReaderBase derived class as an AudioSource in JUCE.

This allows any reader to play audio through JUCE (our audio framework).

Definition at line 47 of file AudioReaderSource.h.

Constructor & Destructor Documentation

◆ AudioReaderSource()

AudioReaderSource::AudioReaderSource ( ReaderBase audio_reader,
int64_t  starting_frame_number,
int  buffer_size 
)

Constructor that reads samples from a reader.

Parameters
audio_readerThis reader provides constant samples from a ReaderBase derived class
starting_frame_numberThis is the frame number to start reading samples from the reader.
buffer_sizeThe max number of samples to keep in the buffer at one time.

Definition at line 38 of file AudioReaderSource.cpp.

◆ ~AudioReaderSource()

AudioReaderSource::~AudioReaderSource ( )

Destructor.

Definition at line 50 of file AudioReaderSource.cpp.

Member Function Documentation

◆ getEstimatedFrame()

int64_t openshot::AudioReaderSource::getEstimatedFrame ( ) const
inline

Get the estimate frame that is playing at this moment.

Definition at line 116 of file AudioReaderSource.h.

◆ getFrame()

std::shared_ptr<Frame> openshot::AudioReaderSource::getFrame ( ) const
inline

Return the current frame object.

Definition at line 113 of file AudioReaderSource.h.

◆ getNextAudioBlock()

void AudioReaderSource::getNextAudioBlock ( const juce::AudioSourceChannelInfo &  info)

Get the next block of audio samples.

Parameters
infoThis struct informs us of which samples are needed next.

Definition at line 179 of file AudioReaderSource.cpp.

◆ getNextReadPosition()

juce::int64 AudioReaderSource::getNextReadPosition ( ) const

Get the next read position of this source.

Definition at line 258 of file AudioReaderSource.cpp.

◆ getReaderInfo()

const ReaderInfo& openshot::AudioReaderSource::getReaderInfo ( ) const
inline

Definition at line 110 of file AudioReaderSource.h.

◆ getSpeed()

int openshot::AudioReaderSource::getSpeed ( ) const
inline

Get Speed (The speed and direction to playback a reader (1=normal, 2=fast, 3=faster, -1=rewind, etc...)

Definition at line 121 of file AudioReaderSource.h.

◆ getTotalLength()

juce::int64 AudioReaderSource::getTotalLength ( ) const

Get the total length (in samples) of this audio source.

Definition at line 265 of file AudioReaderSource.cpp.

◆ isLooping()

bool AudioReaderSource::isLooping ( ) const

Determines if this audio source should repeat when it reaches the end.

Definition at line 275 of file AudioReaderSource.cpp.

◆ prepareToPlay()

void AudioReaderSource::prepareToPlay ( int  ,
double   
)

Prepare to play this audio source.

Definition at line 244 of file AudioReaderSource.cpp.

◆ Reader() [1/2]

ReaderBase* openshot::AudioReaderSource::Reader ( ) const
inline

Get Reader.

Definition at line 126 of file AudioReaderSource.h.

◆ Reader() [2/2]

void openshot::AudioReaderSource::Reader ( ReaderBase audio_reader)
inline

Set Reader.

Definition at line 124 of file AudioReaderSource.h.

◆ releaseResources()

void AudioReaderSource::releaseResources ( )

Release all resources.

Definition at line 247 of file AudioReaderSource.cpp.

◆ Seek()

void openshot::AudioReaderSource::Seek ( int64_t  new_position)
inline

Seek to a specific frame.

Definition at line 129 of file AudioReaderSource.h.

◆ setBuffer()

void AudioReaderSource::setBuffer ( juce::AudioSampleBuffer *  audio_buffer)

Update the internal buffer used by this source.

Definition at line 289 of file AudioReaderSource.cpp.

◆ setLooping()

void AudioReaderSource::setLooping ( bool  shouldLoop)

Set if this audio source should repeat when it reaches the end.

Parameters
shouldLoopDetermines if the audio source should repeat when it reaches the end

Definition at line 282 of file AudioReaderSource.cpp.

◆ setNextReadPosition()

void AudioReaderSource::setNextReadPosition ( juce::int64  newPosition)

Set the next read position of this source.

Parameters
newPositionThe sample # to start reading from

Definition at line 250 of file AudioReaderSource.cpp.

Referenced by setBuffer().

◆ setSpeed()

void openshot::AudioReaderSource::setSpeed ( int  new_speed)
inline

Set Speed (The speed and direction to playback a reader (1=normal, 2=fast, 3=faster, -1=rewind, etc...)

Definition at line 119 of file AudioReaderSource.h.


The documentation for this class was generated from the following files: