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.

71 lines
1.8KB

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