Dry
|
Sound stream that supports manual buffering of data from the main thread. More...
#include <Dry/Audio/BufferedSoundStream.h>
Public Member Functions | |
BufferedSoundStream () | |
Construct. | |
~BufferedSoundStream () override | |
Destruct. | |
unsigned | GetData (signed char *dest, unsigned numBytes) override |
Produce sound data into destination. Return number of bytes produced. Called by SoundSource from the mixing thread. | |
void | AddData (void *data, unsigned numBytes) |
Buffer sound data. Makes a copy of it. | |
void | AddData (const SharedArrayPtr< signed char > &data, unsigned numBytes) |
Buffer sound data by taking ownership of it. | |
void | AddData (const SharedArrayPtr< signed short > &data, unsigned numBytes) |
Buffer sound data by taking ownership of it. | |
void | Clear () |
Remove all buffered audio data. | |
unsigned | GetBufferNumBytes () const |
Return amount of buffered (unplayed) sound data in bytes. | |
float | GetBufferLength () const |
Return length of buffered (unplayed) sound data in seconds. | |
![]() | |
SoundStream () | |
Construct. | |
~SoundStream () override | |
Destruct. | |
virtual bool | Seek (unsigned sample_number) |
Seek to sample number. Return true on success. Need not be implemented by all streams. | |
void | SetFormat (unsigned frequency, bool sixteenBit, bool stereo) |
Set sound data format. | |
void | SetStopAtEnd (bool enable) |
Set whether playback should stop when no more data. Default false. | |
unsigned | GetSampleSize () const |
Return sample size. | |
float | GetFrequency () const |
Return default frequency as a float. | |
unsigned | GetIntFrequency () const |
Return default frequency as an integer. | |
bool | GetStopAtEnd () const |
Return whether playback should stop when no more data. | |
bool | IsSixteenBit () const |
Return whether data is sixteen bit. | |
bool | IsStereo () const |
Return whether data is stereo. | |
![]() | |
RefCounted () | |
Construct. Allocate the reference count structure and set an initial self weak reference. | |
virtual | ~RefCounted () |
Destruct. Mark as expired and also delete the reference count structure if no outside weak references exist. | |
RefCounted (const RefCounted &rhs)=delete | |
Prevent copy construction. | |
RefCounted & | operator= (const RefCounted &rhs)=delete |
Prevent assignment. | |
void | AddRef () |
Increment reference count. Can also be called outside of a SharedPtr for traditional reference counting. | |
void | ReleaseRef () |
Decrement reference count and delete self if no more references. Can also be called outside of a SharedPtr for traditional reference counting. | |
int | Refs () const |
Return reference count. | |
int | WeakRefs () const |
Return weak reference count. | |
RefCount * | RefCountPtr () |
Return pointer to the reference count structure. | |
Private Attributes | |
List< Pair< SharedArrayPtr< signed char >, unsigned > > | buffers_ |
Buffers and their sizes. | |
unsigned | position_ |
Byte position in the front most buffer. | |
Mutex | bufferMutex_ |
Mutex for buffer data. | |
Additional Inherited Members | |
![]() | |
unsigned | frequency_ |
Default frequency. | |
bool | stopAtEnd_ |
Stop when no more data flag. | |
bool | sixteenBit_ |
Sixteen bit flag. | |
bool | stereo_ |
Stereo flag. | |
Sound stream that supports manual buffering of data from the main thread.