--- doc/docbase/instrument_scripts/nksp/01_nksp.html 2020/01/04 18:15:04 3701 +++ doc/docbase/instrument_scripts/nksp/01_nksp.html 2020/01/06 15:55:17 3702 @@ -270,7 +270,7 @@ had in mind when you wrote a certain script three years ago, and also if some other developer might need to continue working on your scripts one day, you should place as many comments into your scripts as possible. A - comment in NKSP is everything that is nested into a an opening and closing + comment in NKSP is everything that is nested into an opening and closing pair of curly braces.

{ This is a comment. } @@ -469,7 +469,7 @@

Let's assume you wanted to write an instrument script that shall resemble - a simple delay effect. You could do that by writing an note event handler + a simple delay effect. You could do that by writing a note event handler that automatically triggers several new notes for each note being triggered on a MIDI keyboard. The following example demonstrates how that could be achieved. @@ -528,7 +528,7 @@ happening when executing that script exactly: Each time you play a note on your keyboard, a new instance of the note event handler will be spawned and executed by the sampler. In all our examples so far - our scripts were so simple, that in practice only one handler instance + our scripts were so simple, that in practice only one event handler instance was executed at a time. This is different in this case though. Because by calling the wait() function, the respective handler execution instance is paused for a while and in total each handler @@ -537,9 +537,9 @@ you play multiple, successive notes on your keyboard in short time, you will have several instances of the note event handler running simultaniously. And that's where the problem starts. Because by default, - as said, all variables are global variables. So the handler instances + as said, all variables are global variables. So the event handler instances which are now running in parallel, are all reading and modifying the same - data. Thus the individual handler instances will modify the + data. Thus the individual event handler instances will modify the $i and $velocity variables of each other, causing an undesired misbehavior.

@@ -1031,7 +1031,7 @@ execution of the script instance by calling exit(). The latter is important in this example, because otherwise the script execution instances would continue to run in this endless loop forever, even after the respectives - notes are gone. Which would let your CPU usage to increase with every new note + notes are gone. Which would let your CPU usage increase with every new note and would never decrease again. This behavior of the sampler is not a bug, it is intended, since there may also be cases where you want to do certain things by script even after the @@ -1190,7 +1190,7 @@

If you are already familiar with some programming languages, then you might already have seen such synchronized code block concepts - in languages like i.e. Java. This technique really provides an easy way + in languages like e.g. Java. This technique really provides an easy way to protect certain sections of your script against concurrency issues.

@@ -1293,7 +1293,7 @@

All these operations yield in a boolean result which could then - be used i.e. with if or while loop statements. + be used e.g. with if or while loop statements.

String Operators

@@ -1381,7 +1381,7 @@ You should only reset a preprocessor condition that way if you did set it with SET_CONDITION(??condition-name??) before. Trying to reset a condition that has not been set before, or trying to reset a - condition that has already been reset, will both be ignored by the samlper, + condition that has already been reset, will both be ignored by the sampler, but again you will get a warning, and you should take care about it.

@@ -1558,8 +1558,8 @@ previous example just to disable messages. There is actually a built-in preprocessor condition dedicated to perform that task much more conveniently for you. To disable all messages in your script, simply add SET_CONDITION(NKSP_NO_MESSAGE) - i.e. at the very beginning of your script. - So the previous example can be simplified like this: + e.g. at the very beginning of your script. + So the previous example can be simplified to this:

{ Enable debug mode, so show all debug messages. }