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.

53 lines
1.0KB

  1. #pragma once
  2. #include <jansson.h>
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wsuggest-override"
  5. #include <RtAudio.h>
  6. #pragma GCC diagnostic pop
  7. namespace rack {
  8. struct AudioIO {
  9. int maxOutputs = 8;
  10. int maxInputs = 8;
  11. // Stream properties
  12. int driver = 0;
  13. int device = -1;
  14. int sampleRate = 44100;
  15. int blockSize = 256;
  16. int numOutputs = 0;
  17. int numInputs = 0;
  18. RtAudio *rtAudio = NULL;
  19. AudioIO();
  20. virtual ~AudioIO();
  21. std::vector<int> listDrivers();
  22. std::string getDriverName(int driver);
  23. void setDriver(int driver);
  24. int getDeviceCount();
  25. std::string getDeviceName(int device);
  26. std::string getDeviceDetail(int device);
  27. void openStream();
  28. void closeStream();
  29. /** Returns whether the audio stream is open and running */
  30. bool isActive();
  31. std::vector<int> listSampleRates();
  32. virtual void processStream(const float *input, float *output, int length) {}
  33. virtual void onCloseStream() {}
  34. virtual void onOpenStream() {}
  35. json_t *toJson();
  36. void fromJson(json_t *rootJ);
  37. };
  38. } // namespace rack