OpenShot Audio Library | OpenShotAudio 0.3.2

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

`#include <juce_AudioSourcePlayer.h>`

Inheritance diagram for juce::AudioSourcePlayer:

## Public Member Functions
| AudioSourcePlayer ()
| ~AudioSourcePlayer () override
void | setSource (AudioSource *newSource)
AudioSource * | getCurrentSource () const noexcept
void | setGain (float newGain) noexcept
float | getGain () const noexcept
void | audioDeviceIOCallback (const float **inputChannelData, int totalNumInputChannels, float **outputChannelData, int totalNumOutputChannels, int numSamples) override
void | audioDeviceAboutToStart (AudioIODevice *device) override
void | audioDeviceStopped () override
void | prepareToPlay (double sampleRate, int blockSize)
Public Member Functions inherited from juce::AudioIODeviceCallback
virtual | ~AudioIODeviceCallback ()=default
virtual void | audioDeviceIOCallback (const float **inputChannelData, int numInputChannels, float **outputChannelData, int numOutputChannels, int numSamples)=0
virtual void | audioDeviceAboutToStart (AudioIODevice *device)=0
virtual void | audioDeviceStopped ()=0
virtual void | audioDeviceError (const String &errorMessage)

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

Definition at line 36 of file juce_AudioSourcePlayer.h.

## Constructor & Destructor Documentation

## ◆ AudioSourcePlayer()

juce::AudioSourcePlayer::AudioSourcePlayer | ( |  | ) |

Creates an empty AudioSourcePlayer.

Definition at line 26 of file juce_AudioSourcePlayer.cpp.

## ◆ ~AudioSourcePlayer()

juce::AudioSourcePlayer::~AudioSourcePlayer | ( |  | ) |
| override

Destructor.

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

Definition at line 30 of file juce_AudioSourcePlayer.cpp.

## Member Function Documentation

## ◆ audioDeviceAboutToStart()

void juce::AudioSourcePlayer::audioDeviceAboutToStart | ( | AudioIODevice * | device | ) |
| override virtual

Implementation of the AudioIODeviceCallback method.

Implements juce::AudioIODeviceCallback.

Definition at line 153 of file juce_AudioSourcePlayer.cpp.

## ◆ audioDeviceIOCallback()

void juce::AudioSourcePlayer::audioDeviceIOCallback | ( | const float ** | inputChannelData,
|  | int | totalNumInputChannels,
|  | float ** | outputChannelData,
|  | int | totalNumOutputChannels,
|  | int | numSamples
| ) |  |
| override virtual

Implementation of the AudioIODeviceCallback method.

Implements juce::AudioIODeviceCallback.

Definition at line 59 of file juce_AudioSourcePlayer.cpp.

## ◆ audioDeviceStopped()

void juce::AudioSourcePlayer::audioDeviceStopped | ( |  | ) |
| override virtual

Implementation of the AudioIODeviceCallback method.

Implements juce::AudioIODeviceCallback.

Definition at line 169 of file juce_AudioSourcePlayer.cpp.

## ◆ getCurrentSource()

AudioSource * juce::AudioSourcePlayer::getCurrentSource | ( |  | ) | const
| inline noexcept

Returns the source that's playing. May return nullptr if there's no source.

Definition at line 69 of file juce_AudioSourcePlayer.h.

## ◆ getGain()

float juce::AudioSourcePlayer::getGain | ( |  | ) | const
| inline noexcept

Returns the current gain.

See also
  setGain

Definition at line 79 of file juce_AudioSourcePlayer.h.

## ◆ prepareToPlay()

void juce::AudioSourcePlayer::prepareToPlay | ( | double | sampleRate,
|  | int | blockSize
| ) |  |

An alternative method for initialising the source without an AudioIODevice.

Definition at line 159 of file juce_AudioSourcePlayer.cpp.

Referenced by audioDeviceAboutToStart().

## ◆ setGain()

void juce::AudioSourcePlayer::setGain | ( | float | newGain | ) |
| noexcept

Sets a gain to apply to the audio data.

See also
  getGain

Definition at line 54 of file juce_AudioSourcePlayer.cpp.

## ◆ setSource()

void juce::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

  newSource | the 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.

Definition at line 35 of file juce_AudioSourcePlayer.cpp.

Referenced by ~AudioSourcePlayer().

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

- juce_AudioSourcePlayer.h
- juce_AudioSourcePlayer.cpp