From 019bf74777568574696a3faca7a846a6beaa065b Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Sat, 8 Jan 2011 15:00:30 +0100 Subject: Changed always_reattack (controller 3) to legato-pedal When in monomode, not pressing the legato pedal will cause the note always being reattacked, while pressing it will cause it to be only reattacked if it's envelopes are done (i.e., past release phase) When in polymode, the legato pedal is ignored, notes will always be reattacked, because not doing so would cause interference between the two generated sounds. --- synth/README.developer | 1 - synth/channel.cpp | 20 ++++++++++++-------- synth/channel.h | 5 +++-- 3 files changed, 15 insertions(+), 11 deletions(-) (limited to 'synth') diff --git a/synth/README.developer b/synth/README.developer index c2ee3a2..8957815 100644 --- a/synth/README.developer +++ b/synth/README.developer @@ -12,7 +12,6 @@ regeln: TODO für todos. DEBUG für debugging-outputs und -dinge. FINDMICH nur für marker, die unmittelbar gebraucht werden. Abweichungen von General MIDI: - controller 3 steuert always_reattack im polymode controller 1 muss von der config definiert werden, sonst wird er ignoriert controller 119 steuert quick-release-zeit im falle eines voice-limits. 0 bedeutet: sofort abschalten diff --git a/synth/channel.cpp b/synth/channel.cpp index e92afef..0042162 100644 --- a/synth/channel.cpp +++ b/synth/channel.cpp @@ -14,7 +14,6 @@ Channel::Channel() set_program(0); curr_prg.controller[NO_CONT]=1; quick_release=0; - always_reattack=false; portamento_frames2=portamento_frames=0; do_portamento=false; pitchbend=ONE; @@ -28,6 +27,7 @@ Channel::Channel() held_keys.clear(); sostenuto_keys.clear(); hold_pedal_pressed=false; + legato_pedal_pressed=false; } Channel::~Channel() @@ -99,7 +99,7 @@ void Channel::note_on(int note, int vel) { pressed_keys.insert(note); - if ( (n_voices==1) && (!notes.empty()) ) + if ( (n_voices==1) && (!notes.empty()) ) //we're in monomode { //no need to create a new note; reuse the existing NoteSkel *n; //i'm lazy @@ -131,15 +131,14 @@ void Channel::note_on(int note, int vel) //if not still active, don't do portamento n->set_note(note,n->still_active()); n->set_vel((float)vel/128.0); - if (always_reattack || !n->still_active()) n->reattack(); + if ((legato_pedal_pressed==false) || !n->still_active()) n->reattack(); //no need to push back. would become #1 instead of #1 } } - else + else //we're in polymode { bool neednewnote=true; - if (always_reattack) - { + //if (always_reattack) always_reattack is always true when in polymode for (it=notes.begin(); it!=notes.end(); it++) if ( ((*it)->get_note()==note) && ((*it)->get_program()==program) ) { @@ -150,7 +149,7 @@ void Channel::note_on(int note, int vel) notes.erase(it); break; } - } + if (neednewnote) { NoteSkel *newnote=NULL; @@ -218,13 +217,13 @@ void Channel::set_controller(int con,int val) { switch (con) { - case 3: always_reattack=(val>=64); case 5: set_portamento_time(val); break; case 7: set_volume(val); break; case 8: set_balance(val); break; case 65: set_portamento(val); break; case 64: set_hold_pedal(val>=64); break; case 66: set_sostenuto_pedal(val>=64); break; + case 68: set_legato_pedal(val>=64); break; case 119: set_quick_release(val); case 120: panic(); break; case 121: reset_controllers(); break; @@ -391,6 +390,11 @@ void Channel::set_sostenuto_pedal(bool newstate) } } +void Channel::set_legato_pedal(bool newstate) +{ + legato_pedal_pressed=newstate; +} + void Channel::panic() { list::iterator it; diff --git a/synth/channel.h b/synth/channel.h index 2f7795c..b0a855a 100644 --- a/synth/channel.h +++ b/synth/channel.h @@ -39,7 +39,7 @@ class Channel void set_hold_pedal(bool newstate); void set_sostenuto_pedal(bool newstate); - + void set_legato_pedal(bool newstate); float balL, balR; private: @@ -57,7 +57,6 @@ class Channel std::list notes; - bool always_reattack; bool do_portamento; int n_voices; @@ -70,6 +69,8 @@ class Channel set held_keys; set sostenuto_keys; + + bool legato_pedal_pressed; }; #endif -- cgit v1.2.3