TDME2 1.9.121
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
AudioStream Class Referenceabstract

Audio stream. More...

#include <tdme/audio/AudioStream.h>

Inheritance diagram for AudioStream:
Inheritance graph
Collaboration diagram for AudioStream:
Collaboration graph

Public Member Functions

virtual void setParameters (uint32_t sampleRate, uint8_t channels, const uint32_t bufferSize=32768)
 Set audio initialization parameters. More...
 
virtual bool isPlaying () override
 
virtual void rewind () override
 Rewinds this audio entity. More...
 
virtual void play () override
 Plays this audio entity. More...
 
virtual void pause () override
 Pauses this audio entity. More...
 
virtual void stop () override
 Stops this audio entity. More...
 
- Public Member Functions inherited from AudioEntity
virtual const string & getId () const
 
virtual const bool isLooping () const
 
virtual void setLooping (bool looping)
 Set looping. More...
 
virtual const bool isFixed () const
 
virtual void setFixed (bool fixed)
 Set this entity fixed, means the sound will always played no matter where the position and listener is located. More...
 
virtual const float getPitch () const
 
virtual void setPitch (float pitch)
 Set up pitch. More...
 
virtual const float getGain () const
 
virtual void setGain (float gain)
 Set up gain. More...
 
virtual const Vector3getSourcePosition () const
 
virtual void setSourcePosition (const Vector3 &sourcePosition)
 Set source position. More...
 
virtual const Vector3getSourceDirection () const
 
virtual void setSourceDirection (const Vector3 &sourceDirection)
 Set source direction. More...
 
virtual const Vector3getSourceVelocity () const
 
virtual void getSourceVelocity (const Vector3 &sourceVelocity)
 Set source velocity. More...
 
virtual bool isPlaying ()=0
 
virtual void rewind ()=0
 Rewinds this audio entity. More...
 
virtual void play ()=0
 Plays this audio entity. More...
 
virtual void pause ()=0
 Pauses this audio entity. More...
 
virtual void stop ()=0
 Stops this audio entity. More...
 

Protected Member Functions

 AudioStream (const string &id)
 Protected constructor. More...
 
virtual ~AudioStream ()
 Destructor. More...
 
virtual bool initialize () override
 Initiates this OpenAL entity to OpenAl. More...
 
virtual void update () override
 Commits properties to OpenAl. More...
 
virtual void dispose () override
 Dispose this entity from OpenAL. More...
 
virtual void fillBuffer (ByteBuffer *data)=0
 Fill buffer. More...
 
- Protected Member Functions inherited from AudioEntity
 AudioEntity (const string &id)
 Constructor. More...
 
virtual ~AudioEntity ()
 Constructor. More...
 
virtual bool initialize ()=0
 Initiates this OpenAL entity to OpenAl. More...
 
virtual void update ()=0
 Commits properties to OpenAl. More...
 
virtual void dispose ()=0
 Dispose this entity from OpenAL. More...
 

Private Member Functions

bool isPlayingBuffers ()
 
void updateProperties ()
 Updates properties to Open AL. More...
 

Private Attributes

bool initiated { false }
 
array< uint32_t, 2 > alBufferIds
 
uint32_t alSourceId
 
uint32_t sampleRate
 
uint8_t channels
 
ByteBufferdata { nullptr }
 
int32_t format
 
bool playing { false }
 

Friends

class Audio
 

Additional Inherited Members

- Protected Attributes inherited from AudioEntity
string id
 
bool looping
 
bool fixed
 
float pitch
 
float gain
 
Vector3 sourcePosition
 
Vector3 sourceDirection
 
Vector3 sourceVelocity
 

Detailed Description

Audio stream.

Author
Andreas Drewke
Version
$Id$

Definition at line 22 of file AudioStream.h.

Constructor & Destructor Documentation

◆ AudioStream()

AudioStream ( const string &  id)
protected

Protected constructor.

Parameters
idid

Definition at line 31 of file AudioStream.cpp.

◆ ~AudioStream()

~AudioStream ( )
protectedvirtual

Destructor.

Definition at line 41 of file AudioStream.cpp.

Member Function Documentation

◆ dispose()

void dispose ( )
overrideprotectedvirtual

Dispose this entity from OpenAL.

Implements AudioEntity.

Reimplemented in VorbisAudioStream.

Definition at line 239 of file AudioStream.cpp.

◆ fillBuffer()

virtual void fillBuffer ( ByteBuffer data)
protectedpure virtual

Fill buffer.

Parameters
datadata

Implemented in VorbisAudioStream.

◆ initialize()

bool initialize ( )
overrideprotectedvirtual

Initiates this OpenAL entity to OpenAl.

Implements AudioEntity.

Reimplemented in VorbisAudioStream.

Definition at line 144 of file AudioStream.cpp.

◆ isPlaying()

bool isPlaying ( )
overridevirtual
Returns
if stream is playing

Implements AudioEntity.

Definition at line 57 of file AudioStream.cpp.

◆ isPlayingBuffers()

bool isPlayingBuffers ( )
private
Returns
having buffers that are currently played

Definition at line 51 of file AudioStream.cpp.

◆ pause()

void pause ( )
overridevirtual

Pauses this audio entity.

Implements AudioEntity.

Definition at line 104 of file AudioStream.cpp.

◆ play()

void play ( )
overridevirtual

Plays this audio entity.

Implements AudioEntity.

Definition at line 66 of file AudioStream.cpp.

◆ rewind()

void rewind ( )
overridevirtual

Rewinds this audio entity.

Implements AudioEntity.

Reimplemented in VorbisAudioStream.

Definition at line 62 of file AudioStream.cpp.

◆ setParameters()

void setParameters ( uint32_t  sampleRate,
uint8_t  channels,
const uint32_t  bufferSize = 32768 
)
virtual

Set audio initialization parameters.

Parameters
sampleRatesample rate
channelschannels
bufferSizebuffer size

Definition at line 44 of file AudioStream.cpp.

◆ stop()

void stop ( )
overridevirtual

Stops this audio entity.

Implements AudioEntity.

Definition at line 115 of file AudioStream.cpp.

◆ update()

void update ( )
overrideprotectedvirtual

Commits properties to OpenAl.

Implements AudioEntity.

Definition at line 171 of file AudioStream.cpp.

◆ updateProperties()

void updateProperties ( )
private

Updates properties to Open AL.

Definition at line 222 of file AudioStream.cpp.

Friends And Related Function Documentation

◆ Audio

friend class Audio
friend

Definition at line 25 of file AudioStream.h.

Member Data Documentation

◆ alBufferIds

array<uint32_t, 2> alBufferIds
private

Definition at line 29 of file AudioStream.h.

◆ alSourceId

uint32_t alSourceId
private

Definition at line 30 of file AudioStream.h.

◆ channels

uint8_t channels
private

Definition at line 32 of file AudioStream.h.

◆ data

ByteBuffer* data { nullptr }
private

Definition at line 33 of file AudioStream.h.

◆ format

int32_t format
private

Definition at line 34 of file AudioStream.h.

◆ initiated

bool initiated { false }
private

Definition at line 28 of file AudioStream.h.

◆ playing

bool playing { false }
private

Definition at line 35 of file AudioStream.h.

◆ sampleRate

uint32_t sampleRate
private

Definition at line 31 of file AudioStream.h.


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