startAudioDevice method
Starts or prewarms the audio output device without changing any voice or loaded AudioSource. This uses the same serialized lifecycle path as automatic startup.
This is idempotent: calling it while the device is already started does
nothing. It cancels an obsolete pending idle stop, but does not enable a
sticky or permanent keep-alive mode. If the engine remains idle after
startup, the current timeout configured by setAudioDeviceIdleTimeout
starts again. Pass null to that method for indefinite keep-alive.
The blocking native device operation runs off the UI thread, so this does not freeze the app; await the returned future to know when the device is running again.
Throws SoLoudNotInitializedException if the engine is not initialized.
Implementation
Future<void> startAudioDevice() async {
if (!isInitialized) {
throw const SoLoudNotInitializedException();
}
final error = await _controller.soLoudFFI.startAudioDevice();
_logPlayerError(error, from: 'startAudioDevice() result');
if (error != PlayerErrors.noError) {
throw SoLoudCppException.fromPlayerError(error);
}
}