OpenShot Library | libopenshot  0.4.0
Public Member Functions | List of all members
openshot::AudioBufferSource Class Reference

This class is used to expose an AudioBuffer<float> as an AudioSource in JUCE. More...

#include <AudioBufferSource.h>

Inheritance diagram for openshot::AudioBufferSource:
[legend]
Collaboration diagram for openshot::AudioBufferSource:
[legend]

Public Member Functions

 AudioBufferSource (juce::AudioBuffer< float > *audio_buffer)
 Default constructor. 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...
 
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...
 
void releaseResources ()
 Release all resources. More...
 
void setBuffer (juce::AudioBuffer< float > *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...
 
 ~AudioBufferSource ()
 Destructor. More...
 

Detailed Description

This class is used to expose an AudioBuffer<float> as an AudioSource in JUCE.

The JUCE library cannot play audio directly from an AudioBuffer<float>, so this class exposes an AudioBuffer<float> as a AudioSource, so that JUCE can play the audio.

Definition at line 27 of file AudioBufferSource.h.

Constructor & Destructor Documentation

◆ AudioBufferSource()

AudioBufferSource::AudioBufferSource ( juce::AudioBuffer< float > *  audio_buffer)

Default constructor.

Parameters
audio_bufferThis buffer contains the samples you want to play through JUCE.

Definition at line 19 of file AudioBufferSource.cpp.

◆ ~AudioBufferSource()

AudioBufferSource::~AudioBufferSource ( )

Destructor.

Definition at line 24 of file AudioBufferSource.cpp.

Member Function Documentation

◆ getNextAudioBlock()

void AudioBufferSource::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 31 of file AudioBufferSource.cpp.

◆ getNextReadPosition()

juce::int64 AudioBufferSource::getNextReadPosition ( ) const

Get the next read position of this source.

Definition at line 91 of file AudioBufferSource.cpp.

◆ getTotalLength()

juce::int64 AudioBufferSource::getTotalLength ( ) const

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

Definition at line 98 of file AudioBufferSource.cpp.

◆ isLooping()

bool AudioBufferSource::isLooping ( ) const

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

Definition at line 105 of file AudioBufferSource.cpp.

◆ prepareToPlay()

void AudioBufferSource::prepareToPlay ( int  ,
double   
)

Prepare to play this audio source.

Definition at line 77 of file AudioBufferSource.cpp.

◆ releaseResources()

void AudioBufferSource::releaseResources ( )

Release all resources.

Definition at line 80 of file AudioBufferSource.cpp.

◆ setBuffer()

void AudioBufferSource::setBuffer ( juce::AudioBuffer< float > *  audio_buffer)

Update the internal buffer used by this source.

Definition at line 119 of file AudioBufferSource.cpp.

◆ setLooping()

void AudioBufferSource::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 112 of file AudioBufferSource.cpp.

◆ setNextReadPosition()

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

Set the next read position of this source.

Parameters
newPositionThe sample # to start reading from

Definition at line 83 of file AudioBufferSource.cpp.

Referenced by setBuffer().


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