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