diff options
author | Florian Jung <flo@thinkpad.(none)> | 2011-01-10 17:04:54 +0100 |
---|---|---|
committer | Florian Jung <flo@thinkpad.(none)> | 2011-01-10 17:04:54 +0100 |
commit | eb81cf5820770c54d33facaf09f7f79a17e272ed (patch) | |
tree | a87028cc6235d980e52a04e47ebadbc26320d4fa /synth/note.cpp | |
parent | df97e0ebb7f6591c50f3a588cb2a74901d38ac4a (diff) |
Implemented handler for soft-pedal
Controller 67 aka soft-pedal now can reduce the note's volume by half
TODO:
- let the user set the percentage for the volume, either per
controller (per channel) or per CLI (global)
Diffstat (limited to 'synth/note.cpp')
-rw-r--r-- | synth/note.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/synth/note.cpp b/synth/note.cpp index b6bfa22..91291d7 100644 --- a/synth/note.cpp +++ b/synth/note.cpp @@ -14,12 +14,9 @@ inline fixed_t init_custom_osc_phase(int len, fixed_t sr) } -Note::Note(int n, float v, program_t &prg, jack_nframes_t pf, fixed_t pb, int prg_no) +Note::Note(int n, float v, program_t &prg, jack_nframes_t pf, fixed_t pb, int prg_no, float vol_fac) { - curr_prg=&prg; - - n_oscillators=prg.n_osc; @@ -92,6 +89,7 @@ Note::Note(int n, float v, program_t &prg, jack_nframes_t pf, fixed_t pb, int pr set_note(n); freq=dest_freq; set_vel(v); + set_vol_factor(vol_fac); pitchbend=pb; @@ -132,7 +130,7 @@ void Note::recalc_factors() for (int i=0;i<n_oscillators;i++) { - pfactor.out[i]=calc_pfactor(curr_prg->pfactor.out[i], vel); + pfactor.out[i]=calc_pfactor(curr_prg->pfactor.out[i], vel) * volume_factor; for (int j=0;j<n_oscillators;j++) pfactor.fm[i][j]=calc_pfactor(curr_prg->pfactor.fm[i][j], vel); |