13 #ifndef OALPLUS_DEVICE_1303201647_HPP
14 #define OALPLUS_DEVICE_1303201647_HPP
19 #include <oalplus/error/alc.hpp>
22 #include <oalplus/detail/sep_str_range.hpp>
39 typedef const ALchar* ValueType;
44 return !_ptr || !(*_ptr);
58 _ptr += std::strlen(_ptr)+1;
71 friend class ContextOps;
76 DevCommonOps(::ALCdevice* device)
83 DevCommonOps(DevCommonOps&& tmp)
84 : _device(tmp._device)
86 tmp._device =
nullptr;
89 #if OALPLUS_DOCUMENTATION_ONLY
100 const ALchar* str = OALPLUS_ALCFUNC(GetString)(
104 OALPLUS_CHECK_SIMPLE_ALC(
nullptr, GetString);
106 return aux::SepStrRange((
const char*)str);
116 class DeviceOps<tag::Playback>
117 :
public DevCommonOps
122 DeviceOps(::ALCdevice* device)
123 : DevCommonOps(device)
134 const ALchar* str = OALPLUS_ALCFUNC(GetString)(
138 OALPLUS_CHECK_SIMPLE_ALC(_device, GetString);
150 const ALchar* ptr = OALPLUS_ALCFUNC(GetString)(
154 OALPLUS_CHECK_SIMPLE_ALC(
nullptr, GetString);
164 class DeviceOps<tag::Capture>
165 :
public DevCommonOps
168 DeviceOps(::ALCdevice* device)
169 : DevCommonOps(device)
180 const ALchar* str = OALPLUS_ALCFUNC(GetString)(
182 ALC_CAPTURE_DEVICE_SPECIFIER
184 OALPLUS_CHECK_SIMPLE_ALC(_device, GetString);
196 const ALchar* ptr = OALPLUS_ALCFUNC(GetString)(
198 ALC_CAPTURE_DEVICE_SPECIFIER
200 OALPLUS_CHECK_SIMPLE_ALC(
nullptr, GetString);
211 OALPLUS_ALCFUNC(CaptureStart)(_device);
212 OALPLUS_CHECK_SIMPLE_ALC(_device, CaptureStart);
222 OALPLUS_ALCFUNC(CaptureStop)(_device);
223 OALPLUS_CHECK_SIMPLE_ALC(_device, CaptureStop);
235 OALPLUS_ALCFUNC(GetIntegerv)(
240 OALPLUS_CHECK_SIMPLE_ALC(_device, GetIntegerv);
241 return ALCsizei(result);
249 void Samples(ALCvoid* buffer, ALCsizei samples)
const
251 OALPLUS_ALCFUNC(CaptureSamples)(_device, buffer, samples);
252 OALPLUS_CHECK_SIMPLE_ALC(_device, CaptureSamples);
258 :
public DeviceOps<tag::Playback>
269 :
Base(OALPLUS_ALCFUNC(OpenDevice)(nullptr))
271 OALPLUS_CHECK_SIMPLE_ALC(_device,OpenDevice);
280 :
Base(OALPLUS_ALCFUNC(OpenDevice)(dev_spec))
282 OALPLUS_CHECK_SIMPLE_ALC(_device,OpenDevice);
294 OALPLUS_ALCFUNC(CloseDevice)(_device);
301 :
public DeviceOps<tag::Capture>
312 :
Base(OALPLUS_ALCFUNC(CaptureOpenDevice)(
319 OALPLUS_CHECK_SIMPLE_ALC(_device,CaptureOpenDevice);
328 const ALchar* dev_spec,
332 ):
Base(OALPLUS_ALCFUNC(CaptureOpenDevice)(
339 OALPLUS_CHECK_SIMPLE_ALC(_device,CaptureOpenDevice);
351 OALPLUS_ALCFUNC(CaptureCloseDevice)(_device);
358 #endif // include guard
void Next(void)
Goes to the next specifier in the range.
Definition: device.hpp:55
Audio playback device.
Definition: device.hpp:257
void Samples(ALCvoid *buffer, ALCsizei samples) const
Gets the samples captured on this device.
Definition: device.hpp:249
Class implementing audio playback device-specific operations.
Definition: device.hpp:116
const ALchar * Front(void) const
Returns the specifier string at the front of the range.
Definition: device.hpp:48
void Stop(void)
Stop audio capture on this device.
Definition: device.hpp:220
Compile-time configuration options.
Helper macro expanding into OpenAL function name.
const ALchar * Specifier(void) const
Returns the capture device specifier string.
Definition: device.hpp:178
CaptureDevice(ALCuint frequency, DataFormat format, ALCsizei bufsize)
Constructs an object referencing the default audio device.
Definition: device.hpp:311
~Device(void)
Closes this device.
Definition: device.hpp:290
void StepFront(void)
A synonym for Next.
Definition: device.hpp:62
bool Empty(void) const
Returns true when the range is empty (at the end of traversal)
Definition: device.hpp:42
A range for iteration through the device specifier strings.
Definition: device.hpp:30
const ALchar * Specifier(void) const
Returns the device specifier string.
Definition: device.hpp:132
static DeviceSpecRange Specifiers(void)
Returns a range of specifier strings for available capture devices.
Definition: device.hpp:194
CaptureDevice(const ALchar *dev_spec, ALCuint frequency, DataFormat format, ALCsizei bufsize)
Constructs an object referencing the specified audio device.
Definition: device.hpp:327
void Start(void)
Starts audio capture on this device.
Definition: device.hpp:209
Audio capture device.
Definition: device.hpp:300
Device(void)
Constructs an object referencing the default audio device.
Definition: device.hpp:268
Device(const ALchar *dev_spec)
Constructs an object referencing the specified audio device.
Definition: device.hpp:279
Class implementing audio capture device-specific operations.
Definition: device.hpp:164
~CaptureDevice(void)
Closes this device.
Definition: device.hpp:347
Base wrapper for OpenAL context operations.
Definition: context.hpp:54
static DeviceSpecRange Specifiers(void)
Returns a range of specifier strings for available audio devices.
Definition: device.hpp:148
ALCsizei Samples(void) const
Gets the number of samples captured on this device.
Definition: device.hpp:232