cyfaust 0.1.0__cp311-cp311-macosx_15_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (693) hide show
  1. cyfaust/CMakeLists.txt +93 -0
  2. cyfaust/__init__.py +0 -0
  3. cyfaust/__main__.py +819 -0
  4. cyfaust/box.pxd +46 -0
  5. cyfaust/box.pyx +2459 -0
  6. cyfaust/common.pxd +5 -0
  7. cyfaust/common.pyx +61 -0
  8. cyfaust/cyfaust.cpython-311-darwin.so +0 -0
  9. cyfaust/faust_box.pxd +298 -0
  10. cyfaust/faust_box_oo.pyx +66 -0
  11. cyfaust/faust_gui.pxd +261 -0
  12. cyfaust/faust_interp.pxd +160 -0
  13. cyfaust/faust_player.pxd +80 -0
  14. cyfaust/faust_signal.pxd +257 -0
  15. cyfaust/gui_statics.cpp +15 -0
  16. cyfaust/interp.pyx +673 -0
  17. cyfaust/player.cpp +32519 -0
  18. cyfaust/player.pyx +191 -0
  19. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUBase.cpp +2327 -0
  20. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUBase.h +1019 -0
  21. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUDispatch.cpp +423 -0
  22. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUDispatch.h +82 -0
  23. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUInputElement.cpp +151 -0
  24. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUInputElement.h +119 -0
  25. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUOutputElement.cpp +62 -0
  26. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUOutputElement.h +66 -0
  27. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUPlugInDispatch.cpp +615 -0
  28. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUPlugInDispatch.h +128 -0
  29. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUScopeElement.cpp +512 -0
  30. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUScopeElement.h +544 -0
  31. cyfaust/resources/architecture/AU/AUPublic/AUBase/ComponentBase.cpp +370 -0
  32. cyfaust/resources/architecture/AU/AUPublic/AUBase/ComponentBase.h +340 -0
  33. cyfaust/resources/architecture/AU/AUPublic/AUEffectBase/AUEffectBase.cpp +463 -0
  34. cyfaust/resources/architecture/AU/AUPublic/AUEffectBase/AUEffectBase.h +391 -0
  35. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/AUInstrumentBase.cpp +837 -0
  36. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/AUInstrumentBase.h +267 -0
  37. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/AUMIDIBase.cpp +495 -0
  38. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/AUMIDIBase.h +213 -0
  39. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/LockFreeFIFO.h +168 -0
  40. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/MIDIControlHandler.h +92 -0
  41. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/MusicDeviceBase.cpp +354 -0
  42. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/MusicDeviceBase.h +126 -0
  43. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/SynthElement.cpp +419 -0
  44. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/SynthElement.h +227 -0
  45. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/SynthEvent.h +145 -0
  46. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/SynthNote.cpp +138 -0
  47. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/SynthNote.h +186 -0
  48. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/SynthNoteList.cpp +93 -0
  49. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/SynthNoteList.h +232 -0
  50. cyfaust/resources/architecture/AU/AUPublic/Utility/AUBaseHelper.cpp +134 -0
  51. cyfaust/resources/architecture/AU/AUPublic/Utility/AUBaseHelper.h +80 -0
  52. cyfaust/resources/architecture/AU/AUPublic/Utility/AUBuffer.cpp +217 -0
  53. cyfaust/resources/architecture/AU/AUPublic/Utility/AUBuffer.h +267 -0
  54. cyfaust/resources/architecture/AU/AUPublic/Utility/AUMIDIDefs.h +136 -0
  55. cyfaust/resources/architecture/AU/AUPublic/Utility/AUSilentTimeout.h +93 -0
  56. cyfaust/resources/architecture/AU/English.lproj/InfoPlist.strings +0 -0
  57. cyfaust/resources/architecture/AU/FaustAU.exp +2 -0
  58. cyfaust/resources/architecture/AU/FaustAU.xcodeproj/project.pbxproj +968 -0
  59. cyfaust/resources/architecture/AU/FaustAU.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  60. cyfaust/resources/architecture/AU/FaustAUCustomView.plist +14 -0
  61. cyfaust/resources/architecture/AU/Info.plist +47 -0
  62. cyfaust/resources/architecture/AU/PublicUtility/CAAtomic.h +305 -0
  63. cyfaust/resources/architecture/AU/PublicUtility/CAAtomicStack.h +239 -0
  64. cyfaust/resources/architecture/AU/PublicUtility/CAAudioChannelLayout.cpp +153 -0
  65. cyfaust/resources/architecture/AU/PublicUtility/CAAudioChannelLayout.h +199 -0
  66. cyfaust/resources/architecture/AU/PublicUtility/CAAutoDisposer.h +508 -0
  67. cyfaust/resources/architecture/AU/PublicUtility/CABufferList.cpp +264 -0
  68. cyfaust/resources/architecture/AU/PublicUtility/CABufferList.h +319 -0
  69. cyfaust/resources/architecture/AU/PublicUtility/CAByteOrder.h +161 -0
  70. cyfaust/resources/architecture/AU/PublicUtility/CADebugMacros.cpp +88 -0
  71. cyfaust/resources/architecture/AU/PublicUtility/CADebugMacros.h +580 -0
  72. cyfaust/resources/architecture/AU/PublicUtility/CADebugPrintf.cpp +89 -0
  73. cyfaust/resources/architecture/AU/PublicUtility/CADebugPrintf.h +115 -0
  74. cyfaust/resources/architecture/AU/PublicUtility/CADebugger.cpp +77 -0
  75. cyfaust/resources/architecture/AU/PublicUtility/CADebugger.h +56 -0
  76. cyfaust/resources/architecture/AU/PublicUtility/CAException.h +83 -0
  77. cyfaust/resources/architecture/AU/PublicUtility/CAGuard.cpp +339 -0
  78. cyfaust/resources/architecture/AU/PublicUtility/CAGuard.h +133 -0
  79. cyfaust/resources/architecture/AU/PublicUtility/CAHostTimeBase.cpp +110 -0
  80. cyfaust/resources/architecture/AU/PublicUtility/CAHostTimeBase.h +231 -0
  81. cyfaust/resources/architecture/AU/PublicUtility/CALogMacros.h +140 -0
  82. cyfaust/resources/architecture/AU/PublicUtility/CAMath.h +68 -0
  83. cyfaust/resources/architecture/AU/PublicUtility/CAMutex.cpp +345 -0
  84. cyfaust/resources/architecture/AU/PublicUtility/CAMutex.h +163 -0
  85. cyfaust/resources/architecture/AU/PublicUtility/CAReferenceCounted.h +87 -0
  86. cyfaust/resources/architecture/AU/PublicUtility/CAStreamBasicDescription.cpp +795 -0
  87. cyfaust/resources/architecture/AU/PublicUtility/CAStreamBasicDescription.h +409 -0
  88. cyfaust/resources/architecture/AU/PublicUtility/CAThreadSafeList.h +255 -0
  89. cyfaust/resources/architecture/AU/PublicUtility/CAVectorUnit.cpp +191 -0
  90. cyfaust/resources/architecture/AU/PublicUtility/CAVectorUnit.h +100 -0
  91. cyfaust/resources/architecture/AU/PublicUtility/CAVectorUnitTypes.h +59 -0
  92. cyfaust/resources/architecture/AU/PublicUtility/CAXException.cpp +49 -0
  93. cyfaust/resources/architecture/AU/PublicUtility/CAXException.h +338 -0
  94. cyfaust/resources/architecture/AU/SectionPatternLight.tiff +0 -0
  95. cyfaust/resources/architecture/AU/Source/AUSource/FaustAU.h +38 -0
  96. cyfaust/resources/architecture/AU/Source/AUSource/FaustAU.r +153 -0
  97. cyfaust/resources/architecture/AU/Source/AUSource/FaustAUVersion.h +64 -0
  98. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Bargraph.h +18 -0
  99. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Bargraph.m +21 -0
  100. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Button.h +20 -0
  101. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Button.m +56 -0
  102. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_CustomView.h +87 -0
  103. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_CustomView.m +834 -0
  104. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_CustomViewFactory.h +13 -0
  105. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_CustomViewFactory.m +22 -0
  106. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Knob.h +81 -0
  107. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Knob.m +199 -0
  108. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Slider.h +18 -0
  109. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Slider.m +21 -0
  110. cyfaust/resources/architecture/AU/version.plist +16 -0
  111. cyfaust/resources/architecture/VST/Info.plist +28 -0
  112. cyfaust/resources/architecture/VST/PkgInfo +1 -0
  113. cyfaust/resources/architecture/VST/README +11 -0
  114. cyfaust/resources/architecture/VST/VST.xcode/project.pbxproj +655 -0
  115. cyfaust/resources/architecture/alsa-console.cpp +246 -0
  116. cyfaust/resources/architecture/alsa-gtk.cpp +220 -0
  117. cyfaust/resources/architecture/alsa-qt.cpp +229 -0
  118. cyfaust/resources/architecture/api/DspFaust.cpp +612 -0
  119. cyfaust/resources/architecture/api/DspFaust.h +511 -0
  120. cyfaust/resources/architecture/api/README.md +237 -0
  121. cyfaust/resources/architecture/api/doc/Generic.md +38 -0
  122. cyfaust/resources/architecture/au-effect.cpp +487 -0
  123. cyfaust/resources/architecture/au-instrument.cpp +573 -0
  124. cyfaust/resources/architecture/bench.cpp +91 -0
  125. cyfaust/resources/architecture/c-jack-gtk.c +227 -0
  126. cyfaust/resources/architecture/ca-gtk.cpp +284 -0
  127. cyfaust/resources/architecture/ca-qt.cpp +424 -0
  128. cyfaust/resources/architecture/cpal.rs +195 -0
  129. cyfaust/resources/architecture/csound.cpp +245 -0
  130. cyfaust/resources/architecture/csvplot.cpp +227 -0
  131. cyfaust/resources/architecture/daisy/Makefile +14 -0
  132. cyfaust/resources/architecture/daisy/README.md +50 -0
  133. cyfaust/resources/architecture/daisy/ex_faust.cpp +173 -0
  134. cyfaust/resources/architecture/dssi.cpp +1262 -0
  135. cyfaust/resources/architecture/dummy-mem.cpp +186 -0
  136. cyfaust/resources/architecture/dummy.cpp +294 -0
  137. cyfaust/resources/architecture/faust/au/AUUI.h +404 -0
  138. cyfaust/resources/architecture/faust/audio/alsa-dsp.h +693 -0
  139. cyfaust/resources/architecture/faust/audio/android-dsp.h +583 -0
  140. cyfaust/resources/architecture/faust/audio/audio.h +115 -0
  141. cyfaust/resources/architecture/faust/audio/channels.h +122 -0
  142. cyfaust/resources/architecture/faust/audio/coreaudio-dsp.h +1543 -0
  143. cyfaust/resources/architecture/faust/audio/coreaudio-ios-dsp.h +743 -0
  144. cyfaust/resources/architecture/faust/audio/dummy-audio.h +255 -0
  145. cyfaust/resources/architecture/faust/audio/esp32-dsp.h +284 -0
  146. cyfaust/resources/architecture/faust/audio/fpe.h +164 -0
  147. cyfaust/resources/architecture/faust/audio/jack-dsp.h +534 -0
  148. cyfaust/resources/architecture/faust/audio/juce-dsp.h +119 -0
  149. cyfaust/resources/architecture/faust/audio/netjack-dsp.h +354 -0
  150. cyfaust/resources/architecture/faust/audio/oboe-dsp.h +308 -0
  151. cyfaust/resources/architecture/faust/audio/ofaudio-dsp.h +155 -0
  152. cyfaust/resources/architecture/faust/audio/opensles-android-dsp.h +631 -0
  153. cyfaust/resources/architecture/faust/audio/osc-dsp.h +120 -0
  154. cyfaust/resources/architecture/faust/audio/portaudio-dsp.h +236 -0
  155. cyfaust/resources/architecture/faust/audio/rtaudio-dsp.h +241 -0
  156. cyfaust/resources/architecture/faust/audio/samAudio.h +140 -0
  157. cyfaust/resources/architecture/faust/audio/teensy-dsp.h +171 -0
  158. cyfaust/resources/architecture/faust/dsp/cmajor-cpp-dsp.h +253 -0
  159. cyfaust/resources/architecture/faust/dsp/cmajorpatch-dsp.h +483 -0
  160. cyfaust/resources/architecture/faust/dsp/cpp-dsp-adapter.h +38 -0
  161. cyfaust/resources/architecture/faust/dsp/dsp-adapter.h +836 -0
  162. cyfaust/resources/architecture/faust/dsp/dsp-bench.h +611 -0
  163. cyfaust/resources/architecture/faust/dsp/dsp-checker.h +115 -0
  164. cyfaust/resources/architecture/faust/dsp/dsp-combiner.h +810 -0
  165. cyfaust/resources/architecture/faust/dsp/dsp-compute-adapter.h +159 -0
  166. cyfaust/resources/architecture/faust/dsp/dsp-multi.h +702 -0
  167. cyfaust/resources/architecture/faust/dsp/dsp-multifun.h +90 -0
  168. cyfaust/resources/architecture/faust/dsp/dsp-optimizer.h +511 -0
  169. cyfaust/resources/architecture/faust/dsp/dsp-tools.h +229 -0
  170. cyfaust/resources/architecture/faust/dsp/dsp.h +321 -0
  171. cyfaust/resources/architecture/faust/dsp/fastmath.cpp +301 -0
  172. cyfaust/resources/architecture/faust/dsp/faust-dynamic-engine.cpp +494 -0
  173. cyfaust/resources/architecture/faust/dsp/faust-dynamic-engine.h +386 -0
  174. cyfaust/resources/architecture/faust/dsp/faust-engine.h +75 -0
  175. cyfaust/resources/architecture/faust/dsp/faust-poly-engine.h +638 -0
  176. cyfaust/resources/architecture/faust/dsp/interpreter-dsp-c.h +288 -0
  177. cyfaust/resources/architecture/faust/dsp/interpreter-dsp.h +362 -0
  178. cyfaust/resources/architecture/faust/dsp/interpreter-machine-dsp.h +233 -0
  179. cyfaust/resources/architecture/faust/dsp/libfaust-box-c.h +817 -0
  180. cyfaust/resources/architecture/faust/dsp/libfaust-box.h +889 -0
  181. cyfaust/resources/architecture/faust/dsp/libfaust-c.h +116 -0
  182. cyfaust/resources/architecture/faust/dsp/libfaust-signal-c.h +649 -0
  183. cyfaust/resources/architecture/faust/dsp/libfaust-signal.h +731 -0
  184. cyfaust/resources/architecture/faust/dsp/llvm-dsp-adapter.h +160 -0
  185. cyfaust/resources/architecture/faust/dsp/llvm-dsp-c.h +524 -0
  186. cyfaust/resources/architecture/faust/dsp/llvm-dsp.h +575 -0
  187. cyfaust/resources/architecture/faust/dsp/llvm-machine-dsp.h +215 -0
  188. cyfaust/resources/architecture/faust/dsp/one-sample-dsp.h +477 -0
  189. cyfaust/resources/architecture/faust/dsp/poly-dsp.h +1079 -0
  190. cyfaust/resources/architecture/faust/dsp/poly-interpreter-dsp.h +143 -0
  191. cyfaust/resources/architecture/faust/dsp/poly-llvm-dsp.h +249 -0
  192. cyfaust/resources/architecture/faust/dsp/poly-wasm-dsp.h +257 -0
  193. cyfaust/resources/architecture/faust/dsp/proxy-dsp.h +108 -0
  194. cyfaust/resources/architecture/faust/dsp/proxy-osc-dsp.h +109 -0
  195. cyfaust/resources/architecture/faust/dsp/rnbo-dsp.h +187 -0
  196. cyfaust/resources/architecture/faust/dsp/sound-player.h +428 -0
  197. cyfaust/resources/architecture/faust/dsp/timed-dsp.h +279 -0
  198. cyfaust/resources/architecture/faust/dsp/wasm-dsp-imp.h +188 -0
  199. cyfaust/resources/architecture/faust/dsp/wasm-dsp.h +309 -0
  200. cyfaust/resources/architecture/faust/dsp/ysfx-dsp.h +188 -0
  201. cyfaust/resources/architecture/faust/export.h +61 -0
  202. cyfaust/resources/architecture/faust/gui/APIUI.h +726 -0
  203. cyfaust/resources/architecture/faust/gui/BelaOSCUI.h +170 -0
  204. cyfaust/resources/architecture/faust/gui/CGlue.h +667 -0
  205. cyfaust/resources/architecture/faust/gui/CInterface.h +142 -0
  206. cyfaust/resources/architecture/faust/gui/ControlSequenceUI.h +197 -0
  207. cyfaust/resources/architecture/faust/gui/ControlUI.h +137 -0
  208. cyfaust/resources/architecture/faust/gui/DaisyControlUI.h +283 -0
  209. cyfaust/resources/architecture/faust/gui/DaisyPatchInitControlUI.h +254 -0
  210. cyfaust/resources/architecture/faust/gui/DecoratorUI.h +115 -0
  211. cyfaust/resources/architecture/faust/gui/Esp32ControlUI.h +341 -0
  212. cyfaust/resources/architecture/faust/gui/Esp32Reader.h +102 -0
  213. cyfaust/resources/architecture/faust/gui/Esp32SensorUI.h +137 -0
  214. cyfaust/resources/architecture/faust/gui/FUI.h +147 -0
  215. cyfaust/resources/architecture/faust/gui/GTKUI.h +1414 -0
  216. cyfaust/resources/architecture/faust/gui/GUI.h +465 -0
  217. cyfaust/resources/architecture/faust/gui/JSONControl.h +48 -0
  218. cyfaust/resources/architecture/faust/gui/JSONUI.h +722 -0
  219. cyfaust/resources/architecture/faust/gui/JSONUIDecoder.h +589 -0
  220. cyfaust/resources/architecture/faust/gui/JuceGUI.h +2061 -0
  221. cyfaust/resources/architecture/faust/gui/JuceOSCUI.h +163 -0
  222. cyfaust/resources/architecture/faust/gui/JuceParameterUI.h +158 -0
  223. cyfaust/resources/architecture/faust/gui/JuceReader.h +103 -0
  224. cyfaust/resources/architecture/faust/gui/JuceStateUI.h +88 -0
  225. cyfaust/resources/architecture/faust/gui/LayoutUI.h +423 -0
  226. cyfaust/resources/architecture/faust/gui/LibsndfileReader.h +366 -0
  227. cyfaust/resources/architecture/faust/gui/MapUI.h +370 -0
  228. cyfaust/resources/architecture/faust/gui/MemoryReader.h +111 -0
  229. cyfaust/resources/architecture/faust/gui/MetaDataUI.h +357 -0
  230. cyfaust/resources/architecture/faust/gui/MidiUI.h +939 -0
  231. cyfaust/resources/architecture/faust/gui/OCVUI.h +688 -0
  232. cyfaust/resources/architecture/faust/gui/OSCUI.h +219 -0
  233. cyfaust/resources/architecture/faust/gui/PathBuilder.h +228 -0
  234. cyfaust/resources/architecture/faust/gui/PresetUI.h +337 -0
  235. cyfaust/resources/architecture/faust/gui/PrintCUI.h +152 -0
  236. cyfaust/resources/architecture/faust/gui/PrintUI.h +121 -0
  237. cyfaust/resources/architecture/faust/gui/QTUI.h +1891 -0
  238. cyfaust/resources/architecture/faust/gui/RosCI.h +493 -0
  239. cyfaust/resources/architecture/faust/gui/RosUI.h +488 -0
  240. cyfaust/resources/architecture/faust/gui/SaveUI.h +163 -0
  241. cyfaust/resources/architecture/faust/gui/SimpleParser.h +583 -0
  242. cyfaust/resources/architecture/faust/gui/SoundUI.h +217 -0
  243. cyfaust/resources/architecture/faust/gui/Soundfile.h +342 -0
  244. cyfaust/resources/architecture/faust/gui/Styles/Blue.qrc +5 -0
  245. cyfaust/resources/architecture/faust/gui/Styles/Blue.qss +177 -0
  246. cyfaust/resources/architecture/faust/gui/Styles/Default.qrc +5 -0
  247. cyfaust/resources/architecture/faust/gui/Styles/Default.qss +117 -0
  248. cyfaust/resources/architecture/faust/gui/Styles/Grey.qrc +5 -0
  249. cyfaust/resources/architecture/faust/gui/Styles/Grey.qss +174 -0
  250. cyfaust/resources/architecture/faust/gui/Styles/Salmon.qrc +5 -0
  251. cyfaust/resources/architecture/faust/gui/Styles/Salmon.qss +171 -0
  252. cyfaust/resources/architecture/faust/gui/UI.h +87 -0
  253. cyfaust/resources/architecture/faust/gui/ValueConverter.h +543 -0
  254. cyfaust/resources/architecture/faust/gui/WaveReader.h +364 -0
  255. cyfaust/resources/architecture/faust/gui/console.h +322 -0
  256. cyfaust/resources/architecture/faust/gui/httpdUI.h +372 -0
  257. cyfaust/resources/architecture/faust/gui/meta.h +39 -0
  258. cyfaust/resources/architecture/faust/gui/mspUI.h +580 -0
  259. cyfaust/resources/architecture/faust/gui/qrcodegen.h +269 -0
  260. cyfaust/resources/architecture/faust/gui/qrcodegen.impl.h +1025 -0
  261. cyfaust/resources/architecture/faust/gui/ring-buffer.h +414 -0
  262. cyfaust/resources/architecture/faust/midi/RtMidi.cpp +3054 -0
  263. cyfaust/resources/architecture/faust/midi/RtMidi.h +1034 -0
  264. cyfaust/resources/architecture/faust/midi/bela-midi.h +266 -0
  265. cyfaust/resources/architecture/faust/midi/daisy-midi.h +116 -0
  266. cyfaust/resources/architecture/faust/midi/esp32-midi.h +185 -0
  267. cyfaust/resources/architecture/faust/midi/gramophone-midi.h +107 -0
  268. cyfaust/resources/architecture/faust/midi/iplug2-midi.h +148 -0
  269. cyfaust/resources/architecture/faust/midi/jack-midi.h +247 -0
  270. cyfaust/resources/architecture/faust/midi/juce-midi.h +275 -0
  271. cyfaust/resources/architecture/faust/midi/midi.h +475 -0
  272. cyfaust/resources/architecture/faust/midi/rt-midi.h +315 -0
  273. cyfaust/resources/architecture/faust/midi/teensy-midi.h +89 -0
  274. cyfaust/resources/architecture/faust/misc.h +106 -0
  275. cyfaust/resources/architecture/faust/sound-file.h +132 -0
  276. cyfaust/resources/architecture/faust/unity/AudioPluginInterface.h +301 -0
  277. cyfaust/resources/architecture/faust/vst/faust.h +141 -0
  278. cyfaust/resources/architecture/faust/vst/voice.h +43 -0
  279. cyfaust/resources/architecture/faust/vst/vstui.h +524 -0
  280. cyfaust/resources/architecture/faustvst.cpp +3435 -0
  281. cyfaust/resources/architecture/faustvstqt.h +91 -0
  282. cyfaust/resources/architecture/gen-json.cpp +76 -0
  283. cyfaust/resources/architecture/jack-console.cpp +267 -0
  284. cyfaust/resources/architecture/jack-gtk-ros.cpp +139 -0
  285. cyfaust/resources/architecture/jack-gtk.cpp +282 -0
  286. cyfaust/resources/architecture/jack-internal.cpp +560 -0
  287. cyfaust/resources/architecture/jack-qt-chain-footer.cpp +87 -0
  288. cyfaust/resources/architecture/jack-qt-chain-header.cpp +92 -0
  289. cyfaust/resources/architecture/jack-qt.cpp +281 -0
  290. cyfaust/resources/architecture/jack.rs +171 -0
  291. cyfaust/resources/architecture/juce/README.md +84 -0
  292. cyfaust/resources/architecture/juce/juce-plugin.cpp +809 -0
  293. cyfaust/resources/architecture/juce/juce-standalone.cpp +413 -0
  294. cyfaust/resources/architecture/juce/plugin/plugin-llvm.jucer +184 -0
  295. cyfaust/resources/architecture/juce/plugin/plugin.jucer +159 -0
  296. cyfaust/resources/architecture/juce/standalone/standalone-llvm.jucer +216 -0
  297. cyfaust/resources/architecture/juce/standalone/standalone.jucer +191 -0
  298. cyfaust/resources/architecture/ladspa.cpp +543 -0
  299. cyfaust/resources/architecture/latexheader.tex +65 -0
  300. cyfaust/resources/architecture/lv2.cpp +2090 -0
  301. cyfaust/resources/architecture/lv2qtgui.h +62 -0
  302. cyfaust/resources/architecture/lv2ui.cpp +1966 -0
  303. cyfaust/resources/architecture/max-msp/README.md +109 -0
  304. cyfaust/resources/architecture/max-msp/faustgen-wrapper-poly.maxpat +184 -0
  305. cyfaust/resources/architecture/max-msp/faustgen-wrapper.maxpat +163 -0
  306. cyfaust/resources/architecture/max-msp/max-msp.cpp +734 -0
  307. cyfaust/resources/architecture/max-msp/max-msp64.cpp +789 -0
  308. cyfaust/resources/architecture/max-msp/py2max/README.md +277 -0
  309. cyfaust/resources/architecture/max-msp/py2max/py2max/__init__.py +3 -0
  310. cyfaust/resources/architecture/max-msp/py2max/py2max/common.py +7 -0
  311. cyfaust/resources/architecture/max-msp/py2max/py2max/core.py +1387 -0
  312. cyfaust/resources/architecture/max-msp/py2max/py2max/maxclassdb.py +318 -0
  313. cyfaust/resources/architecture/max-msp/py2max/py2max/utils.py +20 -0
  314. cyfaust/resources/architecture/max-msp/rnbo.py +1591 -0
  315. cyfaust/resources/architecture/max-msp/sndfile/sndfile.h +857 -0
  316. cyfaust/resources/architecture/max-msp/ui.js +230 -0
  317. cyfaust/resources/architecture/max-msp/wrapper-poly.maxpat +153 -0
  318. cyfaust/resources/architecture/max-msp/wrapper.maxpat +131 -0
  319. cyfaust/resources/architecture/minimal-bench.cpp +100 -0
  320. cyfaust/resources/architecture/minimal-effect.c +149 -0
  321. cyfaust/resources/architecture/minimal-effect.cpp +70 -0
  322. cyfaust/resources/architecture/minimal-fixed-point.cpp +195 -0
  323. cyfaust/resources/architecture/minimal-static.cpp +160 -0
  324. cyfaust/resources/architecture/minimal.c +103 -0
  325. cyfaust/resources/architecture/minimal.cpp +84 -0
  326. cyfaust/resources/architecture/minimal.rs +223 -0
  327. cyfaust/resources/architecture/module.cpp +91 -0
  328. cyfaust/resources/architecture/octave.cpp +471 -0
  329. cyfaust/resources/architecture/oscio-gtk.cpp +115 -0
  330. cyfaust/resources/architecture/oscio-qt.cpp +121 -0
  331. cyfaust/resources/architecture/owl.cpp +345 -0
  332. cyfaust/resources/architecture/pa-gtk.cpp +119 -0
  333. cyfaust/resources/architecture/pa-qt.cpp +261 -0
  334. cyfaust/resources/architecture/path-printer.cpp +100 -0
  335. cyfaust/resources/architecture/plot.cpp +128 -0
  336. cyfaust/resources/architecture/portaudio.rs +192 -0
  337. cyfaust/resources/architecture/puredata.cpp +636 -0
  338. cyfaust/resources/architecture/ra-qt.cpp +238 -0
  339. cyfaust/resources/architecture/sam/fast_pow2.h +69 -0
  340. cyfaust/resources/architecture/sam/fastexp.h +140 -0
  341. cyfaust/resources/architecture/sam/samFaustDSP.cpp +125 -0
  342. cyfaust/resources/architecture/sam/samFaustDSP.h +107 -0
  343. cyfaust/resources/architecture/scheduler.cpp +1391 -0
  344. cyfaust/resources/architecture/sndfile.cpp +291 -0
  345. cyfaust/resources/architecture/supercollider.cpp +611 -0
  346. cyfaust/resources/architecture/teensy/README.md +13 -0
  347. cyfaust/resources/architecture/teensy/teensy.cpp +214 -0
  348. cyfaust/resources/architecture/teensy/teensy.h +71 -0
  349. cyfaust/resources/architecture/thread.h +373 -0
  350. cyfaust/resources/architecture/vcvrack/README.md +78 -0
  351. cyfaust/resources/architecture/vcvrack/template/.gitignore +6 -0
  352. cyfaust/resources/architecture/vcvrack/template/Makefile +22 -0
  353. cyfaust/resources/architecture/vcvrack/template/res/FaustModule.svg +299 -0
  354. cyfaust/resources/architecture/vcvrack/template/src/FaustModule.cpp +942 -0
  355. cyfaust/resources/architecture/vst.cpp +947 -0
  356. cyfaust/resources/libraries/aanl.lib +900 -0
  357. cyfaust/resources/libraries/all.lib +36 -0
  358. cyfaust/resources/libraries/analyzers.lib +980 -0
  359. cyfaust/resources/libraries/basics.lib +2681 -0
  360. cyfaust/resources/libraries/compressors.lib +1341 -0
  361. cyfaust/resources/libraries/delays.lib +401 -0
  362. cyfaust/resources/libraries/demos.lib +1556 -0
  363. cyfaust/resources/libraries/dx7.lib +1036 -0
  364. cyfaust/resources/libraries/effect.lib +1645 -0
  365. cyfaust/resources/libraries/envelopes.lib +666 -0
  366. cyfaust/resources/libraries/examples/README.md +13 -0
  367. cyfaust/resources/libraries/examples/ambisonics/fourSourcesToOcto.dsp +20 -0
  368. cyfaust/resources/libraries/examples/ambisonics/oneSourceToStereo.dsp +12 -0
  369. cyfaust/resources/libraries/examples/analysis/FFT.dsp +26 -0
  370. cyfaust/resources/libraries/examples/analysis/dbmeter.dsp +19 -0
  371. cyfaust/resources/libraries/examples/analysis/spectralLevel.dsp +8 -0
  372. cyfaust/resources/libraries/examples/analysis/spectralTiltLab.dsp +20 -0
  373. cyfaust/resources/libraries/examples/analysis/vumeter.dsp +18 -0
  374. cyfaust/resources/libraries/examples/autodiff/delay/diff.dsp +2 -0
  375. cyfaust/resources/libraries/examples/autodiff/delay/gt.dsp +2 -0
  376. cyfaust/resources/libraries/examples/autodiff/gain/diff.dsp +7 -0
  377. cyfaust/resources/libraries/examples/autodiff/gain/gt.dsp +1 -0
  378. cyfaust/resources/libraries/examples/autodiff/gain_dc/diff.dsp +7 -0
  379. cyfaust/resources/libraries/examples/autodiff/gain_dc/gt.dsp +4 -0
  380. cyfaust/resources/libraries/examples/autodiff/gain_exp/diff.dsp +9 -0
  381. cyfaust/resources/libraries/examples/autodiff/gain_exp/gt.dsp +1 -0
  382. cyfaust/resources/libraries/examples/autodiff/gain_pow/diff.dsp +9 -0
  383. cyfaust/resources/libraries/examples/autodiff/gain_pow/gt.dsp +1 -0
  384. cyfaust/resources/libraries/examples/autodiff/gain_pow_trig/diff.dsp +12 -0
  385. cyfaust/resources/libraries/examples/autodiff/gain_pow_trig/gt.dsp +1 -0
  386. cyfaust/resources/libraries/examples/autodiff/gain_sq/diff.dsp +7 -0
  387. cyfaust/resources/libraries/examples/autodiff/gain_sq/gt.dsp +1 -0
  388. cyfaust/resources/libraries/examples/autodiff/mem/diff.dsp +1 -0
  389. cyfaust/resources/libraries/examples/autodiff/mem/gt.dsp +1 -0
  390. cyfaust/resources/libraries/examples/autodiff/noise.dsp +2 -0
  391. cyfaust/resources/libraries/examples/autodiff/noop.dsp +2 -0
  392. cyfaust/resources/libraries/examples/autodiff/one_zero/diff.dsp +2 -0
  393. cyfaust/resources/libraries/examples/autodiff/one_zero/gt.dsp +2 -0
  394. cyfaust/resources/libraries/examples/autodiff/ramp.dsp +1 -0
  395. cyfaust/resources/libraries/examples/autodiff/recursion/diff.dsp +2 -0
  396. cyfaust/resources/libraries/examples/autodiff/recursion/gt.dsp +1 -0
  397. cyfaust/resources/libraries/examples/autodiff/recursion/target.dsp +13 -0
  398. cyfaust/resources/libraries/examples/autodiff/tremolo/diff.dsp +14 -0
  399. cyfaust/resources/libraries/examples/autodiff/tremolo/diffable.lib +7 -0
  400. cyfaust/resources/libraries/examples/autodiff/tremolo/gt.dsp +11 -0
  401. cyfaust/resources/libraries/examples/delayEcho/echo.dsp +15 -0
  402. cyfaust/resources/libraries/examples/delayEcho/quadEcho.dsp +21 -0
  403. cyfaust/resources/libraries/examples/delayEcho/smoothDelay.dsp +26 -0
  404. cyfaust/resources/libraries/examples/delayEcho/stereoEcho.dsp +16 -0
  405. cyfaust/resources/libraries/examples/delayEcho/tapiir.dsp +44 -0
  406. cyfaust/resources/libraries/examples/dynamic/compressor.dsp +8 -0
  407. cyfaust/resources/libraries/examples/dynamic/distortion.dsp +8 -0
  408. cyfaust/resources/libraries/examples/dynamic/gateCompressor.dsp +10 -0
  409. cyfaust/resources/libraries/examples/dynamic/noiseGate.dsp +8 -0
  410. cyfaust/resources/libraries/examples/dynamic/volume.dsp +15 -0
  411. cyfaust/resources/libraries/examples/filtering/APF.dsp +13 -0
  412. cyfaust/resources/libraries/examples/filtering/BPF.dsp +13 -0
  413. cyfaust/resources/libraries/examples/filtering/DNN.dsp +25 -0
  414. cyfaust/resources/libraries/examples/filtering/HPF.dsp +13 -0
  415. cyfaust/resources/libraries/examples/filtering/LPF.dsp +13 -0
  416. cyfaust/resources/libraries/examples/filtering/bandFilter.dsp +44 -0
  417. cyfaust/resources/libraries/examples/filtering/cryBaby.dsp +4 -0
  418. cyfaust/resources/libraries/examples/filtering/diodeLadder.dsp +12 -0
  419. cyfaust/resources/libraries/examples/filtering/filterBank.dsp +6 -0
  420. cyfaust/resources/libraries/examples/filtering/graphicEqLab.dsp +10 -0
  421. cyfaust/resources/libraries/examples/filtering/highShelf.dsp +13 -0
  422. cyfaust/resources/libraries/examples/filtering/korg35HPF.dsp +13 -0
  423. cyfaust/resources/libraries/examples/filtering/korg35LPF.dsp +13 -0
  424. cyfaust/resources/libraries/examples/filtering/lfBoost.dsp +40 -0
  425. cyfaust/resources/libraries/examples/filtering/lowBoost.dsp +40 -0
  426. cyfaust/resources/libraries/examples/filtering/lowCut.dsp +40 -0
  427. cyfaust/resources/libraries/examples/filtering/lowShelf.dsp +13 -0
  428. cyfaust/resources/libraries/examples/filtering/moogHalfLadder.dsp +12 -0
  429. cyfaust/resources/libraries/examples/filtering/moogLadder.dsp +12 -0
  430. cyfaust/resources/libraries/examples/filtering/moogVCF.dsp +6 -0
  431. cyfaust/resources/libraries/examples/filtering/multibandFilter.dsp +14 -0
  432. cyfaust/resources/libraries/examples/filtering/notch.dsp +13 -0
  433. cyfaust/resources/libraries/examples/filtering/oberheim.dsp +14 -0
  434. cyfaust/resources/libraries/examples/filtering/oberheimBPF.dsp +13 -0
  435. cyfaust/resources/libraries/examples/filtering/oberheimBSF.dsp +13 -0
  436. cyfaust/resources/libraries/examples/filtering/oberheimHPF.dsp +13 -0
  437. cyfaust/resources/libraries/examples/filtering/oberheimLPF.dsp +13 -0
  438. cyfaust/resources/libraries/examples/filtering/parametricEqLab.dsp +10 -0
  439. cyfaust/resources/libraries/examples/filtering/parametricEqualizer.dsp +6 -0
  440. cyfaust/resources/libraries/examples/filtering/peakNotch.dsp +13 -0
  441. cyfaust/resources/libraries/examples/filtering/peakingEQ.dsp +13 -0
  442. cyfaust/resources/libraries/examples/filtering/sallenKey2ndOrder.dsp +14 -0
  443. cyfaust/resources/libraries/examples/filtering/sallenKey2ndOrderBPF.dsp +13 -0
  444. cyfaust/resources/libraries/examples/filtering/sallenKey2ndOrderHPF.dsp +13 -0
  445. cyfaust/resources/libraries/examples/filtering/sallenKey2ndOrderLPF.dsp +13 -0
  446. cyfaust/resources/libraries/examples/filtering/sallenKeyOnePole.dsp +13 -0
  447. cyfaust/resources/libraries/examples/filtering/sallenKeyOnePoleHPF.dsp +12 -0
  448. cyfaust/resources/libraries/examples/filtering/sallenKeyOnePoleLPF.dsp +12 -0
  449. cyfaust/resources/libraries/examples/filtering/spectralTilt.dsp +8 -0
  450. cyfaust/resources/libraries/examples/filtering/vcfWahLab.dsp +12 -0
  451. cyfaust/resources/libraries/examples/filtering/vocoder.dsp +8 -0
  452. cyfaust/resources/libraries/examples/filtering/wahPedal.dsp +6 -0
  453. cyfaust/resources/libraries/examples/gameaudio/bubble.dsp +42 -0
  454. cyfaust/resources/libraries/examples/gameaudio/door.dsp +58 -0
  455. cyfaust/resources/libraries/examples/gameaudio/fire.dsp +46 -0
  456. cyfaust/resources/libraries/examples/gameaudio/insects.dsp +148 -0
  457. cyfaust/resources/libraries/examples/gameaudio/rain.dsp +27 -0
  458. cyfaust/resources/libraries/examples/gameaudio/wind.dsp +23 -0
  459. cyfaust/resources/libraries/examples/generator/filterOsc.dsp +8 -0
  460. cyfaust/resources/libraries/examples/generator/noise.dsp +52 -0
  461. cyfaust/resources/libraries/examples/generator/noiseMetadata.dsp +74 -0
  462. cyfaust/resources/libraries/examples/generator/osc.dsp +17 -0
  463. cyfaust/resources/libraries/examples/generator/osci.dsp +17 -0
  464. cyfaust/resources/libraries/examples/generator/sawtoothLab.dsp +8 -0
  465. cyfaust/resources/libraries/examples/generator/virtualAnalog.dsp +8 -0
  466. cyfaust/resources/libraries/examples/generator/virtualAnalogLab.dsp +10 -0
  467. cyfaust/resources/libraries/examples/misc/UITester.dsp +71 -0
  468. cyfaust/resources/libraries/examples/misc/autopan.dsp +59 -0
  469. cyfaust/resources/libraries/examples/misc/capture.dsp +24 -0
  470. cyfaust/resources/libraries/examples/misc/drumkit.dsp +36 -0
  471. cyfaust/resources/libraries/examples/misc/guitarix.dsp +184 -0
  472. cyfaust/resources/libraries/examples/misc/matrix.dsp +17 -0
  473. cyfaust/resources/libraries/examples/misc/midiTester.dsp +122 -0
  474. cyfaust/resources/libraries/examples/misc/mixer.dsp +27 -0
  475. cyfaust/resources/libraries/examples/misc/statespace.dsp +39 -0
  476. cyfaust/resources/libraries/examples/misc/switcher.dsp +20 -0
  477. cyfaust/resources/libraries/examples/misc/tester.dsp +32 -0
  478. cyfaust/resources/libraries/examples/misc/tester2.dsp +31 -0
  479. cyfaust/resources/libraries/examples/old/README.md +5 -0
  480. cyfaust/resources/libraries/examples/old/freeverb.dsp +109 -0
  481. cyfaust/resources/libraries/examples/old/rewriting/Makefile +21 -0
  482. cyfaust/resources/libraries/examples/old/rewriting/fact.dsp +3 -0
  483. cyfaust/resources/libraries/examples/old/rewriting/fold.dsp +61 -0
  484. cyfaust/resources/libraries/examples/old/rewriting/mesh.dsp +43 -0
  485. cyfaust/resources/libraries/examples/old/rewriting/mesh.pd +37 -0
  486. cyfaust/resources/libraries/examples/old/rewriting/sample.pd +12 -0
  487. cyfaust/resources/libraries/examples/old/rewriting/serial.dsp +7 -0
  488. cyfaust/resources/libraries/examples/old/rewriting/sum.dsp +55 -0
  489. cyfaust/resources/libraries/examples/old/rewriting/test.pd +48 -0
  490. cyfaust/resources/libraries/examples/phasing/flanger.dsp +8 -0
  491. cyfaust/resources/libraries/examples/phasing/phaser.dsp +8 -0
  492. cyfaust/resources/libraries/examples/phasing/phaserFlangerLab.dsp +12 -0
  493. cyfaust/resources/libraries/examples/physicalModeling/brass.dsp +8 -0
  494. cyfaust/resources/libraries/examples/physicalModeling/brassMIDI.dsp +8 -0
  495. cyfaust/resources/libraries/examples/physicalModeling/churchBell.dsp +8 -0
  496. cyfaust/resources/libraries/examples/physicalModeling/clarinet.dsp +8 -0
  497. cyfaust/resources/libraries/examples/physicalModeling/clarinetMIDI.dsp +8 -0
  498. cyfaust/resources/libraries/examples/physicalModeling/djembeMIDI.dsp +8 -0
  499. cyfaust/resources/libraries/examples/physicalModeling/elecGuitarMIDI.dsp +10 -0
  500. cyfaust/resources/libraries/examples/physicalModeling/englishBell.dsp +8 -0
  501. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/NLFeks.dsp +91 -0
  502. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/NLFfm.dsp +70 -0
  503. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/README +125 -0
  504. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/bass.dsp +84 -0
  505. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/bass.h +91 -0
  506. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/blowBottle.dsp +102 -0
  507. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/bowed.dsp +114 -0
  508. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/brass.dsp +103 -0
  509. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/clarinet.dsp +110 -0
  510. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/flute.dsp +116 -0
  511. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/fluteStk.dsp +121 -0
  512. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/glassHarmonica.dsp +131 -0
  513. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/harpsi.dsp +90 -0
  514. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/harpsichord.h +185 -0
  515. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/instrument.h +114 -0
  516. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/modalBar.dsp +122 -0
  517. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/modalBar.h +48 -0
  518. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/audio-out.pd +33 -0
  519. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/bottle.pd +10 -0
  520. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/clarinets.pd +15 -0
  521. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/canon/audio-out.pd +33 -0
  522. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/canon/bass.pd +162 -0
  523. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/canon/canon.pd +55 -0
  524. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/canon/flute.pd +343 -0
  525. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/canon/pachelbel.mid +0 -0
  526. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/daisy/audio-out.pd +33 -0
  527. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/daisy/daisy.mid +0 -0
  528. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/daisy/daisy.pd +45 -0
  529. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/daisy/piano.pd +205 -0
  530. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/daisy/voiceForm.pd +340 -0
  531. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/take5/audio-out.pd +33 -0
  532. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/take5/blowHole.pd +330 -0
  533. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/take5/piano.pd +205 -0
  534. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/take5/take5.mid +0 -0
  535. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/take5/take5.pd +45 -0
  536. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/turkish-march/audio-out.pd +33 -0
  537. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/turkish-march/harpsi.pd +204 -0
  538. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/turkish-march/turkish-march.mid +0 -0
  539. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/turkish-march/turkish-march.pd +31 -0
  540. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/what-a-friend/audio-out.pd +33 -0
  541. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/what-a-friend/bass.pd +162 -0
  542. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/what-a-friend/modalBar.pd +258 -0
  543. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/what-a-friend/piano.pd +205 -0
  544. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/what-a-friend/what-a-friend.pd +52 -0
  545. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/what-a-friend/what_a_friend.mid +0 -0
  546. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/flutes.pd +15 -0
  547. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fm.pd +10 -0
  548. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/glassBare.pd +10 -0
  549. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/harpsichord-poly.pd +10 -0
  550. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/ironBare.pd +10 -0
  551. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/midi-in.pd +111 -0
  552. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/modal.pd +10 -0
  553. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/osc.pd +26 -0
  554. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/piano-poly.pd +10 -0
  555. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/plucked.pd +20 -0
  556. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/saxophone.pd +10 -0
  557. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/tibetan.pd +10 -0
  558. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/trumpet.pd +10 -0
  559. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/violin.pd +10 -0
  560. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/voiceSynth.pd +10 -0
  561. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/woodenBare.pd +10 -0
  562. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/phonemes.h +189 -0
  563. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/piano.dsp +255 -0
  564. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/piano.h +751 -0
  565. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/saxophony.dsp +114 -0
  566. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/sitar.dsp +48 -0
  567. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/tibetanBowl.dsp +155 -0
  568. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/tunedBar.dsp +123 -0
  569. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/uniBar.dsp +100 -0
  570. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/voiceForm.dsp +125 -0
  571. cyfaust/resources/libraries/examples/physicalModeling/fds/1dDampedWaveEquation.dsp +43 -0
  572. cyfaust/resources/libraries/examples/physicalModeling/fds/2dKirchhoffThinPlate.dsp +75 -0
  573. cyfaust/resources/libraries/examples/physicalModeling/fds/BowedString.dsp +61 -0
  574. cyfaust/resources/libraries/examples/physicalModeling/fds/ControllableNonPhysicalString.dsp +72 -0
  575. cyfaust/resources/libraries/examples/physicalModeling/fds/HammeredString.dsp +74 -0
  576. cyfaust/resources/libraries/examples/physicalModeling/fds/PianoHammeredString.dsp +85 -0
  577. cyfaust/resources/libraries/examples/physicalModeling/fds/StiffString.dsp +54 -0
  578. cyfaust/resources/libraries/examples/physicalModeling/flute.dsp +8 -0
  579. cyfaust/resources/libraries/examples/physicalModeling/fluteMIDI.dsp +8 -0
  580. cyfaust/resources/libraries/examples/physicalModeling/frenchBell.dsp +8 -0
  581. cyfaust/resources/libraries/examples/physicalModeling/germanBell.dsp +8 -0
  582. cyfaust/resources/libraries/examples/physicalModeling/guitarMIDI.dsp +8 -0
  583. cyfaust/resources/libraries/examples/physicalModeling/karplus.dsp +8 -0
  584. cyfaust/resources/libraries/examples/physicalModeling/marimbaMIDI.dsp +10 -0
  585. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/00_BasicOscillator/harmonicOscillator.dsp +58 -0
  586. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/00_BasicOscillator/harmonicOscillator2.dsp +62 -0
  587. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/00_BasicOscillator/harmonicOscillator3.dsp +65 -0
  588. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/01_ParamControl/paramOsc.dsp +63 -0
  589. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/02_AudioParamControl/audioParamOsc.dsp +63 -0
  590. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/03_HammerTime/hammerOsc.dsp +71 -0
  591. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/04_Gravity/bouncingOsc.dsp +64 -0
  592. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/05_PluckedOscillator/pluckedOsc.dsp +57 -0
  593. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/06_BowedOscillator/bowedOsc.dsp +65 -0
  594. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/07_NonLinearOscillator/nlOsc.dsp +78 -0
  595. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/08_TwoMassChain/2massChain.dsp +75 -0
  596. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/09_TinyString/tinyString.dsp +101 -0
  597. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/10_PluckedString/pluckedString.dsp +678 -0
  598. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/11_BowedString/bowedString.dsp +671 -0
  599. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/12_TriangleMesh/triangleMesh.dsp +448 -0
  600. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/13_Construction/construction.dsp +1036 -0
  601. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/14_Polyphonic/polyTriangle.dsp +79 -0
  602. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/15_PhysicalLFO/physicalLFO.dsp +107 -0
  603. cyfaust/resources/libraries/examples/physicalModeling/modularInterpInstrMIDI.dsp +8 -0
  604. cyfaust/resources/libraries/examples/physicalModeling/nylonGuitarMIDI.dsp +8 -0
  605. cyfaust/resources/libraries/examples/physicalModeling/old/harpe.dsp +45 -0
  606. cyfaust/resources/libraries/examples/physicalModeling/old/karplus.dsp +34 -0
  607. cyfaust/resources/libraries/examples/physicalModeling/old/karplus32.dsp +47 -0
  608. cyfaust/resources/libraries/examples/physicalModeling/russianBell.dsp +8 -0
  609. cyfaust/resources/libraries/examples/physicalModeling/standardBell.dsp +8 -0
  610. cyfaust/resources/libraries/examples/physicalModeling/violin.dsp +8 -0
  611. cyfaust/resources/libraries/examples/physicalModeling/violinMIDI.dsp +8 -0
  612. cyfaust/resources/libraries/examples/physicalModeling/vocalBP.dsp +8 -0
  613. cyfaust/resources/libraries/examples/physicalModeling/vocalBPMIDI.dsp +8 -0
  614. cyfaust/resources/libraries/examples/physicalModeling/vocalFOF.dsp +8 -0
  615. cyfaust/resources/libraries/examples/physicalModeling/vocalFOFMIDI.dsp +8 -0
  616. cyfaust/resources/libraries/examples/pitchShifting/pitchShifter.dsp +20 -0
  617. cyfaust/resources/libraries/examples/psychoacoustic/harmonicExciter.dsp +10 -0
  618. cyfaust/resources/libraries/examples/quantizing/quantizedChords.dsp +49 -0
  619. cyfaust/resources/libraries/examples/reverb/dattorro.dsp +8 -0
  620. cyfaust/resources/libraries/examples/reverb/fdnRev.dsp +8 -0
  621. cyfaust/resources/libraries/examples/reverb/freeverb.dsp +8 -0
  622. cyfaust/resources/libraries/examples/reverb/greyhole.dsp +8 -0
  623. cyfaust/resources/libraries/examples/reverb/jprev.dsp +8 -0
  624. cyfaust/resources/libraries/examples/reverb/reverbDesigner.dsp +12 -0
  625. cyfaust/resources/libraries/examples/reverb/reverbTester.dsp +8 -0
  626. cyfaust/resources/libraries/examples/reverb/zitaRev.dsp +8 -0
  627. cyfaust/resources/libraries/examples/reverb/zitaRevFDN.dsp +8 -0
  628. cyfaust/resources/libraries/examples/smartKeyboard/acGuitar.dsp +100 -0
  629. cyfaust/resources/libraries/examples/smartKeyboard/associatedEffects/elecGuitarEffect.dsp +8 -0
  630. cyfaust/resources/libraries/examples/smartKeyboard/associatedEffects/myEffect.dsp +5 -0
  631. cyfaust/resources/libraries/examples/smartKeyboard/associatedEffects/reverb.dsp +5 -0
  632. cyfaust/resources/libraries/examples/smartKeyboard/bells.dsp +80 -0
  633. cyfaust/resources/libraries/examples/smartKeyboard/bowed.dsp +87 -0
  634. cyfaust/resources/libraries/examples/smartKeyboard/brass.dsp +82 -0
  635. cyfaust/resources/libraries/examples/smartKeyboard/clarinet.dsp +113 -0
  636. cyfaust/resources/libraries/examples/smartKeyboard/crazyGuiro.dsp +96 -0
  637. cyfaust/resources/libraries/examples/smartKeyboard/drums.dsp +74 -0
  638. cyfaust/resources/libraries/examples/smartKeyboard/dubDub.dsp +87 -0
  639. cyfaust/resources/libraries/examples/smartKeyboard/elecGuitar.dsp +67 -0
  640. cyfaust/resources/libraries/examples/smartKeyboard/fm.dsp +78 -0
  641. cyfaust/resources/libraries/examples/smartKeyboard/frog.dsp +74 -0
  642. cyfaust/resources/libraries/examples/smartKeyboard/harp.dsp +84 -0
  643. cyfaust/resources/libraries/examples/smartKeyboard/midiOnly.dsp +62 -0
  644. cyfaust/resources/libraries/examples/smartKeyboard/multiSynth.dsp +75 -0
  645. cyfaust/resources/libraries/examples/smartKeyboard/toy.dsp +71 -0
  646. cyfaust/resources/libraries/examples/smartKeyboard/trumpet.dsp +59 -0
  647. cyfaust/resources/libraries/examples/smartKeyboard/turenas.dsp +114 -0
  648. cyfaust/resources/libraries/examples/smartKeyboard/violin.dsp +91 -0
  649. cyfaust/resources/libraries/examples/smartKeyboard/violin2.dsp +84 -0
  650. cyfaust/resources/libraries/examples/smartKeyboard/vocal.dsp +43 -0
  651. cyfaust/resources/libraries/examples/spat/panpot.dsp +17 -0
  652. cyfaust/resources/libraries/examples/spat/spat.dsp +25 -0
  653. cyfaust/resources/libraries/fds.lib +535 -0
  654. cyfaust/resources/libraries/filter.lib +1710 -0
  655. cyfaust/resources/libraries/filters.lib +3125 -0
  656. cyfaust/resources/libraries/hoa.lib +1081 -0
  657. cyfaust/resources/libraries/instruments.lib +263 -0
  658. cyfaust/resources/libraries/interpolators.lib +675 -0
  659. cyfaust/resources/libraries/math.lib +602 -0
  660. cyfaust/resources/libraries/maths.lib +798 -0
  661. cyfaust/resources/libraries/maxmsp.lib +237 -0
  662. cyfaust/resources/libraries/mi.lib +528 -0
  663. cyfaust/resources/libraries/misceffects.lib +998 -0
  664. cyfaust/resources/libraries/music.lib +496 -0
  665. cyfaust/resources/libraries/noises.lib +487 -0
  666. cyfaust/resources/libraries/oscillator.lib +450 -0
  667. cyfaust/resources/libraries/oscillators.lib +1838 -0
  668. cyfaust/resources/libraries/phaflangers.lib +235 -0
  669. cyfaust/resources/libraries/physmodels.lib +3990 -0
  670. cyfaust/resources/libraries/platform.lib +59 -0
  671. cyfaust/resources/libraries/quantizers.lib +310 -0
  672. cyfaust/resources/libraries/reducemaps.lib +235 -0
  673. cyfaust/resources/libraries/reverbs.lib +686 -0
  674. cyfaust/resources/libraries/routes.lib +262 -0
  675. cyfaust/resources/libraries/sf.lib +53 -0
  676. cyfaust/resources/libraries/signals.lib +570 -0
  677. cyfaust/resources/libraries/soundfiles.lib +234 -0
  678. cyfaust/resources/libraries/spats.lib +173 -0
  679. cyfaust/resources/libraries/stdfaust.lib +38 -0
  680. cyfaust/resources/libraries/synths.lib +322 -0
  681. cyfaust/resources/libraries/tonestacks.lib +427 -0
  682. cyfaust/resources/libraries/tubes.lib +5039 -0
  683. cyfaust/resources/libraries/vaeffects.lib +984 -0
  684. cyfaust/resources/libraries/version.lib +22 -0
  685. cyfaust/resources/libraries/wdmodels.lib +2276 -0
  686. cyfaust/resources/libraries/webaudio.lib +402 -0
  687. cyfaust/signal.pxd +44 -0
  688. cyfaust/signal.pyx +1993 -0
  689. cyfaust-0.1.0.dist-info/METADATA +355 -0
  690. cyfaust-0.1.0.dist-info/RECORD +693 -0
  691. cyfaust-0.1.0.dist-info/WHEEL +5 -0
  692. cyfaust-0.1.0.dist-info/entry_points.txt +3 -0
  693. cyfaust-0.1.0.dist-info/licenses/LICENSE +26 -0
