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
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;
00035
00036 unsigned m_time;
00037 adr_s16 m_sl;
00038 adr_s16 m_sr;
00039 };
00040
00041
00042 #endif