/[svn]/doc/docbase/instrument_scripts/nksp/reference/functions/nksp_ignore_event_function.html
ViewVC logotype

Diff of /doc/docbase/instrument_scripts/nksp/reference/functions/nksp_ignore_event_function.html

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2882 by schoenebeck, Tue Apr 19 16:14:30 2016 UTC revision 3213 by schoenebeck, Thu May 25 13:25:43 2017 UTC
# Line 14  Line 14 
14        they can cause any sound to be changed.        they can cause any sound to be changed.
15      </p>      </p>
16      <p>      <p>
17          The argument this function takes is optional. If you omit passing an
18          argument to this function, then the event ID will be used that
19          caused this current event handler to be executed
20          (which is <code>$EVENT_ID</code>).
21        </p>
22        <p>
23        Dropping events with this function only succeeds if the event just        Dropping events with this function only succeeds if the event just
24        "recently" occurred. That effectively means you should drop the event in        "recently" occurred. That effectively means you should drop the event in
25        the respective event handler before any <code lang="nksp">wait()</code> calls, and before        the respective event handler before any <code lang="nksp">wait()</code> calls, and before
# Line 34  Line 40 
40      <h3>Function Prototype</h3>      <h3>Function Prototype</h3>
41      <p/>      <p/>
42      <code>      <code>
43  ignore_event(??event-id??)  ignore_event([??event-id??])
44      </code>      </code>
45    
46      <h3>Arguments</h3>      <h3>Arguments</h3>
# Line 45  ignore_event(??event-id??) Line 51  ignore_event(??event-id??)
51        <tr>        <tr>
52          <td><code>??event-id??</code></td>          <td><code>??event-id??</code></td>
53          <td>Event ID Number or Event ID Array</td>          <td>Event ID Number or Event ID Array</td>
54          <td>MIDI event(s) to be dropped.<br>          <td>Event ID(s) of the MIDI event(s) to be dropped.<br>
55              [required]</td>              [optional, default: ID of the event handler's event]</td>
56        </tr>        </tr>
57      </table>      </table>
58            
# Line 54  ignore_event(??event-id??) Line 60  ignore_event(??event-id??)
60      <p>None.</p>      <p>None.</p>
61            
62      <h3>Examples</h3>      <h3>Examples</h3>
63      <p>None yet.<p>      <p>
64          The following example implements a simple split point behavior for your sound.
65          It only plays notes starting at C5, all note-on events below C5 will be dropped.
66        </p>
67        <code>
68    on init
69      { MIDI note number for "C5" }
70      declare const $splitPoint := 60
71    end on
72    
73    on note
74      if ($EVENT_NOTE &lt; $splitPoint)
75        { $EVENT_ID is a built-in variable which always reflects
76          the ID of the event which caused the execution of this
77          specific event handler instance, i.e. here it reflects
78          the respective MIDI note-on event }
79        ignore_event($EVENT_ID)
80      end if
81    end on
82        </code>
83        <p>
84          Since you are almost always passing <code>$EVENT_ID</code> to <code>ignore_event()</code>,
85          you can also omit that optional argument with NKSP. So the following
86          would behave identical with the example above.
87        </p>
88        <code>
89    on init
90      { MIDI note number for "C5" }
91      declare const $splitPoint := 60
92    end on
93    
94    on note
95      if ($EVENT_NOTE &lt; $splitPoint)
96        ignore_event()
97      end if
98    end on
99        </code>
100    
101      <note>      <note>
102        Passing an array of event IDs is only supported by NKSP. If you want        Passing an array of event IDs is only supported by NKSP. If you want
103        to keep compatibility to KSP, then you should only pass a single        to keep compatibility to KSP, then you should only pass a single
104        event ID to this function.        event ID to this function.<br>
105          <br>
106          Same applies to the optional argument: Dynamic, optional arguments are
107          only supported by NKSP. If you want to retain compatibility to KSP,
108          then you should always pass a parameter to this function.
109      </note>      </note>
110    
111    </body>    </body>

Legend:
Removed from v.2882  
changed lines
  Added in v.3213

  ViewVC Help
Powered by ViewVC