help me figure out why createNoteInput intercepts the isPressed / isBeingTouched event

Post Reply New Topic
RELATED
PRODUCTS

Post

AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
I have a launchpad, I'm trying to make a backlight for the pad buttons, and also for them to send information with notes and velocity to the synthesizer.
I studied similar scripts, but for my level of knowledge of the language they are too complex.
I managed to implement these two features separately, but together for some reason they do not work. Perhaps the participants of this forum can help me?

Code: Select all (#)

method init()

NoteInput noteInput = midiIn.createNoteInput("MIDI", "??????", "??????", "??????", "??????");
noteInput.setShouldConsumeEvents(false);

//I create a button and a backlight for the button
final HardwareButton Button_1 = hardwareSurface.createHardwareButton ("PAD_BUTTON_1");
final OnOffHardwareLight ButtonLight1 = hardwareSurface.createOnOffHardwareLight("PAD_BUTTON_LIGHT_1");

//installing a backlight for the button
Button_1.setBackgroundLight(ButtonLight1);

//associate pressing and releasing a button with a midi event
Button_1.pressedAction().setActionMatcher(midiIn.createNoteOnActionMatcher(0, 37));
Button_1.releasedAction().setActionMatcher(midiIn.createNoteOffActionMatcher(0, 37));

//tracking the click event
Button_1.isPressed().markInterested();

//pass the press value to the light state
ButtonLight1.isOn().setValueSupplier(()-> Button_1.isPressed().get());

ButtonLight1.isOn().onUpdateHardware(state -> {
    host.println("state: " + state);
 });

I also tried to bind isBeginTouched events and also use addValueObserver instead of markInterested, tried MultiStateHardwareLight instead of OnOffHardwareLight - all this did not lead to the result.

What could be the problem and how can it be circumvented?

Post

I managed to find the answer myself, if this is useful to someone, check out the setShouldFireEvenWhenUsedAsNoteInput() method in the documentation.

Post

onyme wrote: Thu Oct 31, 2024 8:48 pm I managed to find the answer myself, if this is useful to someone, check out the setShouldFireEvenWhenUsedAsNoteInput() method in the documentation.
Thanks for posting your solution! big help here today.
----------------------------------------------------------------------
/CTRL → http://slashctrl.io
Music & mixes → http://soundcloud.com/kirkwoodwest

Post Reply

Return to “Controller Scripting”