Loading...
Searching...
No Matches
juce::BufferingAudioSource Class Reference

## 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

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

- juce_audio_basics/sources/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)
| Creates a BufferingAudioSource.
| ~BufferingAudioSource () override
| Destructor.
void | prepareToPlay (int samplesPerBlockExpected, double sampleRate) override
| Implementation of the AudioSource method.
void | releaseResources () override
| Implementation of the AudioSource method.
void | getNextAudioBlock (const AudioSourceChannelInfo &) override
| Implementation of the AudioSource method.
void | setNextReadPosition (int64 newPosition) override
| Implements the PositionableAudioSource method.
int64 | getNextReadPosition () const override
| Implements the PositionableAudioSource method.
int64 | getTotalLength () const override
| Implements the PositionableAudioSource method.
bool | isLooping () const override
| Implements the PositionableAudioSource method.
bool | waitForNextAudioBlockReady (const AudioSourceChannelInfo &info, uint32 timeout)
| A useful function to block until the next the buffer info can be filled.
Public Member Functions inherited from juce::PositionableAudioSource
| ~PositionableAudioSource () override=default
| Destructor.
virtual void | setLooping (bool shouldLoop)
| Tells the source whether you'd like it to play in a loop.
Public Member Functions inherited from juce::AudioSource
virtual | ~AudioSource ()=default
| Destructor.

## Additional Inherited Members

Protected Member Functions inherited from juce::PositionableAudioSource
| PositionableAudioSource ()=default
| Creates the PositionableAudioSource.
Protected Member Functions inherited from juce::AudioSource
| AudioSource ()=default
| Creates an AudioSource.

## Constructors and Destructors

## 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

References juce::PositionableAudioSource::PositionableAudioSource(), and juce::TimeSliceClient::TimeSliceThread.

## ~BufferingAudioSource()

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

override

Destructor.

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

## Member Functions

## prepareToPlay()

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

override virtual

Implementation of the AudioSource method.

Implements juce::AudioSource.

## releaseResources()

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

override virtual

Implementation of the AudioSource method.

Implements juce::AudioSource.

## getNextAudioBlock()

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

override virtual

Implementation of the AudioSource method.

Implements juce::AudioSource.

## setNextReadPosition()

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

override virtual

Implements the PositionableAudioSource method.

Implements juce::PositionableAudioSource.

## getNextReadPosition()

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

override virtual

Implements the PositionableAudioSource method.

Implements juce::PositionableAudioSource.

## getTotalLength()

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

inline override virtual

Implements the PositionableAudioSource method.

Implements juce::PositionableAudioSource.

## isLooping()

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

inline override virtual

Implements the PositionableAudioSource method.

Implements juce::PositionableAudioSource.

## waitForNextAudioBlockReady()

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

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

This is useful for offline rendering.

References juce::TimeSliceClient::TimeSliceThread.

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited