uiCombo not responding to MIDI CC

Home Forums General Programming uiCombo not responding to MIDI CC

Tagged: ,

Viewing 16 posts - 21 through 36 (of 36 total)
  • Author
    Posts
  • #84342
    lfo2vco
    Participant
      • Topics: 26
      • Replies: 162
      • Total: 188
      • ★★

      Thanks for the feedback guys,

      Possemo, I have taken on board your suggestion regarding the comments, I am currently going though and amending all my scripts putting the comments on a new line. When completed I will test to see what effect this has first, and then if necessary move onto adding the ‘nil’ value between ‘if’ and ‘elseif’ as you suggested.

      Diamondamp, thanks for the pointer regarding MIDI messages being overwritten this hadn’t occurred to me. I will try the local variable and see if it makes any difference, once I have completed and tested the changes discussed with Possemo.
      Regarding your last post, I have a working method to add bidirectional communication with iuCombos, thus I only required specific bytes of a CC message to achieve this. But thank you for the detailed suggestion and code.

      I will report back and let you both know how I get on.

      Here is some noise I organised into an acceptable format:
      https://soundcloud.com/lfo2vco/a-dark-crystal

      #84343
      Possemo
      Participant
        • Topics: 14
        • Replies: 638
        • Total: 652
        • ★★★

        I didn’t knew the list diamondams posted. Yea that’s a nice way to do it. I should study the github page some more – thanks diamondamps.

        with the line if midiCcID >= 0xB0 and midiCcID <= 0xBF then... you are checking if the message is a CC (Control Change). This could probably achieved with this:

        if midiMessage:isController() == true then...

        I don’t know if the syntax is correct but it must be something similar. You could leave the “== true”:

        if midiMessage:isController() then...

        • This reply was modified 5 years, 10 months ago by Possemo.
        • This reply was modified 5 years, 10 months ago by Possemo.
        #84346
        daimondamps
        Participant
          • Topics: 8
          • Replies: 80
          • Total: 88

          Github repository is down :/ Good I have a copy.

          #84347
          lfo2vco
          Participant
            • Topics: 26
            • Replies: 162
            • Total: 188
            • ★★

            Hi Guys,

            Sorry Daimondamp I didn’t understand what you were posting, my skills in this area are limited so I fumble through with a lot of help from guys like Possemo and yourself.

            I noticed the DMCA notice on Roman’s Github page the other day. I thought it was rather crap considering all the effort Roman has put into ctrlr and also taking into account it is non profit software.

            Here is some noise I organised into an acceptable format:
            https://soundcloud.com/lfo2vco/a-dark-crystal

            #84348
            daimondamps
            Participant
              • Topics: 8
              • Replies: 80
              • Total: 88

              One more thing . I think if you want first byte you have to use getByte(1) not getByte(0)
              Lua arrays(tables) start at 1 instead of 0.
              What i’ve posted are the methods for midiMessage object.
              So you can use them as getData()or getByte().
              You can check interesting type of message with methods like midiMessage:isSomething()
              It will return true or false.

              • This reply was modified 5 years, 10 months ago by daimondamps.
              • This reply was modified 5 years, 10 months ago by daimondamps.
              • This reply was modified 5 years, 10 months ago by daimondamps.
              #84416
              lfo2vco
              Participant
                • Topics: 26
                • Replies: 162
                • Total: 188
                • ★★

                Well, I may have got to the bottom of this issue.

                I removed the Index Bootstrap variable from most of my scripts to see what would happen. The result was that I encountered the same error message as was being created by the VST version. This speeded up debugging as I didn’t need to export a VST every time to check the results of my changes. I also noted that it only affected two scripts when I have multiples in a similar format.

                Index Bootstrap Variable:

                	if panel:getRestoreState() == true or panel:getProgramState() == true then
                		return
                	end

                First action was to double check that the syntax was exactly the same on the two erroneous scripts as the other non problematic scripts; it was. This lead me leave the coding and look for other possible issues within the panel.

                Upon inspection it turned out that one of the scripts was also assigned to a Modulator via the ‘Called when the modulator value changes’ menu. This was obviously wrong as the script is intended to assign a value to a Modulator not vice versa. I corrected this, it worked.

                I could not find a similar problem for the other script, however assuming it was a similar problem I renamed it. This also worked, I guess as it broke any possible links to a Modulator via ‘Called when the modulator value changes’.

                So now all I have is an issue with pop-up menus that launch at Panel Boot in the VST to sort out, but that is in another thread.

                Thanks again for all your help Possemo and Daimondamp.

                Here is some noise I organised into an acceptable format:
                https://soundcloud.com/lfo2vco/a-dark-crystal

                #84421
                Possemo
                Participant
                  • Topics: 14
                  • Replies: 638
                  • Total: 652
                  • ★★★

                  This does not work:

                  if midiMessage:isController() then...

                  Error message:
                  attempt to call method ‘isController’ (a nil value)

                  Has someone got this working?

                  #84423
                  daimondamps
                  Participant
                    • Topics: 8
                    • Replies: 80
                    • Total: 88

                    This does not work:

                    if midiMessage:isController() then...

                    Error message:
                    attempt to call method ‘isController’ (a nil value)

                    Has someone got this working?

                    It is a little bit tricky but is working for me :

                    midiMessageReceived = function(midi)
                          ourMidiClassAndMessage= MidiMessage()
                          if ourMidiClassAndMessage:isSysEx() then console("sysex") end;
                    end

                    Note that midi is not the same as MidiMessage() which is a class

                    You can check methods of x with what(ourMidiClassAndMessage)

                    I wonder if we could do the ourMidiClassAndMessage= MidiMessage() part on init only?

                    EDIT: MidiMessage() object is not working when recive callback is called. It doesn’t contain any data.
                    Maybe it was half implemented 🙁

                    • This reply was modified 5 years, 9 months ago by daimondamps.
                    • This reply was modified 5 years, 9 months ago by daimondamps.
                    • This reply was modified 5 years, 9 months ago by daimondamps.
                    • This reply was modified 5 years, 9 months ago by daimondamps.
                    • This reply was modified 5 years, 9 months ago by daimondamps.
                    • This reply was modified 5 years, 9 months ago by daimondamps.
                    • This reply was modified 5 years, 9 months ago by daimondamps.
                    #84429
                    daimondamps
                    Participant
                      • Topics: 8
                      • Replies: 80
                      • Total: 88

                      UPDATE: So we have two objects. One is CtrlrMidiMessage()

                      Object type [CtrlrMidiMessage]
                      -----------------------------------------------------------------
                      
                      Members:
                      	                       getData:	function
                      	             getPropertyDouble:	function
                      	                   getProperty:	function
                      	                     getNumber:	function
                      	                    setChannel:	function
                      	                getPropertyInt:	function
                      	             getPropertyString:	function
                      	             setPropertyString:	function
                      	       getInitializationResult:	function
                      	                   setProperty:	function
                      	            getMidiMessageType:	function
                      	             setPropertyColour:	function
                      	                      getValue:	function
                      	                        __init:	function
                      	                       getSize:	function
                      	                    getChannel:	function
                      	                removeProperty:	function
                      	                setPropertyInt:	function
                      	                    getLuaData:	function
                      	                 getObjectTree:	function
                      	                       getType:	function
                      	                      toString:	function
                      	                     setNumber:	function
                      	             setPropertyDouble:	function
                      	                      setValue:	function
                      

                      And the other is MidiMessage():

                      Object type [MidiMessage]
                      -----------------------------------------------------------------
                      
                      Members:
                      	       isKeySignatureMetaEvent:	function
                      	                        __init:	function
                      	                 isAllSoundOff:	function
                      	                  isAftertouch:	function
                      	getSongPositionPointerMidiBeat:	function
                      	            getPitchWheelValue:	function
                      	                       isSysEx:	function
                      	                    getChannel:	function
                      	              getMetaEventType:	function
                      	                   isMidiStart:	function
                      	                    isMidiStop:	function
                      	              multiplyVelocity:	function
                      	 getQuarterFrameSequenceNumber:	function
                      	                 isNoteOnOrOff:	function
                      	   getTempoMetaEventTickLength:	function
                      	                 isAllNotesOff:	function
                      	              getFloatVelocity:	function
                      	  getMidiMachineControlCommand:	function
                      	   isMidiMachineControlMessage:	function
                      	                    getRawData:	function
                      	            isControllerOfType:	function
                      	        getProgramChangeNumber:	function
                      	                 setNoteNumber:	function
                      	                getRawDataSize:	function
                      	            isSostenutoPedalOn:	function
                      	                  setTimeStamp:	function
                      	                  isController:	function
                      	           isSostenutoPedalOff:	function
                      	                isMidiContinue:	function
                      	              isTempoMetaEvent:	function
                      	                     isNoteOff:	function
                      	                 isSoftPedalOn:	function
                      	          getQuarterFrameValue:	function
                      	                  getTimeStamp:	function
                      	getMidiChannelMetaEventChannel:	function
                      	                 getNoteNumber:	function
                      	                   setVelocity:	function
                      	            getAfterTouchValue:	function
                      	               isProgramChange:	function
                      	            getMetaEventLength:	function
                      	        isMidiChannelMetaEvent:	function
                      	                   getVelocity:	function
                      	       getChannelPressureValue:	function
                      	               isTextMetaEvent:	function
                      	      getTextFromTextMetaEvent:	function
                      	                   isFullFrame:	function
                      	                isSoftPedalOff:	function
                      	                    setChannel:	function
                      	                 isActiveSense:	function
                      	                  isForChannel:	function
                      	             isSustainPedalOff:	function
                      	              isTrackNameEvent:	function
                      	                   isMidiClock:	function
                      	              getMetaEventData:	function
                      	         isEndOfTrackMetaEvent:	function
                      	      isMidiMachineControlGoto:	function
                      	 getTempoSecondsPerQuarterNote:	function
                      	                addToTimeStamp:	function
                      	      isTimeSignatureMetaEvent:	function
                      	getKeySignatureNumberOfSharpsOrFlats:	function
                      	                   isMetaEvent:	function
                      	                  isPitchWheel:	function
                      	              getSysExDataSize:	function
                      	           getControllerNumber:	function
                      	              isTrackMetaEvent:	function
                      	         isSongPositionPointer:	function
                      	          getTimeSignatureInfo:	function
                      	             isChannelPressure:	function
                      	              isSustainPedalOn:	function
                      	                      isNoteOn:	function
                      	                isQuarterFrame:	function
                      	            getControllerValue:	function
                      	                  getSysExData:	function
                      • This reply was modified 5 years, 9 months ago by daimondamps.
                      #84435
                      Possemo
                      Participant
                        • Topics: 14
                        • Replies: 638
                        • Total: 652
                        • ★★★

                        Thanks diamondamps. This takes us a step forward. So MidiMessage() does not seem to be accessible via the receive callback. But CtrlrMidiMessage() has some useful options as well. I got it working with this:

                        midiReceived = function(midi)
                          messageType = midi:getType()
                          console(tostring(messageType))
                        end

                        type 5 seems to be sysex, type 0 seems to be CC. It would be nice if we could find a list that explains the various types.

                        Edit – another one: programChange is type 7
                        Edit2 – two more: noteOn = 3, noteOff = 4

                        • This reply was modified 5 years, 9 months ago by Possemo.
                        • This reply was modified 5 years, 9 months ago by Possemo.
                        #84440
                        daimondamps
                        Participant
                          • Topics: 8
                          • Replies: 80
                          • Total: 88

                          Count from 0 :

                          enum CtrlrMidiMessageType
                          {
                          	CC,
                          	Aftertouch,
                          	ChannelPressure,
                          	NoteOn,
                          	NoteOff,
                          	SysEx,
                          	Multi,
                          	ProgramChange,
                          	PitchWheel,
                          	None,
                          	MidiClock,
                          	MidiClockContinue,
                          	MidiClockStop,
                          	MidiClockStart,
                          	ActiveSense,
                          	kMidiMessageType,
                          };
                          • This reply was modified 5 years, 9 months ago by daimondamps.
                          #84442
                          Quimquim
                          Participant
                            • Topics: 7
                            • Replies: 23
                            • Total: 30

                            lfo to vco you said in a previous message…I have a working method to add bidirectional communication with iuCombos, thus I only required specific bytes of a CC message to achieve this.

                            I’m interested by your method can you post it?

                            Also if someone could write a short document with a couple of working example, how to use the bunch function posted higher in this post would be fine for all of us instead to read spreaded part of post to try to understand if what is mention is working or not.

                            I think a such document would avoid a lot of questions on the forum.

                            Also why not to create in the forum a special section (Ex:Tutorial) showing samples of working things to help other developers to not reinvent the wheel if someone already found a way to solve particular situations.

                            This would avoid to dig all the forum to find solutions not spread everywhere.

                            Thanks from all of us, newbe and others!!!

                            Stay tuned. Quimquim

                            #84443
                            lfo2vco
                            Participant
                              • Topics: 26
                              • Replies: 162
                              • Total: 188
                              • ★★

                              lfo to vco you said in a previous message…I have a working method to add bidirectional communication with iuCombos, thus I only required specific bytes of a CC message to achieve this.

                              I’m interested by your method can you post it?

                              Hey there,

                              OK so I lost my iMac to the current heatwave we are having here in the UK, so at the moment I an computerless. Thus this is not the most up to date version, but it will work.

                              OK so the following message is attached to the ‘Called when panels receives a MIDImessage’ dropdown in the panel settings.

                              midiMessageReceived = function(midiMessage)
                              
                              	-- Controller Byte
                              	midiCcID = midiMessage:getData():getByte(0)
                              	-- MIDI Channels
                              	if midiCcID >= 0xB0 and midiCcID <= 0xBF then
                              
                              		-- Parameter Byte
                              		midiCcMod = midiMessage:getData():getByte(1)
                              
                              		if midiCcMod == 0x08 then
                              			dcoOneRangeMessage(midiMessage)
                              		elseif midiCcMod == 0x10 then
                              			lfoModeMessage(midiMessage)
                               		elseif midiCcMod == 0x67 then
                              			atLevelMessage(midiMessage)
                              
                              		end
                              
                              	end
                              
                              end

                              So I don’t know how much you know already, so please excuse me if I’m telling you how to suck eggs. This method grabs the MIDI message via midiCcMod, then if midiCcID >= 0xB0 and midiCcID <= 0xBF identifies it as a continuous controller. Then midiCcMod = midiMessage:getData():getByte(1) grabs the parameter byte which identifies which modulator to assign it to. Then if midiCcMod == 0x08 then etc., passes to another method that acts on the modulator. Such as this:

                              dcoOneRangeMessage = function(midiMessage)
                              
                              	-- Value Byte
                              	midiCcData = midiMessage:getData():getByte(2)
                              	if midiCcData >= 0x00 and midiCcData <= 0x23 then
                              		DCO1Range:setModulatorValue((0), false, false, false)
                              	elseif midiCcData >= 0x24 and midiCcData <= 0x53 then
                              		DCO1Range:setModulatorValue((1), false, false, false)
                              	elseif midiCcData >= 0x54 then
                              		DCO1Range:setModulatorValue((2), false, false, false)
                              
                              	end
                              
                              end

                              Here is some noise I organised into an acceptable format:
                              https://soundcloud.com/lfo2vco/a-dark-crystal

                              #84444
                              Possemo
                              Participant
                                • Topics: 14
                                • Replies: 638
                                • Total: 652
                                • ★★★

                                @diamondamps: thanks for the list

                                @quimquim
                                : what do you want to do? In general all modulators have bidirectional functionality.

                                #84446
                                Quimquim
                                Participant
                                  • Topics: 7
                                  • Replies: 23
                                  • Total: 30

                                  Possemo see in the topic “Decode tone from CC32 CC00 PC midi messages” to not mix replys from the actual topic.

                                  Stay tuned. Quimquim

                                  #115526
                                  goodweather
                                  Participant
                                    • Topics: 45
                                    • Replies: 550
                                    • Total: 595
                                    • ★★★

                                    Hi,
                                    I’m just busy to make my first VST versions of my panels and had the problem that no Lua code was launched as dll. Spent the whole afternoon reading the forum about VST preparation.
                                    Found the issue and maybe it will also be interesting for you.

                                    I discovered that we should not have getProgramState() in the condition in the isPanelReady function.
                                    Removing that and thus only using
                                    if panel:getBootstrapState() == false and bPanelLoaded == true then
                                    solves the issue.

                                    I will search further in the forum about the meaning of getProgramState().
                                    All the startup phase of a panel is still a bit cryptic even if I understand it more and more.

                                  Viewing 16 posts - 21 through 36 (of 36 total)
                                  • The forum ‘Programming’ is closed to new topics and replies.
                                  There is currently 0 users and 81 guests online
                                  No users are currently active
                                  Forum Statistics
                                  Threads: 2,495, Posts: 17,374, Members: 77,605
                                  Most users ever online was 12 on January 22, 2019 3:47 pm
                                  Ctrlr