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