raylib-cpp
C++ object-oriented wrapper library for raylib.
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
raylib::AudioStream Class Reference

AudioStream management functions. More...

#include <AudioStream.hpp>

Public Member Functions

 AudioStream (AudioStream &&other)
 
 AudioStream (const ::AudioStream &music)
 
 AudioStream (const AudioStream &)=delete
 
 AudioStream (rAudioBuffer *buffer=nullptr, rAudioProcessor *processor=nullptr, unsigned int sampleRate=0, unsigned int sampleSize=0, unsigned int channels=0)
 
 AudioStream (unsigned int sampleRate, unsigned int sampleSize, unsigned int channels=2)
 Init audio stream (to stream raw audio pcm data) More...
 
void AttachProcessor (::AudioCallback processor)
 Attach audio stream processor to stream. More...
 
void DetachProcessor (::AudioCallback processor)
 Detach audio stream processor from stream. More...
 
rAudioBuffer * GetBuffer () const
 Retrieves the buffer value for the object. More...
 
unsigned int GetChannels () const
 Retrieves the channels value for the object. More...
 
rAudioProcessor * GetProcessor () const
 Retrieves the processor value for the object. More...
 
unsigned int GetSampleRate () const
 Retrieves the sampleRate value for the object. More...
 
unsigned int GetSampleSize () const
 Retrieves the sampleSize value for the object. More...
 
bool IsPlaying () const
 Check if audio stream is playing. More...
 
bool IsProcessed () const
 Check if any audio stream buffers requires refill. More...
 
bool IsReady () const
 Retrieve whether or not the audio stream is ready. More...
 
void Load (unsigned int SampleRate, unsigned int SampleSize, unsigned int Channels=2)
 Load audio stream (to stream raw audio pcm data) More...
 
AudioStreamoperator= (AudioStream &&other) noexcept
 
AudioStreamoperator= (const ::AudioStream &stream)
 
AudioStreamoperator= (const AudioStream &)=delete
 
AudioStreamPause ()
 Pause audio stream. More...
 
AudioStreamPlay ()
 Play audio stream. More...
 
AudioStreamResume ()
 Resume audio stream. More...
 
void SetCallback (::AudioCallback callback)
 Audio thread callback to request new data. More...
 
AudioStreamSetPan (float pan=0.5f)
 Set pan for audio stream (0.5 is centered) More...
 
AudioStreamSetPitch (float pitch)
 Set pitch for audio stream (1.0 is base level) More...
 
AudioStreamSetVolume (float volume=1.0f)
 Set volume for audio stream (1.0 is max level) More...
 
AudioStreamStop ()
 Stop audio stream. More...
 
void Unload ()
 Unload audio stream and free memory. More...
 
AudioStreamUpdate (const void *data, int samplesCount)
 Update audio stream buffers with data. More...
 
AudioStreamUpdate (std::span< std::byte > data)
 Update audio stream buffers with data. More...
 

Static Public Member Functions

static void SetBufferSizeDefault (int size)
 Default size for new audio streams. More...
 

Protected Member Functions

void set (const ::AudioStream &stream)
 

Detailed Description

AudioStream management functions.

Definition at line 13 of file AudioStream.hpp.

Constructor & Destructor Documentation

◆ AudioStream() [1/4]

raylib::AudioStream::AudioStream ( const ::AudioStream &  music)
inline

Definition at line 15 of file AudioStream.hpp.

◆ AudioStream() [2/4]

raylib::AudioStream::AudioStream ( rAudioBuffer *  buffer = nullptr,
rAudioProcessor *  processor = nullptr,
unsigned int  sampleRate = 0,
unsigned int  sampleSize = 0,
unsigned int  channels = 0 
)
inline

Definition at line 19 of file AudioStream.hpp.

◆ AudioStream() [3/4]

raylib::AudioStream::AudioStream ( unsigned int  sampleRate,
unsigned int  sampleSize,
unsigned int  channels = 2 
)
inline

Init audio stream (to stream raw audio pcm data)

Exceptions
raylib::RaylibExceptionThrows if the AudioStream failed to load.

Definition at line 32 of file AudioStream.hpp.

References Load().

◆ AudioStream() [4/4]

raylib::AudioStream::AudioStream ( AudioStream &&  other)
inline

Definition at line 38 of file AudioStream.hpp.

◆ ~AudioStream()

raylib::AudioStream::~AudioStream ( )
inline

Definition at line 48 of file AudioStream.hpp.

Member Function Documentation

◆ AttachProcessor()

void raylib::AudioStream::AttachProcessor ( ::AudioCallback  processor)
inline

Attach audio stream processor to stream.

Definition at line 194 of file AudioStream.hpp.

◆ DetachProcessor()

void raylib::AudioStream::DetachProcessor ( ::AudioCallback  processor)
inline

Detach audio stream processor from stream.

Definition at line 201 of file AudioStream.hpp.

◆ GetBuffer()

rAudioBuffer * raylib::AudioStream::GetBuffer ( ) const
inline

