Public Member Functions

AudioSourcePlayer Class Reference

Wrapper class to continuously stream audio from an audio source to an AudioIODevice. More...

Inherits AudioIODeviceCallback.

List of all members.

Public Member Functions

 AudioSourcePlayer ()
 Creates an empty AudioSourcePlayer.
virtual ~AudioSourcePlayer ()
 Destructor.
void setSource (AudioSource *newSource)
 Changes the current audio source to play from.
AudioSourcegetCurrentSource () const noexcept
 Returns the source that's playing.
void setGain (float newGain) noexcept
 Sets a gain to apply to the audio data.
float getGain () const noexcept
 Returns the current gain.
void audioDeviceIOCallback (const float **inputChannelData, int totalNumInputChannels, float **outputChannelData, int totalNumOutputChannels, int numSamples)
 Implementation of the AudioIODeviceCallback method.
void audioDeviceAboutToStart (AudioIODevice *device)
 Implementation of the AudioIODeviceCallback method.
void audioDeviceStopped ()
 Implementation of the AudioIODeviceCallback method.

Detailed Description

Wrapper class to continuously stream audio from an audio source to an AudioIODevice.

This object acts as an AudioIODeviceCallback, so can be attached to an output device, and will stream audio from an AudioSource.


Constructor & Destructor Documentation

AudioSourcePlayer::AudioSourcePlayer (  )

Creates an empty AudioSourcePlayer.

virtual AudioSourcePlayer::~AudioSourcePlayer (  ) [virtual]

Destructor.

Make sure this object isn't still being used by an AudioIODevice before deleting it!


Member Function Documentation

void AudioSourcePlayer::setSource ( AudioSource newSource )

Changes the current audio source to play from.

If the source passed in is already being used, this method will do nothing. If the source is not null, its prepareToPlay() method will be called before it starts being used for playback.

If there's another source currently playing, its releaseResources() method will be called after it has been swapped for the new one.

Parameters:
newSourcethe new source to use - this will NOT be deleted by this object when no longer needed, so it's the caller's responsibility to manage it.
AudioSource* AudioSourcePlayer::getCurrentSource (  ) const

Returns the source that's playing.

May return 0 if there's no source.

void AudioSourcePlayer::setGain ( float  newGain )

Sets a gain to apply to the audio data.

See also:
getGain
float AudioSourcePlayer::getGain (  ) const

Returns the current gain.

See also:
setGain
void AudioSourcePlayer::audioDeviceIOCallback ( const float **  inputChannelData,
int  totalNumInputChannels,
float **  outputChannelData,
int  totalNumOutputChannels,
int  numSamples 
) [virtual]

Implementation of the AudioIODeviceCallback method.

Implements AudioIODeviceCallback.

void AudioSourcePlayer::audioDeviceAboutToStart ( AudioIODevice device ) [virtual]

Implementation of the AudioIODeviceCallback method.

Implements AudioIODeviceCallback.

void AudioSourcePlayer::audioDeviceStopped (  ) [virtual]

Implementation of the AudioIODeviceCallback method.

Implements AudioIODeviceCallback.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines