JUCE: MemoryAudioSource Class Reference

JUCE

Public Member Functions | List of all members
MemoryAudioSource Class Reference
juce_audio_basics » sources

An AudioSource which takes some float audio data as an input. More...

`#include <juce_MemoryAudioSource.h>`

Inheritance diagram for MemoryAudioSource:

## Public Member Functions
| MemoryAudioSource (AudioBuffer< float > &audioBuffer, bool copyMemory, bool shouldLoop=false)
| Creates a MemoryAudioSource by providing an audio buffer. More...
void | prepareToPlay (int samplesPerBlockExpected, double sampleRate) override
| Implementation of the AudioSource method. More...
void | releaseResources () override
| Implementation of the AudioSource method. More...
void | getNextAudioBlock (const AudioSourceChannelInfo &bufferToFill) override
| Implementation of the AudioSource method. More...
void | setNextReadPosition (int64 newPosition) override
| Implementation of the PositionableAudioSource method. More...
int64 | getNextReadPosition () const override
| Implementation of the PositionableAudioSource method. More...
int64 | getTotalLength () const override
| Implementation of the PositionableAudioSource method. More...
bool | isLooping () const override
| Implementation of the PositionableAudioSource method. More...
void | setLooping (bool shouldLoop) override
| Implementation of the PositionableAudioSource method. More...
Public Member Functions inherited from PositionableAudioSource
| ~PositionableAudioSource () override=default
| Destructor. More...
virtual void | setNextReadPosition (int64 newPosition)=0
| Tells the stream to move to a new position. More...
virtual int64 | getNextReadPosition () const =0
| Returns the position from which the next block will be returned. More...
virtual int64 | getTotalLength () const =0
| Returns the total length of the stream (in samples). More...
virtual bool | isLooping () const =0
| Returns true if this source is actually playing in a loop. More...
virtual void | setLooping (bool shouldLoop)
| Tells the source whether you'd like it to play in a loop. More...
Public Member Functions inherited from AudioSource
virtual | ~AudioSource ()=default
| Destructor. More...
virtual void | prepareToPlay (int samplesPerBlockExpected, double sampleRate)=0
| Tells the source to prepare for playing. More...
virtual void | releaseResources ()=0
| Allows the source to release anything it no longer needs after playback has stopped. More...
virtual void | getNextAudioBlock (const AudioSourceChannelInfo &bufferToFill)=0
| Called repeatedly to fetch subsequent blocks of audio data. More...

## Additional Inherited Members
Protected Member Functions inherited from PositionableAudioSource
| PositionableAudioSource ()=default
| Creates the PositionableAudioSource. More...
Protected Member Functions inherited from AudioSource
| AudioSource ()=default
| Creates an AudioSource. More...

## Detailed Description

An AudioSource which takes some float audio data as an input.

## Constructor & Destructor Documentation

## ◆ MemoryAudioSource()

MemoryAudioSource::MemoryAudioSource | ( | AudioBuffer< float > & | audioBuffer,
|  | bool | copyMemory,
|  | bool | shouldLoop = `false`
| ) |  |

Creates a MemoryAudioSource by providing an audio buffer.

If copyMemory is true then the buffer will be copied into an internal buffer which will be owned by the MemoryAudioSource. If copyMemory is false, then you must ensure that the lifetime of the audio buffer is at least as long as the MemoryAudioSource.

## Member Function Documentation

## ◆ prepareToPlay()

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

Implementation of the AudioSource method.

Implements AudioSource.

## ◆ releaseResources()

void MemoryAudioSource::releaseResources | ( |  | ) |
| overridevirtual

Implementation of the AudioSource method.

Implements AudioSource.

## ◆ getNextAudioBlock()

void MemoryAudioSource::getNextAudioBlock | ( | const AudioSourceChannelInfo & | bufferToFill | ) |
| overridevirtual

Implementation of the AudioSource method.

Implements AudioSource.

## ◆ setNextReadPosition()

void MemoryAudioSource::setNextReadPosition | ( | int64 | newPosition | ) |
| overridevirtual

Implementation of the PositionableAudioSource method.

Implements PositionableAudioSource.

## ◆ getNextReadPosition()

int64 MemoryAudioSource::getNextReadPosition | ( |  | ) | const
| overridevirtual

Implementation of the PositionableAudioSource method.

Implements PositionableAudioSource.

## ◆ getTotalLength()

int64 MemoryAudioSource::getTotalLength | ( |  | ) | const
| overridevirtual

Implementation of the PositionableAudioSource method.

Implements PositionableAudioSource.

## ◆ isLooping()

bool MemoryAudioSource::isLooping | ( |  | ) | const
| overridevirtual

Implementation of the PositionableAudioSource method.

Implements PositionableAudioSource.

## ◆ setLooping()

void MemoryAudioSource::setLooping | ( | bool | shouldLoop | ) |
| overridevirtual

Implementation of the PositionableAudioSource method.

Reimplemented from PositionableAudioSource.

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

- juce_MemoryAudioSource.h