Streams provide I/O to and from an audio file of a given format. More...
#include <AudioCodecs_Stream.hxx>
Public Member Functions | |
Stream () | |
virtual | ~Stream () |
virtual void | PrepareReading ()=0 |
Open the stream in read mode. | |
virtual void | PrepareWriting ()=0 |
Open the stream in write mode. | |
virtual void | Dispose ()=0 |
Close the stream. | |
virtual void | SeekTo (unsigned long framePosition) |
Moves the current position to framePosition. If such functionality is not supported by the stream it will be ignored. | |
virtual unsigned long | GetFramePosition () const |
Returns the current frame position. | |
bool | ReadData (int channel, TData *buffer, unsigned nFrames) |
Read a picked channel. | |
bool | ReadData (TData **buffers, unsigned nFrames) |
Read all the channels. | |
bool | ReadData (int *channels, int nchannels, TData **buffers, unsigned nFrames) |
Read many picked channels. | |
void | WriteData (int channel, const TData *buffer, unsigned nFrames) |
Read a picked channel (Do it has sense?). | |
void | WriteData (TData **const buffers, unsigned nFrames) |
Read all the channels. | |
void | WriteData (int *channels, int nchannels, TData **const buffers, unsigned nFrames) |
Read many picked channels (Do it has sense?). | |
Protected Member Functions | |
virtual void | DiskToMemoryTransfer ()=0 |
Move data from the file to mInterleavedData. | |
virtual void | MemoryToDiskTransfer ()=0 |
Move data from mInterleavedData to the file. | |
void | SetChannels (unsigned nChannels) |
Protected Attributes | |
unsigned | mChannels |
std::vector< TData > | mInterleavedData |
bool | mEOFReached |
unsigned | mFramesLastRead |
unsigned long | mFramePosition |
Streams provide I/O to and from an audio file of a given format.
You can get a stream by using a Codec. To add support for a different format you must subclass both the Codec and the Stream.
Definition at line 43 of file AudioCodecs_Stream.hxx.
CLAM::AudioCodecs::Stream::Stream | ( | ) |
Definition at line 24 of file AudioCodecs_Stream.cxx.
CLAM::AudioCodecs::Stream::~Stream | ( | ) | [virtual] |
Definition at line 30 of file AudioCodecs_Stream.cxx.
virtual void CLAM::AudioCodecs::Stream::DiskToMemoryTransfer | ( | ) | [protected, pure virtual] |
Move data from the file to mInterleavedData.
Implemented in CLAM::AudioCodecs::MpegAudioStream, CLAM::AudioCodecs::OggVorbisAudioStream, and CLAM::AudioCodecs::PCMAudioStream.
virtual void CLAM::AudioCodecs::Stream::Dispose | ( | ) | [pure virtual] |
Close the stream.
Implemented in CLAM::AudioCodecs::MpegAudioStream, CLAM::AudioCodecs::OggVorbisAudioStream, and CLAM::AudioCodecs::PCMAudioStream.
Referenced by CLAM::MultiChannelAudioFileWriter::DestroyOldInputs().
virtual unsigned long CLAM::AudioCodecs::Stream::GetFramePosition | ( | ) | const [inline, virtual] |
Returns the current frame position.
Definition at line 58 of file AudioCodecs_Stream.hxx.
References mFramePosition.
virtual void CLAM::AudioCodecs::Stream::MemoryToDiskTransfer | ( | ) | [protected, pure virtual] |
Move data from mInterleavedData to the file.
Implemented in CLAM::AudioCodecs::MpegAudioStream, CLAM::AudioCodecs::OggVorbisAudioStream, and CLAM::AudioCodecs::PCMAudioStream.
virtual void CLAM::AudioCodecs::Stream::PrepareReading | ( | ) | [pure virtual] |
Open the stream in read mode.
Implemented in CLAM::AudioCodecs::MpegAudioStream, CLAM::AudioCodecs::OggVorbisAudioStream, and CLAM::AudioCodecs::PCMAudioStream.
virtual void CLAM::AudioCodecs::Stream::PrepareWriting | ( | ) | [pure virtual] |
Open the stream in write mode.
Implemented in CLAM::AudioCodecs::MpegAudioStream, CLAM::AudioCodecs::OggVorbisAudioStream, and CLAM::AudioCodecs::PCMAudioStream.
Referenced by CLAM::MultiChannelAudioFileWriter::ConcreteStop(), and CLAM::MonoAudioFileWriter::ConcreteStop().
bool CLAM::AudioCodecs::Stream::ReadData | ( | int * | channels, | |
int | nchannels, | |||
TData ** | buffers, | |||
unsigned | nFrames | |||
) |
Read many picked channels.
Definition at line 63 of file AudioCodecs_Stream.cxx.
Read all the channels.
Definition at line 49 of file AudioCodecs_Stream.cxx.
Read a picked channel.
Definition at line 34 of file AudioCodecs_Stream.cxx.
virtual void CLAM::AudioCodecs::Stream::SeekTo | ( | unsigned long | framePosition | ) | [inline, virtual] |
Moves the current position to framePosition. If such functionality is not supported by the stream it will be ignored.
Reimplemented in CLAM::AudioCodecs::MpegAudioStream, and CLAM::AudioCodecs::OggVorbisAudioStream.
Definition at line 56 of file AudioCodecs_Stream.hxx.
void CLAM::AudioCodecs::Stream::SetChannels | ( | unsigned | nChannels | ) | [protected] |
Definition at line 142 of file AudioCodecs_Stream.cxx.
Referenced by CLAM::AudioCodecs::PCMAudioStream::PCMAudioStream().
void CLAM::AudioCodecs::Stream::WriteData | ( | int * | channels, | |
int | nchannels, | |||
TData **const | buffers, | |||
unsigned | nFrames | |||
) |
Read many picked channels (Do it has sense?).
Definition at line 118 of file AudioCodecs_Stream.cxx.
Read all the channels.
Definition at line 106 of file AudioCodecs_Stream.cxx.
Read a picked channel (Do it has sense?).
Definition at line 95 of file AudioCodecs_Stream.cxx.
Referenced by CLAM::MonoAudioFileWriter::ConcreteConfigure().
unsigned CLAM::AudioCodecs::Stream::mChannels [protected] |
Definition at line 86 of file AudioCodecs_Stream.hxx.
Referenced by CLAM::AudioCodecs::OggVorbisAudioStream::DiskToMemoryTransfer(), CLAM::AudioCodecs::PCMAudioStream::MemoryToDiskTransfer(), CLAM::AudioCodecs::OggVorbisAudioStream::MemoryToDiskTransfer(), CLAM::AudioCodecs::OggVorbisAudioStream::OggVorbisAudioStream(), and CLAM::AudioCodecs::OggVorbisAudioStream::PrepareReading().
bool CLAM::AudioCodecs::Stream::mEOFReached [protected] |
unsigned long CLAM::AudioCodecs::Stream::mFramePosition [protected] |
Definition at line 90 of file AudioCodecs_Stream.hxx.
Referenced by CLAM::AudioCodecs::PCMAudioStream::DiskToMemoryTransfer(), GetFramePosition(), CLAM::AudioCodecs::PCMAudioStream::PrepareReading(), CLAM::AudioCodecs::OggVorbisAudioStream::PrepareReading(), CLAM::AudioCodecs::PCMAudioStream::SeekTo(), and CLAM::AudioCodecs::OggVorbisAudioStream::SeekTo().
unsigned CLAM::AudioCodecs::Stream::mFramesLastRead [protected] |
Definition at line 89 of file AudioCodecs_Stream.hxx.
Referenced by CLAM::AudioCodecs::PCMAudioStream::DiskToMemoryTransfer(), and CLAM::AudioCodecs::OggVorbisAudioStream::DiskToMemoryTransfer().
std::vector<TData> CLAM::AudioCodecs::Stream::mInterleavedData [protected] |
Definition at line 87 of file AudioCodecs_Stream.hxx.
Referenced by CLAM::AudioCodecs::PCMAudioStream::DiskToMemoryTransfer(), CLAM::AudioCodecs::OggVorbisAudioStream::DiskToMemoryTransfer(), CLAM::AudioCodecs::PCMAudioStream::MemoryToDiskTransfer(), and CLAM::AudioCodecs::OggVorbisAudioStream::MemoryToDiskTransfer().