with Lifecycle
Tie this CommandQueue's lifetime to a LifecycleOwner. This will call release when the owner's lifecycle reaches DESTROYED. Returns an AutoCloseable that can be used to manually release early; calling it is idempotent.
Also manages the audio engine start/stop state by acquiring a reference when the lifecycle is "resumed" and releasing when "paused" or destroyed.
Typical usage from an Activity or Fragment:
val cq = CommandQueue().also { it.withLifecycle(this, "MyActivity") }
⚠️ Do not use this with a command queue created with rememberRiveWorker. A command queue created with that method has its lifecycle managed by the Composable's lifecycle.
Parameters
The LifecycleOwner to tie this CommandQueue's lifetime to, such as an Activity or Fragment.
A string indicating the source of the acquisition, for logging purposes, e.g. "MyActivity".