PrevUpHomeNext

Devices

#include <oalplus/device.hpp>

Common device operations

namespace tag {

struct Playback { };
struct Capture { };

} // namespace tag

class DevCommonOps
{
public:
	DevCommonOps(DevCommonOps&&) = default;

	static Range<StrCRef> Extensions(void); 1
};

template <typename DeviceTag>
class DeviceOps;

1

Returns a range of ALC extension strings for this devices. See alcGetString, ALC_EXTENSIONS.

Playback operations

DeviceOps<tag::Playback> implements audio playback device-specific operations.

[Note] Note

Do not use this class directly, use Device instead.

template <>
class DeviceOps<tag::Playback>
 : public DevCommonOps
{
public:
	StrCRef Specifier(void) const; 1

	static Range<StrCRef> Specifiers(void); 2
};

1

Returns the device specifier string. See alcGetString, ALC_DEVICE_SPECIFIER.

2

Returns a range of specifier strings for available audio playback devices. See alcGetString, ALC_DEVICE_SPECIFIER.

Capture operations

DeviceOps<tag::Capture> implements audio capture device-specific operations.

[Note] Note

Do not use this class directly, use CaptureDevice instead.

template <>
class DeviceOps<tag::Capture>
 : public DevCommonOps
{
public:
	StrCRef Specifier(void) const; 1

	static Range<StrCRef> Specifiers(void); 2

	void Start(void); 3
	void Stop(void); 4

	ALCsizei Samples(void) const; 5
	void Samples(ALCvoid* buffer, ALCsizei samples) const; 6
};

1

Returns the device specifier string. See alcGetString, ALC_CAPTURE_DEVICE_SPECIFIER.

2

Returns a range of specifier strings for available audio capture devices. See alcGetString, ALC_CAPTURE_DEVICE_SPECIFIER.

3

Starts audio capture on this device. See alcCaptureStart.

4

Stops audio capture on this device. See alcCaptureStop.

5

Gets the number of samples captured on this device. See alcGetInteger, ALC_CAPTURE_SAMPLES.

6

Gets the samples captured on this device. See alcCaptureSamples.

Playback device

class Device
 : public DeviceOps<tag::Playback>
{
public:
	Device(void); 1

	Device(StrCRef dev_spec); 2
};

1

Constructs an object referencing the default audio playback device. See alcOpenDevice.

2

Constructs an object referencing the specified audio device. See alcOpenDevice.

Capture device

class CaptureDevice
 : public DeviceOps<tag::Capture>
{
public:
	CaptureDevice(
		ALCuint frequency,
		DataFormat format,
		ALCsizei bufsize
	); 1

	CaptureDevice(
		StrCRef dev_spec,
		ALCuint frequency,
		DataFormat format,
		ALCsizei bufsize
	); 2
};

1

Constructs an object referencing the default audio capture device. See alcCaptureOpenDevice.

2

Constructs an object referencing the specified audio capture device. See alcCaptureOpenDevice.


PrevUpHomeNext