00001 #ifndef INPUT_WAV_H 00002 #define INPUT_WAV_H 00003 00004 00005 #include "audiere.h" 00006 #include "basic_source.h" 00007 #include "types.h" 00008 00009 00010 namespace audiere { 00011 00012 class WAVInputStream : public BasicSource { 00013 public: 00014 WAVInputStream(); 00015 00016 bool initialize(FilePtr file); 00017 00018 void ADR_CALL getFormat( 00019 int& channel_count, 00020 int& sample_rate, 00021 SampleFormat& sample_format); 00022 int doRead(int frame_count, void* buffer); 00023 void ADR_CALL reset(); 00024 00025 bool ADR_CALL isSeekable(); 00026 int ADR_CALL getLength(); 00027 void ADR_CALL setPosition(int position); 00028 int ADR_CALL getPosition(); 00029 00030 private: 00031 bool findFormatChunk(); 00032 bool findDataChunk(); 00033 bool skipBytes(int size); 00034 00035 private: 00036 FilePtr m_file; 00037 00038 // from format chunk 00039 int m_channel_count; 00040 int m_sample_rate; 00041 SampleFormat m_sample_format; 00042 00043 // from data chunk 00044 int m_data_chunk_location; // bytes 00045 int m_data_chunk_length; // in frames 00046 00047 int m_frames_left_in_chunk; 00048 }; 00049 00050 } 00051 00052 00053 #endif