AudioDataLib
A C++ library of classes supporting a variety of audio-data tasks.
Loading...
Searching...
No Matches
AudioDataLib::AudioStream Class Reference

This stream is designed to act as a FIFO queue of audio data of a particular format. More...

#include <ByteStream.h>

Inheritance diagram for AudioDataLib::AudioStream:
AudioDataLib::ByteStream AudioDataLib::ThreadSafeAudioStream

Public Member Functions

 AudioStream ()
 
 AudioStream (const AudioData *audioData)
 
virtual ~AudioStream ()
 
virtual uint64_t WriteBytesToStream (const uint8_t *buffer, uint64_t bufferSize) override
 
virtual uint64_t ReadBytesFromStream (uint8_t *buffer, uint64_t bufferSize) override
 
virtual uint64_t GetSize () const override
 
virtual bool CanRead () override
 
virtual bool CanWrite () override
 
const AudioData::FormatGetFormat () const
 
void SetFormat (const AudioData::Format &format)
 
- Public Member Functions inherited from AudioDataLib::ByteStream
 ByteStream ()
 
virtual ~ByteStream ()
 
virtual uint64_t PeekBytesFromStream (uint8_t *buffer, uint64_t bufferSize)
 
template<typename T >
bool ReadType (T *value)
 
template<typename T >
bool WriteType (const T *value)
 

Protected Attributes

AudioData::Format format
 
ByteStreambyteStream
 

Detailed Description

This stream is designed to act as a FIFO queue of audio data of a particular format.

This class by itself often acts, single-handedly, as the glue between this library and one that interfaces with the actual audio hardware. The low-level library will dicate the stream format, and then this library will accommodate that format. The low-level library reads from (or writes to) this stream while this library writes to (or reads from) it.

Constructor & Destructor Documentation

◆ AudioStream() [1/2]

AudioStream::AudioStream ( )

◆ AudioStream() [2/2]

AudioStream::AudioStream ( const AudioData * audioData)

◆ ~AudioStream()

AudioStream::~AudioStream ( )
virtual

Member Function Documentation

◆ CanRead()

bool AudioStream::CanRead ( )
overridevirtual

Indicate whether there is data available to be read from the stream.

Implements AudioDataLib::ByteStream.

Reimplemented in AudioDataLib::ThreadSafeAudioStream.

◆ CanWrite()

bool AudioStream::CanWrite ( )
overridevirtual

Indicate whether it is possible to write additional data to the stream.

Implements AudioDataLib::ByteStream.

Reimplemented in AudioDataLib::ThreadSafeAudioStream.

◆ GetFormat()

const AudioData::Format & AudioDataLib::AudioStream::GetFormat ( ) const
inline

◆ GetSize()

uint64_t AudioStream::GetSize ( ) const
overridevirtual

Return the amount of data (in bytes) currently stored in the stream.

Implements AudioDataLib::ByteStream.

Reimplemented in AudioDataLib::ThreadSafeAudioStream.

◆ ReadBytesFromStream()

uint64_t AudioStream::ReadBytesFromStream ( uint8_t * buffer,
uint64_t bufferSize )
overridevirtual

Read from this stream into the given buffer.

Parameters
[out]bufferThis is a pointer to an array where bytes read from the stream will be written.
[in]bufferSizeThis is the size in bytes of the given array.
Returns
The number of bytes actually read from the stream and written to the given buffer is returned.

Implements AudioDataLib::ByteStream.

Reimplemented in AudioDataLib::ThreadSafeAudioStream.

◆ SetFormat()

void AudioDataLib::AudioStream::SetFormat ( const AudioData::Format & format)
inline

◆ WriteBytesToStream()

uint64_t AudioStream::WriteBytesToStream ( const uint8_t * buffer,
uint64_t bufferSize )
overridevirtual

Write the given buffer to this stream.

Parameters
[in]bufferThis is a pointer to the array of bytes to write to the stream.
[in]bufferSizeThis is the size of the given array in bytes.
Returns
The number of bytes actually written to the stream is returned.

Implements AudioDataLib::ByteStream.

Reimplemented in AudioDataLib::ThreadSafeAudioStream.

Member Data Documentation

◆ byteStream

ByteStream* AudioDataLib::AudioStream::byteStream
protected

◆ format

AudioData::Format AudioDataLib::AudioStream::format
protected

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