Chris@55: #ifndef INCLUDED_PORTAUDIO_DEVICE_HXX Chris@55: #define INCLUDED_PORTAUDIO_DEVICE_HXX Chris@55: Chris@55: // --------------------------------------------------------------------------------------- Chris@55: Chris@55: #include Chris@55: Chris@55: #include "portaudio.h" Chris@55: Chris@55: #include "portaudiocpp/SampleDataFormat.hxx" Chris@55: Chris@55: // --------------------------------------------------------------------------------------- Chris@55: Chris@55: // Forward declaration(s): Chris@55: namespace portaudio Chris@55: { Chris@55: class System; Chris@55: class HostApi; Chris@55: } Chris@55: Chris@55: // --------------------------------------------------------------------------------------- Chris@55: Chris@55: // Declaration(s): Chris@55: namespace portaudio Chris@55: { Chris@55: Chris@55: ////// Chris@55: /// @brief Class which represents a PortAudio device in the System. Chris@55: /// Chris@55: /// A single physical device in the system may have multiple PortAudio Chris@55: /// Device representations using different HostApi 's though. A Device Chris@55: /// can be half-duplex or full-duplex. A half-duplex Device can be used Chris@55: /// to create a half-duplex Stream. A full-duplex Device can be used to Chris@55: /// create a full-duplex Stream. If supported by the HostApi, two Chris@55: /// half-duplex Devices can even be used to create a full-duplex Stream. Chris@55: /// Chris@55: /// Note that Device objects are very light-weight and can be passed around Chris@55: /// by-value. Chris@55: ////// Chris@55: class Device Chris@55: { Chris@55: public: Chris@55: // query info: name, max in channels, max out channels, Chris@55: // default low/hight input/output latency, default sample rate Chris@55: PaDeviceIndex index() const; Chris@55: const char *name() const; Chris@55: int maxInputChannels() const; Chris@55: int maxOutputChannels() const; Chris@55: PaTime defaultLowInputLatency() const; Chris@55: PaTime defaultHighInputLatency() const; Chris@55: PaTime defaultLowOutputLatency() const; Chris@55: PaTime defaultHighOutputLatency() const; Chris@55: double defaultSampleRate() const; Chris@55: Chris@55: bool isInputOnlyDevice() const; // extended Chris@55: bool isOutputOnlyDevice() const; // extended Chris@55: bool isFullDuplexDevice() const; // extended Chris@55: bool isSystemDefaultInputDevice() const; // extended Chris@55: bool isSystemDefaultOutputDevice() const; // extended Chris@55: bool isHostApiDefaultInputDevice() const; // extended Chris@55: bool isHostApiDefaultOutputDevice() const; // extended Chris@55: Chris@55: bool operator==(const Device &rhs) const; Chris@55: bool operator!=(const Device &rhs) const; Chris@55: Chris@55: // host api reference Chris@55: HostApi &hostApi(); Chris@55: const HostApi &hostApi() const; Chris@55: Chris@55: private: Chris@55: PaDeviceIndex index_; Chris@55: const PaDeviceInfo *info_; Chris@55: Chris@55: private: Chris@55: friend class System; Chris@55: Chris@55: explicit Device(PaDeviceIndex index); Chris@55: ~Device(); Chris@55: Chris@55: Device(const Device &); // non-copyable Chris@55: Device &operator=(const Device &); // non-copyable Chris@55: }; Chris@55: Chris@55: // ----------------------------------------------------------------------------------- Chris@55: Chris@55: } // namespace portaudio Chris@55: Chris@55: // --------------------------------------------------------------------------------------- Chris@55: Chris@55: #endif // INCLUDED_PORTAUDIO_DEVICE_HXX Chris@55: