|
|
// ########################################################################## // #### #### // #### RTP Audio Server Project #### // #### ============================ #### // #### #### // #### WAV Audio Reader #### // #### #### // #### Version 1.00 -- February 04, 2001 #### // #### #### // #### Copyright (C) 1999 Thomas Dreibholz #### // #### 2000 Universität Bonn, Abt. IV #### // #### 2001 EMail: Dreibholz@bigfoot.com #### // #### WWW: http://www.bigfoot.com/~dreibholz #### // #### #### // ########################################################################## #ifndef WAVAUDIOREADER_H #define WAVAUDIOREADER_H #include "system.h" #include "audioreaderinterface.h" #include "audioquality.h" namespace Coral { /** * This class is a reader for WAV audio files. * * @short WAV Audio Reader * @author Thomas Dreibholz (Dreibholz@bigfoot.com) * @version 1.0 */ class WavAudioReader : public AudioReaderInterface, public AudioQuality { // ====== Constructor/Destructor ========================================= public: /** * Constructor. * * @param name Name of WAV file or NULL. */ WavAudioReader(const char* name = NULL); /** * Destructor. */ ~WavAudioReader(); // ====== Initialize ===================================================== /** * openMedia() implementation of AudioReaderInterface. * * @see AudioReaderInterface#openMedia */ bool openMedia(const char* name); /** * closeMedia() implementation of AudioReaderInterface. * * @see AudioReaderInterface#closeMedia */ void closeMedia(); /** * ready() implementation of AudioReaderInterface. * * @see AudioReaderInterface#ready */ bool ready() const; // ====== Input functions ================================================ /** * getMediaInfo() implementation of AudioReaderInterface. * * @see AudioReaderInterface#getMediaInfo */ void getMediaInfo(MediaInfo& mediaInfo) const; /** * getErrorCode() implementation of AudioReaderInterface. * * @see AudioReaderInterface#getErrorCode */ MediaError getErrorCode() const; /** * getPosition() implementation of AudioReaderInterface. * * @see AudioReaderInterface#getPosition */ card64 getPosition() const; /** * getMaxPosition() implementation of AudioReaderInterface. * * @see AudioReaderInterface#getMaxPosition */ card64 getMaxPosition() const; /** * setPosition() implementation of AudioReaderInterface. * * @see AudioReaderInterface#setPosition */ void setPosition(const card64 position); /** * getNextBlock() implementation of AudioReaderInterface. * * @see AudioReaderInterface#getNextBlock */ cardinal getNextBlock(void* buffer, const cardinal blockSize); // ====== Private data =================================================== private: struct RIFF_Header { char RIFF[4]; card32 Length; char FormatID[4]; }; struct RIFF_Chunk { char ID[4]; card32 Length; }; struct WAVE_Format { card16 FormatTag; card16 Channels; card32 SamplesPerSec; card32 AvgBytesPerSec; card16 BlockAlign; }; bool getChunk(RIFF_Chunk& chunk); MediaError Error; FILE* InputFD; WAVE_Format Format; card64 StartPosition; card64 EndPosition; card64 Position; card64 MaxPosition; }; } #endif
Generated by: viper@odin on Sun Feb 4 18:54:51 2001, using kdoc 2.0a22. |