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.

WavEngine.h 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 modify
  8. it under the terms of version 2 of the GNU General Public License
  9. as published by the Free Software Foundation.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License (version 2) for more details.
  14. You should have received a copy of the GNU General Public License (version 2)
  15. along with this program; if not, write to the Free Software Foundation,
  16. Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. */
  18. #ifndef WAVENGINE_H
  19. #define WAVENGINE_H
  20. #include "AudioOut.h"
  21. #include <string>
  22. #include <pthread.h>
  23. #include <semaphore.h>
  24. #include "SafeQueue.h"
  25. class WavFile;
  26. class WavEngine:public AudioOut
  27. {
  28. public:
  29. WavEngine();
  30. ~WavEngine();
  31. bool openAudio();
  32. bool Start();
  33. void Stop();
  34. void setAudioEn(bool /*nval*/) {}
  35. bool getAudioEn() const {return true; }
  36. void push(Stereo<float *> smps, size_t len);
  37. void newFile(WavFile *_file);
  38. void destroyFile();
  39. protected:
  40. void *AudioThread();
  41. static void *_AudioThread(void *arg);
  42. private:
  43. WavFile *file;
  44. sem_t work;
  45. SafeQueue<float> buffer;
  46. pthread_t *pThread;
  47. };
  48. #endif