| 1 | #ifndef INCLUDED_PORTAUDIO_HOSTAPI_HXX |
| 2 | #define INCLUDED_PORTAUDIO_HOSTAPI_HXX |
| 3 | |
| 4 | // --------------------------------------------------------------------------------------- |
| 5 | |
| 6 | #include "portaudio.h" |
| 7 | |
| 8 | #include "portaudiocpp/System.hxx" |
| 9 | |
| 10 | // --------------------------------------------------------------------------------------- |
| 11 | |
| 12 | // Forward declaration(s): |
| 13 | namespace portaudio |
| 14 | { |
| 15 | class Device; |
| 16 | } |
| 17 | |
| 18 | // --------------------------------------------------------------------------------------- |
| 19 | |
| 20 | // Declaration(s): |
| 21 | namespace portaudio |
| 22 | { |
| 23 | |
| 24 | |
| 25 | ////// |
| 26 | /// @brief HostApi represents a host API (usually type of driver) in the System. |
| 27 | /// |
| 28 | /// A single System can support multiple HostApi's each one typically having |
| 29 | /// a set of Devices using that HostApi (usually driver type). All Devices in |
| 30 | /// the HostApi can be enumerated and the default input/output Device for this |
| 31 | /// HostApi can be retreived. |
| 32 | ////// |
| 33 | class HostApi |
| 34 | { |
| 35 | public: |
| 36 | typedef System::DeviceIterator DeviceIterator; |
| 37 | |
| 38 | // query info: id, name, numDevices |
| 39 | PaHostApiTypeId typeId() const; |
| 40 | PaHostApiIndex index() const; |
| 41 | const char *name() const; |
| 42 | int deviceCount() const; |
| 43 | |
| 44 | // iterate devices |
| 45 | DeviceIterator devicesBegin(); |
| 46 | DeviceIterator devicesEnd(); |
| 47 | |
| 48 | // default devices |
| 49 | Device &defaultInputDevice() const; |
| 50 | Device &defaultOutputDevice() const; |
| 51 | |
| 52 | // comparison operators |
| 53 | bool operator==(const HostApi &rhs) const; |
| 54 | bool operator!=(const HostApi &rhs) const; |
| 55 | |
| 56 | private: |
| 57 | const PaHostApiInfo *info_; |
| 58 | Device **devices_; |
| 59 | |
| 60 | private: |
| 61 | friend class System; |
| 62 | |
| 63 | explicit HostApi(PaHostApiIndex index); |
| 64 | ~HostApi(); |
| 65 | |
| 66 | HostApi(const HostApi &); // non-copyable |
| 67 | HostApi &operator=(const HostApi &); // non-copyable |
| 68 | }; |
| 69 | |
| 70 | |
| 71 | } |
| 72 | |
| 73 | // --------------------------------------------------------------------------------------- |
| 74 | |
| 75 | #endif // INCLUDED_PORTAUDIO_HOSTAPI_HXX |
| 76 |