Synth.isNote(eventID)
-
@d-healey said in Synth.isNote(eventID):
if (Message.isArtificial())
Synth.noteOffByEventId(tid);Thanks yeah the redundant if statement I know about - being lazy again...
So this sorta works - in that it fixes the problem if I check in the porta script if mono is running and handle each case slightly differently.
But this breaks all sorts of encapsulation guidelines I'd really like to keep to....
-
@Lindon so back to my first point/question(s)
any one know if this is do-able and would be willing to give it a shot?
-
@Lindon I think it's doable, but I think I'd need to rewrite the port script somewhat. Could you give me a breakdown of what the port script should do so I don't have to reverse engineer yours?
-
@d-healey yeah I mean give it a shot at adding in the C++ code to get us to
Synth.isNote(EventId);
-
@Lindon Oh I meant independent mono and poly scripts working in harmony was doable, I'm sure the
isNote
thing is doable too but not sure how to tackle it. -
@d-healey - thanks.
@Christoph-Hart - is there anything else we'd need other than what i outlined in the OP?
-
Yes, you will need another method in
EventIdHandler
:/** Checks whether the event ID points to an active artificial event. */ bool isArtificialEventId(uint16 eventId) const { return !artificialEvents[eventId % HISE_EVENT_ID_ARRAY_SIZE].isEmpty(); }
and call this instead of
popNoteOnFromEventId()
, because this method removes the event (hence the namepop...
).However this is a pretty shallow advice. I can't guarantee that there are no unwanted side effects, as the system of assigning artificial event IDs is pretty delicate (AFAIK you can't have multiple artificial notes with the same note number and channel for performance reasons)...
-
BTW, you can query if a note is already artificial and use that info in the second script:
HiseSnippet 794.3oc6VssaSCDDc2zXDIhhnB9.r5SIBnJtTtH3AZaRJJBRaDoTwaUasG2rp16ZYuNPTU+s36h+.XV63ZmV2aVphWXUjb14lOy3yryNJTZCQQxPBsw9yB.B8QFimITS5NgwEjA8HzGaLjEofPyTQaOKfEEANDJcoOoEPaTmjr98G2l4wD1PtHB4.I2F9B2mqxkNZyOy871g4.6y8KX8FaNvVJ5J8jwHdVxnCIfYeB6XXWl1rZFD5C56vUxvwJlBhPa1V5La7D4ODo1e.OhejGn2XQFiAJULo6DtmynrbMhPn0Gkm4Kkl4OyXH2get77JvSRTXl6QwZ.s1hPp9BPx5pfzNROGc.tB3Uq.7pmBuULFaGxCT4ZzX6oykliNqhvqVpVRseQMLciE1JtTXJE6JUvdhVsadZyFckhHoGrVPHWnZs5dByi.WYH7dyUMet4PLn3mf0NFT8mBB0.mVsa+gkaZhqLc9rSfsBUbWtMm40RqtjnxbQVzMGzlm07RH00sbn55dufULr2HXu.LwPnBkddPXJRufZMQubMycrkH1+HH7ElSYdwv4Fhe8Wjd071Quv9HEB0BFJECDb0dAv7VkLNPlDKx405hFkmWEkljNkXVtnKyoIcSwD9uuMnGSwPZNctLzt..+nnyPZOXJdlQJougQOH5DkL.O0nxcDquPCaVGg5V2QLFvxoy0SwZf+3tsxTyiJxwZmRAOM8gdcg2fTMAOfUJ.SdjICgzTX0Lh6YoO.uH3NEFt3xA5ZZs9Oe9eNeFmyHch8XpEG9nmxNWAVhWfKOP+1h3pYEmBeGlH0ozIRVkks2R3thwHtxdR43sVI3UOr6dFuymuurQeWWvVkC15F678pNL+N.kuJiUbwwCYpP9OITici8GiWwwFPjHDXiMJiVSynR22QuWWYFCBmjM+AWyUZo2SmqzJSIwmYGJOzNk1puAwCSjfXRjb4oF3s3v8lVjjFRzOiNq0g3iWr4Paaco3kH1K2m0qfOupB9rQE740Uvm2TAedaE74cWqO56TtUrR5m1lfBF0O4XDJsufgrrDFI4uPCl7HI
So your
Synth.isNote()
function can be written in HiseScript like this:// You don't need the event id, just make sure you never call this method // outside the `onNoteOn` / `onNoteOff` callbacks.. inline function isNote() { return Message.isArtificial(); }
-
@Christoph-Hart I'd like to add my vote to @Lindon's request. It appears that my plugins would benefit from it too :)
-
@d-healey many ways yes!