audio_monitor
A Flutter desktop plugin for controlling native audio monitoring features.
Windows native listen support
On Windows, audio_monitor configures the built-in operating system feature exposed in Sound Control Panel as:
Recording > Microphone Properties > Listen > Listen to this device
This implementation:
- Uses the Windows endpoint property store for the capture device
- Reads and writes the same native setting shown by the Sound Control Panel
- Can assign a specific playback endpoint or the current default playback device
This implementation does not:
- Capture audio in the plugin
- Render audio in the plugin
- Build a custom software monitoring pipeline
- Record, buffer, or process PCM samples
Behavior depends on Windows endpoint property support and write access to the device property store.
Platform support
| Platform | Status | Notes |
|---|---|---|
| Windows | Supported | Controls native Listen to this device |
| macOS | Unsupported for this API | Throws unsupportedPlatform |
| Linux | Unsupported for this API | Throws unsupportedPlatform |
Installation
dependencies:
audio_monitor: ^0.1.0
Then run:
flutter pub get
Dart API
import 'package:audio_monitor/audio_monitor.dart';
final inputs = await AudioMonitor.getInputDevices();
final outputs = await AudioMonitor.getOutputDevices();
final configuration = await AudioMonitor.getNativeListenConfiguration(
inputDeviceId: inputs.first.id,
);
await AudioMonitor.enableNativeListen(
inputDeviceId: inputs.first.id,
outputDeviceId: outputs.first.id,
);
await AudioMonitor.setNativeListenOutputDevice(
inputDeviceId: inputs.first.id,
outputDeviceId: AudioMonitor.defaultOutputDeviceId,
);
await AudioMonitor.disableNativeListen(
inputDeviceId: inputs.first.id,
);
Data models
AudioInputDevice
idnameisDefaultstate
AudioOutputDevice
idnameisDefaultstate
AudioDeviceState
activedisabledunpluggednotPresentunknown
NativeListenConfiguration
enabledoutputDeviceIdoutputDeviceNameusesDefaultOutputDevice
Errors
Native failures are surfaced as AudioMonitorException with these codes:
inputDeviceNotFoundoutputDeviceNotFounddeviceNotActivelistenConfigurationUnavailablelistenConfigurationUnsupportedpermissionDeniednativeWindowsApiFailedunsupportedPlatform
Native Windows Listen to this device
The Windows backend writes endpoint properties associated with native microphone monitoring. The goal is that after calling enableNativeListen, the Sound Control Panel reflects the same state.
If your device driver or Windows build refuses property-store writes for this setting, the plugin returns a platform exception instead of falling back to a custom audio monitor path.
Diagnostic tool
The repository includes a Windows diagnostic executable target:
audio_monitor_property_dump
It dumps property keys and values for capture and render endpoints so you can compare endpoint state before and after changing Listen to this device manually in Windows.
Manual QA checklist
- Run the example app on Windows.
- Verify that input devices are listed with state and default marker.
- Verify that output devices are listed with state and default marker.
- Select an input device and an output device.
- Press
Enable native listen. - Open Sound Control Panel and confirm
Listen to this deviceis checked. - Confirm the selected playback device matches the app state.
- Change the output device in the app and press
Apply output device. - Reopen the microphone
Listentab and confirm the playback target changed. - Press
Disable native listen. - Confirm the checkbox is unchecked in Sound Control Panel.
Warning
This feature is Windows-specific and depends on native endpoint property behavior. It does not provide a portable cross-platform software monitor path.