Extra "ports" of juce-based plugins using the distrho build system
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

379 lines
10KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  5. <head>
  6. <title>protoplug: Module polyGen</title>
  7. <link rel="stylesheet" href="../ldoc.css" type="text/css" />
  8. </head>
  9. <body>
  10. <div id="container">
  11. <div id="product">
  12. <div id="product_logo"></div>
  13. <div id="product_name"><big><b></b></big></div>
  14. <div id="product_description"></div>
  15. </div> <!-- id="product" -->
  16. <div id="main">
  17. <!-- Menu -->
  18. <div id="navigation">
  19. <a href="http://osar.fr">
  20. <div class=osarlogo> </div>
  21. </a>
  22. <br/>
  23. <a href="http://osar.fr/protoplug">
  24. <h1>protoplug</h1>
  25. </a>
  26. <span class="proto_subtitle">Lua API reference</span>
  27. <ul>
  28. <li><a href="../index.html">Index</a></li>
  29. </ul>
  30. <h2>Contents</h2>
  31. <ul>
  32. <li><a href="#Functions">Functions</a></li>
  33. <li><a href="#Class_polyGen_VTrack">Class polyGen.VTrack </a></li>
  34. </ul>
  35. <h2>Modules</h2>
  36. <ul class="$(kind=='Topics' and '' or 'nowrap'">
  37. <li><a href="../modules/plugin.html">plugin</a></li>
  38. <li><a href="../modules/script.html">script</a></li>
  39. <li><a href="../modules/midi.html">midi</a></li>
  40. <li><a href="../modules/gui.html">gui</a></li>
  41. <li><strong>polyGen</strong></li>
  42. <li><a href="../modules/stereoFx.html">stereoFx</a></li>
  43. </ul>
  44. <h2>Classes</h2>
  45. <ul class="$(kind=='Topics' and '' or 'nowrap'">
  46. <li><a href="../classes/juce.AffineTransform.html">juce.AffineTransform</a></li>
  47. <li><a href="../classes/juce.AudioFormatReader.html">juce.AudioFormatReader</a></li>
  48. <li><a href="../classes/juce.Colour.html">juce.Colour</a></li>
  49. <li><a href="../classes/juce.ColourGradient.html">juce.ColourGradient</a></li>
  50. <li><a href="../classes/juce.Component.html">juce.Component</a></li>
  51. <li><a href="../classes/juce.FillType.html">juce.FillType</a></li>
  52. <li><a href="../classes/juce.Font.html">juce.Font</a></li>
  53. <li><a href="../classes/juce.Graphics.html">juce.Graphics</a></li>
  54. <li><a href="../classes/juce.Image.html">juce.Image</a></li>
  55. <li><a href="../classes/juce.Justification.html">juce.Justification</a></li>
  56. <li><a href="../classes/juce.LagrangeInterpolator.html">juce.LagrangeInterpolator</a></li>
  57. <li><a href="../classes/juce.Line.html">juce.Line</a></li>
  58. <li><a href="../classes/juce.Path.html">juce.Path</a></li>
  59. <li><a href="../classes/juce.Point.html">juce.Point</a></li>
  60. <li><a href="../classes/juce.RectanglePlacement.html">juce.RectanglePlacement</a></li>
  61. <li><a href="../classes/juce.Rectangle_float.html">juce.Rectangle_float</a></li>
  62. <li><a href="../classes/juce.Rectangle_int.html">juce.Rectangle_int</a></li>
  63. </ul>
  64. <h2>Examples</h2>
  65. <ul class="$(kind=='Topics' and '' or 'nowrap'">
  66. <li><a href="../examples/classic-filter.lua.html">classic-filter.lua</a></li>
  67. <li><a href="../examples/sine-organ.lua.html">sine-organ.lua</a></li>
  68. <li><a href="../examples/midi-chordify.lua.html">midi-chordify.lua</a></li>
  69. <li><a href="../examples/sinemouse-demo.lua.html">sinemouse-demo.lua</a></li>
  70. <li><a href="../examples/soundfile-test.lua.html">soundfile-test.lua</a></li>
  71. </ul>
  72. </div>
  73. <div id="content">
  74. <h1>Module <code>polyGen</code></h1>
  75. <p>Use this module to create a polyphonic generator with virtual tracks.</p>
  76. <p>
  77. <p> Example at <a href="../examples/sine-organ.lua.html#">sine-organ.lua</a>.</p>
  78. <p> This module facilitates the creation of polyphonic instruments. It acts
  79. as a layer that covers the <a href="../modules/plugin.html#processBlock">plugin.processBlock</a> function, receives MIDI
  80. notes and dispatches them to virtual tracks. The <a href="../modules/polyGen.html#polyGen.VTrack">polyGen.VTrack</a> prototype
  81. is exposed for you to define audio processing in a simple,
  82. monophonic, per-note fashion. Initialize this module by calling <a href="../modules/polyGen.html#initTracks">polyGen.initTracks</a> .</p>
  83. <p> The <a href="../modules/polyGen.html#">polyGen</a> global is available to every protoplug script after including the
  84. main protoplug header :</p>
  85. <pre><code>require "include/protoplug"
  86. </code></pre>
  87. </p>
  88. <h2><a href="#Functions">Functions</a></h2>
  89. <table class="function_list">
  90. <tr>
  91. <td class="name" nowrap><a href="#initTracks"><span class="proto_prefix">polyGen</span>.initTracks ([n=8])</a></td>
  92. <td class="summary">Set up virtual tracks.</td>
  93. </tr>
  94. </table>
  95. <h2><a href="#Class_polyGen_VTrack">Class polyGen.VTrack </a></h2>
  96. <table class="function_list">
  97. <tr>
  98. <td class="name" nowrap><a href="#VTrack:addProcessBlock"><span class="proto_prefix">polyGen.VTrack</span>:addProcessBlock (samples, smax)</a></td>
  99. <td class="summary">Override to additively process an audio block.</td>
  100. </tr>
  101. <tr>
  102. <td class="name" nowrap><a href="#VTrack:noteOn"><span class="proto_prefix">polyGen.VTrack</span>:noteOn (note, vel)</a></td>
  103. <td class="summary">Override to recieve note on.</td>
  104. </tr>
  105. <tr>
  106. <td class="name" nowrap><a href="#VTrack:noteOff"><span class="proto_prefix">polyGen.VTrack</span>:noteOff (note)</a></td>
  107. <td class="summary">Override to recieve note off.</td>
  108. </tr>
  109. <tr>
  110. <td class="name" nowrap><a href="#VTrack:init"><span class="proto_prefix">polyGen.VTrack</span>:init ()</a></td>
  111. <td class="summary">Override to allow initialisation.</td>
  112. </tr>
  113. <tr>
  114. <td class="name" nowrap><a href="#VTrack.i"><span class="proto_prefix">polyGen.VTrack</span>.i</a></td>
  115. <td class="summary">Track number.</td>
  116. </tr>
  117. <tr>
  118. <td class="name" nowrap><a href="#VTrack.note"><span class="proto_prefix">polyGen.VTrack</span>.note</a></td>
  119. <td class="summary">Current MIDI note.</td>
  120. </tr>
  121. <tr>
  122. <td class="name" nowrap><a href="#VTrack.noteFreq"><span class="proto_prefix">polyGen.VTrack</span>.noteFreq</a></td>
  123. <td class="summary">Current note frequency.</td>
  124. </tr>
  125. <tr>
  126. <td class="name" nowrap><a href="#VTrack.notePeriod"><span class="proto_prefix">polyGen.VTrack</span>.notePeriod</a></td>
  127. <td class="summary">Current note period.</td>
  128. </tr>
  129. <tr>
  130. <td class="name" nowrap><a href="#VTrack.noteIsOn"><span class="proto_prefix">polyGen.VTrack</span>.noteIsOn</a></td>
  131. <td class="summary">Note is on.</td>
  132. </tr>
  133. </table>
  134. <br/>
  135. <br/>
  136. <h2><a name="Functions"></a>Functions</h2>
  137. <dl class="function">
  138. <dt>
  139. <a name = "initTracks"></a>
  140. <strong><span class="proto_prefix">polyGen</span>.initTracks ([n=8])</strong>
  141. </dt>
  142. <dd>
  143. Set up virtual tracks.
  144. This function must be called by any script that wishes to use this module.
  145. </ul>
  146. <h3>Parameters:</h3>
  147. <ul>
  148. <li><span class="parameter">n</span>
  149. the number of virtual tracks to use (aka. voices or polyphony)
  150. (<em>default</em> 8)
  151. </li>
  152. </ul>
  153. </dd>
  154. </dl>
  155. <h2><a name="Class_polyGen_VTrack"></a>Class polyGen.VTrack </h2>
  156. Virtual track. A monophonic voice that defines the instrument's sound.
  157. <br><br>
  158. <dl class="function">
  159. <dt>
  160. <a name = "VTrack:addProcessBlock"></a>
  161. <strong><span class="proto_prefix">polyGen.VTrack</span>:addProcessBlock (samples, smax)</strong>
  162. </dt>
  163. <dd>
  164. Override to additively process an audio block.
  165. Define the output of a virtual track in this method.
  166. Use <code>self.noteIsOn</code>, <code>self.noteFreq</code>, or any fields you defined to
  167. determine current the state of the calling track.</p>
  168. <p> This method is called successively on every track,
  169. which should <em>add</em> their output to <code>samples</code>.
  170. </ul>
  171. <h3>Parameters:</h3>
  172. <ul>
  173. <li><span class="parameter">samples</span>
  174. a C <code>float**</code> pointing to two channels of samples to add to.
  175. </li>
  176. <li><span class="parameter">smax</span>
  177. the maximum sample index (nSamples - 1)
  178. </li>
  179. </ul>
  180. <h3>See also:</h3>
  181. <ul>
  182. <a href="../examples/sine-organ.lua.html#">sine-organ.lua</a>
  183. </ul>
  184. </dd>
  185. <dt>
  186. <a name = "VTrack:noteOn"></a>
  187. <strong><span class="proto_prefix">polyGen.VTrack</span>:noteOn (note, vel)</strong>
  188. </dt>
  189. <dd>
  190. Override to recieve note on.
  191. Override this method to handle a note getting dispatched to a virtual track.
  192. </ul>
  193. <h3>Parameters:</h3>
  194. <ul>
  195. <li><span class="parameter">note</span>
  196. the MIDI note number (0-127)
  197. </li>
  198. <li><span class="parameter">vel</span>
  199. the MIDI velocity (0-127)
  200. </li>
  201. </ul>
  202. </dd>
  203. <dt>
  204. <a name = "VTrack:noteOff"></a>
  205. <strong><span class="proto_prefix">polyGen.VTrack</span>:noteOff (note)</strong>
  206. </dt>
  207. <dd>
  208. Override to recieve note off.
  209. Override this method to handle a note off on a virtual track.
  210. </ul>
  211. <h3>Parameters:</h3>
  212. <ul>
  213. <li><span class="parameter">note</span>
  214. a reminder of the MIDI note number
  215. </li>
  216. </ul>
  217. </dd>
  218. <dt>
  219. <a name = "VTrack:init"></a>
  220. <strong><span class="proto_prefix">polyGen.VTrack</span>:init ()</strong>
  221. </dt>
  222. <dd>
  223. Override to allow initialisation.
  224. Override this method to perform initialisation tasks on each track,
  225. for example to create any per-track fields.
  226. </ul>
  227. </dd>
  228. <dt>
  229. <a name = "VTrack.i"></a>
  230. <strong><span class="proto_prefix">polyGen.VTrack</span>.i</strong>
  231. </dt>
  232. <dd>
  233. Track number.
  234. Use <code>self.i</code> to check which virtual track is being called.
  235. </ul>
  236. </dd>
  237. <dt>
  238. <a name = "VTrack.note"></a>
  239. <strong><span class="proto_prefix">polyGen.VTrack</span>.note</strong>
  240. </dt>
  241. <dd>
  242. Current MIDI note.
  243. The MIDI note number that is currently being played by this track,
  244. or <code>-1</code> if in note off state.
  245. </ul>
  246. </dd>
  247. <dt>
  248. <a name = "VTrack.noteFreq"></a>
  249. <strong><span class="proto_prefix">polyGen.VTrack</span>.noteFreq</strong>
  250. </dt>
  251. <dd>
  252. Current note frequency.
  253. The note frequency that is currently being played by this track.
  254. </ul>
  255. </dd>
  256. <dt>
  257. <a name = "VTrack.notePeriod"></a>
  258. <strong><span class="proto_prefix">polyGen.VTrack</span>.notePeriod</strong>
  259. </dt>
  260. <dd>
  261. Current note period.
  262. <code>1/noteFreq</code>
  263. </ul>
  264. </dd>
  265. <dt>
  266. <a name = "VTrack.noteIsOn"></a>
  267. <strong><span class="proto_prefix">polyGen.VTrack</span>.noteIsOn</strong>
  268. </dt>
  269. <dd>
  270. Note is on.
  271. Whether the track is playing a note (<code>boolean</code>).
  272. </ul>
  273. </dd>
  274. </dl>
  275. </div> <!-- id="content" -->
  276. </div> <!-- id="main" -->
  277. <div id="about">
  278. <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.2</a></i>
  279. </div> <!-- id="about" -->
  280. </div> <!-- id="container" -->
  281. </body>
  282. </html>