|
AudioDataLib
A C++ library of classes supporting a variety of audio-data tasks.
|
This is the base class for all types of byte streams used in the library. More...
#include <ByteStream.h>
Public Member Functions | |
| ByteStream () | |
| virtual | ~ByteStream () |
| virtual uint64_t | WriteBytesToStream (const uint8_t *buffer, uint64_t bufferSize)=0 |
| virtual uint64_t | ReadBytesFromStream (uint8_t *buffer, uint64_t bufferSize)=0 |
| virtual uint64_t | PeekBytesFromStream (uint8_t *buffer, uint64_t bufferSize) |
| virtual uint64_t | GetSize () const =0 |
| virtual bool | CanRead ()=0 |
| virtual bool | CanWrite ()=0 |
| template<typename T > | |
| bool | ReadType (T *value) |
| template<typename T > | |
| bool | WriteType (const T *value) |
This is the base class for all types of byte streams used in the library.
Some derivatives are read-only, write-only, or read-write. Consequently, not all interface methods are supported by all derivatives.
| ByteStream::ByteStream | ( | ) |
|
virtual |
|
pure virtual |
Indicate whether there is data available to be read from the stream.
Implemented in AudioDataLib::FileInputStream, AudioDataLib::FileOutputStream, AudioDataLib::ReadOnlyBufferStream, AudioDataLib::WriteOnlyBufferStream, AudioDataLib::AudioStream, AudioDataLib::ThreadSafeAudioStream, and AudioDataLib::MemoryStream.
|
pure virtual |
Indicate whether it is possible to write additional data to the stream.
Implemented in AudioDataLib::FileInputStream, AudioDataLib::FileOutputStream, AudioDataLib::ReadOnlyBufferStream, AudioDataLib::WriteOnlyBufferStream, AudioDataLib::AudioStream, AudioDataLib::ThreadSafeAudioStream, and AudioDataLib::MemoryStream.
|
pure virtual |
Return the amount of data (in bytes) currently stored in the stream.
Implemented in AudioDataLib::FileInputStream, AudioDataLib::FileOutputStream, AudioDataLib::ReadOnlyBufferStream, AudioDataLib::WriteOnlyBufferStream, AudioDataLib::AudioStream, AudioDataLib::ThreadSafeAudioStream, and AudioDataLib::MemoryStream.
|
virtual |
Read from this stream into the given buffer, but unlike ReadBytesFromStream, do not modify the stream. That is, a subsequent read from the stream will read from the same location.
| [out] | buffer | This is a pointer to an array where bytes read from the stream will be written. |
| [in] | bufferSize | This is the size in bytes of the given array. |
Reimplemented in AudioDataLib::ReadOnlyBufferStream.
|
pure virtual |
Read from this stream into the given buffer.
| [out] | buffer | This is a pointer to an array where bytes read from the stream will be written. |
| [in] | bufferSize | This is the size in bytes of the given array. |
Implemented in AudioDataLib::FileInputStream, AudioDataLib::FileOutputStream, AudioDataLib::ReadOnlyBufferStream, AudioDataLib::WriteOnlyBufferStream, AudioDataLib::AudioStream, AudioDataLib::ThreadSafeAudioStream, and AudioDataLib::MemoryStream.
|
inline |
Read an amount of data from the stream equal to the size of the given type. Byte-swapping may be a consideration here. Note that a failed read could still be a partial read. In other words, the stream can get modified even if the read fails.
|
pure virtual |
Write the given buffer to this stream.
| [in] | buffer | This is a pointer to the array of bytes to write to the stream. |
| [in] | bufferSize | This is the size of the given array in bytes. |
Implemented in AudioDataLib::FileInputStream, AudioDataLib::FileOutputStream, AudioDataLib::ReadOnlyBufferStream, AudioDataLib::WriteOnlyBufferStream, AudioDataLib::AudioStream, AudioDataLib::ThreadSafeAudioStream, and AudioDataLib::MemoryStream.
|
inline |
Write an amount of data to the stream equal to the size of the given type. Byte-swapping may be a consideration here. Note that a failed write could still be a partial write. In other words, the stream can get modified even if the write fails.