Home › Forums › General › Programming › setting modulator MIDI channel via Lua
- This topic has 6 replies, 3 voices, and was last updated 11 years, 9 months ago by atom.
-
AuthorPosts
-
July 25, 2012 at 12:30 am #669
I have a combo box that contains values 1-16. I want the selection of this combo box to set the MIDI channel of a component.
Following the API I see there is a setChannel function for the CtrlrMidiMessage class, but I don’t think that’s what I want.
Could we get a "setChannel" function under the "ctrlrModulator" class, or maybe there’s some other way to set this up so users can specify the MIDI ch a modulator or group of modulators speak over? Maybe add all the modulators to a group and drive the group’s midi channel from the combobox?
edit: arg. nope.. groups don’t get MIDI channels. . .
Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
July 25, 2012 at 9:51 pm #4649*bump*
Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
July 25, 2012 at 9:58 pm #4650Well i can set up a setMidiChannel() method for a modulator but it will just change the midi channel on the midi message it owns (same as if you’d do it yourself from LUA).
If you have an idea how to solve it in the GUI (set midi channel to multiple modulators at once) i’d love to implement something. I can consider groups and tabs for that, but maybe there are some better ideas for that ?
July 25, 2012 at 10:41 pm #4651thanks for the reply. How do you change the midi channel the midi message owns from Lua, if you don’t mind explaining? Might be exactly what I’m looking for.
As for your implementation question I’m not sure what the best way to go about this would be but I think adding modulators to groups (or tabs) and assigning a midi channel to the group (or tab) would be a logical place to organize things.
My desire here is to be able to use a combobox w/ values 1-16 to set the MIDI out channel of a group of modulators to this selected MIDI channel.
I’ve tried something like, but there is no setChannel function for the ctrlr modulator class so obviously this doesn’t work.
[code:32d9ljvg]
s1ch= panel:getModulatorByName("MIDI Channel s1"):getModulatorValue()if s1ch==1 then
panel:getModulatorByName("modulator1"):setChannel(1)
panel:getModulatorByName("modulator2"):setChannel(1)
panel:getModulatorByName("modulator3"):setChannel(1)elseif s1ch==2 then
panel:getModulatorByName("modulator1"):setChannel(2)
panel:getModulatorByName("modulator2"):setChannel(2)
panel:getModulatorByName("modulator3"):setChannel(2)etc...
[/code:32d9ljvg]Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
July 26, 2012 at 7:39 am #4652Try with this:
panel:getModulatorByName("modulator1"):setPropertyInt("midiMessageChannel",3)
August 3, 2012 at 11:40 pm #4653"dasfaker":3ux2lbu8 wrote:Try with this:panel:getModulatorByName("modulator1"):setPropertyInt("midiMessageChannel",3)[/quote:3ux2lbu8]
I tried this, however it did not change the MIDI Channel property of the modulator as I expected. Maybe it’s not visually reflected in the modulator’s property?? Only gave it a tertiary try.. I’ll look more at it this weekend probably.
Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
August 4, 2012 at 8:26 am #4654That’s wrong the MIDI channel is not the property of the modulator, it’s the property of the MidiMessage object that belongs to the modulator, so
to set the midi channel of modulator-1 with the variable newMidiChannel:[code:17vwi94w]
panel:getModulatorByName("modulator-1"):getMidiMessage():setPropertyInt("midiMessageChannel", newMidiChannel)
[/code:17vwi94w] -
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.