Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

resampler.hpp

Go to the documentation of this file.
00001 #ifndef RESAMPLER_HPP
00002 #define RESAMPLER_HPP
00003 
00004 
00005 #include "config.h"
00006 #include "input.hpp"
00007 
00008 
00009 class Resampler : public ISampleSource
00010 {
00011 public:
00012   Resampler(ISampleSource* source);
00013   ~Resampler();
00014 
00015   // for now, resamplers always return (2, 44100, 16)
00016   void GetFormat(int& channel_count, int& sample_rate, int& bits_per_sample);
00017 
00018   int Read(int sample_count, void* samples);
00019   bool Reset();
00020 
00021 private:
00022   void FillBuffer();
00023   void ResetState();
00024 
00025 private:
00026   ISampleSource* m_source;
00027   int m_native_channel_count;
00028   int m_native_sample_rate;
00029   int m_native_bits_per_sample;
00030 
00031   static const int NATIVE_BUFFER_SIZE = 4096;
00032   adr_s16 m_native_buffer[NATIVE_BUFFER_SIZE * 2];
00033   adr_s16* m_position;
00034   unsigned m_samples_left;  // number of samples left to consume
00035 
00036   unsigned m_time;
00037   adr_s16 m_sl; // left channel
00038   adr_s16 m_sr; // right channel
00039 };
00040 
00041 
00042 #endif

Generated at Mon Jun 10 02:55:12 2002 for audiere by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001