Skip to main content

maolan_engine/
meter.rs

1use crate::message::SessionSlotState;
2
3#[derive(Clone, Debug, Default)]
4pub struct MeterSnapshot {
5    pub hw_out_db: Vec<f32>,
6    pub track_meters: Vec<(String, Vec<f32>)>,
7}
8
9#[derive(Clone, Debug)]
10pub struct TransportSnapshot {
11    pub sample: usize,
12    pub tempo_bpm: f64,
13    pub playing: bool,
14    pub transport_running: bool,
15    pub tsig_num: u16,
16    pub tsig_denom: u16,
17}
18
19impl Default for TransportSnapshot {
20    fn default() -> Self {
21        Self {
22            sample: 0,
23            tempo_bpm: 120.0,
24            playing: false,
25            transport_running: false,
26            tsig_num: 4,
27            tsig_denom: 4,
28        }
29    }
30}
31
32#[derive(Clone, Debug)]
33pub struct SessionRuntimeSlotSnapshot {
34    pub track_name: String,
35    pub scene_index: usize,
36    pub state: SessionSlotState,
37    pub play_position_samples: usize,
38    pub elapsed_samples: usize,
39}
40
41#[derive(Clone, Debug, PartialEq, Eq, Hash)]
42pub struct SessionCompletedClipPass {
43    pub track_name: String,
44    pub scene_index: usize,
45    pub clip_id: String,
46    pub pass_index: usize,
47    pub start_sample: usize,
48    pub length_samples: usize,
49}
50
51#[derive(Clone, Debug, Default)]
52pub struct SessionRuntimeSnapshot {
53    pub session_sample: usize,
54    pub slots: Vec<SessionRuntimeSlotSnapshot>,
55    pub completed_clip_passes: Vec<SessionCompletedClipPass>,
56    /// Scene whose launch most recently fired; `None` before any scene
57    /// launch or after the session transport stopped.
58    pub current_scene: Option<usize>,
59}