mjolnir._asm.sys.audiodevice

Home: https://github.com/asmagill/mjolnir_asm.sys

Manipulate the system's audio devices.

This module is based primarily on code from the previous incarnation of Mjolnir by Steven Degutis.

alloutputdevices

mjolnir._asm.sys.audiodevice.alloutputdevices() -> audio[]

Returns a list of all connected output devices.

current

mjolnir._asm.sys.audiodevice.current() -> table

Convenience function which returns a table with the following keys and values:

    {
        name = defaultoutputdevice():name(),
        uid = module.defaultoutputdevice():uid(),
        muted = defaultoutputdevice():muted(),
        volume = defaultoutputdevice():volume(),
        device = defaultoutputdevice(),
    }

defaultoutputdevice

mjolnir._asm.sys.audiodevice.defaultoutputdevice() -> audio or nil

Gets the system's default audio device, or nil, it it does not exist.

muted

mjolnir._asm.sys.audiodevice:muted() -> bool or nil

Returns true/false if the audio device is muted, or nil if it does not support being muted.

name

mjolnir._asm.sys.audiodevice:name() -> string or nil

Returns the name of the audio device, or nil if it does not have a name.

setdefaultoutputdevice

mjolnir._asm.sys.audiodevice:setdefaultoutputdevice() -> bool

Sets the system's default audio device to this device. Returns true if the audio device was successfully set.

setmuted

mjolnir._asm.sys.audiodevice:setmuted(bool) -> bool

Returns true if the the device's muted status was set, or false if it does not support being muted.

setvolume

mjolnir._asm.sys.audiodevice:setvolume(level) -> bool

Returns true if the volume was set, or false if the audio device does not support setting a volume level. Level is a percentage between 0 and 100.

uid

mjolnir._asm.sys.audiodevice:uid() -> string or nil

Returns the Unique Identifier of the audio device, or nil if it does not have a uid.

volume

mjolnir._asm.sys.audiodevice:volume() -> number or bool

Returns a number between 0 and 100 inclusive, representing the volume percentage. Or nil, if the audio device does not have a volume level.