diff options
Diffstat (limited to 'synth')
-rw-r--r-- | synth/README.developer | 1 | ||||
-rw-r--r-- | synth/channel.cpp | 20 | ||||
-rw-r--r-- | synth/channel.h | 5 |
3 files changed, 15 insertions, 11 deletions
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 ef215c9..6446b0f 100644 --- a/synth/channel.cpp +++ b/synth/channel.cpp @@ -9,7 +9,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; @@ -23,6 +22,7 @@ Channel::Channel() held_keys.clear(); sostenuto_keys.clear(); hold_pedal_pressed=false; + legato_pedal_pressed=false; } Channel::~Channel() @@ -94,7 +94,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 Note *n; //i'm lazy @@ -119,15 +119,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) ) { @@ -138,7 +137,7 @@ void Channel::note_on(int note, int vel) notes.erase(it); break; } - } + if (neednewnote) notes.push_back( new Note(note,(float)vel/128.0, curr_prg, @@ -195,13 +194,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; @@ -368,6 +367,11 @@ void Channel::set_sostenuto_pedal(bool newstate) } } +void Channel::set_legato_pedal(bool newstate) +{ + legato_pedal_pressed=newstate; +} + void Channel::panic() { list<Note*>::iterator it; diff --git a/synth/channel.h b/synth/channel.h index 4ddcbb3..f673294 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<Note*> notes; - bool always_reattack; bool do_portamento; int n_voices; @@ -70,6 +69,8 @@ class Channel set<int> held_keys; set<int> sostenuto_keys; + + bool legato_pedal_pressed; }; #endif |