ResamplingReader.h 832 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef NULLSOFT_WINAMP_RESAMPLINGREADER_H
  2. #define NULLSOFT_WINAMP_RESAMPLINGREADER_H
  3. #include "../Agave/DecodeFile/ifc_audiostream.h"
  4. #include "Resampler.h"
  5. #include "CommonReader.h"
  6. // TODO: should probably pass in a sample frame size (nch*bps/8) so that we can have an integral number of samples in the buffer
  7. #define RESAMPLE_BUFFERSIZE 1024
  8. class ResamplingReader :public CommonReader
  9. {
  10. public:
  11. ResamplingReader(Resampler *_resampler, CommonReader *_reader, size_t inputFrameSize);
  12. ~ResamplingReader();
  13. size_t ReadAudio(void *outputBuffer, size_t sizeBytes);
  14. protected:
  15. RECVS_DISPATCH;
  16. private:
  17. Resampler *resampler;
  18. CommonReader *reader;
  19. __int8 *buffer;
  20. size_t bufferAlloc;
  21. size_t bufferValid;
  22. enum ReadState
  23. {
  24. READING=0,
  25. ENDOFFILE=1,
  26. FLUSHING=2,
  27. DONE=3,
  28. };
  29. ReadState readState;
  30. };
  31. #endif