Changeset 889

Show
Ignore:
Timestamp:
03/11/09 02:37:50 (4 years ago)
Author:
gabriel@…
Message:

Trigger note release instead of abrupt cutoff on note-off events.

(Thanks to Krzysztof Foltman for the patch.)

Issue was reported to the forums [1] that bass drum kicks on TR808
created a clicking sound when used with a MIDI controller. In the
sampler, NOTE OFF events create an abrupt mute on the instrument,
which creates a high-frequency click. This patch instead triggers a
release on the instrument, respecting the mute group of the
instrument.

[1]  http://www.hydrogen-music.org/forum/?action=show_thread&fid=0&thread=1034&page=1

Location:
trunk/libs/hydrogen/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/libs/hydrogen/src/adsr.cpp

    r73 r889  
    147147                __release_value = __value; 
    148148                __state = RELEASE; 
     149                __ticks = 0; 
    149150                return __release_value; 
    150151        } 
  • trunk/libs/hydrogen/src/sampler/sampler.cpp

    r817 r889  
    170170void Sampler::note_off( Note* note ) 
    171171{ 
    172 //this is in work. i planing a sustain-curve that users can edit 
    173 //in moment only stop_playing_notes delete the current playing note. 
    174         stop_playing_notes( note->get_instrument() ); 
    175 //also the note_off msg from midi keyboard should be recorded into drum pattern note_map. 
    176 //all this will develop into branch: new_fx_rack_and_sample_fun 
     172        assert(note); 
     173        Instrument *pInstr = note->get_instrument(); 
     174        // find the notes using the same instrument, and release them 
     175        for ( unsigned j = 0; j < __playing_notes_queue.size(); j++ ) { 
     176                Note *pNote = __playing_notes_queue[ j ]; 
     177                if ( pNote->get_instrument() == pInstr ) { 
     178                        pNote->m_adsr.release(); 
     179                } 
     180        } 
    177181} 
    178182