c_crossfader.h 1019 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef __C_CROSSFADER_H__
  2. #define __C_CROSSFADER_H__
  3. #include "../Include/c_datapump.h"
  4. class C_CROSSFADER : public C_DATAPUMP<short> {
  5. private:
  6. protected:
  7. int BufferLength; // in milliseconds
  8. int srate;
  9. int nch;
  10. int crossfade;
  11. int mode;
  12. void SampleRateConvert(int newsrate);
  13. void ChannelConvert(int newnch);
  14. virtual void addItems(short *inputBuffer, size_t inputSize); // overriding the addItems() function to do crossfading and channels
  15. public:
  16. C_CROSSFADER(int length, int nCh, int sRate); // length is in milliseconds
  17. virtual ~C_CROSSFADER();
  18. void SetChannels(int nCh);
  19. void SetSampleRate(int sRate); // in samples per second
  20. void SetBufferLength(int bufferLength); // in milliseconds
  21. void SetCrossfading(int onoff);
  22. void SetCrossfadeMode(int Mode); // 0 = X-style, 1 = h-style
  23. virtual size_t put(short *inputBuffer, size_t inputSize); // in channel-less shorts
  24. virtual size_t get(short *outputBuffer, size_t outputSize, int nCh); // in channel-less shorts
  25. };
  26. #endif // !__C_CROSSFADER_H__