GetWidgetCaption not supported?

It appears there used to be a function GetWidgetCaption(w), but its not in the latest documentation. Which could explain why it always gives me a compile error.

Is there a way to Set and Get a Widget’s caption now?

Actually, this was a work-around anyhow. What I’m really looking for is a way to change the Rackspace’s Tempo setting programmatically. So if I change the Tempo using the Tap() function, I can also update the Rackspace’s Tempo setting so it can be recalled the next time that Rackspace is loaded. Since I couldn’t find a way to do that, I thought I might be able to set the Tempo as a property of a (utility) Widget. That would allow it to be saved between sessions. But that doesn’t seem to be an option.

Maybe there’s a better way?

What version of GP are you using? There is GetWidgetLabel and SetWidgetLabel in GP3

Interesting suggestion - will put this on our tracking system.

Because I was curious I built a small gig with a script.
You can set your tempo with the widget and with the 2 variations the tempo is different for the 2 variations. Or did I completely not understand?

Tempo.gig (5.0 KB)

1 Like

Thanks for your help. Unfortunately the issue isn’t in programatically setting the Tempo – no problem there. What I’m trying to accomplish is to be able to use a Tap Tempo “widget” during rehearsals to set the tempo for a song (Rackspace) and have it save with the Rackspace so when I reload that song, the Tempo will be set to what I set it to earlier. I have most of it working already (and I’ll happily share it once its finished).

What I’m trying to do is the following:

  1. Change the Tempo live (using the Tap() functions) – works great.
  2. Save that Tempo for that Rackspace. This can’t be done directly to the Tempo property of the Rackspace (at least I can’t find a function for it).
  3. Move to a different Rackspace.
  4. Repeat steps 1 and 2 for this Rackspace.
  5. Switch back to the first Rackspace and set the Tempo to what had been previously set there. This would be trivial I could have changed the Rackpace’s Tempo property, but failing that, there needs to be some place to save the Tempo with the Rackspace when it’s not active or unloaded.
  6. Save the Gig and close GigPerformer.
  7. Open GigPerformer, reload the Gig, and have those previously saved Tempos load when the associated Rackspace is activated.

I’m able to do all the above except save the Tempo to the Rackspace. I don’t see a function to read or write the Rackspace’s Temp property, so as a work-around I tried saving the Tempo to the Caption of the Beat LED so I could load it back later. However, GetWidgetCaption(w) is producing the following compiler error: "Semantic error: Line 41, Col 9: Unknown identifer: GetWidgetCaption".

I also tried saving the tempo to a global variable on the off chance that it’s value is restored the next time the Rack is loaded. I didn’t expect it to work, but I know Widget parameters can be persisted, so I thought it might be possible (I haven’t found anything documenting that). This actually sort of works but it’s not reliable. I don’t understand how or why – seems like it may have to do with which Rackspace is active when the Gig is saved.

Anyhow, the ideal solution would be a way to read / write the Rackspace’s Tempo property. Even better would be a Variation-level parameter for Tempo so each variation can have a different Tempo. That’s not needed often, but it would be handy in certain circumstances.

Version 3.5.0.

The statement “GetWidgetCaption(Knob1)” gives the compiler error “Semantic error: Line 41, Col 9: Unknown identifer: GetWidgetCaption”.

In SetList Mode each Song Part can have its own tempo.
Did you check this?

Try this with Gig performer 3.6.0

GetWidgetLabel()

Did you try to save the tempo in the Rackspace property?
The bpm field is shown in gray, but you can edit it!
…and you have to check “Set time information”

I didn’t see that there was an update. I’ll try it when I get a minute. Thanks!

That’s all fine. The issue is, I want to be able to set this from a Tap Tempo Widget in real time, while rehearsing this section with the band. It’s disruptive during a live rehearsal situation to stop and edit the Rackspace – using a live update from Tap would be much easier. I know, 1st world problem :wink:

I got curious and (while hanging at the airport) created the following script which seems to essentially do what you need.
Basically, you respond to an event (I used CC 10 with value of 127) and then first trigger a Tap, then get the global BPM and assign the value to the widget called ‘knob1’. The callback for that widget just sets the global BPM

When you come back to that rackspace, the current widget value will be reset to its value when you last left that rackspace, causing that widget callback to be triggered which will set the GlobalBPM appropriately

Var
   Tapper : MidiInBlock
   knob1 : Widget

On WidgetValueChanged(newValue : double) from knob1
    SetBPM(Scale(newValue, 0, 1, 20, 640)) 
End

On ControlChangeEvent(m : ControlChangeMessage) Matching 10 from Tapper
   var bpm : double
   
   if m.GetCCValue() == 127
    then
       Tap()
       bpm = GetBPM()    
       SetWidgetValue(knob1, Scale(bpm, 20, 640, 0.0, 1.0))
  end     
End

Is there a function to convert a String to a Float (assuming, of course that it’s a valid conversion)? I haven’t been able to find one.

No – that will be in a future version of GP. In the meantime, while a bit awkward, it’s possible to create functions to do this. For example, see below - assumption, incoming string must be valid

// This is needed because there's no built in version of this yet
function CharToInt(s : string) returns int
   select
      s == "0" do result = 0
      s == "1" do result = 1
      s == "2" do result = 2
      s == "3" do result = 3
      s == "4" do result = 4
      s == "5" do result = 5
      s == "6" do result = 6
      s == "7" do result = 7
      s == "8" do result = 8
      s == "9" do result = 9
   end
end

function StrToFloat(s : string) returns double
   var
      i : integer
      ch : string
      theInt, theFraction : double
      foundDecimalPoint : boolean
      places : double
   theInt = 0
   theFraction = 0
   places = 1
   
   foundDecimalPoint = false;
   
   
   for i = 0; i < Length(s); i = i + 1 do
    
      ch = CopySubstring(s, i, 1)
      
      if ch == "."
         then
            foundDecimalPoint = true
         elsif ch >= "0" && ch <= "9"
                then if foundDecimalPoint
                        then 
                           theFraction = 10.0 * theFraction + CharToInt(ch) 
                           places = places * 10
                        else theInt = 10.0 * theInt + CharToInt(ch)
                     end
                else Print("Invalid number")
      end      
   end

   result = theInt + theFraction/places

end