annotate src/portaudio/bindings/cpp/include/portaudiocpp/System.hxx @ 105:c83a7e2af39c

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