Manipulate the system's audio devices
This module is based primarily on code from the previous incarnation of Mjolnir by Steven Degutis.
Note:
Signature | hs.audiodevice.allDevices() -> hs.audiodevice[] |
---|---|
Type | Function |
Description | Returns a list of all connected devices |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 173 |
Signature | hs.audiodevice.allInputDevices() -> audio[] |
---|---|
Type | Function |
Description | Returns a list of all connected input devices. |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/audiodevice.lua line 144 |
Signature | hs.audiodevice.allOutputDevices() -> hs.audiodevice[] |
---|---|
Type | Function |
Description | Returns a list of all connected output devices |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/audiodevice.lua line 131 |
Signature | hs.audiodevice.current([input]) -> table |
---|---|
Type | Function |
Description | Fetch various metadata about the current default audio devices |
Parameters |
|
Returns |
{
name = defaultOutputDevice():name(),
uid = module.defaultOutputDevice():uid(),
muted = defaultOutputDevice():muted(),
volume = defaultOutputDevice():volume(),
device = defaultOutputDevice(),
}
|
Source | extensions/audiodevice/audiodevice.lua line 18 |
Signature | hs.audiodevice.defaultEffectDevice() -> audio or nil |
---|---|
Type | Function |
Description | Get the currently selected sound effect device |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 315 |
Signature | hs.audiodevice.defaultInputDevice() -> audio or nil |
---|---|
Type | Function |
Description | Get the currently selected audio input device |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 284 |
Signature | hs.audiodevice.defaultOutputDevice() -> audio or nil |
---|---|
Type | Function |
Description | Get the currently selected audio output device |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 253 |
Signature | hs.audiodevice.findDeviceByName(name) -> device or nil |
---|---|
Type | Function |
Description | Find an audio device by name |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/audiodevice.lua line 53 |
Signature | hs.audiodevice.findDeviceByUID(uid) -> device or nil |
---|---|
Type | Function |
Description | Find an audio device by UID |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/audiodevice.lua line 66 |
Signature | hs.audiodevice.findInputByName(name) -> device or nil |
---|---|
Type | Function |
Description | Find an audio input device by name |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/audiodevice.lua line 92 |
Signature | hs.audiodevice.findInputByUID(uid) -> device or nil |
---|---|
Type | Function |
Description | Find an audio input device by UID |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/audiodevice.lua line 118 |
Signature | hs.audiodevice.findOutputByName(name) -> device or nil |
---|---|
Type | Function |
Description | Find an audio output device by name |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/audiodevice.lua line 79 |
Signature | hs.audiodevice.findOutputByUID(uid) -> device or nil |
---|---|
Type | Function |
Description | Find an audio output device by UID |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/audiodevice.lua line 105 |
Signature | hs.audiodevice:allInputDataSources() -> hs.audiodevice.dataSource[] or nil |
---|---|
Type | Method |
Description | Gets all of the input data sources of an audio device |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 1499 |
Signature | hs.audiodevice:allOutputDataSources() -> hs.audiodevice.dataSource[] or nil |
---|---|
Type | Method |
Description | Gets all of the output data sources of an audio device |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 1446 |
Signature | hs.audiodevice:balance() -> number or nil |
---|---|
Type | Method |
Description | Get the current left/right balance of this audio device |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/audiodevice/libaudiodevice.m line 1067 |
Signature | hs.audiodevice:currentInputDataSource() -> hs.audiodevice.dataSource object or nil |
---|---|
Type | Method |
Description | Gets the current input data source of an audio device |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/audiodevice/libaudiodevice.m line 1372 |
Signature | hs.audiodevice:currentOutputDataSource() -> hs.audiodevice.dataSource object or nil |
---|---|
Type | Method |
Description | Gets the current output data source of an audio device |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/audiodevice/libaudiodevice.m line 1409 |
Signature | hs.audiodevice:inputMuted() -> bool or nil |
---|---|
Type | Method |
Description | Get the Input mutedness state of the audio device |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 563 |
Signature | hs.audiodevice:inputVolume() -> number or nil |
---|---|
Type | Method |
Description | Get the current input volume of this audio device |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/audiodevice/libaudiodevice.m line 794 |
Signature | hs.audiodevice:inUse() -> bool or nil |
---|---|
Type | Method |
Description | Check if the audio device is in use |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 521 |
Signature | hs.audiodevice:isInputDevice() -> boolean |
---|---|
Type | Method |
Description | Determines if an audio device is an input device |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 1185 |
Signature | hs.audiodevice:isOutputDevice() -> boolean |
---|---|
Type | Method |
Description | Determines if an audio device is an output device |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 1165 |
Signature | hs.audiodevice:jackConnected() -> boolean or nil |
---|---|
Type | Method |
Description | Determines whether an audio jack (e.g. headphones) is connected to an audio device |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 1284 |
Signature | hs.audiodevice:muted() -> bool or nil |
---|---|
Type | Method |
Description | Get the mutedness state of the audio device |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/audiodevice/libaudiodevice.m line 635 |
Signature | hs.audiodevice:name() -> string or nil |
---|---|
Type | Method |
Description | Get the name of the audio device |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 448 |
Signature | hs.audiodevice:outputMuted() -> bool or nil |
---|---|
Type | Method |
Description | Get the Output mutedness state of the audio device |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 599 |
Signature | hs.audiodevice:outputVolume() -> number or nil |
---|---|
Type | Method |
Description | Get the current output volume of this audio device |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/audiodevice/libaudiodevice.m line 835 |
Signature | hs.audiodevice:setBalance(level) -> bool |
---|---|
Type | Method |
Description | Set the balance of this audio device |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/audiodevice/libaudiodevice.m line 1112 |
Signature | hs.audiodevice:setDefaultEffectDevice() -> bool |
---|---|
Type | Method |
Description | Selects this device as the audio output device for system sound effects |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 382 |
Signature | hs.audiodevice:setDefaultInputDevice() -> bool |
---|---|
Type | Method |
Description | Selects this device as the system's audio input device |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 415 |
Signature | hs.audiodevice:setDefaultOutputDevice() -> bool |
---|---|
Type | Method |
Description | Selects this device as the system's audio output device |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 349 |
Signature | hs.audiodevice:setInputMuted(state) -> bool |
---|---|
Type | Method |
Description | Set the mutedness state of the Input of the audio device |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 678 |
Signature | hs.audiodevice:setInputVolume(level) -> bool |
---|---|
Type | Method |
Description | Set the input volume of this audio device |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/audiodevice/libaudiodevice.m line 921 |
Signature | hs.audiodevice:setMuted(state) -> bool |
---|---|
Type | Method |
Description | Set the mutedness state of the audio device |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/audiodevice/libaudiodevice.m line 751 |
Signature | hs.audiodevice:setOutputMuted(state) -> bool |
---|---|
Type | Method |
Description | Set the mutedness state of the Output of the audio device |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 714 |
Signature | hs.audiodevice:setOutputVolume(level) -> bool |
---|---|
Type | Method |
Description | Set the output volume of this audio device |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/audiodevice/libaudiodevice.m line 967 |
Signature | hs.audiodevice:setVolume(level) -> bool |
---|---|
Type | Method |
Description | Set the volume of this audio device |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/audiodevice/libaudiodevice.m line 1013 |
Signature | hs.audiodevice:supportsInputDataSources() -> boolean |
---|---|
Type | Method |
Description | Determines whether an audio device supports input data sources |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 1318 |
Signature | hs.audiodevice:supportsOutputDataSources() -> boolean |
---|---|
Type | Method |
Description | Determines whether an audio device supports output data sources |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 1345 |
Signature | hs.audiodevice:transportType() -> string |
---|---|
Type | Method |
Description | Gets the hardware transport type of an audio device |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 1205 |
Signature | hs.audiodevice:uid() -> string or nil |
---|---|
Type | Method |
Description | Get the unique identifier of the audio device |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 482 |
Signature | hs.audiodevice:volume() -> number or nil |
---|---|
Type | Method |
Description | Get the current volume of this audio device |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/audiodevice/libaudiodevice.m line 876 |
Signature | hs.audiodevice:watcherCallback(fn) -> hs.audiodevice |
---|---|
Type | Method |
Description | Sets or removes a callback function for an audio device watcher |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/audiodevice/libaudiodevice.m line 1552 |
Signature | hs.audiodevice:watcherIsRunning() -> boolean |
---|---|
Type | Method |
Description | Gets the status of the |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 1698 |
Signature | hs.audiodevice:watcherStart() -> hs.audiodevice or nil |
---|---|
Type | Method |
Description | Starts the watcher on an |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 1608 |
Signature | hs.audiodevice:watcherStop() -> hs.audiodevice |
---|---|
Type | Method |
Description | Stops the watcher on an |
Parameters |
|
Returns |
|
Source | extensions/audiodevice/libaudiodevice.m line 1676 |