Retrieves the buffer value for the object.

Returns
The buffer value of the object.

Definition at line 52 of file AudioStream.hpp.

◆ GetChannels()

unsigned int raylib::AudioStream::GetChannels ( ) const
inline

Retrieves the channels value for the object.

Returns
The channels value of the object.

Definition at line 56 of file AudioStream.hpp.

◆ GetProcessor()

rAudioProcessor * raylib::AudioStream::GetProcessor ( ) const
inline

Retrieves the processor value for the object.

Returns
The processor value of the object.

Definition at line 53 of file AudioStream.hpp.

◆ GetSampleRate()

unsigned int raylib::AudioStream::GetSampleRate ( ) const
inline

Retrieves the sampleRate value for the object.

Returns
The sampleRate value of the object.

Definition at line 54 of file AudioStream.hpp.

◆ GetSampleSize()

unsigned int raylib::AudioStream::GetSampleSize ( ) const
inline

Retrieves the sampleSize value for the object.

Returns
The sampleSize value of the object.

Definition at line 55 of file AudioStream.hpp.

◆ IsPlaying()

bool raylib::AudioStream::IsPlaying ( ) const
inline

Check if audio stream is playing.

Definition at line 141 of file AudioStream.hpp.

◆ IsProcessed()

bool raylib::AudioStream::IsProcessed ( ) const
inline

Check if any audio stream buffers requires refill.

Definition at line 110 of file AudioStream.hpp.

◆ IsReady()

bool raylib::AudioStream::IsReady ( ) const
inline

Retrieve whether or not the audio stream is ready.

Definition at line 208 of file AudioStream.hpp.

Referenced by Load(), and Unload().

◆ Load()

void raylib::AudioStream::Load ( unsigned int  SampleRate,
unsigned int  SampleSize,
unsigned int  Channels = 2 
)
inline

Load audio stream (to stream raw audio pcm data)

Exceptions
raylib::RaylibExceptionThrows if the AudioStream failed to load.

Definition at line 217 of file AudioStream.hpp.

References IsReady(), and Unload().

Referenced by AudioStream().

◆ operator=() [1/2]

AudioStream & raylib::AudioStream::operator= ( AudioStream &&  other)
inlinenoexcept

Definition at line 65 of file AudioStream.hpp.

◆ operator=() [2/2]

AudioStream & raylib::AudioStream::operator= ( const ::AudioStream &  stream)
inline

Definition at line 58 of file AudioStream.hpp.

◆ Pause()

AudioStream & raylib::AudioStream::Pause ( )
inline

Pause audio stream.

Definition at line 125 of file AudioStream.hpp.

◆ Play()

AudioStream & raylib::AudioStream::Play ( )
inline

Play audio stream.

Definition at line 117 of file AudioStream.hpp.

◆ Resume()

AudioStream & raylib::AudioStream::Resume ( )
inline

Resume audio stream.

Definition at line 133 of file AudioStream.hpp.

◆ set()

void raylib::AudioStream::set ( const ::AudioStream &  stream)
inlineprotected

Definition at line 226 of file AudioStream.hpp.

◆ SetBufferSizeDefault()

static void raylib::AudioStream::SetBufferSizeDefault ( int  size)
inlinestatic

Default size for new audio streams.

Definition at line 180 of file AudioStream.hpp.

◆ SetCallback()

void raylib::AudioStream::SetCallback ( ::AudioCallback  callback)
inline

Audio thread callback to request new data.

Definition at line 187 of file AudioStream.hpp.

◆ SetPan()

AudioStream & raylib::AudioStream::SetPan ( float  pan = 0.5f)
inline

Set pan for audio stream (0.5 is centered)

Definition at line 172 of file AudioStream.hpp.

◆ SetPitch()

AudioStream & raylib::AudioStream::SetPitch ( float  pitch)
inline

Set pitch for audio stream (1.0 is base level)

Definition at line 164 of file AudioStream.hpp.

◆ SetVolume()

AudioStream & raylib::AudioStream::SetVolume ( float  volume = 1.0f)
inline

Set volume for audio stream (1.0 is max level)

Definition at line 156 of file AudioStream.hpp.

◆ Stop()

AudioStream & raylib::AudioStream::Stop ( )
inline

Stop audio stream.

Definition at line 148 of file AudioStream.hpp.

◆ Unload()

void raylib::AudioStream::Unload ( )
inline

Unload audio stream and free memory.

Definition at line 101 of file AudioStream.hpp.

References IsReady().

Referenced by Load().

◆ Update() [1/2]

AudioStream & raylib::AudioStream::Update ( const void *  data,
int  samplesCount 
)
inline

Update audio stream buffers with data.

Definition at line 85 of file AudioStream.hpp.

◆ Update() [2/2]

AudioStream & raylib::AudioStream::Update ( std::span< std::byte >  data)
inline

Update audio stream buffers with data.

Definition at line 93 of file AudioStream.hpp.