Plugin Caption

Hi, I’m trying to get the “Plugin Caption” value for a plugin block with a specified handle to show up in Touch OSC. Does anyone have any idea how to do this?

Hi @kylehudson,

welcome to the Family :wink:

What do you want to see in Touch OSC?

What version of Touch OSC are you using?

Menu entry "Set Handle…

https://gigperformer.com/docs/GP4UserManual/plugin-contextual-menu.html

Thanks for your help!
For context, I’m building a reusable rackspace with a pre-defined signal path for 10 stereo channels, to be mixed and controlled live via TouchOSC. I want each channel strip in TouchOSC to be automatically populated with the name of the plugin for each channel, which I’ll define on a per-rackspace basis. I’m still a beginner with GPScript, but the below seems to work! There’s possibly a more efficient way to do it, but for the moment this code works (just for a single channel, I’ll need to adjust it to cover the rest).

//$<AutoDeclare>
// DO NOT EDIT THIS SECTION MANUALLY
Var
   Channel_1_2 : PluginBlock
//$</AutoDeclare>

// Called when rackspace is activated
On Activate
   var x : OSCMessage
   var y : String
   y = GetPluginCaption(Channel_1_2)
   OSC_SetAddress(x, "/Channel_1_2_Name")    
   OSC_AppendStringArg(x, y)
   OSC_Send(x)   
   OSC_ClearArgs(x)
   y = ""
End
1 Like

Welcome, and good job figuring this out!

Whenever you have repeating sections in your scripts, I always look for ways to use the Arrays and Loops to keep things simple. Something like this can easily be extended by just adding your additional pluginblock names to the variables at the top. The rest is dynamic.

Var
    Channel_1_2, Channel_3_4, Channel_5_6 : PluginBlock
    Plugins : PluginBlock Array = [Channel_1_2, Channel_3_4, Channel_5_6]

// Called when rackspace is activated
On Activate
    Var i : Integer
        address : String
    For i = 0; i < Size(Plugins); i = i + 1 Do
        address = "/Channel_"+(i*2+1)+"_"+(i*2+2)+"_Name"
        OSC_SendString(address, GetPluginCaption(Plugins[i]))
    End
End

EDIT: I didn’t have the address logic quite right!

4 Likes