How to declare variable for midi CC that's used in global midi

Where is your MFP? Global Rackspace?
The other thing to consider is do you really want both the song part change and MFP start to be quantized to beat 1? It may be better to keep the song part change manual so you can trigger it just before the beat, so that your new song part/variation is ‘ready’.

Yes. Right now that’s being triggered to play with CC in the song part switching itself.
image

The first line choses the song, the second line turns widget on that starts the PLAY function. I had to do it this way b/c when it was just relying on the widget state in the variation, it was getting the widget PLAY message first and song part second. Never started to play. Once I put them both here, works fine.

Sure, that sounds good as long as it doesn’t stop the playing of the current song.

Try it with your current set up first.

var
    MyMidiBlock : MidiInBlock // rename MyMidiBlock to the handle you've given to the block
    SwitchPart : Boolean

initialization
    SwitchPart = false
end

On BeatChanged(bar : integer, beat : integer)
    if beat == 1 and SwitchPart == true then
        SongNextPart()
        SwitchPart = false
    end
end

// CC to move to the next song part
On ControlChangeEvent(m : ControlChangeMessage) Matching 51 from MyMidiBlock // Change 51 to the CC number from your controller
    if GetCCValue(m) == 127 then
        SwitchPart = true
    end
End

Just to clarify, you are talking about the song part change in the MFP right? Not the song part change in the setlist… If so, you are right, the MFP song change has to happen before the PLAY command, but that’s all taken care of with the current setlist song part change that I just screen shotted. I’m not sure if that’s the best way to handle it, but it works flawlessly, I just would like the entire setlist song part change to happen on the next bar 1.

In the global rackspace script editor?

Yep. Also add your Midi Input block for the controller that’s sending the Next CC message (I’m assuming it sends CC).

I owe you (another) beer!!! :slight_smile: It works! You know it was bound to since we both picked CC51 for next (before I even got your message). LOL

Now how do I go backwards to PREV song part (w/o creating a copy/separate message with SongPrevPart)? I’m guessing there is a more elegant way of doing an IF 50 PREV if 51 NEXT?

1 Like

Do you need to? Song parts are just pointers, so you can duplicate the same part and position it where you need to.

If possible I would love to b/c sometimes in an improvised setting I might want to go NEXT or PREV…depends…

Ok sure. You’ll need to create two boolean variables e.g. SwitchNextPart, SwitchPrevPart : Boolean

You can then either duplicate the On ControlChangeEvent again, or it’s also possible to manage everything within the one using if/then/else.

Var
    MyMidiBlock : MidiInBlock
    SwitchNextPart, SwitchPrevPart : Boolean = false

On BeatChanged(bar : integer, beat : integer)
    if beat == 1 and (SwitchNextPart or SwitchPrevPart) then
        if SwitchNextPart then
            SongNextPart()
        else
            SongPrevPart()
        end
        SwitchNextPart = false
        SwitchPrevPart = false
    end
end

// CC to move to the next song part
On ControlChangeEvent(m : ControlChangeMessage) Matching 51 from MyMidiBlock // Change 51 to the CC number from your controller
    if GetCCValue(m) == 127 then
        SwitchNextPart = true
    end
End

// CC to move to the previous song part
On ControlChangeEvent(m : ControlChangeMessage) Matching 50 from MyMidiBlock // Change 50 to the CC number from your controller
    if GetCCValue(m) == 127 then
        SwitchPrevPart = true
    end
End

Thanks so much! I’m glad you sent it b/c it was not letting my copy the “on BeatChanged” as it was defined already. I was messing up the If / else … Works great!

I’m very happy with this already, but … is it possible to press two or three times to bypass parts? If so, how difficult is it to accomplish that? If it is not easy, I’ll just use touch for those extra rare times. I’m pretty sure that won’t be needed much.

I’m sure it’s possible. But you’d have to manage a counter that increments/decrements with each press, and also a widget to communicate this to you so you know which one you’re about to switch too.

Gotcha! This is great for now! Thanks for your help again! :slight_smile:
Can’t wait to get more proficient at scripting!

1 Like

@ztones I have turned this into a template. You might find it useful. It will allow you to click next/prev multiple times quickly to move to a particular part (before the next bar starts). There are also direct select widgets for parts 1-8.

2 Likes

I “might” find this useful? Might? That “might” be the understatement of the week! :rofl:
This is really awesome! I find it VERY useful! Skipping song parts and direct select, all quantized? N I C E !!! Thanks so much for making this!

I put the script and template in my global rackspace. Compiled fine. Unfortunately I just crashed GP (probably too many plugins open and editing things…) and running out, no time to continue to test right now, but I did notice couple of odd behaviors. It may be because I have some midi commands in the song parts that are not playing nice together. I have the song selection and then a play command (turs on a widget associated to play) for my midi file player in the parts. So one thing i noticed is that the first bar kept looping over and over, never advancing to the next part and actually playing the midi file. Just the first bar. Then when I went to a song part that had NO commands at all (no song selection or play for the MFP) it started playing some midi that was inside my EzBass plugin. Once I deleted it, it didn’t do it anymore, so lets not worry about that, might have been fluke in the plugin. But not progressing passed the first bar is something that I’d like to solve obviously. :slight_smile:

Please send the crash report if it happens again and before you send it, provide the steps to reproduce the crash.

Are you using the Local GP Port (specifically CC 80) for anything? I am using that in the Gig script to reset everything when it detects the song has changed.

Otherwise, are you merging my code with a lot of existing Global Rackspace scripts? I can take a look if you are and try to figure it out.

1 Like