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.

305 lines
9.2KB

  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 script</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="#Predefined_values">Predefined values</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><strong>script</strong></li>
  39. <li><a href="../modules/midi.html">midi</a></li>
  40. <li><a href="../modules/gui.html">gui</a></li>
  41. <li><a href="../modules/polyGen.html">polyGen</a></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>script</code></h1>
  75. <p>Use <a href="../modules/script.html#">script</a> to handle script events, libraries and files.</p>
  76. <p>
  77. <p> The <a href="../modules/script.html#">script</a> global is available to every protoplug script after including the
  78. main protoplug header :</p>
  79. <pre><code>require "include/protoplug"
  80. </code></pre>
  81. </p>
  82. <h2><a href="#Functions">Functions</a></h2>
  83. <table class="function_list">
  84. <tr>
  85. <td class="name" nowrap><a href="#addHandler"><span class="proto_prefix">script</span>.addHandler (event, handler)</a></td>
  86. <td class="summary">Add a handler for a script event.</td>
  87. </tr>
  88. <tr>
  89. <td class="name" nowrap><a href="#saveData"><span class="proto_prefix">script</span>.saveData ()</a></td>
  90. <td class="summary">Save script data.</td>
  91. </tr>
  92. <tr>
  93. <td class="name" nowrap><a href="#loadData"><span class="proto_prefix">script</span>.loadData (data)</a></td>
  94. <td class="summary">Load script data.</td>
  95. </tr>
  96. <tr>
  97. <td class="name" nowrap><a href="#ffiLoad"><span class="proto_prefix">script</span>.ffiLoad (libName[, ...])</a></td>
  98. <td class="summary">Load shared libraries.</td>
  99. </tr>
  100. </table>
  101. <h2><a href="#Predefined_values">Predefined values</a></h2>
  102. <table class="function_list">
  103. <tr>
  104. <td class="name" nowrap><a href="#protoplugDir"><span class="proto_prefix">script</span>.protoplugDir</a></td>
  105. <td class="summary">Current protoplug directory.</td>
  106. </tr>
  107. </table>
  108. <br/>
  109. <br/>
  110. <h2><a name="Functions"></a>Functions</h2>
  111. <dl class="function">
  112. <dt>
  113. <a name = "addHandler"></a>
  114. <strong><span class="proto_prefix">script</span>.addHandler (event, handler)</strong>
  115. </dt>
  116. <dd>
  117. <p>Add a handler for a script event.
  118. The following events are available :</p>
  119. <ul>
  120. <li><code>"init"</code> - Emitted after the script has been compiled and run.</li>
  121. <li><code>"preClose"</code> - Emitted before the script state gets destroyed.</li>
  122. </ul>
  123. </ul>
  124. <h3>Parameters:</h3>
  125. <ul>
  126. <li><span class="parameter">event</span>
  127. <span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
  128. the event to handle
  129. </li>
  130. <li><span class="parameter">handler</span>
  131. <span class="types"><span class="type">function</span></span>
  132. a function to add the event's handlers
  133. </li>
  134. </ul>
  135. <h3>See also:</h3>
  136. <ul>
  137. <li><a href="../modules/plugin.html#addHandler">plugin.addHandler</a></li>
  138. <li><a href="../modules/gui.html#addHandler">gui.addHandler</a></li>
  139. </ul>
  140. </dd>
  141. <dt>
  142. <a name = "saveData"></a>
  143. <strong><span class="proto_prefix">script</span>.saveData ()</strong>
  144. </dt>
  145. <dd>
  146. Save script data.
  147. Override this function to save any custom data.</p>
  148. <p> This gets called :
  149. - when the host saves the plugin's state (eg. when saving a project)
  150. - right before the script is recompiled, to keep custom data across compilations.
  151. </ul>
  152. <h3>Returns:</h3>
  153. <ol>
  154. <span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
  155. the data to be saved
  156. </ol>
  157. </dd>
  158. <dt>
  159. <a name = "loadData"></a>
  160. <strong><span class="proto_prefix">script</span>.loadData (data)</strong>
  161. </dt>
  162. <dd>
  163. Load script data.
  164. Override this function to load any custom data.
  165. Be warned that the data might originate from another script, so it's a good
  166. idea to start the data with a header confirming the format.</p>
  167. <p> This gets called :
  168. - when the host loads the plugin's state (eg. when loading a project)
  169. - right after the script is recompiled, to keep custom data across compilations.
  170. </ul>
  171. <h3>Parameters:</h3>
  172. <ul>
  173. <li><span class="parameter">data</span>
  174. <span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
  175. the data to be loaded
  176. </li>
  177. </ul>
  178. </dd>
  179. <dt>
  180. <a name = "ffiLoad"></a>
  181. <strong><span class="proto_prefix">script</span>.ffiLoad (libName[, ...])</strong>
  182. </dt>
  183. <dd>
  184. Load shared libraries.
  185. Protoplug scripts should use this wrapper function instead of LuaJIT's
  186. <a href="http://luajit.org/ext_ffi_api.html#ffi_load">ffi.load</a>.
  187. It has the same behaviour as <code>ffi.load</code>, but it adds <code>protoplug/lib</code> as a
  188. search path, and can accept multiple arguments to test for different
  189. library names. The names are tested from left to right until one load
  190. successfully. If none of them work, an error is raised.</p>
  191. <pre><code>sdl = script.ffiLoad("sdl")
  192. </code></pre>
  193. <p> This looks for <code>libsdl.so</code> or <code>sdl.dll</code> in protoplug's lib folder and
  194. in the system paths. </p>
  195. <pre><code>fftw = script.ffiLoad("libfftw3.so.3", "libfftw3-3.dll")
  196. </code></pre>
  197. <p> This looks for the supplied names in the same locations as above. This is
  198. necessary for libs like FFTW, that have has platform-dependent names.
  199. </ul>
  200. <h3>Parameters:</h3>
  201. <ul>
  202. <li><span class="parameter">libName</span>
  203. <span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
  204. </li>
  205. <li><span class="parameter">...</span>
  206. <span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
  207. alternate names for the same library
  208. </li>
  209. </ul>
  210. <h3>Returns:</h3>
  211. <ol>
  212. The library's ffi namespace
  213. </ol>
  214. </dd>
  215. </dl>
  216. <h2><a name="Predefined_values"></a>Predefined values</h2>
  217. <dl class="function">
  218. <dt>
  219. <a name = "protoplugDir"></a>
  220. <strong><span class="proto_prefix">script</span>.protoplugDir</strong>
  221. </dt>
  222. <dd>
  223. Current protoplug directory.
  224. The full path of the <code>protoplug</code> directory currently being used. It should
  225. be alongside the protoplug fx and gen dynamic libraries.
  226. </ul>
  227. </dd>
  228. </dl>
  229. </div> <!-- id="content" -->
  230. </div> <!-- id="main" -->
  231. <div id="about">
  232. <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.2</a></i>
  233. </div> <!-- id="about" -->
  234. </div> <!-- id="container" -->
  235. </body>
  236. </html>