@@ -0,0 +1,1966 @@
1
+ /************************************************************************
2
+ ************************************************************************
3
+ FAUST Architecture File
4
+ Copyright (C) 2009-2016 Albert Graef <aggraef@gmail.com>
5
+ ---------------------------------------------------------------------
6
+ This program is free software; you can redistribute it and/or modify
7
+ it under the terms of the GNU Lesser General Public License as
8
+ published by the Free Software Foundation; either version 3 of the
9
+ License, or (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU Lesser General Public License for more details.
15
+
16
+ You should have received a copy of the GNU Lesser General Public
17
+ License along with the GNU C Library; if not, write to the Free
18
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19
+ 02111-1307 USA.
20
+ ************************************************************************
21
+ ************************************************************************/
22
+
23
+ /* LV2 UI architecture for Faust synths. */
24
+
25
+ #include <stdlib.h>
26
+ #include <string.h>
27
+ #include <math.h>
28
+ #include <unistd.h>
29
+ #include <list>
30
+ #include <map>
31
+ #include <set>
32
+
33
+ // generic Faust dsp and UI classes
34
+ #include <faust/dsp/dsp.h>
35
+ #include <faust/gui/UI.h>
36
+
37
+ using namespace std;
38
+
39
+ typedef pair<const char*,const char*> strpair;
40
+
41
+ struct Meta : std::map<const char*, const char*>
42
+ {
43
+ void declare(const char *key, const char *value)
44
+ {
45
+ (*this)[key] = value;
46
+ }
47
+ const char* get(const char *key, const char *def)
48
+ {
49
+ if (this->find(key) != this->end())
50
+ return (*this)[key];
51
+ else
52
+ return def;
53
+ }
54
+ };
55
+
56
+ /******************************************************************************
57
+ *******************************************************************************
58
+
59
+ VECTOR INTRINSICS
60
+
61
+ *******************************************************************************
62
+ *******************************************************************************/
63
+
64
+ <<includeIntrinsic>>
65
+
66
+ /***************************************************************************
67
+ LV2 UI interface
68
+ ***************************************************************************/
69
+
70
+ enum ui_elem_type_t {
71
+ UI_BUTTON, UI_CHECK_BUTTON,
72
+ UI_V_SLIDER, UI_H_SLIDER, UI_NUM_ENTRY,
73
+ UI_V_BARGRAPH, UI_H_BARGRAPH,
74
+ UI_END_GROUP, UI_V_GROUP, UI_H_GROUP, UI_T_GROUP
75
+ };
76
+
77
+ struct ui_elem_t {
78
+ ui_elem_type_t type;
79
+ const char *label;
80
+ int port;
81
+ float *zone;
82
+ void *ref;
83
+ float init, min, max, step;
84
+ };
85
+
86
+ class LV2UI : public UI
87
+ {
88
+ public:
89
+ bool is_instr;
90
+ int nelems, nports;
91
+ ui_elem_t *elems;
92
+ map< int, list<strpair> > metadata;
93
+
94
+ LV2UI(int maxvoices = 0);
95
+ virtual ~LV2UI();
96
+
97
+ protected:
98
+ void add_elem(ui_elem_type_t type, const char *label = NULL);
99
+ void add_elem(ui_elem_type_t type, const char *label, float *zone);
100
+ void add_elem(ui_elem_type_t type, const char *label, float *zone,
101
+ float init, float min, float max, float step);
102
+ void add_elem(ui_elem_type_t type, const char *label, float *zone,
103
+ float min, float max);
104
+
105
+ bool have_freq, have_gain, have_gate;
106
+ bool is_voice_ctrl(const char *label);
107
+
108
+ public:
109
+ virtual void addButton(const char* label, float* zone);
110
+ virtual void addCheckButton(const char* label, float* zone);
111
+ virtual void addVerticalSlider(const char* label, float* zone, float init, float min, float max, float step);
112
+ virtual void addHorizontalSlider(const char* label, float* zone, float init, float min, float max, float step);
113
+ virtual void addNumEntry(const char* label, float* zone, float init, float min, float max, float step);
114
+
115
+ virtual void addSoundfile(const char* label, const char* filename, Soundfile** sf_zone) {}
116
+
117
+ virtual void addHorizontalBargraph(const char* label, float* zone, float min, float max);
118
+ virtual void addVerticalBargraph(const char* label, float* zone, float min, float max);
119
+
120
+ virtual void openTabBox(const char* label);
121
+ virtual void openHorizontalBox(const char* label);
122
+ virtual void openVerticalBox(const char* label);
123
+ virtual void closeBox();
124
+
125
+ virtual void run();
126
+
127
+ virtual void declare(float* zone, const char* key, const char* value);
128
+
129
+ };
130
+
131
+ LV2UI::LV2UI(int maxvoices)
132
+ {
133
+ is_instr = maxvoices>0;
134
+ have_freq = have_gain = have_gate = false;
135
+ nelems = nports = 0;
136
+ elems = NULL;
137
+ }
138
+
139
+ LV2UI::~LV2UI()
140
+ {
141
+ if (elems) free(elems);
142
+ }
143
+
144
+ void LV2UI::declare(float* zone, const char* key, const char* value)
145
+ {
146
+ map< int, list<strpair> >::iterator it = metadata.find(nelems);
147
+ if (it != metadata.end())
148
+ it->second.push_back(strpair(key, value));
149
+ else
150
+ metadata[nelems] = list<strpair>(1, strpair(key, value));
151
+ }
152
+
153
+ inline void LV2UI::add_elem(ui_elem_type_t type, const char *label)
154
+ {
155
+ ui_elem_t *elems1 = (ui_elem_t*)realloc(elems, (nelems+1)*sizeof(ui_elem_t));
156
+ if (elems1)
157
+ elems = elems1;
158
+ else
159
+ return;
160
+ elems[nelems].type = type;
161
+ elems[nelems].label = label;
162
+ elems[nelems].port = -1;
163
+ elems[nelems].zone = NULL;
164
+ elems[nelems].ref = NULL;
165
+ elems[nelems].init = 0.0;
166
+ elems[nelems].min = 0.0;
167
+ elems[nelems].max = 0.0;
168
+ elems[nelems].step = 0.0;
169
+ nelems++;
170
+ }
171
+
172
+ #define portno(label) (is_voice_ctrl(label)?-1:nports++)
173
+
174
+ inline void LV2UI::add_elem(ui_elem_type_t type, const char *label, float *zone)
175
+ {
176
+ ui_elem_t *elems1 = (ui_elem_t*)realloc(elems, (nelems+1)*sizeof(ui_elem_t));
177
+ if (elems1)
178
+ elems = elems1;
179
+ else
180
+ return;
181
+ elems[nelems].type = type;
182
+ elems[nelems].label = label;
183
+ elems[nelems].port = portno(label);
184
+ elems[nelems].zone = zone;
185
+ elems[nelems].ref = NULL;
186
+ elems[nelems].init = 0.0;
187
+ elems[nelems].min = 0.0;
188
+ elems[nelems].max = 1.0;
189
+ elems[nelems].step = 1.0;
190
+ nelems++;
191
+ }
192
+
193
+ inline void LV2UI::add_elem(ui_elem_type_t type, const char *label, float *zone,
194
+ float init, float min, float max, float step)
195
+ {
196
+ ui_elem_t *elems1 = (ui_elem_t*)realloc(elems, (nelems+1)*sizeof(ui_elem_t));
197
+ if (elems1)
198
+ elems = elems1;
199
+ else
200
+ return;
201
+ elems[nelems].type = type;
202
+ elems[nelems].label = label;
203
+ elems[nelems].port = portno(label);
204
+ elems[nelems].zone = zone;
205
+ elems[nelems].ref = NULL;
206
+ elems[nelems].init = init;
207
+ elems[nelems].min = min;
208
+ elems[nelems].max = max;
209
+ elems[nelems].step = step;
210
+ nelems++;
211
+ }
212
+
213
+ inline void LV2UI::add_elem(ui_elem_type_t type, const char *label, float *zone,
214
+ float min, float max)
215
+ {
216
+ ui_elem_t *elems1 = (ui_elem_t*)realloc(elems, (nelems+1)*sizeof(ui_elem_t));
217
+ if (elems1)
218
+ elems = elems1;
219
+ else
220
+ return;
221
+ elems[nelems].type = type;
222
+ elems[nelems].label = label;
223
+ elems[nelems].port = portno(label);
224
+ elems[nelems].zone = zone;
225
+ elems[nelems].ref = NULL;
226
+ elems[nelems].init = 0.0;
227
+ elems[nelems].min = min;
228
+ elems[nelems].max = max;
229
+ elems[nelems].step = 0.0;
230
+ nelems++;
231
+ }
232
+
233
+ inline bool LV2UI::is_voice_ctrl(const char *label)
234
+ {
235
+ if (!is_instr)
236
+ return false;
237
+ else if (!have_freq && !strcmp(label, "freq"))
238
+ return (have_freq = true);
239
+ else if (!have_gain && !strcmp(label, "gain"))
240
+ return (have_gain = true);
241
+ else if (!have_gate && !strcmp(label, "gate"))
242
+ return (have_gate = true);
243
+ else
244
+ return false;
245
+ }
246
+
247
+ void LV2UI::addButton(const char* label, float* zone)
248
+ { add_elem(UI_BUTTON, label, zone); }
249
+ void LV2UI::addCheckButton(const char* label, float* zone)
250
+ { add_elem(UI_CHECK_BUTTON, label, zone); }
251
+ void LV2UI::addVerticalSlider(const char* label, float* zone, float init, float min, float max, float step)
252
+ { add_elem(UI_V_SLIDER, label, zone, init, min, max, step); }
253
+ void LV2UI::addHorizontalSlider(const char* label, float* zone, float init, float min, float max, float step)
254
+ { add_elem(UI_H_SLIDER, label, zone, init, min, max, step); }
255
+ void LV2UI::addNumEntry(const char* label, float* zone, float init, float min, float max, float step)
256
+ { add_elem(UI_NUM_ENTRY, label, zone, init, min, max, step); }
257
+
258
+ void LV2UI::addHorizontalBargraph(const char* label, float* zone, float min, float max)
259
+ { add_elem(UI_H_BARGRAPH, label, zone, min, max); }
260
+ void LV2UI::addVerticalBargraph(const char* label, float* zone, float min, float max)
261
+ { add_elem(UI_V_BARGRAPH, label, zone, min, max); }
262
+
263
+ void LV2UI::openTabBox(const char* label)
264
+ { add_elem(UI_T_GROUP, label); }
265
+ void LV2UI::openHorizontalBox(const char* label)
266
+ { add_elem(UI_H_GROUP, label); }
267
+ void LV2UI::openVerticalBox(const char* label)
268
+ { add_elem(UI_V_GROUP, label); }
269
+ void LV2UI::closeBox()
270
+ { add_elem(UI_END_GROUP); }
271
+
272
+ void LV2UI::run() {}
273
+
274
+ //----------------------------------------------------------------------------
275
+ // FAUST generated signal processor
276
+ //----------------------------------------------------------------------------
277
+
278
+ <<includeclass>>
279
+
280
+ //----------------------------------------------------------------------------
281
+ // LV2 UI interface
282
+ //----------------------------------------------------------------------------
283
+
284
+ #line 282 "lv2ui.cpp"
285
+
286
+ #include <assert.h>
287
+ #include <stdio.h>
288
+ #include <stdlib.h>
289
+
290
+ #include <lv2/lv2plug.in/ns/lv2core/lv2.h>
291
+ #include <lv2/lv2plug.in/ns/extensions/ui/ui.h>
292
+
293
+ /* Define this to get debugging output from the Qt-related code. Setting this
294
+ to a value >1 will give even more extensive debugging output. Using a zero
295
+ value or commenting the following line makes sure that no qDebug calls are
296
+ included in the code at all. */
297
+ //#define FAUSTQT_DEBUG 1
298
+
299
+ /* Define this to get debugging output from the LV2 UI interface
300
+ (communication between LV2 host and LV2 UI code). Setting this to a value
301
+ >1 will give even more extensive debugging output. */
302
+ //#define LV2UI_DEBUG 1
303
+
304
+ // Set this to the proper shared library extension for your system
305
+ #ifndef DLLEXT
306
+ #define DLLEXT ".so"
307
+ #endif
308
+
309
+ #ifndef URI_PREFIX
310
+ #define URI_PREFIX "https://faustlv2.bitbucket.io"
311
+ #endif
312
+
313
+ #ifndef PLUGIN_URI
314
+ #define PLUGIN_URI URI_PREFIX "/mydsp"
315
+ #endif
316
+
317
+ //#define NVOICES 16
318
+
319
+ #ifndef VOICE_CTRLS
320
+ #define VOICE_CTRLS 1
321
+ #endif
322
+
323
+ #ifndef FAUST_MTS
324
+ #define FAUST_MTS 1
325
+ #endif
326
+
327
+ #ifndef FAUST_META
328
+ #define FAUST_META 1
329
+ #endif
330
+
331
+ #ifndef FAUST_MIDICC
332
+ #define FAUST_MIDICC 1
333
+ #endif
334
+
335
+ #if FAUST_MTS
336
+
337
+ // Helper classes to read and store MTS tunings.
338
+
339
+ #include <sys/types.h>
340
+ #include <sys/stat.h>
341
+ #include <dirent.h>
342
+
343
+ #include <string>
344
+ #include <vector>
345
+ #include <algorithm>
346
+
347
+ struct MTSTuning {
348
+ char *name; // name of the tuning
349
+ int len; // length of sysex data in bytes
350
+ unsigned char *data; // sysex data
351
+ MTSTuning() : name(0), len(0), data(0) {}
352
+ MTSTuning& operator=(const MTSTuning &t)
353
+ {
354
+ if (this == &t) return *this;
355
+ if (name) free(name); if (data) free(data);
356
+ name = 0; data = 0; len = t.len;
357
+ if (t.name) {
358
+ name = strdup(t.name); assert(name);
359
+ }
360
+ if (t.data) {
361
+ data = (unsigned char*)malloc(len); assert(data);
362
+ memcpy(data, t.data, len);
363
+ }
364
+ return *this;
365
+ }
366
+ MTSTuning(const MTSTuning& t) : name(0), len(0), data(0)
367
+ { *this = t; }
368
+ MTSTuning(const char *filename);
369
+ ~MTSTuning()
370
+ { if (name) free(name); if (data) free(data); }
371
+ };
372
+
373
+ MTSTuning::MTSTuning(const char *filename)
374
+ {
375
+ FILE *fp = fopen(filename, "rb");
376
+ name = 0; len = 0; data = 0;
377
+ if (!fp) return;
378
+ struct stat st;
379
+ if (fstat(fileno(fp), &st)) return;
380
+ len = st.st_size;
381
+ data = (unsigned char*)calloc(len, 1);
382
+ if (!data) {
383
+ len = 0; fclose(fp);
384
+ return;
385
+ }
386
+ assert(len > 0);
387
+ if (fread(data, 1, len, fp) < (size_t)len) {
388
+ free(data); len = 0; data = 0; fclose(fp);
389
+ return;
390
+ }
391
+ fclose(fp);
392
+ // Do some basic sanity checks.
393
+ if (data[0] != 0xf0 || data[len-1] != 0xf7 || // not a sysex message
394
+ (data[1] != 0x7e && data[1] != 0x7f) || data[3] != 8 || // not MTS
395
+ !((len == 21 && data[4] == 8) ||
396
+ (len == 33 && data[4] == 9))) { // no 1- or 2-byte tuning
397
+ free(data); len = 0; data = 0;
398
+ return;
399
+ }
400
+ // Name of the tuning is the basename of the file, without the trailing .syx
401
+ // suffix.
402
+ string nm = filename;
403
+ size_t p = nm.rfind(".syx");
404
+ if (p != string::npos) nm.erase(p);
405
+ p = nm.rfind('/');
406
+ if (p != string::npos) nm.erase(0, p+1);
407
+ name = strdup(nm.c_str());
408
+ assert(name);
409
+ }
410
+
411
+ struct MTSTunings {
412
+ vector<MTSTuning> tuning;
413
+ MTSTunings() {}
414
+ MTSTunings(const char *path);
415
+ };
416
+
417
+ static bool compareByName(const MTSTuning &a, const MTSTuning &b)
418
+ {
419
+ return strcmp(a.name, b.name) < 0;
420
+ }
421
+
422
+ MTSTunings::MTSTunings(const char *path)
423
+ {
424
+ DIR *dp = opendir(path);
425
+ if (!dp) return;
426
+ struct dirent *d;
427
+ while ((d = readdir(dp))) {
428
+ string nm = d->d_name;
429
+ if (nm.length() > 4 && nm.substr(nm.length()-4) == ".syx") {
430
+ string pathname = path;
431
+ pathname += "/";
432
+ pathname += nm;
433
+ MTSTuning t(pathname.c_str());
434
+ if (t.data) {
435
+ #if 1
436
+ // The data isn't currently used anywhere in the GUI, so we get rid of
437
+ // it immediately.
438
+ free(t.data); t.data = 0; t.len = 0;
439
+ #endif
440
+ tuning.push_back(t);
441
+ }
442
+ }
443
+ }
444
+ closedir(dp);
445
+ // sort found tunings by name
446
+ sort(tuning.begin(), tuning.end(), compareByName);
447
+ }
448
+
449
+ #endif
450
+
451
+ /***************************************************************************/
452
+
453
+ /* LV2 plugin UI data structure. This is a stripped-down version of the
454
+ LV2Plugin struct in lv2.cpp whose sole purpose is to keep track of all the
455
+ parameters of the plugin. Therefore most of the live port data isn't
456
+ actually implemented and we only have to maintain a single dsp and UI
457
+ instance here, no matter how many voices we actually have in the case of an
458
+ instrument plugin. In fact, the dsp instance is mostly used to fill in the
459
+ data of the various UI objects that we use. NOTE: This *must* be kept in
460
+ sync with lv2.cpp so that (at least) the numbering of the control ports
461
+ matches up. */
462
+
463
+ struct LV2PluginUI {
464
+ const int maxvoices; // maximum number of voices (zero if not an instrument)
465
+ const int ndsps; // number of dsp instances (1 if maxvoices==0)
466
+ int nvoices; // current number of voices (<= maxvoices)
467
+ int tuning_no; // current tuning number (<= n_tunings)
468
+ mydsp *dsp; // the dsp
469
+ LV2UI *ui; // Faust interface description
470
+ int n_in, n_out; // number of input and output control ports
471
+ int *ctrls; // Faust ui elements (indices into ui->elems)
472
+ int *inctrls, *outctrls; // indices for active and passive controls
473
+ int freq, gain, gate; // indices of voice controls
474
+ int n_params; // number of param mapping entries
475
+ int *param_no; // map Qt -> Faust control numbers
476
+ int *control_no; // map Faust -> Qt control numbers
477
+ #if 0
478
+ std::map<uint8_t,int> ctrlmap; // MIDI controller map
479
+ #endif
480
+ // LV2 UI tie-ins to send port data from GUI to the host.
481
+ LV2UI_Write_Function write_function;
482
+ LV2UI_Controller controller;
483
+
484
+ // Static methods. These all use static data so they can be invoked before
485
+ // instantiating a plugin.
486
+
487
+ // Global meta data (dsp name, author, etc.).
488
+ static Meta *meta;
489
+ static void init_meta()
490
+ {
491
+ if (!meta) {
492
+ meta = new Meta;
493
+ mydsp tmp_dsp;
494
+ tmp_dsp.metadata(meta);
495
+ }
496
+ }
497
+
498
+ static const char *pluginName()
499
+ {
500
+ init_meta();
501
+ return meta->get("name", "mydsp");
502
+ }
503
+
504
+ static const char *pluginAuthor()
505
+ {
506
+ init_meta();
507
+ return meta->get("author", "");
508
+ }
509
+
510
+ static const char *pluginDescription()
511
+ {
512
+ init_meta();
513
+ return meta->get("description", "");
514
+ }
515
+
516
+ static const char *pluginLicense()
517
+ {
518
+ init_meta();
519
+ return meta->get("license", "");
520
+ }
521
+
522
+ static const char *pluginVersion()
523
+ {
524
+ init_meta();
525
+ return meta->get("version", "");
526
+ }
527
+
528
+ // Load a collection of sysex files with MTS tunings in ~/.faust/tuning.
529
+ static int n_tunings;
530
+ #if FAUST_MTS
531
+ static MTSTunings *mts;
532
+
533
+ static MTSTunings *load_sysex_data()
534
+ {
535
+ if (!mts) {
536
+ string mts_path;
537
+ // Look for FAUST_HOME. If that isn't set, try $HOME/.faust. If HOME
538
+ // isn't set either, just assume a .faust subdir of the cwd.
539
+ const char *home = getenv("FAUST_HOME");
540
+ if (home)
541
+ mts_path = home;
542
+ else {
543
+ home = getenv("HOME");
544
+ if (home) {
545
+ mts_path = home;
546
+ mts_path += "/.faust";
547
+ } else
548
+ mts_path = ".faust";
549
+ }
550
+ // MTS tunings are looked for in this subdir.
551
+ mts_path += "/tuning";
552
+ mts = new MTSTunings(mts_path.c_str());
553
+ #ifdef __APPLE__
554
+ if (!mts || mts->tuning.size() == 0) {
555
+ // Also check ~/Library/Faust/Tuning on the Mac.
556
+ home = getenv("HOME");
557
+ if (home) {
558
+ if (mts) delete mts;
559
+ mts_path = home;
560
+ mts_path += "/Library/Faust/Tuning";
561
+ mts = new MTSTunings(mts_path.c_str());
562
+ }
563
+ }
564
+ #endif
565
+ n_tunings = mts->tuning.size();
566
+ }
567
+ return mts;
568
+ }
569
+ #endif
570
+
571
+ // The number of voices of an instrument plugin. We get this information
572
+ // from the global meta data (nvoices key) of the dsp module if present, and
573
+ // you can also override this setting at compile time by defining the
574
+ // NVOICES macro. If neither is defined or the value is zero then the plugin
575
+ // becomes a simple audio effect instead.
576
+ static int numVoices()
577
+ {
578
+ #ifdef NVOICES
579
+ return NVOICES;
580
+ #else
581
+ init_meta();
582
+ const char *numVoices = meta->get("nvoices", "0");
583
+ int nvoices = atoi(numVoices);
584
+ if (nvoices < 0 ) nvoices = 0;
585
+ return nvoices;
586
+ #endif
587
+ }
588
+
589
+ // Instance methods.
590
+
591
+ LV2PluginUI(const int num_voices,
592
+ LV2UI_Write_Function write_function,
593
+ LV2UI_Controller controller)
594
+ : maxvoices(num_voices), ndsps(num_voices<=0?1:num_voices),
595
+ write_function(write_function), controller(controller)
596
+ {
597
+ // Initialize static data.
598
+ init_meta();
599
+ #if FAUST_MTS
600
+ // Synth: load tuning sysex data if present.
601
+ if (num_voices>0) load_sysex_data();
602
+ #endif
603
+ // Allocate data structures and set some reasonable defaults.
604
+ nvoices = maxvoices/2;
605
+ if (nvoices <= 0) nvoices = 1;
606
+ tuning_no = 0;
607
+ n_in = n_out = 0;
608
+ freq = gain = gate = -1;
609
+ ctrls = inctrls = outctrls = NULL;
610
+ // Initialize the Faust DSP.
611
+ dsp = new mydsp();
612
+ ui = new LV2UI(num_voices);
613
+ dsp->init(48000);
614
+ dsp->buildUserInterface(ui);
615
+ // The ports are numbered as follows: 0..k-1 are the control ports, then
616
+ // come the n audio input ports, then the m audio output ports, and
617
+ // finally the midi input port and the polyphony and tuning controls.
618
+ int k = ui->nports, p = 0, q = 0;
619
+ // Allocate tables for the built-in control elements and their ports.
620
+ ctrls = (int*)calloc(k, sizeof(int));
621
+ inctrls = (int*)calloc(k, sizeof(int));
622
+ outctrls = (int*)calloc(k, sizeof(int));
623
+ assert(k == 0 || (ctrls && inctrls && outctrls));
624
+ // Scan the Faust UI for active and passive controls which become the
625
+ // input and output control ports of the plugin, respectively.
626
+ for (int i = 0, j = 0; i < ui->nelems; i++) {
627
+ switch (ui->elems[i].type) {
628
+ case UI_T_GROUP: case UI_H_GROUP: case UI_V_GROUP: case UI_END_GROUP:
629
+ // control groups (ignored right now)
630
+ break;
631
+ case UI_H_BARGRAPH: case UI_V_BARGRAPH:
632
+ // passive controls (output ports)
633
+ ctrls[j++] = i;
634
+ outctrls[q++] = i;
635
+ break;
636
+ default:
637
+ // active controls (input ports)
638
+ if (maxvoices == 0)
639
+ goto noinstr;
640
+ else if (freq == -1 &&
641
+ !strcmp(ui->elems[i].label, "freq"))
642
+ freq = i;
643
+ else if (gain == -1 &&
644
+ !strcmp(ui->elems[i].label, "gain"))
645
+ gain = i;
646
+ else if (gate == -1 &&
647
+ !strcmp(ui->elems[i].label, "gate"))
648
+ gate = i;
649
+ else {
650
+ noinstr:
651
+ #if 0 //FAUST_MIDICC
652
+ // Disabled since the controller mappings aren't currently used
653
+ // anywhere in the GUI.
654
+ std::map< int, list<strpair> >::iterator it =
655
+ ui->metadata.find(i);
656
+ if (it != ui->metadata.end()) {
657
+ // Scan for controller mappings.
658
+ for (std::list<strpair>::iterator jt = it->second.begin();
659
+ jt != it->second.end(); jt++) {
660
+ const char *key = jt->first, *val = jt->second;
661
+ if (strcmp(key, "midi") == 0) {
662
+ unsigned num;
663
+ if (sscanf(val, "ctrl %u", &num) < 1) continue;
664
+ ctrlmap.insert(std::pair<uint8_t,int>(num, p));
665
+ }
666
+ }
667
+ }
668
+ #endif
669
+ ctrls[j++] = i;
670
+ inctrls[p++] = i;
671
+ }
672
+ break;
673
+ }
674
+ }
675
+ // Realloc the inctrls and outctrls vectors to their appropriate sizes.
676
+ inctrls = (int*)realloc(inctrls, p*sizeof(int));
677
+ assert(p == 0 || inctrls);
678
+ outctrls = (int*)realloc(outctrls, q*sizeof(int));
679
+ assert(q == 0 || outctrls);
680
+ n_in = p; n_out = q;
681
+ // Map of GUI parameter numbers to the actual control indices. This is
682
+ // initialized later by LV2QtGUI::open() below.
683
+ n_params = 0;
684
+ param_no = control_no = 0;
685
+ }
686
+
687
+ ~LV2PluginUI()
688
+ {
689
+ delete dsp;
690
+ delete ui;
691
+ if (param_no) delete[] param_no;
692
+ if (control_no) delete[] control_no;
693
+ free(ctrls); free(inctrls); free(outctrls);
694
+ }
695
+
696
+ // Qt GUI interface. XXXTODO: This should probably be rewritten some
697
+ // time. Currently these methods mostly emulate some methods from the VST
698
+ // API which the Qt GUI implementation was originally written for. Note that
699
+ // these methods work with normalized (0..1) values, like in the VST API.
700
+
701
+ double quantize(double x, double d)
702
+ {
703
+ if (d == 0.0) return x;
704
+ // Round off x to the nearest increment of d. Note that this may produce
705
+ // rounding artifacts if d is some power of 10 less than 0, since these
706
+ // can't be represented exactly in binary.
707
+ double i;
708
+ if (x*d < 0.0)
709
+ modf(x/d-0.5, &i);
710
+ else
711
+ modf(x/d+0.5, &i);
712
+ return i*d;
713
+ }
714
+
715
+ float nvoices_val, tuning_no_val;
716
+
717
+ // AG: Note that we have to map the GUI parameter numbers to the actual
718
+ // Faust control indices here. This extra level of indirection is necessary
719
+ // because in some cases Qt may enumerate the child widgets in a different
720
+ // order than what we have in the Faust program. The mapping is computed in
721
+ // the QTGUIWrapper class below, please see the comments there for details.
722
+
723
+ int map_param(int i)
724
+ {
725
+ return (i < 0 || i >= n_params) ? i : param_no[i];
726
+ }
727
+
728
+ int map_control(int i)
729
+ {
730
+ return (i < 0 || i >= n_params) ? i : control_no[i];
731
+ }
732
+
733
+ void setParameter(int index, float value)
734
+ {
735
+ index = map_param(index);
736
+ const double eps = 1e-5;
737
+ int k = ui->nports;
738
+ int n = dsp->getNumInputs(), m = dsp->getNumOutputs();
739
+ if (index >= 0 && index < k) {
740
+ int j = ctrls[index];
741
+ assert(index == ui->elems[j].port);
742
+ float min = ui->elems[j].min;
743
+ float max = ui->elems[j].max;
744
+ float step = ui->elems[j].step;
745
+ float val = (min == max)?min:min+quantize(value*(max-min), step);
746
+ if (fabs(val) < fabs(step) || fabs(val)/fabs(max-min) < eps)
747
+ val = 0.0;
748
+ // Make sure to clamp the value in the allowed range, Carla barfs
749
+ // otherwise.
750
+ val = clamp(min, max, val);
751
+ if (*ui->elems[j].zone != val) {
752
+ // update our copy of the control value
753
+ *ui->elems[j].zone = val;
754
+ // also send the data to the LV2 host
755
+ #if LV2UI_DEBUG
756
+ fprintf(stderr, "%s: write_function: send value %g on port #%d\n", pluginName(), val, index);
757
+ #endif
758
+ write_function(controller, index, sizeof(float), 0,
759
+ ui->elems[j].zone);
760
+ }
761
+ } else if (index == k && maxvoices > 0) {
762
+ int oldval = nvoices;
763
+ nvoices = (int)quantize((value*maxvoices), 1);
764
+ if (nvoices <= 0) nvoices = 1;
765
+ if (oldval != nvoices) {
766
+ // index is k (#regular control ports) + n (#audio ins) + m (#audio
767
+ // outs) + 1 (#midi ins), next port is polyphony control
768
+ int index = k+n+m+1;
769
+ nvoices_val = (float)nvoices;
770
+ #if LV2UI_DEBUG
771
+ fprintf(stderr, "%s: write_function: send nvoices value %g on port #%d\n", pluginName(), nvoices_val, index);
772
+ #endif
773
+ write_function(controller, index, sizeof(float), 0, &nvoices_val);
774
+ }
775
+ #if FAUST_MTS
776
+ } else if (index == k+1 && n_tunings > 0) {
777
+ int oldval = tuning_no;
778
+ tuning_no = (int)quantize((value*n_tunings), 1);
779
+ if (oldval != tuning_no) {
780
+ // index is k (#regular control ports) + n (#audio ins) + m (#audio
781
+ // outs) + 1 (#midi ins) + 1 (polyphony control), next port is tuning
782
+ // control
783
+ int index = k+n+m+2;
784
+ tuning_no_val = (float)tuning_no;
785
+ #if LV2UI_DEBUG
786
+ fprintf(stderr, "%s: write_function: send tuning value %g on port #%d\n", pluginName(), tuning_no_val, index);
787
+ #endif
788
+ write_function(controller, index, sizeof(float), 0, &tuning_no_val);
789
+ }
790
+ #endif
791
+ }
792
+ }
793
+
794
+ // Version of setParameter which is used by the LV2 port_event callback.
795
+ // This just sets the port value directly, without translation, and doesn't
796
+ // send the value.
797
+ void setPortval(int index, float value)
798
+ {
799
+ const double eps = 1e-5;
800
+ int k = ui->nports;
801
+ int n = dsp->getNumInputs(), m = dsp->getNumOutputs();
802
+ if (index >= 0 && index < k) {
803
+ int j = ctrls[index];
804
+ assert(index == ui->elems[j].port);
805
+ // quantize+clamp
806
+ float min = ui->elems[j].min;
807
+ float max = ui->elems[j].max;
808
+ float step = ui->elems[j].step;
809
+ float val = (min == max)?min:min+quantize(value-min, step);
810
+ if (fabs(val) < fabs(step) || fabs(val)/fabs(max-min) < eps)
811
+ val = 0.0;
812
+ val = clamp(min, max, val);
813
+ // update our copy of the control value
814
+ *ui->elems[j].zone = val;
815
+ } else if (index == k && maxvoices > 0) {
816
+ nvoices = (int)value;
817
+ if (nvoices <= 0) nvoices = 1;
818
+ #if FAUST_MTS
819
+ } else if (index == k+1 && n_tunings > 0) {
820
+ tuning_no = (int)value;
821
+ #endif
822
+ }
823
+ }
824
+
825
+ float clamp(float min, float max, float val)
826
+ {
827
+ if (min<=max) {
828
+ if (val < min) val = min;
829
+ if (val > max) val = max;
830
+ } else {
831
+ if (val > min) val = min;
832
+ if (val < max) val = max;
833
+ }
834
+ return val;
835
+ }
836
+
837
+ float normalize(float min, float max, float val)
838
+ {
839
+ if (min == max)
840
+ return 0.0f;
841
+ else
842
+ return clamp(0.0, 1.0, (val-min)/(max-min));
843
+ }
844
+
845
+ float getParameter(int index)
846
+ {
847
+ index = map_param(index);
848
+ int k = ui->nports;
849
+ if (index >= 0 && index < k) {
850
+ int j = ctrls[index];
851
+ assert(index == ui->elems[j].port);
852
+ return normalize(ui->elems[j].min, ui->elems[j].max, *ui->elems[j].zone);
853
+ } else if (index == k && maxvoices > 0) {
854
+ return normalize(0, maxvoices, nvoices);
855
+ #if FAUST_MTS
856
+ } else if (index == k+1 && n_tunings > 0) {
857
+ return normalize(0, n_tunings, tuning_no);
858
+ #endif
859
+ } else
860
+ return 0.0f;
861
+ }
862
+
863
+ void getParameterName(int index, char *label)
864
+ {
865
+ index = map_param(index);
866
+ int k = ui->nports;
867
+ strcpy(label, "");
868
+ if (index < k) {
869
+ int j = ctrls[index];
870
+ assert(index == ui->elems[j].port);
871
+ strncpy(label, ui->elems[j].label, 32);
872
+ } else if (index == k && maxvoices > 0) {
873
+ strcpy(label, "Polyphony");
874
+ #if FAUST_MTS
875
+ } else if (index == k+1 && n_tunings > 0) {
876
+ strcpy(label, "Tuning");
877
+ #endif
878
+ }
879
+ }
880
+
881
+ void getParameterDisplay(int index, char *text)
882
+ {
883
+ index = map_param(index);
884
+ int k = ui->nports;
885
+ strcpy(text, "");
886
+ if (index < k) {
887
+ int j = ctrls[index];
888
+ assert(index == ui->elems[j].port);
889
+ sprintf(text, "%0.5g", *ui->elems[j].zone);
890
+ } else if (index == k && maxvoices > 0) {
891
+ sprintf(text, "%d voices", nvoices);
892
+ #if FAUST_MTS
893
+ } else if (index == k+1 && n_tunings > 0) {
894
+ sprintf(text, "%d %s", tuning_no,
895
+ tuning_no>0?mts->tuning[tuning_no-1].name:
896
+ "default");
897
+ #endif
898
+ }
899
+ }
900
+
901
+ float getMinimum(int index)
902
+ {
903
+ index = map_param(index);
904
+ int k = ui->nports;
905
+ if (index < 0)
906
+ return 0.0f;
907
+ else if (index < k) {
908
+ int j = ctrls[index];
909
+ assert(index == ui->elems[j].port);
910
+ float min = ui->elems[j].min;
911
+ return min;
912
+ } else if (index == k && maxvoices > 0) {
913
+ return 0.0f;
914
+ #if FAUST_MTS
915
+ } else if (index == k+1 && n_tunings > 0) {
916
+ return 0.0f;
917
+ #endif
918
+ } else
919
+ return 0.0f;
920
+ }
921
+
922
+ float getMaximum(int index)
923
+ {
924
+ index = map_param(index);
925
+ int k = ui->nports;
926
+ if (index < 0)
927
+ return 0.0f;
928
+ else if (index < k) {
929
+ int j = ctrls[index];
930
+ assert(index == ui->elems[j].port);
931
+ float max = ui->elems[j].max;
932
+ return max;
933
+ } else if (index == k && maxvoices > 0) {
934
+ return (float)maxvoices;
935
+ #if FAUST_MTS
936
+ } else if (index == k+1 && n_tunings > 0) {
937
+ return (float)n_tunings;
938
+ #endif
939
+ } else
940
+ return 0.0f;
941
+ }
942
+
943
+ float getStep(int index)
944
+ {
945
+ index = map_param(index);
946
+ int k = ui->nports;
947
+ if (index < 0)
948
+ return 0.0f;
949
+ else if (index < k) {
950
+ int j = ctrls[index];
951
+ assert(index == ui->elems[j].port);
952
+ float step = ui->elems[j].step;
953
+ return step;
954
+ } else if (index == k && maxvoices > 0) {
955
+ return 1.0f;
956
+ #if FAUST_MTS
957
+ } else if (index == k+1 && n_tunings > 0) {
958
+ return 1.0f;
959
+ #endif
960
+ } else
961
+ return 0.0f;
962
+ }
963
+
964
+ int isPassiveControl(int index)
965
+ {
966
+ index = map_param(index);
967
+ int k = ui->nports;
968
+ if (index >= 0 && index < k) {
969
+ int j = ctrls[index];
970
+ assert(index == ui->elems[j].port);
971
+ switch (ui->elems[j].type) {
972
+ case UI_V_BARGRAPH:
973
+ return 1; // passive control is of type UI_V_BARGRAPH
974
+ case UI_H_BARGRAPH:
975
+ return 2; // passive control is of type UI_H_BARGRAPH
976
+ default:
977
+ return 0; // not a passive control
978
+ }
979
+ } else
980
+ return 0;
981
+ }
982
+
983
+ };
984
+
985
+ Meta *LV2PluginUI::meta = 0;
986
+ int LV2PluginUI::n_tunings = 0;
987
+ #if FAUST_MTS
988
+ MTSTunings *LV2PluginUI::mts = 0;
989
+ #endif
990
+
991
+ /* Generic Faust Qt GUI code by Roman Svidler ported from faust-vst-qt. */
992
+
993
+ // Copyright (c) 2015-2016 by Roman Svidler
994
+ // Copyright (c) 2015-2016 by Albert Gräf
995
+
996
+ // This is based on the generic Qt code provided by QTUI.h in the Faust
997
+ // distribution. Here we only add the necessary machinery to interface between
998
+ // the GUI and the LV2 host.
999
+
1000
+ // OSCUI.h and httpdUI.h pull in their own definition of the Meta struct,
1001
+ // prevent name clashes with our version.
1002
+ #define Meta FaustMeta
1003
+
1004
+ #include "lv2qtgui.h"
1005
+
1006
+ #include <iostream>
1007
+ #include <QApplication>
1008
+ #include <faust/gui/QTUI.h>
1009
+ #ifdef OSCCTRL
1010
+ #include <faust/gui/OSCUI.h>
1011
+ #endif
1012
+ #ifdef HTTPCTRL
1013
+ #include <faust/gui/httpdUI.h>
1014
+ #endif
1015
+
1016
+ #include <QWidget>
1017
+ #include <QList>
1018
+ #include <QtAlgorithms>
1019
+
1020
+ #line 1018 "lv2ui.cpp"
1021
+
1022
+ std::list<GUI*> GUI::fGuiList;
1023
+ ztimedmap GUI::gTimedZoneMap;
1024
+
1025
+ LV2QtGUI::LV2QtGUI(LV2PluginUI* plugui) :
1026
+ widget(NULL), uidsp(NULL), qtinterface(NULL),
1027
+ #ifdef OSCCTRL
1028
+ oscinterface(NULL),
1029
+ #endif
1030
+ #ifdef HTTPCTRL
1031
+ httpdinterface(NULL),
1032
+ #endif
1033
+ plugui(plugui)
1034
+ {
1035
+ // The host should actually take care of initializing Qt, but we also do
1036
+ // that here if needed to be on the safe side.
1037
+ static int argc = 0;
1038
+ static char* argv[1] = {0};
1039
+ if(qApp) {
1040
+ #if FAUSTQT_DEBUG
1041
+ qDebug() << "qApp already exists";
1042
+ #endif
1043
+ } else {
1044
+ #if FAUSTQT_DEBUG
1045
+ qDebug() << "qApp is created!";
1046
+ #endif
1047
+ new QApplication(argc, argv);
1048
+ }
1049
+
1050
+ #if FAUSTQT_DEBUG
1051
+ qDebug() << "qApp=" << qApp;
1052
+ #endif
1053
+ }
1054
+
1055
+ LV2QtGUI::~LV2QtGUI()
1056
+ {
1057
+ }
1058
+
1059
+ // This is a little wrapper class around QTGUI which takes care of eliminating
1060
+ // the freq/gain/gate controls of instruments in the user interface when
1061
+ // running the dsp's buildUserInterface method. It also adds polyphony and
1062
+ // tuning controls to instruments as needed, and does some other extra
1063
+ // bookkeeping and on-the-fly modifications that we need. -ag
1064
+
1065
+ // AG XXXFIXME: This is more complicated than we'd like it to be, since for
1066
+ // some unknown reason, the children of a tab widget are listed in reverse
1067
+ // order (https://bitbucket.org/agraef/faust-lv2/issues/10). Since the GUI
1068
+ // code assumes that the widgets are in the same order as the Faust control
1069
+ // elements, we need to construct a mapping that translates between the two.
1070
+
1071
+ struct QTGUIElem {
1072
+ int i;
1073
+ QList<int> p;
1074
+ const char *label;
1075
+ QTGUIElem(int _i, QList<int> _p, const char *_label) :
1076
+ i(_i), p(_p), label(_label)
1077
+ {}
1078
+ };
1079
+
1080
+ bool qtguielem_less(const QTGUIElem &x, const QTGUIElem &y)
1081
+ {
1082
+ // Qt4 doesn't define operator< on QLists, so we need to do the
1083
+ // lexicographic comparison manually.
1084
+ QList<int>::const_iterator i = x.p.begin(), j = y.p.begin();
1085
+ for (; i != x.p.end() && j != y.p.end(); ++i, ++j) {
1086
+ if (*i < *j)
1087
+ return true;
1088
+ else if (*i > *j)
1089
+ return false;
1090
+ }
1091
+ return j != y.p.end();
1092
+ }
1093
+
1094
+ class QTGUIWrapper : public UI
1095
+ {
1096
+ protected:
1097
+ bool is_instr;
1098
+ QTGUI *ui;
1099
+ QList<int> path;
1100
+ QList<QTGUIElem> elems;
1101
+ int level, maxvoices, numtunings;
1102
+ float *voices_zone, *tuning_zone;
1103
+ bool have_freq, have_gain, have_gate;
1104
+ bool is_voice_ctrl(const char *label)
1105
+ {
1106
+ if (!is_instr)
1107
+ return false;
1108
+ else if (!have_freq && !strcmp(label, "freq"))
1109
+ return (have_freq = true);
1110
+ else if (!have_gain && !strcmp(label, "gain"))
1111
+ return (have_gain = true);
1112
+ else if (!have_gate && !strcmp(label, "gate"))
1113
+ return (have_gate = true);
1114
+ else
1115
+ return false;
1116
+ }
1117
+ public:
1118
+ int *elem_no;
1119
+ int nelems;
1120
+ QTGUIWrapper(QTGUI *_ui, int _maxvoices, int _numtunings,
1121
+ float *_voices_zone, float *_tuning_zone) :
1122
+ is_instr(_maxvoices>0), ui(_ui), level(0),
1123
+ maxvoices(_maxvoices), numtunings(_numtunings),
1124
+ voices_zone(_voices_zone), tuning_zone(_tuning_zone),
1125
+ have_freq(false), have_gain(false), have_gate(false),
1126
+ elem_no(0), nelems(0)
1127
+ {}
1128
+ virtual ~QTGUIWrapper() {}
1129
+
1130
+ // -- widget's layouts
1131
+ virtual void openTabBox(const char* label)
1132
+ { ui->openTabBox(label); level++; path.append(-1); }
1133
+ virtual void openHorizontalBox(const char* label)
1134
+ { ui->openHorizontalBox(label); level++; path.append(0); }
1135
+ virtual void openVerticalBox(const char* label)
1136
+ { ui->openVerticalBox(label); level++; path.append(0); }
1137
+ virtual void closeBox()
1138
+ {
1139
+ if (--level == 0) {
1140
+ #if VOICE_CTRLS
1141
+ if (is_instr) {
1142
+ // Add polyphony and tuning controls (experimental).
1143
+ ui->addHorizontalSlider("Polyphony", voices_zone,
1144
+ maxvoices/2, 0, maxvoices, 1);
1145
+ addElem("Polyphony");
1146
+ #if FAUST_MTS
1147
+ if (numtunings>0)
1148
+ ui->addHorizontalSlider("Tuning", tuning_zone, 0, 0, numtunings, 1);
1149
+ addElem("Tuning");
1150
+ #endif
1151
+ }
1152
+ #endif
1153
+ // AG: Create an index of all the GUI elements in the right order.
1154
+ // XXXFIXME: This may need to be revisited if Qt or Faust changes the
1155
+ // order for some reason.
1156
+ qSort(elems.begin(), elems.end(), qtguielem_less);
1157
+ elem_no = new int[nelems];
1158
+ nelems = 0;
1159
+ for (QList<QTGUIElem>::iterator x = elems.begin(); x != elems.end();
1160
+ ++x, ++nelems) {
1161
+ elem_no[nelems] = x->i;
1162
+ #if 0
1163
+ fprintf(stderr, "%s (#%d):", x->label, x->i);
1164
+ for (QList<int>::iterator i = x->p.begin(); i != x->p.end(); ++i) {
1165
+ fprintf(stderr, " %d", *i);
1166
+ }
1167
+ fprintf(stderr, "\n");
1168
+ #endif
1169
+ }
1170
+ }
1171
+ path.pop_back();
1172
+ if (!path.empty()) {
1173
+ if (path.last() < 0)
1174
+ path.last()--;
1175
+ else
1176
+ path.last()++;
1177
+ }
1178
+ ui->closeBox();
1179
+ }
1180
+
1181
+ void addElem(const char *label)
1182
+ {
1183
+ elems.append(QTGUIElem(nelems++, path, label));
1184
+ assert(!path.empty());
1185
+ if (path.last() < 0)
1186
+ path.last()--;
1187
+ else
1188
+ path.last()++;
1189
+ }
1190
+
1191
+ // -- active widgets
1192
+ virtual void addButton(const char* label, FAUSTFLOAT* zone)
1193
+ {
1194
+ if (!is_voice_ctrl(label)) {
1195
+ ui->addButton(label, zone);
1196
+ addElem(label);
1197
+ }
1198
+ }
1199
+ virtual void addCheckButton(const char* label, FAUSTFLOAT* zone)
1200
+ {
1201
+ if (!is_voice_ctrl(label)) {
1202
+ ui->addCheckButton(label, zone);
1203
+ addElem(label);
1204
+ }
1205
+ }
1206
+ virtual void addVerticalSlider(const char* label, FAUSTFLOAT* zone,
1207
+ FAUSTFLOAT init, FAUSTFLOAT min,
1208
+ FAUSTFLOAT max, FAUSTFLOAT step)
1209
+ {
1210
+ if (!is_voice_ctrl(label)) {
1211
+ ui->addVerticalSlider(label, zone, init, min, max, step);
1212
+ addElem(label);
1213
+ }
1214
+ }
1215
+ virtual void addHorizontalSlider(const char* label, FAUSTFLOAT* zone,
1216
+ FAUSTFLOAT init, FAUSTFLOAT min,
1217
+ FAUSTFLOAT max, FAUSTFLOAT step)
1218
+ {
1219
+ if (!is_voice_ctrl(label)) {
1220
+ ui->addHorizontalSlider(label, zone, init, min, max, step);
1221
+ addElem(label);
1222
+ }
1223
+ }
1224
+ virtual void addNumEntry(const char* label, FAUSTFLOAT* zone,
1225
+ FAUSTFLOAT init, FAUSTFLOAT min,
1226
+ FAUSTFLOAT max, FAUSTFLOAT step)
1227
+ {
1228
+ if (!is_voice_ctrl(label)) {
1229
+ ui->addNumEntry(label, zone, init, min, max, step);
1230
+ addElem(label);
1231
+ }
1232
+ }
1233
+
1234
+ // -- passive widgets
1235
+ virtual void addHorizontalBargraph(const char* label, FAUSTFLOAT* zone,
1236
+ FAUSTFLOAT min, FAUSTFLOAT max)
1237
+ {
1238
+ ui->addHorizontalBargraph(label, zone, min, max);
1239
+ addElem(label);
1240
+ }
1241
+ virtual void addVerticalBargraph(const char* label, FAUSTFLOAT* zone,
1242
+ FAUSTFLOAT min, FAUSTFLOAT max)
1243
+ {
1244
+ ui->addVerticalBargraph(label, zone, min, max);
1245
+ addElem(label);
1246
+ }
1247
+
1248
+ virtual void addSoundfile(const char* label, const char* filename, Soundfile** sf_zone) {}
1249
+
1250
+ virtual void declare(FAUSTFLOAT* zone, const char* key, const char* val)
1251
+ {
1252
+ // XXXFIXME: Faust's Qt GUI implementation handles [scale:log] and similar
1253
+ // meta data affecting the scaling of slider data, but this isn't
1254
+ // supported in the current faust-lv2 implementation, so we just ignore
1255
+ // this meta data for now.
1256
+ if (strcmp(key, "scale")) ui->declare(zone, key, val);
1257
+ }
1258
+
1259
+ };
1260
+
1261
+ QWidget* LV2QtGUI::open()
1262
+ {
1263
+ static int argc = 0;
1264
+ static char* argv[1] = {0};
1265
+
1266
+ widget = new QScrollArea();
1267
+ widget->setWidgetResizable(true);
1268
+ qtinterface = new QTGUI(widget);
1269
+ widget->setWidget(qtinterface);
1270
+
1271
+ mydsp* dsp = new mydsp();
1272
+
1273
+ #if FAUSTQT_DEBUG
1274
+ qDebug() << "open interface: " << qtinterface;
1275
+ #endif
1276
+ // We build the QTGUI indirectly through QTGUIWrapper whose sole purpose is
1277
+ // to eliminate the voice controls in case of an instrument plugin.
1278
+ QTGUIWrapper qtwrapper(qtinterface,
1279
+ plugui->maxvoices, plugui->n_tunings,
1280
+ &voices_zone, &tuning_zone);
1281
+ dsp->buildUserInterface(&qtwrapper);
1282
+
1283
+ // AG: Initialize the Qt GUI -> Faust UI mapping (see the explanation under
1284
+ // QTGUIWrapper above).
1285
+ plugui->n_params = qtwrapper.nelems;
1286
+ plugui->param_no = qtwrapper.elem_no;
1287
+ plugui->control_no = new int[qtwrapper.nelems];
1288
+ for (int i = 0; i < qtwrapper.nelems; i++)
1289
+ plugui->control_no[plugui->param_no[i]] = i;
1290
+ #if 0
1291
+ for (int i = 0; i < plugui->n_params; i++)
1292
+ fprintf(stderr, "QT->LV2 %d -> %d\n", i, plugui->param_no[i]);
1293
+ for (int i = 0; i < plugui->n_params; i++)
1294
+ fprintf(stderr, "LV2->QT %d -> %d\n", i, plugui->control_no[i]);
1295
+ #endif
1296
+
1297
+ // HTTPD and OSC support (experimental)
1298
+ #ifdef HTTPCTRL
1299
+ httpdinterface = new httpdUI(plugui->pluginName(),
1300
+ dsp->getNumInputs(), dsp->getNumOutputs(),
1301
+ argc, argv);
1302
+ dsp->buildUserInterface(httpdinterface);
1303
+ #if FAUSTQT_DEBUG
1304
+ qDebug() << "HTTPD is on";
1305
+ #endif
1306
+ #endif
1307
+
1308
+ #ifdef OSCCTRL
1309
+ oscinterface = new OSCUI(plugui->pluginName(), argc, argv);
1310
+ dsp->buildUserInterface(oscinterface);
1311
+ #if FAUSTQT_DEBUG
1312
+ qDebug() << "OSC is on";
1313
+ #endif
1314
+ #endif
1315
+
1316
+ // update the size of the QTGUI after creating the GUI elements
1317
+ qtinterface->adjustSize();
1318
+
1319
+ // the dimensions of the plug-in window must not exceed screenGeometry
1320
+ // (-80 pixel tolerance)
1321
+ int desktopHeight = QApplication::desktop()->screenGeometry().height()-80;
1322
+ int desktopWidth = QApplication::desktop()->screenGeometry().width()-80;
1323
+
1324
+ #if FAUSTQT_DEBUG>1
1325
+ qDebug() << "desktop-height: " <<
1326
+ QApplication::desktop()->screenGeometry().height();
1327
+ qDebug() << "desktop-width: " <<
1328
+ QApplication::desktop()->screenGeometry().width();
1329
+ #endif
1330
+
1331
+ // determine the window size
1332
+ rectangle.top = 0;
1333
+ rectangle.left = 0;
1334
+ // the height of the plug-in GUI must not exceed the desktop resolution
1335
+ if(qtinterface->height() > desktopHeight)
1336
+ rectangle.bottom = desktopHeight;
1337
+ else // add 20 pixels for scroll bars
1338
+ rectangle.bottom = qtinterface->height()+20;
1339
+ // the width of the plug-in GUI must not exceed the desktop resolution
1340
+ if(qtinterface->width() > desktopWidth)
1341
+ rectangle.right = desktopWidth;
1342
+ else // add 20 pixels for scroll bars
1343
+ rectangle.right = qtinterface->width()+20;
1344
+
1345
+ // adjust the widget size
1346
+ widget->resize(rectangle.right, rectangle.bottom);
1347
+
1348
+ // determine all children of qtinterface of type QObject*
1349
+ QList<QObject*> allObjects = qtinterface->findChildren<QObject*>();
1350
+ #if FAUSTQT_DEBUG>1
1351
+ qDebug() << "QObjects total count: " << allObjects.count();
1352
+ #endif
1353
+
1354
+ int lv2ParamCount = 0;
1355
+
1356
+ bool vBargraphChecked = true; // used in HorizontalBargraph search
1357
+ QObject* lastObject; // used in addNumDisplay check
1358
+
1359
+ for (QList<QObject*>::iterator i = allObjects.begin(); i != allObjects.end();
1360
+ ++i) {
1361
+ #if FAUSTQT_DEBUG>1
1362
+ qDebug("");
1363
+ // debugging output: class name of found object
1364
+ qDebug() << "QObject: " << (*i)->metaObject()->className();
1365
+ qDebug() << "LV2 parameter assigned: " << lv2ParamCount;
1366
+ #endif
1367
+
1368
+ // Slider
1369
+ QSlider* slider = qobject_cast<QSlider*>(*i);
1370
+ if (slider) {
1371
+ #if FAUSTQT_DEBUG>1
1372
+ qDebug("found slider!");
1373
+ #endif
1374
+ slider->setProperty("lv2Param", lv2ParamCount);
1375
+ QList<QObject*> c; c.append(slider);
1376
+ controls.append(c);
1377
+
1378
+ connect(slider, SIGNAL(valueChanged(int)), this, SLOT(updateUI()),
1379
+ Qt::QueuedConnection);
1380
+ updateQTGUI(slider, plugui->getParameter(lv2ParamCount));
1381
+
1382
+ lv2ParamCount++;
1383
+ }
1384
+
1385
+ // Knob
1386
+ QDial* dial = qobject_cast<QDial*>(*i);
1387
+ if (dial) {
1388
+ #if FAUSTQT_DEBUG>1
1389
+ qDebug("found knob!");
1390
+ #endif
1391
+ dial->setProperty("lv2Param", lv2ParamCount);
1392
+ QList<QObject*> c; c.append(dial);
1393
+ controls.append(c);
1394
+
1395
+ connect(dial, SIGNAL(valueChanged(int)), this, SLOT(updateUI()),
1396
+ Qt::QueuedConnection);
1397
+ updateQTGUI(dial, plugui->getParameter(lv2ParamCount));
1398
+
1399
+ lv2ParamCount++;
1400
+ }
1401
+
1402
+ // Button
1403
+ QPushButton* button = qobject_cast<QPushButton*>(*i);
1404
+ if (button) {
1405
+ #if FAUSTQT_DEBUG>1
1406
+ qDebug("found button!");
1407
+ #endif
1408
+ button->setProperty("lv2Param", lv2ParamCount);
1409
+ QList<QObject*> c; c.append(button);
1410
+ controls.append(c);
1411
+
1412
+ connect(button, SIGNAL(pressed()), this,
1413
+ SLOT(updateUI_buttonPressed()), Qt::QueuedConnection);
1414
+ connect(button, SIGNAL(released()), this,
1415
+ SLOT(updateUI_buttonReleased()), Qt::QueuedConnection);
1416
+
1417
+ // button is released when GUI opens
1418
+ plugui->setParameter(lv2ParamCount, 0.0f);
1419
+
1420
+ lv2ParamCount++;
1421
+ }
1422
+
1423
+ // NumDisplay (list) / NumEntry / numerical HorizontalBargraph
1424
+ QDoubleSpinBox* num = qobject_cast<QDoubleSpinBox*>(*i);
1425
+ if (num) {
1426
+ // ignore QDoubleSpinBox with NoButtons, as it's not a list but
1427
+ // a NumDisplay
1428
+ if(num->buttonSymbols() != QAbstractSpinBox::NoButtons) {
1429
+ #if FAUSTQT_DEBUG>1
1430
+ qDebug("found list!");
1431
+ #endif
1432
+ num->setProperty("lv2Param", lv2ParamCount);
1433
+ QList<QObject*> c; c.append(num);
1434
+ controls.append(c);
1435
+
1436
+ connect(num, SIGNAL(valueChanged(double)), this, SLOT(updateUI()),
1437
+ Qt::QueuedConnection);
1438
+
1439
+ updateQTGUI(num, plugui->getParameter(lv2ParamCount));
1440
+
1441
+ lv2ParamCount++;
1442
+
1443
+ // if previous control is passive and vBargraphChecked==false:
1444
+ // found NumDisplay of VerticalBargraphs
1445
+ // this is always called if we found a vBargraph in the previous
1446
+ // iteration
1447
+ } else if(plugui->isPassiveControl(lv2ParamCount-1)==1
1448
+ && !vBargraphChecked) {
1449
+ #if FAUSTQT_DEBUG>1
1450
+ qDebug("found numDisplay!");
1451
+ #endif
1452
+ num->setProperty("lv2Param", lv2ParamCount-1);
1453
+ controls[lv2ParamCount-1].append(num);
1454
+ passive_controls.append(num);
1455
+
1456
+ // the corresponding display of the vBargraphs is now set
1457
+ vBargraphChecked = true;
1458
+ } else if(lv2ParamCount < plugui->n_params &&
1459
+ plugui->isPassiveControl(lv2ParamCount)==2
1460
+ && vBargraphChecked) {
1461
+ QAbstractSlider* sliderOrKnob =
1462
+ qobject_cast<QAbstractSlider*>(lastObject);
1463
+ // only if the previously found QObject is neither slider nor
1464
+ // knob
1465
+ if(!sliderOrKnob) {
1466
+ #if FAUSTQT_DEBUG>1
1467
+ qDebug("found horizontal bargraph with numerical style!");
1468
+ #endif
1469
+ num->setProperty("lv2Param", lv2ParamCount);
1470
+ QList<QObject*> c; c.append(num);
1471
+ controls.append(c);
1472
+ passive_controls.append(num);
1473
+
1474
+ lv2ParamCount++;
1475
+ }
1476
+ }
1477
+ }
1478
+
1479
+ // CheckBox
1480
+ QCheckBox* checkBox = qobject_cast<QCheckBox*>(*i);
1481
+ if (checkBox) {
1482
+ #if FAUSTQT_DEBUG>1
1483
+ qDebug("found checkbox!");
1484
+ #endif
1485
+ checkBox->setProperty("lv2Param", lv2ParamCount);
1486
+ QList<QObject*> c; c.append(checkBox);
1487
+ controls.append(c);
1488
+
1489
+ connect(checkBox, SIGNAL(stateChanged(int)), this,
1490
+ SLOT(updateUI_checkBox()), Qt::QueuedConnection);
1491
+
1492
+ // if the LV2 parameter of the checkbox is less than 0.5 then the
1493
+ // checkbox is unchecked
1494
+ updateQTGUI(checkBox, plugui->getParameter(lv2ParamCount));
1495
+
1496
+ lv2ParamCount++;
1497
+ }
1498
+
1499
+ // Bargraph
1500
+ AbstractDisplay* bargraph = dynamic_cast<AbstractDisplay*>(*i);
1501
+ if (bargraph) {
1502
+ if(plugui->isPassiveControl(lv2ParamCount)==1) {
1503
+ #if FAUSTQT_DEBUG>1
1504
+ qDebug("found vertical bargraph!");
1505
+ #endif
1506
+ vBargraphChecked = false;
1507
+ }
1508
+ #if FAUSTQT_DEBUG>1
1509
+ else
1510
+ qDebug("found horizontal bargraph!");
1511
+ #endif
1512
+
1513
+ bargraph->setProperty("lv2Param", lv2ParamCount);
1514
+ //led->setProperty("elemType", "led");
1515
+ QList<QObject*> c; c.append(bargraph);
1516
+ controls.append(c);
1517
+ passive_controls.append(bargraph);
1518
+
1519
+ lv2ParamCount++;
1520
+ }
1521
+
1522
+ // Radiobuttons
1523
+ uiRadioButtons* uiRadio = dynamic_cast<uiRadioButtons*>(*i);
1524
+ if (uiRadio) {
1525
+ #if FAUSTQT_DEBUG>1
1526
+ qDebug("found radio buttons!");
1527
+ #endif
1528
+
1529
+ QList<QRadioButton*> radiobuttons =
1530
+ uiRadio->findChildren<QRadioButton*>();
1531
+
1532
+ int radioCount = 0;
1533
+ QList<QObject*> c;
1534
+ // iterate over all radio buttons in this group
1535
+ for (QList<QRadioButton*>::iterator r = radiobuttons.begin();
1536
+ r != radiobuttons.end(); ++r) {
1537
+ float minimum = plugui->getMinimum(lv2ParamCount);
1538
+ float maximum = plugui->getMaximum(lv2ParamCount);
1539
+ float step = plugui->getStep(lv2ParamCount);
1540
+ // set all properties needed for updateUI()
1541
+ (*r)->setProperty("value", radioCount);
1542
+ (*r)->setProperty("lv2Param", lv2ParamCount);
1543
+ (*r)->setProperty("minimum", minimum);
1544
+ (*r)->setProperty("maximum", maximum);
1545
+ (*r)->setProperty("singleStep", step);
1546
+ connect((*r), SIGNAL(clicked(bool)), this, SLOT(updateUI()),
1547
+ Qt::QueuedConnection);
1548
+
1549
+ // set the proper radio button as "clicked" when the GUI opens
1550
+ updateQTGUI(*r, plugui->getParameter(lv2ParamCount));
1551
+ c.append(*r);
1552
+ radioCount++;
1553
+ }
1554
+ controls.append(c);
1555
+ lv2ParamCount++;
1556
+ }
1557
+
1558
+ // Menu
1559
+ uiMenu* menu = dynamic_cast<uiMenu*>(*i);
1560
+ if (menu) {
1561
+ #if FAUSTQT_DEBUG>1
1562
+ qDebug("found menu!");
1563
+ #endif
1564
+
1565
+ float minimum = plugui->getMinimum(lv2ParamCount);
1566
+ float maximum = plugui->getMaximum(lv2ParamCount);
1567
+ float step = plugui->getStep(lv2ParamCount);
1568
+
1569
+ menu->setProperty("lv2Param", lv2ParamCount);
1570
+ menu->setProperty("minimum", minimum);
1571
+ menu->setProperty("maximum", maximum);
1572
+ menu->setProperty("singleStep", step);
1573
+ QList<QObject*> c; c.append(menu);
1574
+ controls.append(c);
1575
+
1576
+ connect(menu, SIGNAL(activated(int)), this, SLOT(updateUI()),
1577
+ Qt::QueuedConnection);
1578
+
1579
+ updateQTGUI(menu, plugui->getParameter(lv2ParamCount));
1580
+
1581
+ lv2ParamCount++;
1582
+ }
1583
+ // save the QObject of this iteration
1584
+ lastObject = (*i);
1585
+ }
1586
+
1587
+ #if FAUSTQT_DEBUG>1
1588
+ qDebug() << "LV2 parameters assigned: " << lv2ParamCount;
1589
+ #endif
1590
+
1591
+ #ifdef HTTPCTRL
1592
+ httpdinterface->run();
1593
+ #ifdef QRCODECTRL
1594
+ // FIXME: This will pop up each time the GUI is opened. We should maybe have
1595
+ // a little button in the GUI somewhere so that the user can show the QR
1596
+ // code when needed.
1597
+ qtinterface->displayQRCode(httpdinterface->getTCPPort());
1598
+ #endif
1599
+ #endif
1600
+
1601
+ #ifdef OSCCTRL
1602
+ oscinterface->run();
1603
+ #endif
1604
+
1605
+ qtinterface->run();
1606
+
1607
+ // The STYLE symbol is set during compilation when using the -style option
1608
+ // of the faust2lv2 script or the corresponding options in the Makefile. You
1609
+ // can also set this manually if needed, but note that the corresponding
1610
+ // resource needs to be present in the qmake project (this is taken care of
1611
+ // automagically when using the -style option). Otherwise (or if no style
1612
+ // was specified) the default style will be used. -ag
1613
+ #ifdef STYLE
1614
+ // set the style sheet for this GUI, if any
1615
+ QString styleSheet("");
1616
+ // C preprocessor stringify magic to insert the style sheet name
1617
+ #define __xstr(s) __str(s)
1618
+ #define __str(s) #s
1619
+ QFile file(":/" __xstr(STYLE) ".qss");
1620
+ if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
1621
+ styleSheet = QLatin1String(file.readAll());
1622
+ file.close();
1623
+ }
1624
+ widget->setStyleSheet(styleSheet);
1625
+ #endif
1626
+
1627
+ #if FAUSTQT_DEBUG
1628
+ qDebug() << "Number of controls: " << controls.size();
1629
+ qDebug() << "Number of passive controls: " << passive_controls.size();
1630
+ #endif
1631
+
1632
+ uidsp = dsp;
1633
+ return widget;
1634
+ }
1635
+
1636
+ void LV2QtGUI::close()
1637
+ {
1638
+ #ifdef HTTPCTRL
1639
+ httpdinterface->stop();
1640
+ delete httpdinterface;
1641
+ httpdinterface = NULL;
1642
+ #endif
1643
+ #ifdef OSCCTRL
1644
+ oscinterface->stop();
1645
+ delete oscinterface;
1646
+ oscinterface = NULL;
1647
+ #endif
1648
+ qtinterface->stop();
1649
+ delete qtinterface;
1650
+ qtinterface = NULL;
1651
+ delete widget;
1652
+ widget = NULL;
1653
+ mydsp* dsp = (mydsp*)uidsp;
1654
+ delete dsp;
1655
+ dsp = NULL;
1656
+ controls.clear();
1657
+ passive_controls.clear();
1658
+ }
1659
+
1660
+ void LV2QtGUI::updateQTGUI(QObject* object, float value)
1661
+ {
1662
+ const double eps = 1e-5;
1663
+ double minimum, maximum, step, newValue;
1664
+ const char* valueChar;
1665
+
1666
+ // checkboxes and radio buttons need special treatment
1667
+ QCheckBox* checkBox = qobject_cast<QCheckBox*>(object);
1668
+ if (checkBox) {
1669
+ if (value < 0.5f)
1670
+ checkBox->setChecked(false);
1671
+ else
1672
+ checkBox->setChecked(true);
1673
+ return;
1674
+ }
1675
+
1676
+ minimum = object->property("minimum").toDouble();
1677
+ maximum = object->property("maximum").toDouble();
1678
+ step = object->property("singleStep").toDouble();
1679
+
1680
+ QRadioButton* radioBut = qobject_cast<QRadioButton*>(object);
1681
+ if (radioBut) {
1682
+ int radioVal = radioBut->property("value").toInt();
1683
+ float val = plugui->normalize(minimum, maximum, radioVal);
1684
+ if (fabs(val-value)/(1+fabs(maximum-minimum)) < eps)
1685
+ radioBut->click();
1686
+ return;
1687
+ }
1688
+
1689
+ if (QString(object->metaObject()->className())=="uiMenu")
1690
+ valueChar = "currentIndex";
1691
+ else
1692
+ valueChar = "value";
1693
+
1694
+ #if FAUSTQT_DEBUG>1
1695
+ int lv2Param = object->property("lv2Param").toInt();
1696
+ qDebug() << "QTGUI: lv2Param: " << lv2Param;
1697
+ qDebug() << "QTGUI: LV2 value: " << value;
1698
+ qDebug() << "QTGUI: old Qt value: "
1699
+ << object->property(valueChar).toDouble();
1700
+ #endif
1701
+
1702
+ newValue = (minimum==maximum)?minimum : minimum+plugui->quantize(value*
1703
+ (maximum-minimum), step);
1704
+
1705
+ if (fabs(newValue) < fabs(step) ||
1706
+ fabs(newValue)/fabs(maximum-minimum) < eps)
1707
+ newValue = 0.0;
1708
+
1709
+ // set new value with setProperty("value",..), as setValue() is not
1710
+ // defined for QObject
1711
+ object->setProperty(valueChar, newValue);
1712
+ #if FAUSTQT_DEBUG>1
1713
+ qDebug() << "QTGUI: new Qt value: "
1714
+ << object->property(valueChar).toDouble();
1715
+ #endif
1716
+ uiMenu* menu = dynamic_cast<uiMenu*>(object);
1717
+ if (menu) menu->updateZone(0); // updates the currentIndex
1718
+ }
1719
+
1720
+ void LV2QtGUI::updatePassiveControl(QObject* object, float value)
1721
+ {
1722
+ int lv2Param = object->property("lv2Param").toInt();
1723
+ float minimum = plugui->getMinimum(lv2Param);
1724
+ float maximum = plugui->getMaximum(lv2Param);
1725
+
1726
+ float fValue = value*maximum - value*minimum + minimum;
1727
+
1728
+ AbstractDisplay* bargraph = dynamic_cast<AbstractDisplay*>(object);
1729
+ QDoubleSpinBox* numDisplay = dynamic_cast<QDoubleSpinBox*>(object);
1730
+
1731
+ if(bargraph)
1732
+ bargraph->setValue(fValue);
1733
+ else if(numDisplay)
1734
+ numDisplay->setValue(fValue);
1735
+ }
1736
+
1737
+
1738
+ /***********************
1739
+ ******* Slots ********
1740
+ ***********************/
1741
+
1742
+ // The slots are called in response to interactive changes of a GUI element
1743
+ // (e.g., slider movements). Here we update the corresponding LV2 parameters.
1744
+
1745
+ void LV2QtGUI::updateUI_buttonPressed()
1746
+ {
1747
+ int lv2Param = QObject::sender()->property("lv2Param").toInt();
1748
+ #if FAUSTQT_DEBUG>1
1749
+ qDebug() << "LV2: lv2Param: " << lv2Param;
1750
+ qDebug() << "LV2: button pressed";
1751
+ #endif
1752
+ plugui->setParameter(lv2Param, 1.0f);
1753
+ }
1754
+
1755
+ void LV2QtGUI::updateUI_buttonReleased()
1756
+ {
1757
+ int lv2Param = QObject::sender()->property("lv2Param").toInt();
1758
+ #if FAUSTQT_DEBUG>1
1759
+ qDebug() << "LV2: lv2Param: " << lv2Param;
1760
+ qDebug() << "LV2: button released";
1761
+ #endif
1762
+ plugui->setParameter(lv2Param, 0.0f);
1763
+ }
1764
+
1765
+ void LV2QtGUI::updateUI_checkBox()
1766
+ {
1767
+ int lv2Param = QObject::sender()->property("lv2Param").toInt();
1768
+ #if FAUSTQT_DEBUG>1
1769
+ qDebug() << "LV2: lv2Param: " << lv2Param;
1770
+ #endif
1771
+
1772
+ // if CheckBox == checked
1773
+ if(QObject::sender()->property("checked").toBool()) {
1774
+ #if FAUSTQT_DEBUG>1
1775
+ qDebug("checkbox checked");
1776
+ #endif
1777
+ plugui->setParameter(lv2Param, 1.0f);
1778
+ } else {
1779
+ #if FAUSTQT_DEBUG>1
1780
+ qDebug("checkbox unchecked");
1781
+ #endif
1782
+ plugui->setParameter(lv2Param, 0.0f);
1783
+ }
1784
+ }
1785
+
1786
+ void LV2QtGUI::updateUI()
1787
+ {
1788
+ double value, minimum, maximum, step;
1789
+ int lv2Param;
1790
+
1791
+ // for uiMenu we have the property "currentIndex" instead of the property
1792
+ // "value"
1793
+ if (QString(QObject::sender()->metaObject()->className())=="uiMenu")
1794
+ value = QObject::sender()->property("currentIndex").toDouble();
1795
+ else
1796
+ value = QObject::sender()->property("value").toDouble();
1797
+ lv2Param = QObject::sender()->property("lv2Param").toInt();
1798
+ minimum = QObject::sender()->property("minimum").toDouble();
1799
+ maximum = QObject::sender()->property("maximum").toDouble();
1800
+ step = QObject::sender()->property("singleStep").toDouble();
1801
+
1802
+ #if FAUSTQT_DEBUG>1
1803
+ qDebug() << "LV2: lv2Param: " << lv2Param;
1804
+ char text[32];
1805
+ plugui->getParameterName(lv2Param, text);
1806
+ qDebug() << "LV2: label: " << text;
1807
+ qDebug() << "LV2: min: " << minimum;
1808
+ qDebug() << "LV2: max: " << maximum;
1809
+ qDebug() << "LV2: step: " << step;
1810
+ qDebug() << "LV2: new Qt value: " << value;
1811
+ qDebug() << "LV2: old LV2 value: " << plugui->getParameter(lv2Param);
1812
+ #endif
1813
+
1814
+ float newFloat = plugui->normalize(minimum, maximum, value);
1815
+ plugui->setParameter(lv2Param, newFloat);
1816
+ #if FAUSTQT_DEBUG>1
1817
+ qDebug() << "LV2: new LV2 value: " << plugui->getParameter(lv2Param);
1818
+ #endif
1819
+ #if VOICE_CTRLS
1820
+ if (lv2Param >= plugui->ui->nports) {
1821
+ // Extra polyphony and tuning controls. Generate some informative tooltips
1822
+ // for these so that the user understands the meaning of these values.
1823
+ QWidget *widget = qobject_cast<QWidget*>(QObject::sender());
1824
+ char text[32];
1825
+ plugui->getParameterDisplay(lv2Param, text);
1826
+ widget->setToolTip(text);
1827
+ }
1828
+ #endif
1829
+ }
1830
+
1831
+ /* LV2-specific part starts here. ********************************************/
1832
+
1833
+ // Thanks are due to Harry van Haaren and Spencer Jackson for figuring out how
1834
+ // this magic works. -ag
1835
+
1836
+ static LV2UI_Handle
1837
+ instantiate(const LV2UI_Descriptor * descriptor,
1838
+ const char * plugin_uri,
1839
+ const char * bundle_path,
1840
+ LV2UI_Write_Function write_function,
1841
+ LV2UI_Controller controller,
1842
+ LV2UI_Widget * widget,
1843
+ const LV2_Feature * const * features)
1844
+ {
1845
+ if (strcmp(plugin_uri, PLUGIN_URI)) {
1846
+ fprintf(stderr,
1847
+ "%s: ERROR: this GUI does not support plugin with URI %s\n",
1848
+ PLUGIN_URI, plugin_uri);
1849
+ return NULL;
1850
+ }
1851
+
1852
+ LV2PluginUI* plugui = new LV2PluginUI(LV2PluginUI::numVoices(),
1853
+ write_function, controller);
1854
+ LV2QtGUI* self = new LV2QtGUI(plugui);
1855
+
1856
+ if (self == NULL) return NULL;
1857
+
1858
+ *widget = (LV2UI_Widget)self->open();
1859
+
1860
+ return (LV2UI_Handle)self;
1861
+ }
1862
+
1863
+ static void
1864
+ cleanup(LV2UI_Handle ui)
1865
+ {
1866
+ LV2QtGUI* self = (LV2QtGUI*)ui;
1867
+ self->close();
1868
+ delete self->plugui;
1869
+ delete self;
1870
+ }
1871
+
1872
+ static void update_portval(LV2QtGUI* self, int i)
1873
+ {
1874
+ // Map the port (Faust control) number to the Qt control number.
1875
+ LV2PluginUI* plugui = (LV2PluginUI*)self->plugui;
1876
+ i = plugui->map_control(i);
1877
+ if (i >= 0 && i < self->controls.size() && !self->controls[i].empty()) {
1878
+ float val = plugui->getParameter(i);
1879
+ if (plugui->isPassiveControl(i)) {
1880
+ for (QList<QObject*>::iterator it = self->controls[i].begin();
1881
+ it != self->controls[i].end(); ++it)
1882
+ self->updatePassiveControl(*it, val);
1883
+ } else {
1884
+ for (QList<QObject*>::iterator it = self->controls[i].begin();
1885
+ it != self->controls[i].end(); ++it)
1886
+ self->updateQTGUI(*it, val);
1887
+ }
1888
+ }
1889
+ }
1890
+
1891
+ static
1892
+ void port_event(LV2UI_Handle ui,
1893
+ uint32_t port_index,
1894
+ uint32_t buffer_size,
1895
+ uint32_t format,
1896
+ const void * buffer)
1897
+ {
1898
+ if(!format) {
1899
+ float val = *(float*)buffer;
1900
+ LV2QtGUI* self = (LV2QtGUI*)ui;
1901
+ LV2PluginUI* plugui = (LV2PluginUI*)self->plugui;
1902
+ int i = port_index, k = plugui->ui->nports;
1903
+ int n = plugui->dsp->getNumInputs(), m = plugui->dsp->getNumOutputs();
1904
+ #if LV2UI_DEBUG
1905
+ {
1906
+ #if LV2UI_DEBUG<2
1907
+ int j = plugui->map_control(i);
1908
+ if (!plugui->isPassiveControl(j))
1909
+ #endif
1910
+ fprintf(stderr, "%s: port_event: got value %g on port #%d\n", plugui->pluginName(), val, i);
1911
+ }
1912
+ #endif
1913
+ if (i < k) { // regular dsp control
1914
+ plugui->setPortval(i, val);
1915
+ update_portval(self, i);
1916
+ } else {
1917
+ i -= k;
1918
+ if (i < n) // audio input
1919
+ goto err;
1920
+ else {
1921
+ i -= n;
1922
+ if (i < m) // audio output
1923
+ goto err;
1924
+ else if (i == m) // midi input
1925
+ goto err;
1926
+ else if (i == m+1) { // polyphony control (instruments only)
1927
+ plugui->setPortval(k, val);
1928
+ update_portval(self, k);
1929
+ } else if (i == m+2) { // tuning control (instruments only)
1930
+ plugui->setPortval(k+1, val);
1931
+ update_portval(self, k+1);
1932
+ } else {
1933
+ err:
1934
+ fprintf(stderr, "%s: bad port number %u\n", PLUGIN_URI, port_index);
1935
+ }
1936
+ }
1937
+ }
1938
+ }
1939
+ }
1940
+
1941
+ static const void*
1942
+ extension_data(const char* uri)
1943
+ {
1944
+ return NULL;
1945
+ }
1946
+
1947
+ static const LV2UI_Descriptor descriptor = {
1948
+ PLUGIN_URI "ui",
1949
+ instantiate,
1950
+ cleanup,
1951
+ port_event,
1952
+ extension_data
1953
+ };
1954
+
1955
+ extern "C"
1956
+ LV2_SYMBOL_EXPORT
1957
+ const LV2UI_Descriptor*
1958
+ lv2ui_descriptor(uint32_t index)
1959
+ {
1960
+ switch (index) {
1961
+ case 0:
1962
+ return &descriptor;
1963
+ default:
1964
+ return NULL;
1965
+ }
1966
+ }