@d-healey After I thought about it, I decided I only needed it to modify 2 keys, so not much work doing it with little copy pasta from the above.
Posts
-
RE: Is there an easier way to let "shift" and other modifier keys into consumed keypresses?
-
Is there an easier way to let "shift" and other modifier keys into consumed keypresses?
HISE doesn't seem to allow me to use just the keycode ("16") of shift to let it pass.
The only way I found to let it in is by copying every single key that I would like to use it as a modifier for changing the boolean, such as:[{ "keyCode": 63232, "description": "cursor up", "shift": false, "cmd": false, "alt": false }, { "keyCode": 63232, "description": "cursor up + shift", "shift": true, "cmd": false, "alt": false },
So that gets quite redundant.
Is there some easier way to let "shift" through with less code? -
RE: How do I find and remove objects in an array?
for (i = 0; i < noteCells; i++) selectedNotes.push(noteCells[i]);
It's not resolving because I meant to use "i < noteCells.length",
so I am stuck with a spinning wheel and a sluggish HISE.I'll just force quit it.
Just didn't know if there is a button similar to "all notes off" to stop the processing. -
RE: How do I find and remove objects in an array?
@d-healey I added a for loop after that function and it seems to be stuck in the loop
-
RE: How do I find and remove objects in an array?
@d-healey Whoops... is there a panic button of some sort for feedback loops? I got stuck in one.
-
RE: How do I find and remove objects in an array?
@d-healey Almost...
that turns it into an object, but it only returns one selection to the list instead of all of the noteCells under the selection rectangle area.
Without the [0] it returns all of them, but inside an array. -
RE: How do I find and remove objects in an array?
@d-healey
I found where the problem is taking place:selectedNotes.push ( selectedNotes.filter(function (c) { var cx = c.col * cellWidth; var cy = height - (c.row + 1) * cellHeight; return ( cx + cellWidth > x1 && cx < x2 && cy + cellHeight > y1 && cy < y2 ); }) );
This selectedNotes.push is pushing an object inside an array to the selectedNotes array, whereas I only need it to push an object to the array.
So the current result is looking like [[{"row":42, "col":4}]]
but I need it to just look like [{"row":42, "col":4}]
I am not sure how I modify that to just use a the object and not have it wrapped in that extra array. -
RE: How do I find and remove objects in an array?
@d-healey said in How do I find and remove objects in an array?:
@VirtualVirgin For those functions (some, filter, etc.) the first parameter should be a function.
Edit: I just realised you're doing the javascript arrow function thing, we don't have that in HISE.
No, the arrow function definitely works:
-
RE: How do I find and remove objects in an array?
@d-healey said in How do I find and remove objects in an array?:
For the original problem you might be able to make use of some of the fancier array functions like map, filter, find, some, etc. Or just use a good ol' fashioned loop to manually search the array for the object you're interested in.
I am using filter and map in this script, but I am new to them so I may not be using them correctly.
My trouble at the moment is detecting which notes are selected
"selectedNotes" is an array that is getting populated properly to tell me which noteCells are selected,
but then I run this inline function to check and this only works somethimes:// check for selected notes inline function isSelected(cell) { local sRow = selectedNotes.some(obj => obj.row === cell.row); local sCol = selectedNotes.some(obj => obj.col === cell.col); if (sRow && sCol) return true; else return false; };
I am trying to use that like "array.contains()", but in this case for specific objects ("cell").
The "cell" is an object with the coordinates i.e. {"row" : 60, "col" : 4}
This works when I use click or shift click to select my notes, but not when a drag selection has been made. Not sure why as they both populate the selectedNotes array. -
RE: How do I find and remove objects in an array?
@d-healey I did take a look at it, but I don't see any way to edit the notes from the viewer. I just think it outputs the graphics from a MIDI file, so I though it was just as well if I try to build my own.
-
RE: How do I find and remove objects in an array?
@d-healey I'm working on a primitive piano roll for MIDI note editing and having trouble with note selection.
To try this out, just double-click on an empty cell to create a note, and double-click again to destroy it.
I think I fixed the adding and removing of array objects.What I am working on now is trying to get the selection methods to work properly for each condition. If I select a note by clicking, that is working, but my click-drag selection is not (even though I can see it is populating my "selectedNotes" array properly).
The issue seems to be with my "isSelected" inline function, which is working for the click selection, but not the drag selection.
After that, I need to fix the selection drag to move the notes, as it was working but I broke it somehow.
HiseSnippet 2814.3ocwZrsaabbcorYfW1Fzjh9VeYrApAYjLMorbrsrkijokufXYKH4KMPPHXztCIGqk6Pr6RKs1guTf7GzW6+R9TxmPetujdNyrWlYuPIKjhRXXwYly4Lm6myLC2MP3vBCEAVMZ853oLqF+wl6G6GMdvXJ2254O1pwsatC8Xt+HxtbpufrmvyibCxDp+LpG4DQvwjgh.RHyi4DwE9DOwHti0ihmRCCYtVMZbomhjpg8ksje92e2indTeGV9TVVuUvcXufOgGkO6ta98bOumPcYulOQC50174NB+ABOwLfsuT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1b6gCgTU4L6ka9j+9B+8E76CqndS3QPqpAbvgq4KmMYeve1gAbhO3FhYNZrDFiqF2CGiZl8Y9txA+F7IYw933FIK1OcQqITm.wO5nxLf+.GthbFfm7k+XPratCNlTQpfIbW9O53XRpRHt5EEwacQQbsKJh29hh32dQQ7NWTDu6YiH9ygYqYQhIpvIKqc1caYp6FM11mBdiROWq+KPJw4zT
-
RE: How do I find and remove objects in an array?
@d-healey
Yikes! I have a mess then. I have to name every object inside the array by declaring a variable for it? -
How do I find and remove objects in an array?
I can't seem to get any matches with this syntax:
-
RE: saveInPreset not working for panel data?
@d-healey
Do you have cases where you need to store panel data in presets?
Is there another method that you use?I'm a little confused reading about the "Control Data" for panels.
I already have data on panels such as:
panel.data.pitchSet
panel.data.tValueThe former being an array and the latter is an integer.
Am I supposed to be passing those into panel.setValue()
i.e.panel.setValue(panel.data.tValue);
or instead of writing to the panel.data.tValue in the first place, I should be writing the data to:
panel.setValue( { "tValue" : tValue });
-
RE: mixing an envelope signal with an aftertouch signal
@Morphoice said in mixing an envelope signal with an aftertouch signal:
@VirtualVirgin superb thank you. How would you go about to make the aftertouch value variable to be either 0 (aftertouch closes the filter) or 1 (aftertouch opens the filter) or have no effect at all (I would Imagine the aftertouch"intensity slider to go from -1 to 1 where 0 is no effect)
I'm trying to understand what you are asking here.
So you want to to turn the aftertouch control signal into a 3 way switch?
Where in the signal path is the aftertouch happening? -
RE: saveInPreset not working for panel data?
@d-healey Ok, I got the value now:
It just seemed like a strange syntax! -
RE: saveInPreset not working for panel data?
@d-healey Ok...
So I'm trying to handle the value data, but after I put it into an object, I don't understand how to get individual values stored in the object.Also,
I don't see any kind of object being stored in the Panel1 here:
I can't find a listing for that object anywhere in the Script Watch Table.
-
RE: saveInPreset not working for panel data?
@d-healey Thanks!
A bit of that is above my head, so a couple of questions:Does the panel.value have a dedicated function that I would be interrupting by writing other data to it? Or is it specifically meant to store any data?
In the example(s) on persistent data, you are using an object.
Does it have to be an object or can I make the top level of panel.value an array with objects in it? -
saveInPreset not working for panel data?
I have a bunch of panels enabled for "saveInPreset", but when I save and load presets, none of the panel data are saved. What is the expected behaviour?
-
RE: mixing an envelope signal with an aftertouch signal
inline function modulateEnvelopeWithAftertouch(envelope, aftertouch) { local modulatedSignal = envelope * (1 - aftertouch) + aftertouch; return modulatedSignal; };