1use nannou::color::Rgb;
4
5use crate::color::{Palette, to_rgb};
6
7#[derive(Clone)]
9pub struct GraphTopologyConfig {
10 pub block_width: f32,
12 pub block_height: f32,
14 pub horizontal_spacing: f32,
16 pub vertical_spacing: f32,
18 pub generator_color: Rgb,
20 pub effector_color: Rgb,
22 pub modulator_color: Rgb,
24 pub io_color: Rgb,
26 pub audio_connection_color: Rgb,
28 pub modulation_connection_color: Rgb,
30 pub text_color: Rgb,
32 pub audio_connection_weight: f32,
34 pub modulation_connection_weight: f32,
36 pub show_arrows: bool,
38 pub arrow_size: f32,
40 pub dash_length: f32,
42 pub dash_gap: f32,
44}
45
46impl Default for GraphTopologyConfig {
47 fn default() -> Self {
48 Self {
49 block_width: 120.0,
50 block_height: 50.0,
51 horizontal_spacing: 80.0,
52 vertical_spacing: 30.0,
53 generator_color: to_rgb(Palette::generator()),
54 effector_color: to_rgb(Palette::effector()),
55 modulator_color: to_rgb(Palette::modulator()),
56 io_color: to_rgb(Palette::io()),
57 audio_connection_color: to_rgb(Palette::audio_connection()),
58 modulation_connection_color: to_rgb(Palette::modulation_connection()),
59 text_color: to_rgb(Palette::text()),
60 audio_connection_weight: 2.0,
61 modulation_connection_weight: 1.5,
62 show_arrows: true,
63 arrow_size: 8.0,
64 dash_length: 8.0,
65 dash_gap: 4.0,
66 }
67 }
68}
69
70#[derive(Clone)]
72pub struct WaveformConfig {
73 pub line_color: Rgb,
75 pub line_weight: f32,
77 pub background_color: Option<Rgb>,
79 pub trigger_level: f32,
81 pub time_window_samples: usize,
83}
84
85impl Default for WaveformConfig {
86 fn default() -> Self {
87 Self {
88 line_color: to_rgb(Palette::waveform()),
89 line_weight: 2.0,
90 background_color: None,
91 trigger_level: 0.0,
92 time_window_samples: 1024,
93 }
94 }
95}
96
97#[derive(Clone, Copy, PartialEq, Eq, Default)]
99pub enum SpectrumDisplayMode {
100 #[default]
102 Bars,
103 Line,
105 Filled,
107}
108
109#[derive(Clone)]
111pub struct SpectrumConfig {
112 pub fft_size: usize,
114 pub bar_color: Rgb,
116 pub peak_color: Rgb,
118 pub min_db: f32,
120 pub max_db: f32,
122 pub smoothing: f32,
124 pub display_mode: SpectrumDisplayMode,
126 pub show_peaks: bool,
128 pub peak_decay: f32,
130}
131
132impl Default for SpectrumConfig {
133 fn default() -> Self {
134 Self {
135 fft_size: 2048,
136 bar_color: to_rgb(Palette::spectrum()),
137 peak_color: to_rgb(Palette::spectrum_peak()),
138 min_db: -80.0,
139 max_db: 0.0,
140 smoothing: 0.8,
141 display_mode: SpectrumDisplayMode::Bars,
142 show_peaks: true,
143 peak_decay: 0.5,
144 }
145 }
146}
147
148#[derive(Clone)]
150pub struct MidiActivityConfig {
151 pub note_on_color: Rgb,
153 pub note_off_color: Rgb,
155 pub velocity_brightness: bool,
157 pub display_range: (u8, u8),
159 pub decay_time_ms: f32,
161}
162
163impl Default for MidiActivityConfig {
164 fn default() -> Self {
165 Self {
166 note_on_color: to_rgb(Palette::midi_note_on()),
167 note_off_color: to_rgb(Palette::midi_note_off()),
168 velocity_brightness: true,
169 display_range: (21, 108),
170 decay_time_ms: 200.0,
171 }
172 }
173}