Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MIDI: make interpreting noteOnZeroAsNoteOff an option rather than a h… #1488

Merged
merged 3 commits into from
May 30, 2015

Conversation

sensestage
Copy link
Contributor

…ardcoded default.

@sensestage
Copy link
Contributor Author

Testing code:

MIDIClient.init;
~midiOut = MIDIOut.newByName( "SuperCollider", "in0" );

MIDIFunc.trace;

MIDIIn.noteOnZeroAsNoteOff = true;
~midiOut.noteOn( 0, 4, 43 );
~midiOut.noteOn( 0, 4, 0 );

MIDIIn.noteOnZeroAsNoteOff = false;
~midiOut.noteOn( 0, 4, 43 );
~midiOut.noteOn( 0, 4, 0 );

MIDIIn.noteOn = { |uid,chan, num, vel| [ uid,chan, num, vel ].postln; };

(
r = Routine({
    var event;
    loop {   // event: b=num, c=vel
        event = MIDIIn.waitNoteOn( 8388613 ); // is SC port
        event.postln;
    }
});
)

r.play;

@LFSaw
Copy link
Member

LFSaw commented May 24, 2015

I checked out the code and tested with the following extended code on OSX:

MIDIClient.init;


(
// LINUX
// var deviceName = "SuperCollider";
// var portName = "in0";

// OSX
var deviceName = "IAC Driver";
var portName = "IAC Bus 1";


~midiOut = MIDIOut.newByName( deviceName, portName );
~src = MIDIClient.sources.select{|dev| dev.device ==  deviceName}.first.uid;
MIDIIn.connectAll;
)


MIDIFunc.trace(true); // turn on tracing

// default behaviour after reboot
~midiOut.noteOn( 0, 4, 43 );
// -> noteOn
~midiOut.noteOn( 0, 4, 0 );
// -> noteOn


// passing through unfiltered
MIDIIn.noteOnZeroAsNoteOff = true;
~midiOut.noteOn( 0, 4, 43 );
// -> noteOn
~midiOut.noteOn( 0, 4, 0 );
// -> noteOff


// filter noteOn==0 (default)
MIDIIn.noteOnZeroAsNoteOff = false;
~midiOut.noteOn( 0, 4, 43 );
// -> noteOn
~midiOut.noteOn( 0, 4, 0 );
// -> noteOn


(
// register messages to MIDIIn, this overwrites MIDIFunc behavior, incl. tracing...
// noteOn message
MIDIIn.noteOn = { |uid,chan, num, vel| [ \noteOn, uid,chan, num, vel ].postln; };
// noteOf message
MIDIIn.noteOff = { |uid,chan, num, vel| [ \noteOff, uid,chan, num, vel ].postln; };
)

(
// create listener
r = Routine({
    var event;
    loop {   // event: b=num, c=vel
        event = MIDIIn.waitNoteOn( ~src );
        event.postln;
    }
});
r.play;
)

r.stop

// passing through unfiltered
MIDIIn.noteOnZeroAsNoteOff = true;
~midiOut.noteOn( 0, 4, 43 );
// -> noteOn
~midiOut.noteOn( 0, 4, 0 );
// -> noteOff


// filter noteOn==0 (default)
MIDIIn.noteOnZeroAsNoteOff = false;
~midiOut.noteOn( 0, 4, 43 );
// -> noteOn
~midiOut.noteOn( 0, 4, 0 );
// -> noteOn

telephon added a commit that referenced this pull request May 30, 2015
MIDI: make interpreting noteOnZeroAsNoteOff optional
@telephon telephon merged commit f8c46e5 into supercollider:master May 30, 2015
@sensestage sensestage deleted the MIDInoteOnZero branch June 28, 2015 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants