jack2 codebase
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.

68 lines
2.2KB

  1. /*
  2. Copyright (C) 2008-2011 Romain Moret at Grame
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  14. */
  15. #ifndef __PortAudioDevices__
  16. #define __PortAudioDevices__
  17. #include <cstdio>
  18. #include <string>
  19. #include <portaudio.h>
  20. #if defined(HAVE_ASIO)
  21. #include <pa_asio.h>
  22. #endif
  23. /*!
  24. \brief A PortAudio Devices manager.
  25. */
  26. class PortAudioDevices
  27. {
  28. private:
  29. PaHostApiIndex fNumHostApi; //number of hosts
  30. PaDeviceIndex fNumDevice; //number of devices
  31. PaDeviceInfo** fDeviceInfo; //array of device info
  32. std::string* fHostName; //array of host names (matched with host id's)
  33. public:
  34. PortAudioDevices();
  35. ~PortAudioDevices();
  36. PaDeviceIndex GetNumDevice();
  37. PaDeviceInfo* GetDeviceInfo(PaDeviceIndex id);
  38. std::string GetDeviceName(PaDeviceIndex id);
  39. std::string GetHostFromDevice(PaDeviceInfo* device);
  40. std::string GetHostFromDevice(PaDeviceIndex id);
  41. std::string GetFullName(PaDeviceIndex id);
  42. std::string GetFullName(std::string hostname, std::string devicename);
  43. PaDeviceInfo* GetDeviceFromFullName(std::string fullname, PaDeviceIndex& id, bool isInput);
  44. void PrintSupportedStandardSampleRates(const PaStreamParameters* inputParameters, const PaStreamParameters* outputParameters);
  45. int GetInputDeviceFromName(const char* name, PaDeviceIndex& device, int& in_max);
  46. int GetOutputDeviceFromName(const char* name, PaDeviceIndex& device, int& out_max);
  47. int GetPreferredBufferSize(PaDeviceIndex id);
  48. void DisplayDevicesNames();
  49. bool IsDuplex(PaDeviceIndex id);
  50. };
  51. #endif