Is setShouldConsumeEvents(false) bulletproof?

Post Reply New Topic
RELATED
PRODUCTS

Post

Hi Guys,

noteIn = host.getMidiInPort(0).createNoteInput("Notes");
noteIn.setShouldConsumeEvents(false);

Are there any situations where this isn't working?

I've got a note input line and I've set events to be passed through, but my script won't react to the events. Any pointers? The device I'm using is a Maschine Studio.

Thanks

Post

I haven't heard of failures so far.

Do you have a println or printMidi in your onMidi function to see what comes in in the console?
The script "not reacting" may have different causes... ;-)

Cheers,

Tom
"Out beyond the ideas of wrongdoing and rightdoing, there is a field. I’ll meet you there." - Rumi
ScreenDream Instagram Mastodon

Post

I've tested with both println and printMidi. Here's a printMidi readout.

MIDI: 144, 36, 106 [90 24 6a ]
MIDI: 160, 36, 62 [a0 24 3e ]
MIDI: 160, 36, 63 [a0 24 3f ]
MIDI: 160, 36, 52 [a0 24 34 ]
MIDI: 160, 36, 63 [a0 24 3f ]
MIDI: 160, 36, 65 [a0 24 41 ]
MIDI: 160, 36, 55 [a0 24 37 ]
MIDI: 160, 36, 15 [a0 24 0f ]
MIDI: 144, 36, 0 [90 24 00 ]
MIDI: 160, 36, 0 [a0 24 00 ]

Have also checked through Midi-OX and everything else is going fine.

Do I need to do anything other than...

if (isChannelController(status) && data1 === 36) {

as an example?

Post

So the midi seems to be going to your script alright then? Is it the data you expect?

What's unclear to me is what you expect to happen?
Just setting setShouldConsumeEvents to false only sends the data you filtered to go into the note lane to your onMidi function as well (everything else does so anyway), but nothing else.
Everything that you want to happen needs to be "told" to the system explicitly by yes, reacting to the incoming data as in your example or creating user controls to midi-map etc..
If you want to handle Sysex, you need to define an onSysex function separately (some controllers send especially transport commands that way). I don't know Maschine so can't help with specifics.

Cheers,

Tom
"Out beyond the ideas of wrongdoing and rightdoing, there is a field. I’ll meet you there." - Rumi
ScreenDream Instagram Mastodon

Post

ThomasHelzle wrote:So the midi seems to be going to your script alright then? Is it the data you expect?

What's unclear to me is what you expect to happen?
Just setting setShouldConsumeEvents to false only sends the data you filtered to go into the note lane to your onMidi function as well (everything else does so anyway), but nothing else.
Everything that you want to happen needs to be "told" to the system explicitly by yes, reacting to the incoming data as in your example or creating user controls to midi-map etc..
If you want to handle Sysex, you need to define an onSysex function separately (some controllers send especially transport commands that way). I don't know Maschine so can't help with specifics.

Cheers,

Tom
So, for instance, C1 on Maschine is CC 36.

If I have this piece of code...

if (isChannelController(status) && data1 === 36) {
println("Yeah");
}

I would expect for Yeah to be printed to the console. If I put this piece of code under any button that isn't sending out MIDI notes, it works. If I set the button to send standard CC instead of MIDI notes, it works, yet if I set it to send out MIDI, it's not being passed through.

If you're not aware of any bugs, that's cool, I'll submit a tech support request. I'm just seeing if anyone knows anything first before I go ahead.

Thanks.

Post

For the sake of completeness, I've also done the same test with my Nektar Panorama P6 and MIDI notes aren't passing through on that either.

Does anyone have an example of a working script where notes are being responded to that I can do further testing with?

Thanks

Post

Could it be that you confuse midi CC with midi notes? You are talking about notes but your code examples show CC.
If you are really meaning notes, also note that it is important to set the following functions accordingly:
void setKeyTranslationTable (Object[] table)
void setVelocityTranslationTable (Object[] table)

Post

- misleading advice removed -
Last edited by BufoBufo on Mon Nov 13, 2017 2:05 pm, edited 1 time in total.

Post

Yeah, that looks like the issue here. You test for a CC in your "if" and say it works if you set the controller to send CCs, but it doesn't work if you use notes (at least that is what I assume you mean with "set it to send out Midi") - this is natural.
Midi is all of it, notes, CCs, PitchBend, Aftertouch etc.
If you want to test for a Note, try "isNoteOn" instead.

@moss: You don't really need to bother with setKeyTranslationTable and setVelocityTranslationTable - it's on standard defaults if you don't touch it? Should work right off the bat if it isn't set somewhere else in the script.

Cheers,

Tom
"Out beyond the ideas of wrongdoing and rightdoing, there is a field. I’ll meet you there." - Rumi
ScreenDream Instagram Mastodon

Post

BufoBufo wrote:Did you try to pass at least one mask parameter to the createNoteInput call, even if it's just a catchall-wildcard? That is

host.getMidiInPort(0).createNoteInput("Notes", "??????");
That can be a good idea or a bad idea, depending on what he is after. ;-)

But I don't think it's the issue here, since that only determines what goes to the note lane, not what goes to the script/onMidi.

Cheers,

Tom
"Out beyond the ideas of wrongdoing and rightdoing, there is a field. I’ll meet you there." - Rumi
ScreenDream Instagram Mastodon

Post

Your're right, Tom. I removed my misleading thought.

Post

In as much as I enjoy random cryptic statements with not-at-all-insulting winky faces while I'm very clearly trying to learn how this stuff works from literal scratch, never mind, I've found my own workaround.

Cheers.

Post

If something is unclear or feels cryptic, just ask away - in above post I tried to not confuse the matter by information that could be more irritating than just leaving it out.

We can't know what you do, what you see or at what level you are from a handful of relatively vague forum posts....

Cheers and best of luck with the script!

Tom
"Out beyond the ideas of wrongdoing and rightdoing, there is a field. I’ll meet you there." - Rumi
ScreenDream Instagram Mastodon

Post Reply

Return to “Controller Scripting”