JUCE  v5.1.1-3-g1a0b28c73
JUCE API
MemoryAudioSource Class Reference

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

#include <juce_MemoryAudioSource.h>

Inheritance diagram for MemoryAudioSource:
Collaboration 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 getNextAudioBlock (const AudioSourceChannelInfo &bufferToFill) override
 Implementation of the AudioSource method. More...
 
void prepareToPlay (int samplesPerBlockExpected, double sampleRate) override
 Implementation of the AudioSource method. More...
 
void releaseResources () override
 Implementation of the AudioSource method. More...
 

Private Attributes

AudioBuffer< float > buffer
 
bool isLooping
 
int position = 0
 

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

◆ getNextAudioBlock()

void MemoryAudioSource::getNextAudioBlock ( const AudioSourceChannelInfo bufferToFill)
overridevirtual

Implementation of the AudioSource method.

Implements AudioSource.

◆ 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.

Member Data Documentation

◆ buffer

AudioBuffer<float> MemoryAudioSource::buffer
private

◆ isLooping

bool MemoryAudioSource::isLooping
private

◆ position

int MemoryAudioSource::position = 0
private

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