Problem with MultiSlider x vector

Discuss problems and solutions.
Post Reply
brianc
Regular
Posts: 87
Joined: 10 Jan 2012 02:16

Problem with MultiSlider x vector

Post by brianc »

I'm drawing some values on a MultiSlider for a sequencer. I'd like to have the ability to change the length of the MultiSlider, and have the values shift properly. My goal is:

- When the number of sliders doubles, use the original values for every other slider, and interpolate between the two previous values. Like
- When the number of sliders halves, use average of the previous two values.

I have buttons for halving and doubling the number of sliders. When pressed, they change the length of the MultiSlider using setattribute(). Afterwards, I'd like to update the values in the MultiSlider's x vector. The vector manipulation part is easy, but the problem I'm having is that the length of the x vector isn't updated right away when the number of sliders is increased. Within the execution of the script, the slider's nbr attribute updates fine, but the length of the x vector isn't updated until sometime later, which is a problem.

Attached is a demo template.

Has anyone dealt with this?
Attachments
MultiSlider_Issue.jzml
(7.46 KiB) Downloaded 77 times
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: Problem with MultiSlider x vector

Post by Macciza »

Hi
Maybe a be a little more explicit
see attached
MultiSlider_Issue-fixed.jzml
(7.48 KiB) Downloaded 116 times
Cheers
MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
brianc
Regular
Posts: 87
Joined: 10 Jan 2012 02:16

Re: Problem with MultiSlider x vector

Post by brianc »

Macciza wrote:Hi
Maybe a be a little more explicit
see attached
Thanks for that! It doesn't fix the problem, though. Yes, I will know what the length of the vector of slider values will be, but I still don't have access to the vector at the proper size.
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: Problem with MultiSlider x vector

Post by Macciza »

Weel
What are you wanting to do?
It solves the problem you posted . . .

To do further work on the MultiSlider values -
Keep an array of your values that gets manipulated by functions that get called when doubling or halving

Cheers
MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
brianc
Regular
Posts: 87
Joined: 10 Jan 2012 02:16

Re: Problem with MultiSlider x vector

Post by brianc »

Macciza wrote:Weel
What are you wanting to do?
It solves the problem you posted . . .

To do further work on the MultiSlider values -
Keep an array of your values that gets manipulated by functions that get called when doubling or halving

Cheers
MM
Thanks for sticking with me on this. You're right, it does display the size properly, and what you're suggesting is how I thought I'd solve it as well, but here's the problem:

- I have a script that doubles/halves the size of a multislider. Let's call it mymultislider.
- Once the length has changed, I'd like to replace the values that are in the x vector. I can do that with something like mymultislider.x = newxvector or a for loop that changes the values element by element. Seems pretty straightforward.
- BUT, the mymultislider.x vector actually doesn't get updated in response to my previous setattribute(mymultislider, 'nbr', newsize) command until AFTER that script runs (seems to be how it's implemented in Lemur), so the new values that I set are overwritten by Lemur, which just adds zeros when doubling the vector or chops off the second half when halving. Since that's the case, when is the appropriate time to replace the values?
dBlicious
Newbie
Posts: 25
Joined: 12 Jan 2013 06:49

Re: Problem with MultiSlider x vector

Post by dBlicious »

Has anyone found a workaround for this? I am trying to do something similar to brianc--restoring x values that are lost when MultiSlider nbr is reduced. I have no trouble storing x in an array for later retrieval. No matter how I try, I can't set the missing x values in the same script after I add more sliders. It's making me nuts! I'd be grateful for some guidance.
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: Problem with MultiSlider x vector

Post by Macciza »

Hi

My best advice would be to send in an example project - there are too many ways of achieving(or not) many things in Lemur . ..

Cheers
MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
dBlicious
Newbie
Posts: 25
Joined: 12 Jan 2013 06:49

Re: Problem with MultiSlider x vector

Post by dBlicious »

I finally figured it out. I changed my on expression for the multislider.x memory update function from x to z. That was causing 0's overwrite the memory array when/where I added sliders. The added slider wouldn't update if I set it in the same function that I added the slider with, probably due to the order that lemur does things behind the scenes. I set up a little script to update x[last] when x[last] != memory[last]. In my case I'm only adding one slider at a time so I don't need to update all x. I'm not entirely happy, as the last bit could break something else down the line.

-A
Post Reply