Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: generic matrix #320

Closed
cyberic99 opened this issue Jun 25, 2018 · 11 comments
Closed

Feature request: generic matrix #320

cyberic99 opened this issue Jun 25, 2018 · 11 comments

Comments

@cyberic99
Copy link
Contributor

Hi

I would find it very useful to have a kind of multipush but with custom values.
Using a switch can be a workaround, but with a switch you cannot click the same item/button twice, because it stays selected...
So would it be possible to have a 'autorelease' property in a switcher?
It would allow the user to click an item, then click it again, and it would send the value twice.

Thx a lot
Eric

@jean-emmanuel
Copy link
Owner

I'm working on a generic and more flexible matrix widget that should do the job and much more ;)

@jean-emmanuel
Copy link
Owner

jean-emmanuel commented Jun 28, 2018

It's in git for testing and should be included in next release. It's really black magic stuff...:)

Simple exemple for a matrix props property (with all other properties to default values):

{
  "color": "red",
  "label": "#{\"abcd\"[$]}"
}

Complex example:

#{

props = {\} # no semicolon -> outputed by formula
            # closing bracket must be escaped here

props.label = "abcd"[$];
props.color = ["red", "cyan"][$ % 2];
props.address = concat("/test/", string($));
props.target = "127.0.0.1:4444";

}

@cyberic99
Copy link
Contributor Author

Wow, that's huge!

I tested it with pushbuttons and was able to set other properties such as norelease and such.

It can be really useful for a grid of knobs too, or even for multifaders

I will try to use it dynamically with a list of buttons to play some samples

The sample list will be a json dict: {"sample1": 1, "sample2": 2}

Hope it will work, especially updating the sample list ;-)

@jean-emmanuel
Copy link
Owner

jean-emmanuel commented Jun 28, 2018

Edit: I had not seen your reply, don't mind this post ;)

In your case you could set the matrix' widgetType to push and its props to something like:

#{

props = {\} # no semicolon -> outputed by formula
            # closing bracket must be escaped here

values = [1,2,3,4];

props.on = values[$];
props.address = concat("/test/", string($));
props.target = "127.0.0.1:4444";

}

@jean-emmanuel
Copy link
Owner

I changed the index variable to $ to be consistent with the existing matrix widgets (plus i is already used in formulas for complex numbers, although I'm not sure it's of any use in o-s-c).

@jean-emmanuel jean-emmanuel changed the title Feature request: switch with auto-release Feature request: generic matrix Jun 28, 2018
@cyberic99
Copy link
Contributor Author

OK. I think that $ can be confusing... idx or index would be IMHO more appropriate, but you choose ;-)

@cyberic99
Copy link
Contributor Author

cyberic99 commented Jun 28, 2018

@jean-emmanuel : even with master (4728599), i has still to be used as index, and $ is not working

@jean-emmanuel
Copy link
Owner

Fixed !

@jean-emmanuel
Copy link
Owner

Included in v0.33.0, I'm sticking to $, it has the benefit of being consistent with the older matrices widgets plus index is already a function available in formulas'. Now let's try it and find the bugs ;)

@cyberic99
Copy link
Contributor Author

For me it's working as expected. I have a matrix of pushes, complex props, and I dynamically change the matrix size. it is working as expected. thx!

@akobelan
Copy link

In case somebody stumbles across the same needs as I had ... #335

  • Example 1:
    -- toggle button matrix
    -- user defined labels
    -- user defined values
    -- alternating colors for enabled buttons

MATRIX/widgetType: toggle
MATRIX/props:

#{
props = {\} # no semicolon -> outputed by formula
            # closing bracket must be escaped here.

values = [1,2,3,4,5,6,7,8,9,10];
props.on = values[$];
props.label = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"][$];
props.color = ["red", "cyan"][$ % 2];
props.address = concat("/test/", string($));
props.target = "127.0.0.1:8088";
}
  • Example 2:
    -- push button matrix
    -- user defined labels
    -- user defined values
    -- alternating colors for enabled buttons
    -- no OSC message sent on release

MATRIX/widgetType: push
MATRIX/props:

#{
props = {\} # no semicolon -> outputed by formula
            # closing bracket must be escaped here.

values = [1,2,3,4,5,6,7,8,9,10];
props.on = values[$];
props.norelease = true;
props.label = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"][$];
props.color = ["red", "cyan"][$ % 2];
props.address = concat("/test/", string($));
props.target = "127.0.0.1:8088";
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants