Commit 6394a3cc authored by Aske Simon Christensen's avatar Aske Simon Christensen
Browse files

Pass sample rate to parameter visualization

parent 668dd297
......@@ -55,7 +55,7 @@ impl From<f32> for Sample {
pub trait SoundParameters {
fn names() -> &'static [&'static str];
fn default_value(name: &str) -> f32;
fn display<P: Index<&'static str, Output = f32>>(&self, name: &'static str, p: &P) -> (String, String);
fn display<P: Index<&'static str, Output = f32>>(&self, name: &'static str, p: &P, sample_rate: f32) -> (String, String);
fn build<P: Index<&'static str, Output = f32>>(p: &P, sample_rate: f32) -> Self;
fn attack<P: Index<&'static str, Output = f32>>(p: &P, sample_rate: f32) -> f32;
fn release<P: Index<&'static str, Output = f32>>(p: &P, sample_rate: f32) -> f32;
......
......@@ -216,12 +216,12 @@ impl<G: SoundGenerator, S: SynthInfo> Plugin for SynthPlugin<G, S> {
fn get_parameter_text(&self, index: i32) -> String {
let param_map: &HashMap<&'static str, f32> = &self.param_map.read().unwrap();
self.sound_params.display(self.param_names[index as usize], param_map).0
self.sound_params.display(self.param_names[index as usize], param_map, self.sample_rate).0
}
fn get_parameter_label(&self, index: i32) -> String {
let param_map: &HashMap<&'static str, f32> = &self.param_map.read().unwrap();
self.sound_params.display(self.param_names[index as usize], param_map).1
self.sound_params.display(self.param_names[index as usize], param_map, self.sample_rate).1
}
fn get_parameter(&self, index: i32) -> f32 {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment