Krzysztof Foltman wrote:
OK, this looks like it's fixing the MIDI Note Off issue. However, it may break something else (for example, sample reloading). Please test.
Oops. The diff is very short, but not empty :) I've attached the correct diff now.

The drumkit reloading seems to work despite filling a pattern with notes with resolution=1/64. Layer reloading seems to work as well. None of them seems to call the note off code anyway. Which is a good thing.

If anyone can test this diff against trunk, it would help a lot!

Krzysztof

Index: libs/hydrogen/src/adsr.cpp
===================================================================
--- libs/hydrogen/src/adsr.cpp	(revision 876)
+++ libs/hydrogen/src/adsr.cpp	(working copy)
@@ -146,6 +146,7 @@
 	if ( __state != RELEASE ) {
 		__release_value = __value;
 		__state = RELEASE;
+		__ticks = 0;
 		return __release_value;
 	}
 
Index: libs/hydrogen/src/sampler/sampler.cpp
===================================================================
--- libs/hydrogen/src/sampler/sampler.cpp	(revision 876)
+++ libs/hydrogen/src/sampler/sampler.cpp	(working copy)
@@ -169,11 +169,15 @@
 
 void Sampler::note_off( Note* note )
 {
-//this is in work. i planing a sustain-curve that users can edit
-//in moment only stop_playing_notes delete the current playing note.
-	stop_playing_notes( note->get_instrument() );
-//also the note_off msg from midi keyboard should be recorded into drum pattern note_map.
-//all this will develop into branch: new_fx_rack_and_sample_fun
+	assert(note);
+	Instrument *pInstr = note->get_instrument();
+	// find the notes using the same instrument, and release them
+	for ( unsigned j = 0; j < __playing_notes_queue.size(); j++ ) {
+		Note *pNote = __playing_notes_queue[ j ];
+		if ( pNote->get_instrument() == pInstr ) {
+			pNote->m_adsr.release();
+		}
+	}
 }
 
 
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Hydrogen-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hydrogen-devel

Reply via email to