Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.2KB

  1. /*
  2. ZynAddSubFX - a software synthesizer
  3. WavEngine.h - Records sound to a file
  4. Copyright (C) 2008 Nasca Octavian Paul
  5. Author: Nasca Octavian Paul
  6. Mark McCurry
  7. This program is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU General Public License
  9. as published by the Free Software Foundation; either version 2
  10. of the License, or (at your option) any later version.
  11. */
  12. #ifndef WAVENGINE_H
  13. #define WAVENGINE_H
  14. #include "AudioOut.h"
  15. #include <string>
  16. #include <pthread.h>
  17. #include "ZynSema.h"
  18. #include "SafeQueue.h"
  19. namespace zyncarla {
  20. class WavFile;
  21. class WavEngine:public AudioOut
  22. {
  23. public:
  24. WavEngine(const SYNTH_T &synth);
  25. ~WavEngine();
  26. bool openAudio();
  27. bool Start();
  28. void Stop();
  29. void setAudioEn(bool /*nval*/) {}
  30. bool getAudioEn() const {return true; }
  31. void push(Stereo<float *> smps, size_t len);
  32. void newFile(WavFile *_file);
  33. void destroyFile();
  34. protected:
  35. void *AudioThread();
  36. static void *_AudioThread(void *arg);
  37. private:
  38. WavFile *file;
  39. ZynSema work;
  40. SafeQueue<float> buffer;
  41. pthread_t *pThread;
  42. };
  43. }
  44. #endif