The OpenD Programming Language

AudioMixer

Interfaces with the default sound card. You should only have a single instance of this and it should be stack allocated, so its destructor cleans up after it.

A mixer gives access to things like volume controls and mute buttons. It should also give a callback feature to alert you of when the settings are changed by another program.

Constructors

this
this(int cardId)

Only cardId == 0 is supported

this
this(string device)

device is a device name. On Linux, it is the ALSA string. On Windows, it is currently ignored, so you should pass "default" or null so when it does get implemented your code won't break.

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Postblit

A postblit is present on this object, but not explicitly documented in the source.

Members

Functions

getAlsaFileDescriptors
int[] getAlsaFileDescriptors()

Gets the ALSA descriptors which you can watch for events on using regular select, poll, epoll, etc.

getMasterVolume
int getMasterVolume()

returns a percentage, between 0 and 100 (inclusive)

getMasterVolumeExact
int getMasterVolumeExact()

Gets the exact value returned from the operating system. The range may vary.

handleAlsaEvents
void handleAlsaEvents()

When the FD is ready, call this to let ALSA do its thing.

setAlsaElemCallback
void setAlsaElemCallback(snd_mixer_elem_callback_t dg)

Set a callback for the master volume change events.

setMasterVolume
void setMasterVolume(int volume)

sets a percentage on the volume, so it must be 0 <= volume <= 100 Note: this affects shared system state and you should not use it unless the end user wants you to.

setMasterVolumeExact
void setMasterVolumeExact(int volume)

Sets an exact volume. Must be in range of the OS provided min and max.

Properties

muteMaster
bool muteMaster [@property getter]

Gets the master channel's mute state Note: this affects shared system state and you should not use it unless the end user wants you to.

muteMaster
bool muteMaster [@property setter]

Mutes or unmutes the master channel Note: this affects shared system state and you should not use it unless the end user wants you to.

Meta