OpenShot Audio Library | OpenShotAudio: juce::BufferingAudioSource Class Reference

OpenShot Audio Library | OpenShotAudio 0.3.2

Loading...
Searching...
No Matches
Public Member Functions | List of all members
juce::BufferingAudioSource Class Reference

`#include <juce_BufferingAudioSource.h>`

Inheritance diagram for juce::BufferingAudioSource:

## Public Member Functions
| BufferingAudioSource (PositionableAudioSource *source, TimeSliceThread &backgroundThread, bool deleteSourceWhenDeleted, int numberOfSamplesToBuffer, int numberOfChannels=2, bool prefillBufferOnPrepareToPlay=true)
| ~BufferingAudioSource () override
void | prepareToPlay (int samplesPerBlockExpected, double sampleRate) override
void | releaseResources () override
void | getNextAudioBlock (const AudioSourceChannelInfo &) override
void | setNextReadPosition (int64 newPosition) override
int64 | getNextReadPosition () const override
int64 | getTotalLength () const override
bool | isLooping () const override
bool | waitForNextAudioBlockReady (const AudioSourceChannelInfo &info, const uint32 timeout)
Public Member Functions inherited from juce::PositionableAudioSource
| ~PositionableAudioSource () override=default
virtual void | setNextReadPosition (int64 newPosition)=0
virtual int64 | getNextReadPosition () const =0
virtual int64 | getTotalLength () const =0
virtual bool | isLooping () const =0
virtual void | setLooping (bool shouldLoop)
Public Member Functions inherited from juce::AudioSource
virtual | ~AudioSource ()=default
virtual void | prepareToPlay (int samplesPerBlockExpected, double sampleRate)=0
virtual void | releaseResources ()=0
virtual void | getNextAudioBlock (const AudioSourceChannelInfo &bufferToFill)=0

## Additional Inherited Members
Protected Member Functions inherited from juce::PositionableAudioSource
| PositionableAudioSource ()=default
Protected Member Functions inherited from juce::AudioSource
| AudioSource ()=default

## Detailed Description

An AudioSource which takes another source as input, and buffers it using a thread.

Create this as a wrapper around another thread, and it will read-ahead with a background thread to smooth out playback. You can either create one of these directly, or use it indirectly using an AudioTransportSource.

See also
  PositionableAudioSource, AudioTransportSource

Definition at line 38 of file juce_BufferingAudioSource.h.

## Constructor & Destructor Documentation

## ◆ BufferingAudioSource()

juce::BufferingAudioSource::BufferingAudioSource | ( | PositionableAudioSource * | source,
|  | TimeSliceThread & | backgroundThread,
|  | bool | deleteSourceWhenDeleted,
|  | int | numberOfSamplesToBuffer,
|  | int | numberOfChannels = `2`,
|  | bool | prefillBufferOnPrepareToPlay = `true`
| ) |  |

Creates a BufferingAudioSource.

Parameters

  source | the input source to read from
  backgroundThread | a background thread that will be used for the background read-ahead. This object must not be deleted until after any BufferingAudioSources that are using it have been deleted!
  deleteSourceWhenDeleted | if true, then the input source object will be deleted when this object is deleted
  numberOfSamplesToBuffer | the size of buffer to use for reading ahead
  numberOfChannels | the number of channels that will be played
  prefillBufferOnPrepareToPlay | if true, then calling prepareToPlay on this object will block until the buffer has been filled

Definition at line 26 of file juce_BufferingAudioSource.cpp.

## ◆ ~BufferingAudioSource()

juce::BufferingAudioSource::~BufferingAudioSource | ( |  | ) |
| override

Destructor.

The input source may be deleted depending on whether the deleteSourceWhenDeleted flag was set in the constructor.

Definition at line 44 of file juce_BufferingAudioSource.cpp.

## Member Function Documentation

## ◆ getNextAudioBlock()

void juce::BufferingAudioSource::getNextAudioBlock | ( | const AudioSourceChannelInfo & | info | ) |
| overridevirtual

Implementation of the AudioSource method.

Implements juce::AudioSource.

Definition at line 97 of file juce_BufferingAudioSource.cpp.

## ◆ getNextReadPosition()

int64 juce::BufferingAudioSource::getNextReadPosition | ( |  | ) | const
| overridevirtual

Implements the PositionableAudioSource method.

Implements juce::PositionableAudioSource.

Definition at line 202 of file juce_BufferingAudioSource.cpp.

## ◆ getTotalLength()

int64 juce::BufferingAudioSource::getTotalLength | ( |  | ) | const
| inlineoverridevirtual

Implements the PositionableAudioSource method.

Implements juce::PositionableAudioSource.

Definition at line 89 of file juce_BufferingAudioSource.h.

Referenced by waitForNextAudioBlockReady().

## ◆ isLooping()

bool juce::BufferingAudioSource::isLooping | ( |  | ) | const
| inlineoverridevirtual

Implements the PositionableAudioSource method.

Implements juce::PositionableAudioSource.

Definition at line 92 of file juce_BufferingAudioSource.h.

Referenced by waitForNextAudioBlockReady().

## ◆ prepareToPlay()

void juce::BufferingAudioSource::prepareToPlay | ( | int | samplesPerBlockExpected,
|  | double | sampleRate
| ) |  |
| overridevirtual

Implementation of the AudioSource method.

Implements juce::AudioSource.

Definition at line 50 of file juce_BufferingAudioSource.cpp.

## ◆ releaseResources()

void juce::BufferingAudioSource::releaseResources | ( |  | ) |
| overridevirtual

Implementation of the AudioSource method.

Implements juce::AudioSource.

Definition at line 83 of file juce_BufferingAudioSource.cpp.

Referenced by ~BufferingAudioSource().

## ◆ setNextReadPosition()

void juce::BufferingAudioSource::setNextReadPosition | ( | int64 | newPosition | ) |
| overridevirtual

Implements the PositionableAudioSource method.

Implements juce::PositionableAudioSource.

Definition at line 212 of file juce_BufferingAudioSource.cpp.

## ◆ waitForNextAudioBlockReady()

bool juce::BufferingAudioSource::waitForNextAudioBlockReady | ( | const AudioSourceChannelInfo & | info,
|  | const uint32 | timeout
| ) |  |

A useful function to block until the next the buffer info can be filled.

This is useful for offline rendering.

Definition at line 158 of file juce_BufferingAudioSource.cpp.

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

- juce_BufferingAudioSource.h
- juce_BufferingAudioSource.cpp