annotate src/portaudio_20140130/bindings/cpp/include/portaudiocpp/System.hxx @ 169:223a55898ab9 tip default

Add null config files
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 02 Mar 2020 14:03:47 +0000
parents e3d5853d5918
children
rev   line source
cannam@124 1 #ifndef INCLUDED_PORTAUDIO_SYSTEM_HXX
cannam@124 2 #define INCLUDED_PORTAUDIO_SYSTEM_HXX
cannam@124 3
cannam@124 4 // ---------------------------------------------------------------------------------------
cannam@124 5
cannam@124 6 #include "portaudio.h"
cannam@124 7
cannam@124 8 // ---------------------------------------------------------------------------------------
cannam@124 9
cannam@124 10 // Forward declaration(s):
cannam@124 11 namespace portaudio
cannam@124 12 {
cannam@124 13 class Device;
cannam@124 14 class Stream;
cannam@124 15 class HostApi;
cannam@124 16 }
cannam@124 17
cannam@124 18 // ---------------------------------------------------------------------------------------
cannam@124 19
cannam@124 20 // Declaration(s):
cannam@124 21 namespace portaudio
cannam@124 22 {
cannam@124 23
cannam@124 24
cannam@124 25 //////
cannam@124 26 /// @brief System singleton which represents the PortAudio system.
cannam@124 27 ///
cannam@124 28 /// The System is used to initialize/terminate PortAudio and provide
cannam@124 29 /// a single acccess point to the PortAudio System (instance()).
cannam@124 30 /// It can be used to iterate through all HostApi 's in the System as
cannam@124 31 /// well as all devices in the System. It also provides some utility
cannam@124 32 /// functionality of PortAudio.
cannam@124 33 ///
cannam@124 34 /// Terminating the System will also abort and close the open streams.
cannam@124 35 /// The Stream objects will need to be deallocated by the client though
cannam@124 36 /// (it's usually a good idea to have them cleaned up automatically).
cannam@124 37 //////
cannam@124 38 class System
cannam@124 39 {
cannam@124 40 public:
cannam@124 41 class HostApiIterator; // forward declaration
cannam@124 42 class DeviceIterator; // forward declaration
cannam@124 43
cannam@124 44 // -------------------------------------------------------------------------------
cannam@124 45
cannam@124 46 static int version();
cannam@124 47 static const char *versionText();
cannam@124 48
cannam@124 49 static void initialize();
cannam@124 50 static void terminate();
cannam@124 51
cannam@124 52 static System &instance();
cannam@124 53 static bool exists();
cannam@124 54
cannam@124 55 // -------------------------------------------------------------------------------
cannam@124 56
cannam@124 57 // host apis:
cannam@124 58 HostApiIterator hostApisBegin();
cannam@124 59 HostApiIterator hostApisEnd();
cannam@124 60
cannam@124 61 HostApi &defaultHostApi();
cannam@124 62
cannam@124 63 HostApi &hostApiByTypeId(PaHostApiTypeId type);
cannam@124 64 HostApi &hostApiByIndex(PaHostApiIndex index);
cannam@124 65
cannam@124 66 int hostApiCount();
cannam@124 67
cannam@124 68 // -------------------------------------------------------------------------------
cannam@124 69
cannam@124 70 // devices:
cannam@124 71 DeviceIterator devicesBegin();
cannam@124 72 DeviceIterator devicesEnd();
cannam@124 73
cannam@124 74 Device &defaultInputDevice();
cannam@124 75 Device &defaultOutputDevice();
cannam@124 76
cannam@124 77 Device &deviceByIndex(PaDeviceIndex index);
cannam@124 78
cannam@124 79 int deviceCount();
cannam@124 80
cannam@124 81 static Device &nullDevice();
cannam@124 82
cannam@124 83 // -------------------------------------------------------------------------------
cannam@124 84
cannam@124 85 // misc:
cannam@124 86 void sleep(long msec);
cannam@124 87 int sizeOfSample(PaSampleFormat format);
cannam@124 88
cannam@124 89 private:
cannam@124 90 System();
cannam@124 91 ~System();
cannam@124 92
cannam@124 93 static System *instance_;
cannam@124 94 static int initCount_;
cannam@124 95
cannam@124 96 static HostApi **hostApis_;
cannam@124 97 static Device **devices_;
cannam@124 98
cannam@124 99 static Device *nullDevice_;
cannam@124 100 };
cannam@124 101
cannam@124 102
cannam@124 103 } // namespace portaudio
cannam@124 104
cannam@124 105
cannam@124 106 #endif // INCLUDED_PORTAUDIO_SYSTEM_HXX
cannam@124 107