Jump to content

Scripter Test - Need help with error!


anp27

Recommended Posts

Warning: Hanging notes occur when there are more than 5 instances of this.

 

This is a script I put together using bits and pieces from different scripts I found on the forum. Big THANKS to Nevermore2k and Nanook, plus ski, drb, Eric and David for advice. What it does is it displays controller values in automation, probably the closest I'll get to a Cubase feature called 'VST Expression /Expression Maps'. Using this script, I am able to draw in automation values which correspond to different articulations within a given Controller, in the case of the code below, Controller 15. In Garritan's JABB3, Controller 15 is the Trumpet Release controller. Within Controller 15, you can get 3 different articulations, a Falloff (values 33 - 64), a Doit (values 65 - 95) and a Kiss (values 96 - 127).

 

While this Script works the way I want it too, I get an error notification I get when I hit the 'Run Script' button:

 

"Evaluating MIDI-processing script...

Script evaluated successfully!

PluginParameters[0] is missing a unit

>"

 

I couldn't figure out what the PluginParameters was referring to.. maybe someone with more knowledge than I can chime in? Also, if anyone can help clean the code up and make it better, that would be great. I literally just copied and pasted stuff in.

 

 

//************************************************
// example: simple pass through and MIDI monitor
//************************************************

function HandleMIDI(event)
{
event.trace();
event.send();
}

// Global Definition for switching articulations.

var cc = new ControlChange;
cc.number = 15;

// standard Event Handling 
function HandleMIDI(event)
{
   event.trace();
   event.send();
     
  }

// For Switching the Articulation (Expression) Every Name in the Plugin Parameter does have an own number
// the First is 0, Second 1 , Third 2 and so on. 


function parameterSwitch(){
if (expression == 0) {
      cc.value = 0;
  

   }
   
if (expression == 1) {
        cc.value = 33;
     
   }
   
     if (expression == 2) {
      cc.value = 65;
       
   }
   
   if (expression == 3) {
      cc.value = 96;
     
   }   
  
}

//-----------------------------------------
// Define the Names as u Wish. 
var PluginParameters = [{name:"Articulation", type: "menu", defaultValue:0, minValue:0, maxValue:127, numberOfSteps:4, valueStrings:["Off","Falloff","Doit","Kiss", ]}];
                                                                     
var expression = 0;

// Now these happens when i change something
// First i say the Var expression should get the Value of PluginParameters
// then the function parameterSwitch(); should be called. And then send x and y.

function ParameterChanged(param, value) {
   expression = value;
   parameterSwitch();
   cc.send();  

}

 

Here's a screenshot of what the automation looks like:

Scripter.png.eceea66da5972033bbb5f6ac8605f2f2.png

Link to comment
Share on other sites

I have worked with HTML and don't have any real scripting knowledge.

 

I remember a previous post where a scripting error solution was posted.

viewtopic.php?f=45&t=99276&p=519147&hilit=script#p519503

 

I compared Norman's post to your script and noticed there was a difference.

So, In the spirit of ... literally just copying and pasting stuff in,

I pasted a snippet near the end of your script's line 54.

 

, unit:'Menu Item'

 

Updated line 54 now reads:

var PluginParameters = [{name:"Articulation", type: "menu", defaultValue:0, minValue:0, maxValue:127, numberOfSteps:4, valueStrings:["Off","Falloff","Doit","Kiss", ], unit:'Menu Item'}];

I have no idea if it is correct but it seems to remove the error message.

Link to comment
Share on other sites

I compared Norman's post to your script and noticed there was a difference.

So, In the spirit of ... literally just copying and pasting stuff in,I pasted a snippet near the end of your script's line 54.

 

That fixed the problem Mark, thanks! I still have no idea what I just did, but everything is working fine. I really think I should learn how to do this stuff properly.....

Link to comment
Share on other sites

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...