Querying whether number falls within ranges
I’m using mousestate to get the horizontal mouse position when hovering over a waveform. I have a set of ranges on the waveform that change, and there can be any number of these ranges.
Essentially I need to display multiple start and end points ala the select tool in waveform~, and give some visual feedback to the user when they hover over a range.
I can store the ranges, but can’t really query the data how I would like. With one range it would be something like "if mouse position > start of range & < end of range then highlight", but with multiple ranges that change I've no idea what object(s) to use.
Perhaps I need to get in to SQL for this task?
You shouldn’t need SQL.
But I may have 30 different ranges one time, and 5 the next time. The problem I think is that the number of ranges change, and the values of them change each time a process is completed – It’s all dynamic.
I envisaged an object where I could take the integer from mousestate, and feed this in to (leproblemefixer) which would then output the index of the range, and start and end points. Coll essentially, but one that I could query in more depth.
I have an object in my library called
[sadam.split] which was developed exactly for these situation. It behaves like the normal
[split] object, but you can give as many ranges as you wish. You can download it from http://www.sadam.hu/software .
Hope this helps,
OK, to be a bit more precise, the number of ranges in
[sadam.split] is constant, you have to specify it at object creation time. However, the limits of the ranges can be changed dynamically. In other words, you can dynamically ‘kill’ a given range by setting the minimum and maximum values of the given range to the same number.
This one’s dynamic. vexpr + zl.sum is a fun trick for boolean logic… (only checks if it is one of the ranges, but you can get that
----------begin_max5_patcher---------- 885.3ocyXs0aaBCE94jeEdnpp0ozJegaYZq6xa6g8KXpphDbRcEXh.mtzV0+ 6y1.oooPiW.y1KfswX9Nemi+74viiG4LKaCsvA7Qvu.iF833QizCoFXTU+QN oQalmDUnmlyr0BQF2YR4i3qSY7DpP+LzyClsVr+nrX86mM61yIv52ubdh6WQ KwfyrH9RGvUUOdUjX9ML9xqyoyEky.Oc5EvI.OWr5FFVeEbk5UdZ7X0kIFZL yyRSobQMZDzM5uhyOJ.haXEf6yVmCxoKYY7u7ll7hLtfGkpsBmukyhR.eOKI 1oQFA9ZFAG5ryJUvdPuRHkM1JSP7JYBju5FBi6DUHg3LZd+Yj3FLR+Vc6LkS Xeuu4TQcPgdV.ucBJ19N4RfKn4WS4QyRzKI7XXI5ukVxqhWdHATrNsQxC2Wj maqjmh45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