1
0

GaplessRingBuffer.h 529 B

1234567891011121314151617181920
  1. #pragma once
  2. #include "RingBuffer.h"
  3. class GaplessRingBuffer
  4. {
  5. public:
  6. GaplessRingBuffer();
  7. ~GaplessRingBuffer();
  8. int Initialize(size_t samples, size_t bps, size_t channels, size_t pregap, size_t postgap);
  9. size_t Read(void *destination, size_t destination_bytes);
  10. bool Empty() const;
  11. size_t Write(const void *input, size_t input_bytes);
  12. void Reset();
  13. private:
  14. RingBuffer ring_buffer;
  15. size_t frameBytes; // byte size of one frame (channels*bps/8)
  16. size_t currentPregapBytes;
  17. size_t pregapBytes;
  18. size_t postgapBytes;
  19. };