Skip to main content

proteus_lib/playback/engine/
state.rs

1//! Shared playback state and metrics structures.
2
3/// Buffering configuration for the playback engine.
4#[derive(Debug, Clone, Copy)]
5pub struct PlaybackBufferSettings {
6    pub start_buffer_ms: f32,
7    pub track_eos_ms: f32,
8}
9
10impl PlaybackBufferSettings {
11    /// Create new buffer settings with a given start buffer size (ms).
12    pub fn new(start_buffer_ms: f32) -> Self {
13        Self {
14            start_buffer_ms: start_buffer_ms.max(0.0),
15            track_eos_ms: 1000.0,
16        }
17    }
18}
19
20/// Aggregated DSP chain performance metrics used by debug UI.
21#[derive(Debug, Clone, Copy, Default)]
22pub struct DspChainMetrics {
23    pub dsp_time_ms: f64,
24    pub audio_time_ms: f64,
25    pub rt_factor: f64,
26    pub avg_dsp_ms: f64,
27    pub avg_audio_ms: f64,
28    pub avg_rt_factor: f64,
29    pub min_rt_factor: f64,
30    pub max_rt_factor: f64,
31    pub track_key_count: usize,
32    pub finished_track_count: usize,
33    pub prot_key_count: usize,
34    pub chain_ksps: f64,
35    pub avg_chain_ksps: f64,
36    pub min_chain_ksps: f64,
37    pub max_chain_ksps: f64,
38}