Audio class

Main class for interacting with Windows Audio APIs.

Constructors

Audio()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

listenerActive bool
Internal state to track if the listener for native events is active.
getter/setter pair

Static Methods

addChangeListener(void callback(String type, String id)) → void
Adds a callback that listens to audio device changes (Added, Removed, Default Changed, etc.).
enumAudioMixer({AudioRole audioRole = AudioRole.multimedia}) Future<List<ProcessVolume>?>
Lists all active application audio sessions (mixers).
enumDevices(AudioDeviceType audioDeviceType, {AudioRole audioRole = AudioRole.multimedia}) Future<List<AudioDevice>?>
Returns a Future list of audio devices of a specified type.
getDefaultDevice(AudioDeviceType audioDeviceType, {AudioRole audioRole = AudioRole.multimedia}) Future<AudioDevice?>
Returns the default audio device for the given AudioDeviceType.
getSampleRate(String deviceID) Future<int>
Gets the current sample rate (in Hz) of the specified audio device.
getVolume(AudioDeviceType audioDeviceType, {AudioRole audioRole = AudioRole.multimedia}) Future<double>
Gets the master volume level (0.0 to 1.0) for the current default device of the given type.
removeChangeListener(void callback(String type, String id)) → void
Removes a previously added audio device change listener.
setAudioDeviceVolume(String deviceID, double volume) Future<int>
Sets the volume of a specific audio device by its deviceID.
setAudioMixerVolume(int processID, double volume, {AudioRole audioRole = AudioRole.multimedia}) Future<bool>
Sets the volume for a specific process identified by processID.
setAudioMixerVolumeByPath(String processPath, double volume, {AudioRole audioRole = AudioRole.multimedia}) Future<bool>
Sets the volume for a specific process identified by its executable path processPath.
setDefaultDevice(String deviceID, {bool console = false, bool multimedia = true, bool communications = false}) Future<int>
Sets the system default audio device using its deviceID.
setSampleRate(String deviceID, int sampleRate) Future<bool>
Sets the sample rate (in Hz) for the specified audio device.
setupChangeListener() Future<void>
Initializes the audio event listener.
setVolume(double volume, AudioDeviceType audioDeviceType, {AudioRole audioRole = AudioRole.multimedia}) Future<int>
Sets the master volume for the default device of the given audioDeviceType.
switchDefaultDevice(AudioDeviceType audioDeviceType, {AudioRole audioRole = AudioRole.multimedia, bool console = false, bool multimedia = true, bool communications = false}) Future<bool>
Switches the default device to the next available one, or toggles between available devices. (Logic depends on implementation of switchDefaultDevice in native code).