feat(bridge,core): add is_hard_muted and get_output_gain readback (TODO-037)
Add bridge read-back functions for hard-mute state and output gain. Add core output_gain() getter. Document feature gaps in SRS.
This commit is contained in:
@@ -1113,6 +1113,21 @@ impl ChanoraSession {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Read the current master output gain. Returns `1.0` (unity) if
|
||||
/// audio is not started.
|
||||
pub async fn output_gain(&self) -> f32 {
|
||||
let guard = self.inner.lock().await;
|
||||
let state = match guard.as_ref() {
|
||||
Some(s) => s,
|
||||
None => return 1.0,
|
||||
};
|
||||
let audio = match state.audio.as_ref() {
|
||||
Some(a) => a,
|
||||
None => return 1.0,
|
||||
};
|
||||
audio.output_gain()
|
||||
}
|
||||
|
||||
/// Set per-client output volume (SRS-075). `1.0` is unity, `0.0`
|
||||
/// mutes. No-op if audio is not started or client has no active
|
||||
/// voice queue.
|
||||
|
||||
@@ -837,6 +837,15 @@ pub async fn set_hard_mute(muted: bool) -> Result<(), BridgeError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Read the current hard-mute state. Returns `true` when the audio
|
||||
/// engine is clamped and transmits nothing regardless of mode.
|
||||
pub async fn is_hard_muted() -> bool {
|
||||
runtime()
|
||||
.spawn(async { session().hard_mute() })
|
||||
.await
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
/// Coarse PTT input class (gen2 v0.9.3 / DEC-026). Stable strings;
|
||||
/// the bridge never carries raw key codes.
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
@@ -999,6 +1008,15 @@ pub async fn set_output_gain(gain: f32) -> Result<(), BridgeError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Read the current master output gain. Returns `1.0` (unity) when
|
||||
/// audio is not started.
|
||||
pub async fn get_output_gain() -> f32 {
|
||||
runtime()
|
||||
.spawn(async { session().output_gain().await })
|
||||
.await
|
||||
.unwrap_or(1.0)
|
||||
}
|
||||
|
||||
/// Set per-client output volume (SRS-075). `1.0` is unity, `0.0`
|
||||
/// mutes. No-op when client has no active voice queue. Volume is
|
||||
/// applied directly to the tsclientlib AudioQueue and takes effect
|
||||
@@ -2394,7 +2412,7 @@ pub async fn enable_audio_debug_wav_dump(enabled: bool) -> Result<(), BridgeErro
|
||||
.spawn(async move { session().set_audio_debug_wav_dump(enabled).await })
|
||||
.await
|
||||
.map_err(|e| task_join_error("enable_audio_debug_wav_dump", e))?
|
||||
.map_err(|e| BridgeError::Unmapped(format!("enable_audio_debug_wav_dump: {e}")))?;
|
||||
.map_err(|e| BridgeError::unmapped_ctx("enable_audio_debug_wav_dump", e))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user