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.

65 lines
1.6KB

  1. #ifndef OUTMGR_H
  2. #define OUTMGR_H
  3. #include "../Misc/Stereo.h"
  4. #include <list>
  5. #include <string>
  6. #include <semaphore.h>
  7. class AudioOut;
  8. class OutMgr
  9. {
  10. public:
  11. static OutMgr &getInstance();
  12. ~OutMgr();
  13. /**Execute a tick*/
  14. const Stereo<float *> tick(unsigned int frameSize);
  15. /**Request a new set of samples
  16. * @param n number of requested samples (defaults to 1)
  17. * @return -1 for locking issues 0 for valid request*/
  18. void requestSamples(unsigned int n = 1);
  19. /**Gets requested driver
  20. * @param name case unsensitive name of driver
  21. * @return pointer to Audio Out or NULL
  22. */
  23. AudioOut *getOut(std::string name);
  24. /**Gets the name of the first running driver
  25. * Deprecated
  26. * @return if no running output, "" is returned
  27. */
  28. std::string getDriver() const;
  29. bool setSink(std::string name);
  30. std::string getSink() const;
  31. class WavEngine * wave; /**<The Wave Recorder*/
  32. friend class EngineMgr;
  33. private:
  34. OutMgr();
  35. void addSmps(float *l, float *r);
  36. unsigned int storedSmps() const {return priBuffCurrent.l - priBuf.l; }
  37. void removeStaleSmps();
  38. AudioOut *currentOut; /**<The current output driver*/
  39. sem_t requested;
  40. /**Buffer*/
  41. Stereo<float *> priBuf; //buffer for primary drivers
  42. Stereo<float *> priBuffCurrent; //current array accessor
  43. float *outl;
  44. float *outr;
  45. class Master & master;
  46. int stales;
  47. };
  48. #endif