Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PoroCYon
oidos
Commits
6394a3cc
Commit
6394a3cc
authored
Apr 07, 2017
by
Aske Simon Christensen
Browse files
Pass sample rate to parameter visualization
parent
668dd297
Changes
2
Hide whitespace changes
Inline
Side-by-side
synth/src/generate.rs
View file @
6394a3cc
...
...
@@ -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
;
...
...
synth/src/synth.rs
View file @
6394a3cc
...
...
@@ -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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment