Set modifier as selected track number???

0

Ok im trying to set a fader to control the volume of a selected track, but then offset it.
So lets say I have 8 faders and I select track #3. I want to control track 3-11 with my 8 faders incrementally.

The way I imagine to do this is with using modifiers to make the track number the faders control.
But I need to get the track number from a reaction.

So in my volume control it controls track m1,m2 etc etc for each of the faders up to m8. that way the track number controlled is the modifier. which im going to try to make “Selected track number+1”, “Selected track number+2” etc etc.

My listener right now is:
self.song().view.add_selected_track_listener

So it triggers whenever i select a new track.

then in the action I have “self.set_modifier_value(“m1″, [….])” as modifier to set the m1
This way im setting the modifier… i hope. I’m starting to get lost here.

And then I am kind of stuck on the output on the action to set the value to be equal to the track number. Especially since it seems to only output a range based on observation.
I’m looking around all over but there seems to be no track number.

It probably looks something like self.song().view.track_number. But I do not see that command in there anywhere.

Glenn Verhaeghe Answered question July 20, 2024
0

I made an error in the 3rd line of code. Volume value doesn’t work in steps from 0 to 127 but is a number between 0.0 and 1.0. To account for this, we need to use the “get value from ranges” feature:

This converts the 128 steps into values between 0.0 and 1.0.

I’ve added the .json for this version. Aside of the fader_num and Listener, you’ll also need to change the Controller you use as displayed in the red box in the image above.

This still won’t solve your is_visible problem but I’m working on an entirely new Reaction for that. I’m guessing it will be ready by tomorrow. I’m going to implement the use of modifiers, like you were trying to set up. I’m only wondering if I’m not making it overly complex but we’ll see. Here’s a sneak peek of the code:

Glenn Verhaeghe Posted new comment July 20, 2024

Actually, I might’ve just thought of a better way than what I’m doing in the sneak peek code, by making a custom list that only contains visible tracks.

EDIT: Better yet, there already is a list like that:
self.song().visible_tracks

EDIT 2: the problem with using the visible_tracks list is that you can only get the selected track’s index num by comparing track names, meaning that you’d need to have unique names for each track. So, maybe this is not a valid way to go.

OK i got it figured out.

It seems like your first command worked but I had to seperate the “set track” part into a seperate action before applying the volume part with the gui as range.

It somehow doesn’t let me add files here like you seem to be able to but the content of the actions are as following

Action 1:
fader_num = 2
track_to_control = self.get_selected_track_num() + fader_num – 1

Action 2:
self.song().tracks[track_to_control].mixer_device.volume.value = self.get_value_from_ranges(False, 128, False, self.midi_cc_ch_0_val_103.cur_val, 0, 127, 0, 0, 0.85, 2, False)

There should really be a way to just indicate this directly.

It seems it only seems to have the bugged offset if the value gets stored to a modulator m1-m20 (i tried some above 8 randomly to make sure it was consistent behaviour)

This is pretty much identical to what I had before but the first action was just done in a ranges by adjusting the output range or current value range by adding a whole integer equal to the track offset i intended and then storing it before recalling it in a track volume module instead of a reaction.

Either way. It seems fixed now! The simple solution was the best one it seems.

Thank you a ton for going out of your way trying a lot of things.
I don’t fully understand the last json you sent. but I’ve learned a lot about CSS in the past 2 days because of it!

No problem, glad it worked out.

About that json file, in that first action I only meant to leave the first 2 lines of code but accidentally left some other code in (that I was experimenting with) when I uploaded the json.

I am still going to try and make the Reaction that only lets you adjust volumes of visible tracks, just to see if I can pull it off.

You are viewing 1 out of 4 answers, click here to view all answers.