Plug'n Script - display array string element in a knob.

Official support for: bluecataudio.com
Post Reply New Topic
RELATED
PRODUCTS

Post

I have a knob that I want to be able to dial in a Midi Note (image attached).
I can easily display the Integer representing the note in the knob. I have created an array of values in my .cxx and I would like the note# Integer to reference the element in the array and display the actual note in the knob.

string midiNotes="C-1;C#-1;D;D#-1;E-1;F-1;F#-1;G-1;G#-1;A-1;A#-1;B-1;C0;C#0;D0;D#0;E0;F0;F#0;G0;G#0;A0;A#0;B0;C1;C#1;D1;D#1;E1;F1;F#1;G1;G#1;A1;A#1;B1;C2;C#2;D2;D#2;E2;F2;F#2;G2;G#2;A2;A#2;B2;C3;C#3;D3;D#3;E3;F3;F#3;G3;G#3;A3;A#3;B3;C4;C#4;D4;D#4;E4;F4;F#4;G4;G#4;A4;A#4;B4;C5;C#5;D5;D#5;E5;F5;F#5;G5;G#5;A5;A#5;B5;C6;C#6;D6;D#6;E6;F6;F#6;G6;G#6;A6;A#6;B6;C7;C#7;D7;D#7;E7;F7;F#7;G7;G#7;A7;A#7;B7;C8;C#8;D8;D#8;E8;F8;F#8;G8;G#8;A8;A#8;B8;C9;C#9;D9;D#9;E9;F9;F#9;G9";
array<string> inputParametersEnums={midiNotes};

So instead of displaying the number 37 in the knob, C#2 would be displayed.
If this is possible, can someone show me how?
You do not have the required permissions to view the files attached to this post.

Post

Yes that should indeed work. Have you also defined min and max values for this parameter? (The doc says "Require that min and max values are defined.")

Post

Yes min & max are defined. Here's some of my cxx

#include "../library/Midi.hxx"

string midiNotes="C-1;C#-1;D;D#-1;E-1;F-1;F#-1;G-1;G#-1;A-1;A#-1;B-1;C0;C#0;D0;D#0;E0;F0;F#0;G0;G#0;A0;A#0;B0;C1;C#1;D1;D#1;E1;F1;F#1;G1;G#1;A1;A#1;B1;C2;C#2;D2;D#2;E2;F2;F#2;G2;G#2;A2;A#2;B2;C3;C#3;D3;D#3;E3;F3;F#3;G3;G#3;A3;A#3;B3;C4;C#4;D4;D#4;E4;F4;F#4;G4;G#4;A4;A#4;B4;C5;C#5;D5;D#5;E5;F5;F#5;G5;G#5;A5;A#5;B5;C6;C#6;D6;D#6;E6;F6;F#6;G6;G#6;A6;A#6;B6;C7;C#7;D7;D#7;E7;F7;F#7;G7;G#7;A7;A#7;B7;C8;C#8;D8;D#8;E8;F8;F#8;G8;G#8;A8;A#8;B8;C9;C#9;D9;D#9;E9;F9;F#9;G9";

// metadata
string name="MIDI Transpose";
string description="Transposes MIDI Note events by the selected amount";

array<string> inputParametersNames={"P0","P1","P2","P3","P4","P5"};
array<double> inputParameters(inputParametersNames.length);
array<double> inputParametersMin ={ 0, 0, 0, 0, 0, 0};
array<double> inputParametersMax ={127,100,20,20, 10,10};
array<double> inputParametersDefault={ 36,100, 0, 0, 1, 1};
array<int> inputParametersSteps ={128,100,21,21, 11,41};
array<string> inputParametersUnits ={"$%","%","%","%" };
array<string> inputParametersFormats={ , , , , ,"0.2" } ;
array<string> inputParametersEnums={midiNotes};

Below is my kuiml.
How do I get C#2 to display in the knob instead of 37?

<CELL h_position="10" v_position="10" >
<PARAM_TEXT param_id="custom_param0" content="NOTE" width="100%" cursor="system::hand" font_weight="bold" fit_text="abbreviate"/>
<PNS_SILVER_BLUE_MODERN_KNOB param_id="custom_param0" positions_count="128" image_scaling="0.6"/>
<PARAM_TEXT param_id="custom_param0" content="" v_position="38" width="100%" cursor="system::hand" font_weight= "bold" fit_text="abbreviate" />
<PARAM_TEXT param_id="custom_param0" content="{value}" spacing="50" width="65" value_format="0.0"/>
</CELL>

Post

Try content="{text_value}"

Post

I got it. I needed
array<string> inputParametersEnums={"C-1;C#-1;D;D#-1;E-1;F-1;F#-1;G-1;G#-1;A-1;A#-1;B-1;C0;C#0;D0;D#0;E0;F0;F#0;G0;G#0;A0;A#0;B0;C1;C#1;D1;D#1;E1;F1;F#1;G1;G#1;A1;A#1;B1;C2;C#2;D2;D#2;E2;F2;F#2;G2;G#2;A2;A#2;B2;C3;C#3;D3;D#3;E3;F3;F#3;G3;G#3;A3;A#3;B3;C4;C#4;D4;D#4;E4;F4;F#4;G4;G#4;A4;A#4;B4;C5;C#5;D5;D#5;E5;F5;F#5;G5;G#5;A5;A#5;B5;C6;C#6;D6;D#6;E6;F6;F#6;G6;G#6;A6;A#6;B6;C7;C#7;D7;D#7;E7;F7;F#7;G7;G#7;A7;A#7;B7;C8;C#8;D8;D#8;E8;F8;F#8;G8;G#8;A8;A#8;B8;C9;C#9;D9;D#9;E9;F9;F#9;G9"};

also needed Ilya's suggestion content="{text_value}"

Post Reply

Return to “Blue Cat Audio”