NamedPipeAudioSink.cpp 499 B

12345678910111213141516171819
  1. #include "NamedPipeAudioSink.h"
  2. #include <stdio.h> // for printf
  3. NamedPipeAudioSink::NamedPipeAudioSink() {
  4. printf("Start\n");
  5. this->namedPipeFile = std::ofstream("outputFifo", std::ios::binary);
  6. printf("stop\n");
  7. }
  8. NamedPipeAudioSink::~NamedPipeAudioSink() {
  9. this->namedPipeFile.close();
  10. }
  11. void NamedPipeAudioSink::feedPCMFrames(const uint8_t* buffer, size_t bytes) {
  12. // Write the actual data
  13. this->namedPipeFile.write((char*)buffer, (long)bytes);
  14. this->namedPipeFile.flush();
  15. }