annotate src/portaudio_20161030/bindings/cpp/include/portaudiocpp/Device.hxx @ 140:59a8758c56b1

Add source for PortAudio stable v190600_20161030
author Chris Cannam <cannam@all-day-breakfast.com>
date Tue, 03 Jan 2017 13:44:07 +0000
parents
children
rev   line source
cannam@140 1 #ifndef INCLUDED_PORTAUDIO_DEVICE_HXX
cannam@140 2 #define INCLUDED_PORTAUDIO_DEVICE_HXX
cannam@140 3
cannam@140 4 // ---------------------------------------------------------------------------------------
cannam@140 5
cannam@140 6 #include <iterator>
cannam@140 7
cannam@140 8 #include "portaudio.h"
cannam@140 9
cannam@140 10 #include "portaudiocpp/SampleDataFormat.hxx"
cannam@140 11
cannam@140 12 // ---------------------------------------------------------------------------------------
cannam@140 13
cannam@140 14 // Forward declaration(s):
cannam@140 15 namespace portaudio
cannam@140 16 {
cannam@140 17 class System;
cannam@140 18 class HostApi;
cannam@140 19 }
cannam@140 20
cannam@140 21 // ---------------------------------------------------------------------------------------
cannam@140 22
cannam@140 23 // Declaration(s):
cannam@140 24 namespace portaudio
cannam@140 25 {
cannam@140 26
cannam@140 27 //////
cannam@140 28 /// @brief Class which represents a PortAudio device in the System.
cannam@140 29 ///
cannam@140 30 /// A single physical device in the system may have multiple PortAudio
cannam@140 31 /// Device representations using different HostApi 's though. A Device
cannam@140 32 /// can be half-duplex or full-duplex. A half-duplex Device can be used
cannam@140 33 /// to create a half-duplex Stream. A full-duplex Device can be used to
cannam@140 34 /// create a full-duplex Stream. If supported by the HostApi, two
cannam@140 35 /// half-duplex Devices can even be used to create a full-duplex Stream.
cannam@140 36 ///
cannam@140 37 /// Note that Device objects are very light-weight and can be passed around
cannam@140 38 /// by-value.
cannam@140 39 //////
cannam@140 40 class Device
cannam@140 41 {
cannam@140 42 public:
cannam@140 43 // query info: name, max in channels, max out channels,
cannam@140 44 // default low/hight input/output latency, default sample rate
cannam@140 45 PaDeviceIndex index() const;
cannam@140 46 const char *name() const;
cannam@140 47 int maxInputChannels() const;
cannam@140 48 int maxOutputChannels() const;
cannam@140 49 PaTime defaultLowInputLatency() const;
cannam@140 50 PaTime defaultHighInputLatency() const;
cannam@140 51 PaTime defaultLowOutputLatency() const;
cannam@140 52 PaTime defaultHighOutputLatency() const;
cannam@140 53 double defaultSampleRate() const;
cannam@140 54
cannam@140 55 bool isInputOnlyDevice() const; // extended
cannam@140 56 bool isOutputOnlyDevice() const; // extended
cannam@140 57 bool isFullDuplexDevice() const; // extended
cannam@140 58 bool isSystemDefaultInputDevice() const; // extended
cannam@140 59 bool isSystemDefaultOutputDevice() const; // extended
cannam@140 60 bool isHostApiDefaultInputDevice() const; // extended
cannam@140 61 bool isHostApiDefaultOutputDevice() const; // extended
cannam@140 62
cannam@140 63 bool operator==(const Device &rhs) const;
cannam@140 64 bool operator!=(const Device &rhs) const;
cannam@140 65
cannam@140 66 // host api reference
cannam@140 67 HostApi &hostApi();
cannam@140 68 const HostApi &hostApi() const;
cannam@140 69
cannam@140 70 private:
cannam@140 71 PaDeviceIndex index_;
cannam@140 72 const PaDeviceInfo *info_;
cannam@140 73
cannam@140 74 private:
cannam@140 75 friend class System;
cannam@140 76
cannam@140 77 explicit Device(PaDeviceIndex index);
cannam@140 78 ~Device();
cannam@140 79
cannam@140 80 Device(const Device &); // non-copyable
cannam@140 81 Device &operator=(const Device &); // non-copyable
cannam@140 82 };
cannam@140 83
cannam@140 84 // -----------------------------------------------------------------------------------
cannam@140 85
cannam@140 86 } // namespace portaudio
cannam@140 87
cannam@140 88 // ---------------------------------------------------------------------------------------
cannam@140 89
cannam@140 90 #endif // INCLUDED_PORTAUDIO_DEVICE_HXX
cannam@140 91