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,1079 @@
1
+ /************************** BEGIN poly-dsp.h *************************
2
+ FAUST Architecture File
3
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
4
+ ---------------------------------------------------------------------
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU Lesser General Public License as published by
7
+ the Free Software Foundation; either version 2.1 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU Lesser General Public License for more details.
14
+
15
+ You should have received a copy of the GNU Lesser General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
+
19
+ EXCEPTION : As a special exception, you may create a larger work
20
+ that contains this FAUST architecture section and distribute
21
+ that work under terms of your choice, so long as this FAUST
22
+ architecture section is not modified.
23
+ *********************************************************************/
24
+
25
+ #ifndef __poly_dsp__
26
+ #define __poly_dsp__
27
+
28
+ #include <stdio.h>
29
+ #include <string>
30
+ #include <cmath>
31
+ #include <algorithm>
32
+ #include <functional>
33
+ #include <ostream>
34
+ #include <sstream>
35
+ #include <vector>
36
+ #include <limits.h>
37
+ #include <float.h>
38
+ #include <assert.h>
39
+
40
+ #include "faust/midi/midi.h"
41
+ #include "faust/dsp/dsp-combiner.h"
42
+ #include "faust/dsp/dsp-adapter.h"
43
+ #include "faust/dsp/proxy-dsp.h"
44
+
45
+ #include "faust/gui/DecoratorUI.h"
46
+ #include "faust/gui/GUI.h"
47
+ #include "faust/gui/MapUI.h"
48
+ #include "faust/gui/JSONControl.h"
49
+
50
+ #define kActiveVoice 0
51
+ #define kFreeVoice -1
52
+ #define kReleaseVoice -2
53
+ #define kLegatoVoice -3
54
+ #define kNoVoice -4
55
+
56
+ #define VOICE_STOP_LEVEL 0.0005 // -70 db
57
+ #define MIX_BUFFER_SIZE 4096
58
+
59
+ /**
60
+ * Allows to control zones in a grouped manner.
61
+ */
62
+ class GroupUI : public GUI, public PathBuilder {
63
+
64
+ private:
65
+
66
+ // Map to associate labels with UI group items
67
+ std::map<std::string, uiGroupItem*> fLabelZoneMap;
68
+
69
+ // Insert a zone into the map based on the label folloing the freq/gain/gate polyphonic convention
70
+ void insertMap(std::string label, FAUSTFLOAT* zone)
71
+ {
72
+ if (!MapUI::endsWith(label, "/gate")
73
+ && !MapUI::endsWith(label, "/freq")
74
+ && !MapUI::endsWith(label, "/key")
75
+ && !MapUI::endsWith(label, "/gain")
76
+ && !MapUI::endsWith(label, "/vel")
77
+ && !MapUI::endsWith(label, "/velocity")) {
78
+
79
+ // Groups all controllers except 'freq/key', 'gate', and 'gain/vel|velocity'
80
+ if (fLabelZoneMap.find(label) != fLabelZoneMap.end()) {
81
+ fLabelZoneMap[label]->addZone(zone);
82
+ } else {
83
+ fLabelZoneMap[label] = new uiGroupItem(this, zone);
84
+ }
85
+ }
86
+ }
87
+
88
+ uiCallbackItem* fPanic;
89
+
90
+ public:
91
+
92
+ GroupUI(FAUSTFLOAT* zone, uiCallback cb, void* arg)
93
+ {
94
+ fPanic = new uiCallbackItem(this, zone, cb, arg);
95
+ }
96
+
97
+ virtual ~GroupUI()
98
+ {
99
+ // 'fPanic' is kept and deleted in GUI, so do not delete here
100
+ }
101
+
102
+ // -- widget's layouts
103
+ void openTabBox(const char* label)
104
+ {
105
+ pushLabel(label);
106
+ }
107
+ void openHorizontalBox(const char* label)
108
+ {
109
+ pushLabel(label);
110
+ }
111
+ void openVerticalBox(const char* label)
112
+ {
113
+ pushLabel(label);
114
+ }
115
+ void closeBox()
116
+ {
117
+ popLabel();
118
+ }
119
+
120
+ // -- active widgets
121
+ void addButton(const char* label, FAUSTFLOAT* zone)
122
+ {
123
+ insertMap(buildPath(label), zone);
124
+ }
125
+ void addCheckButton(const char* label, FAUSTFLOAT* zone)
126
+ {
127
+ insertMap(buildPath(label), zone);
128
+ }
129
+ void addVerticalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT fmin, FAUSTFLOAT fmax, FAUSTFLOAT step)
130
+ {
131
+ insertMap(buildPath(label), zone);
132
+ }
133
+ void addHorizontalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT fmin, FAUSTFLOAT fmax, FAUSTFLOAT step)
134
+ {
135
+ insertMap(buildPath(label), zone);
136
+ }
137
+ void addNumEntry(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT fmin, FAUSTFLOAT fmax, FAUSTFLOAT step)
138
+ {
139
+ insertMap(buildPath(label), zone);
140
+ }
141
+
142
+ // -- passive widgets
143
+ void addHorizontalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT fmin, FAUSTFLOAT fmax)
144
+ {
145
+ insertMap(buildPath(label), zone);
146
+ }
147
+ void addVerticalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT fmin, FAUSTFLOAT fmax)
148
+ {
149
+ insertMap(buildPath(label), zone);
150
+ }
151
+
152
+ };
153
+
154
+ /**
155
+ * One voice of polyphony.
156
+ */
157
+ struct dsp_voice : public MapUI, public decorator_dsp {
158
+
159
+ typedef std::function<double(int)> TransformFunction;
160
+
161
+ // Convert MIDI note to frequency
162
+ static double midiToFreq(double note)
163
+ {
164
+ return 440.0 * std::pow(2.0, (note-69.0)/12.0);
165
+ }
166
+
167
+ // Voice state and properties
168
+ int fCurNote; // Current playing note pitch
169
+ int fNextNote; // In kLegatoVoice state, next note to play
170
+ int fNextVel; // In kLegatoVoice state, next velocity to play
171
+ int fDate; // KeyOn date
172
+ int fRelease; // Current number of samples used in release mode to detect end of note
173
+ FAUSTFLOAT fLevel; // Last audio block level
174
+ double fReleaseLengthSec; // Maximum release length in seconds (estimated time to silence after note release)
175
+ std::vector<std::string> fGatePath; // Paths of 'gate' control
176
+ std::vector<std::string> fGainPath; // Paths of 'gain/vel|velocity' control
177
+ std::vector<std::string> fFreqPath; // Paths of 'freq/key' control
178
+ TransformFunction fKeyFun; // MIDI key to freq conversion function
179
+ TransformFunction fVelFun; // MIDI velocity to gain conversion function
180
+
181
+ FAUSTFLOAT** fInputsSlice;
182
+ FAUSTFLOAT** fOutputsSlice;
183
+
184
+ dsp_voice(dsp* dsp):decorator_dsp(dsp)
185
+ {
186
+ // Default conversion functions
187
+ fVelFun = [](int velocity) { return double(velocity)/127.0; };
188
+ fKeyFun = [](int pitch) { return midiToFreq(pitch); };
189
+ dsp->buildUserInterface(this);
190
+ fCurNote = kFreeVoice;
191
+ fNextNote = fNextVel = -1;
192
+ fLevel = FAUSTFLOAT(0);
193
+ fDate = fRelease = 0;
194
+ fReleaseLengthSec = 0.5; // A half second is a reasonable default maximum release length.
195
+ extractPaths(fGatePath, fFreqPath, fGainPath);
196
+ }
197
+ virtual ~dsp_voice()
198
+ {}
199
+
200
+ // Compute a slice of audio
201
+ void computeSlice(int offset, int slice, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs)
202
+ {
203
+ FAUSTFLOAT** inputsSlice = static_cast<FAUSTFLOAT**>(alloca(sizeof(FAUSTFLOAT*) * getNumInputs()));
204
+ for (int chan = 0; chan < getNumInputs(); chan++) {
205
+ inputsSlice[chan] = &(inputs[chan][offset]);
206
+ }
207
+ FAUSTFLOAT** outputsSlice = static_cast<FAUSTFLOAT**>(alloca(sizeof(FAUSTFLOAT*) * getNumOutputs()));
208
+ for (int chan = 0; chan < getNumOutputs(); chan++) {
209
+ outputsSlice[chan] = &(outputs[chan][offset]);
210
+ }
211
+ compute(slice, inputsSlice, outputsSlice);
212
+ }
213
+
214
+ // Compute audio in legato mode
215
+ void computeLegato(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs)
216
+ {
217
+ int slice = count/2;
218
+
219
+ // Reset envelops
220
+ for (size_t i = 0; i < fGatePath.size(); i++) {
221
+ setParamValue(fGatePath[i], FAUSTFLOAT(0));
222
+ }
223
+
224
+ // Compute current voice on half buffer
225
+ computeSlice(0, slice, inputs, outputs);
226
+
227
+ // Start next keyOn
228
+ keyOn(fNextNote, fNextVel);
229
+
230
+ // Compute on second half buffer
231
+ computeSlice(slice, slice, inputs, outputs);
232
+ }
233
+
234
+ // Extract control paths from fullpath map
235
+ void extractPaths(std::vector<std::string>& gate, std::vector<std::string>& freq, std::vector<std::string>& gain)
236
+ {
237
+ // Keep gain/vel|velocity, freq/key and gate labels
238
+ for (const auto& it : getFullpathMap()) {
239
+ std::string path = it.first;
240
+ if (endsWith(path, "/gate")) {
241
+ gate.push_back(path);
242
+ } else if (endsWith(path, "/freq")) {
243
+ fKeyFun = [](int pitch) { return midiToFreq(pitch); };
244
+ freq.push_back(path);
245
+ } else if (endsWith(path, "/key")) {
246
+ fKeyFun = [](int pitch) { return pitch; };
247
+ freq.push_back(path);
248
+ } else if (endsWith(path, "/gain")) {
249
+ fVelFun = [](int velocity) { return double(velocity)/127.0; };
250
+ gain.push_back(path);
251
+ } else if (endsWith(path, "/vel") || endsWith(path, "/velocity")) {
252
+ fVelFun = [](int velocity) { return double(velocity); };
253
+ gain.push_back(path);
254
+ }
255
+ }
256
+ }
257
+
258
+ // Reset voice
259
+ void reset()
260
+ {
261
+ init(getSampleRate());
262
+ }
263
+
264
+ // Clear instance state
265
+ void instanceClear()
266
+ {
267
+ decorator_dsp::instanceClear();
268
+ fCurNote = kFreeVoice;
269
+ fNextNote = fNextVel = -1;
270
+ fLevel = FAUSTFLOAT(0);
271
+ fDate = fRelease = 0;
272
+ }
273
+
274
+ // Keep 'pitch' and 'velocity' to fadeOut the current voice and start next one in the next buffer
275
+ void keyOn(int pitch, int velocity, bool legato = false)
276
+ {
277
+ if (legato) {
278
+ fNextNote = pitch;
279
+ fNextVel = velocity;
280
+ } else {
281
+ keyOn(pitch, fVelFun(velocity));
282
+ }
283
+ }
284
+
285
+ // KeyOn with normalized MIDI velocity [0..1]
286
+ void keyOn(int pitch, double velocity)
287
+ {
288
+ for (size_t i = 0; i < fFreqPath.size(); i++) {
289
+ setParamValue(fFreqPath[i], fKeyFun(pitch));
290
+ }
291
+ for (size_t i = 0; i < fGatePath.size(); i++) {
292
+ setParamValue(fGatePath[i], FAUSTFLOAT(1));
293
+ }
294
+ for (size_t i = 0; i < fGainPath.size(); i++) {
295
+ setParamValue(fGainPath[i], velocity);
296
+ }
297
+
298
+ fCurNote = pitch;
299
+ }
300
+
301
+ void keyOff(bool hard = false)
302
+ {
303
+ // No use of velocity for now...
304
+ for (size_t i = 0; i < fGatePath.size(); i++) {
305
+ setParamValue(fGatePath[i], FAUSTFLOAT(0));
306
+ }
307
+
308
+ if (hard) {
309
+ // Immediately stop voice
310
+ fCurNote = kFreeVoice;
311
+ } else {
312
+ // Release voice
313
+ fRelease = fReleaseLengthSec * fDSP->getSampleRate();
314
+ fCurNote = kReleaseVoice;
315
+ }
316
+ }
317
+
318
+ // Change the voice release
319
+ void setReleaseLength(double sec)
320
+ {
321
+ fReleaseLengthSec = sec;
322
+ }
323
+
324
+ };
325
+
326
+ /**
327
+ * A group of voices.
328
+ */
329
+ struct dsp_voice_group {
330
+
331
+ // GUI group for controlling voice parameters
332
+ GroupUI fGroups;
333
+
334
+ std::vector<dsp_voice*> fVoiceTable; // Individual voices
335
+ dsp* fVoiceGroup; // Voices group to be used for GUI grouped control
336
+
337
+ FAUSTFLOAT fPanic; // Panic button value
338
+
339
+ bool fVoiceControl; // Voice control mode
340
+ bool fGroupControl; // Group control mode
341
+
342
+ dsp_voice_group(uiCallback cb, void* arg, bool control, bool group)
343
+ :fGroups(&fPanic, cb, arg),
344
+ fVoiceGroup(0), fPanic(FAUSTFLOAT(0)),
345
+ fVoiceControl(control), fGroupControl(group)
346
+ {}
347
+
348
+ virtual ~dsp_voice_group()
349
+ {
350
+ for (size_t i = 0; i < fVoiceTable.size(); i++) {
351
+ delete fVoiceTable[i];
352
+ }
353
+ delete fVoiceGroup;
354
+ }
355
+
356
+ // Add a voice to the group
357
+ void addVoice(dsp_voice* voice)
358
+ {
359
+ fVoiceTable.push_back(voice);
360
+ }
361
+
362
+ // Clear all voices from the group
363
+ void clearVoices()
364
+ {
365
+ fVoiceTable.clear();
366
+ }
367
+
368
+ // Initialize the voice group
369
+ void init()
370
+ {
371
+ // Groups all uiItem for a given path
372
+ fVoiceGroup = new proxy_dsp(fVoiceTable[0]);
373
+ fVoiceGroup->buildUserInterface(&fGroups);
374
+ for (size_t i = 0; i < fVoiceTable.size(); i++) {
375
+ fVoiceTable[i]->buildUserInterface(&fGroups);
376
+ }
377
+ }
378
+
379
+ // Reset the user interface for each voice instance
380
+ void instanceResetUserInterface()
381
+ {
382
+ for (size_t i = 0; i < fVoiceTable.size(); i++) {
383
+ fVoiceTable[i]->instanceResetUserInterface();
384
+ }
385
+ }
386
+
387
+ // Build the user interface for the voice group
388
+ void buildUserInterface(UI* ui_interface)
389
+ {
390
+ if (fVoiceTable.size() > 1) {
391
+ ui_interface->openTabBox("Polyphonic");
392
+
393
+ // Grouped voices UI
394
+ ui_interface->openVerticalBox("Voices");
395
+ ui_interface->addButton("Panic", &fPanic);
396
+ fVoiceGroup->buildUserInterface(ui_interface);
397
+ ui_interface->closeBox();
398
+
399
+ // If not grouped, also add individual voices UI
400
+ if (!fGroupControl || dynamic_cast<SoundUIInterface*>(ui_interface)) {
401
+ for (size_t i = 0; i < fVoiceTable.size(); i++) {
402
+ char buffer[32];
403
+ snprintf(buffer, 32, ((fVoiceTable.size() < 8) ? "Voice%ld" : "V%ld"), long(i+1));
404
+ ui_interface->openHorizontalBox(buffer);
405
+ fVoiceTable[i]->buildUserInterface(ui_interface);
406
+ ui_interface->closeBox();
407
+ }
408
+ }
409
+
410
+ ui_interface->closeBox();
411
+ } else {
412
+ fVoiceTable[0]->buildUserInterface(ui_interface);
413
+ }
414
+ }
415
+
416
+ };
417
+
418
+ /**
419
+ * Base class for MIDI controllable polyphonic DSP.
420
+ */
421
+ #ifdef EMCC
422
+ #include "faust/gui/JSONUI.h"
423
+ #include "faust/gui/MidiUI.h"
424
+ #endif
425
+
426
+ class dsp_poly : public decorator_dsp, public midi, public JSONControl {
427
+
428
+ protected:
429
+
430
+ #ifdef EMCC
431
+ MapUI fMapUI; // Map for UI control
432
+ std::string fJSON; // JSON representation of the UI
433
+ midi_handler fMidiHandler; // MIDI handler for the UI
434
+ MidiUI fMIDIUI; // MIDI UI for the DSP
435
+ #endif
436
+
437
+ public:
438
+
439
+ #ifdef EMCC
440
+ dsp_poly(dsp* dsp):decorator_dsp(dsp), fMIDIUI(&fMidiHandler)
441
+ {
442
+ JSONUI jsonui(getNumInputs(), getNumOutputs());
443
+ buildUserInterface(&jsonui);
444
+ fJSON = jsonui.JSON(true);
445
+ buildUserInterface(&fMapUI);
446
+ buildUserInterface(&fMIDIUI);
447
+ }
448
+ #else
449
+ dsp_poly(dsp* dsp):decorator_dsp(dsp)
450
+ {}
451
+ #endif
452
+
453
+ virtual ~dsp_poly() {}
454
+
455
+ // Reimplemented for EMCC
456
+ #ifdef EMCC
457
+ virtual int getNumInputs() { return decorator_dsp::getNumInputs(); }
458
+ virtual int getNumOutputs() { return decorator_dsp::getNumOutputs(); }
459
+ virtual void buildUserInterface(UI* ui_interface) { decorator_dsp::buildUserInterface(ui_interface); }
460
+ virtual int getSampleRate() { return decorator_dsp::getSampleRate(); }
461
+ virtual void init(int sample_rate) { decorator_dsp::init(sample_rate); }
462
+ virtual void instanceInit(int sample_rate) { decorator_dsp::instanceInit(sample_rate); }
463
+ virtual void instanceConstants(int sample_rate) { decorator_dsp::instanceConstants(sample_rate); }
464
+ virtual void instanceResetUserInterface() { decorator_dsp::instanceResetUserInterface(); }
465
+ virtual void instanceClear() { decorator_dsp::instanceClear(); }
466
+ virtual dsp_poly* clone() { return new dsp_poly(fDSP->clone()); }
467
+ virtual void metadata(Meta* m) { decorator_dsp::metadata(m); }
468
+
469
+ // Additional API
470
+ std::string getJSON()
471
+ {
472
+ return fJSON;
473
+ }
474
+
475
+ virtual void setParamValue(const std::string& path, FAUSTFLOAT value)
476
+ {
477
+ fMapUI.setParamValue(path, value);
478
+ GUI::updateAllGuis();
479
+ }
480
+
481
+ virtual FAUSTFLOAT getParamValue(const std::string& path) { return fMapUI.getParamValue(path); }
482
+
483
+ virtual void computeJS(int count, uintptr_t inputs, uintptr_t outputs)
484
+ {
485
+ decorator_dsp::compute(count, reinterpret_cast<FAUSTFLOAT**>(inputs),reinterpret_cast<FAUSTFLOAT**>(outputs));
486
+ }
487
+ #endif
488
+
489
+ virtual MapUI* keyOn(int channel, int pitch, int velocity)
490
+ {
491
+ return midi::keyOn(channel, pitch, velocity);
492
+ }
493
+ virtual void keyOff(int channel, int pitch, int velocity)
494
+ {
495
+ midi::keyOff(channel, pitch, velocity);
496
+ }
497
+ virtual void keyPress(int channel, int pitch, int press)
498
+ {
499
+ midi::keyPress(channel, pitch, press);
500
+ }
501
+ virtual void chanPress(int channel, int press)
502
+ {
503
+ midi::chanPress(channel, press);
504
+ }
505
+ virtual void ctrlChange(int channel, int ctrl, int value)
506
+ {
507
+ midi::ctrlChange(channel, ctrl, value);
508
+ }
509
+ virtual void ctrlChange14bits(int channel, int ctrl, int value)
510
+ {
511
+ midi::ctrlChange14bits(channel, ctrl, value);
512
+ }
513
+ virtual void pitchWheel(int channel, int wheel)
514
+ {
515
+ #ifdef EMCC
516
+ fMIDIUI.pitchWheel(0., channel, wheel);
517
+ GUI::updateAllGuis();
518
+ #else
519
+ midi::pitchWheel(channel, wheel);
520
+ #endif
521
+ }
522
+ virtual void progChange(int channel, int pgm)
523
+ {
524
+ midi::progChange(channel, pgm);
525
+ }
526
+
527
+ // Change the voice release
528
+ virtual void setReleaseLength(double seconds)
529
+ {}
530
+
531
+ };
532
+
533
+ /**
534
+ * Polyphonic DSP: groups a set of DSP to be played together or triggered by MIDI.
535
+ *
536
+ * All voices are preallocated by cloning the single DSP voice given at creation time.
537
+ * Dynamic voice allocation is done in 'getFreeVoice'
538
+ */
539
+ class mydsp_poly : public dsp_voice_group, public dsp_poly {
540
+
541
+ private:
542
+
543
+ FAUSTFLOAT** fMixBuffer; // Intermediate buffer for mixing voices
544
+ FAUSTFLOAT** fOutBuffer; // Intermediate buffer for output
545
+ midi_interface* fMidiHandler; // The midi_interface the DSP is connected to
546
+ int fDate; // Current date for managing voices
547
+
548
+ // Fade out the audio in the buffer
549
+ void fadeOut(int count, FAUSTFLOAT** outBuffer)
550
+ {
551
+ // FadeOut on half buffer
552
+ for (int chan = 0; chan < getNumOutputs(); chan++) {
553
+ double factor = 1., step = 1./double(count);
554
+ for (int frame = 0; frame < count; frame++) {
555
+ outBuffer[chan][frame] *= factor;
556
+ factor -= step;
557
+ }
558
+ }
559
+ }
560
+
561
+ // Mix the audio from the mix buffer to the output buffer, and also calculate the maximum level on the buffer
562
+ FAUSTFLOAT mixCheckVoice(int count, FAUSTFLOAT** mixBuffer, FAUSTFLOAT** outBuffer)
563
+ {
564
+ FAUSTFLOAT level = 0;
565
+ for (int chan = 0; chan < getNumOutputs(); chan++) {
566
+ FAUSTFLOAT* mixChannel = mixBuffer[chan];
567
+ FAUSTFLOAT* outChannel = outBuffer[chan];
568
+ for (int frame = 0; frame < count; frame++) {
569
+ level = std::max<FAUSTFLOAT>(level, (FAUSTFLOAT)fabs(mixChannel[frame]));
570
+ outChannel[frame] += mixChannel[frame];
571
+ }
572
+ }
573
+ return level;
574
+ }
575
+
576
+ // Mix the audio from the mix buffer to the output buffer
577
+ void mixVoice(int count, FAUSTFLOAT** mixBuffer, FAUSTFLOAT** outBuffer)
578
+ {
579
+ for (int chan = 0; chan < getNumOutputs(); chan++) {
580
+ FAUSTFLOAT* mixChannel = mixBuffer[chan];
581
+ FAUSTFLOAT* outChannel = outBuffer[chan];
582
+ for (int frame = 0; frame < count; frame++) {
583
+ outChannel[frame] += mixChannel[frame];
584
+ }
585
+ }
586
+ }
587
+
588
+ // Copy the audio from one buffer to another
589
+ void copy(int count, FAUSTFLOAT** mixBuffer, FAUSTFLOAT** outBuffer)
590
+ {
591
+ for (int chan = 0; chan < getNumOutputs(); chan++) {
592
+ memcpy(outBuffer[chan], mixBuffer[chan], count * sizeof(FAUSTFLOAT));
593
+ }
594
+ }
595
+
596
+ // Clear the audio buffer
597
+ void clear(int count, FAUSTFLOAT** outBuffer)
598
+ {
599
+ for (int chan = 0; chan < getNumOutputs(); chan++) {
600
+ memset(outBuffer[chan], 0, count * sizeof(FAUSTFLOAT));
601
+ }
602
+ }
603
+
604
+ // Get the index of a voice currently playing a specific pitch
605
+ int getPlayingVoice(int pitch)
606
+ {
607
+ int voice_playing = kNoVoice;
608
+ int oldest_date_playing = INT_MAX;
609
+
610
+ for (size_t i = 0; i < fVoiceTable.size(); i++) {
611
+ if (fVoiceTable[i]->fCurNote == pitch) {
612
+ // Keeps oldest playing voice
613
+ if (fVoiceTable[i]->fDate < oldest_date_playing) {
614
+ oldest_date_playing = fVoiceTable[i]->fDate;
615
+ voice_playing = int(i);
616
+ }
617
+ }
618
+ }
619
+
620
+ return voice_playing;
621
+ }
622
+
623
+ // Allocate a voice with a given type
624
+ int allocVoice(int voice, int type)
625
+ {
626
+ fVoiceTable[voice]->fDate++;
627
+ fVoiceTable[voice]->fCurNote = type;
628
+ return voice;
629
+ }
630
+
631
+ // Get a free voice for allocation, always returns a voice
632
+ int getFreeVoice()
633
+ {
634
+ // Looks for the first available voice
635
+ for (size_t i = 0; i < fVoiceTable.size(); i++) {
636
+ if (fVoiceTable[i]->fCurNote == kFreeVoice) {
637
+ return allocVoice(i, kActiveVoice);
638
+ }
639
+ }
640
+
641
+ // Otherwise steal one
642
+ int voice_release = kNoVoice;
643
+ int voice_playing = kNoVoice;
644
+ int oldest_date_release = INT_MAX;
645
+ int oldest_date_playing = INT_MAX;
646
+
647
+ // Scan all voices
648
+ for (size_t i = 0; i < fVoiceTable.size(); i++) {
649
+ if (fVoiceTable[i]->fCurNote == kReleaseVoice) {
650
+ // Keeps oldest release voice
651
+ if (fVoiceTable[i]->fDate < oldest_date_release) {
652
+ oldest_date_release = fVoiceTable[i]->fDate;
653
+ voice_release = int(i);
654
+ }
655
+ } else {
656
+ // Otherwise keeps oldest playing voice
657
+ if (fVoiceTable[i]->fDate < oldest_date_playing) {
658
+ oldest_date_playing = fVoiceTable[i]->fDate;
659
+ voice_playing = int(i);
660
+ }
661
+ }
662
+ }
663
+
664
+ // Then decide which one to steal
665
+ if (oldest_date_release != INT_MAX) {
666
+ fprintf(stderr, "Steal release voice : voice_date = %d cur_date = %d voice = %d \n",
667
+ fVoiceTable[voice_release]->fDate,
668
+ fDate,
669
+ voice_release);
670
+ return allocVoice(voice_release, kLegatoVoice);
671
+ } else if (oldest_date_playing != INT_MAX) {
672
+ fprintf(stderr, "Steal playing voice : voice_date = %d cur_date = %d voice = %d \n",
673
+ fVoiceTable[voice_playing]->fDate,
674
+ fDate,
675
+ voice_release);
676
+ return allocVoice(voice_playing, kLegatoVoice);
677
+ } else {
678
+ assert(false);
679
+ return kNoVoice;
680
+ }
681
+ }
682
+
683
+ // Callback for panic button
684
+ static void panic(FAUSTFLOAT val, void* arg)
685
+ {
686
+ if (val == FAUSTFLOAT(1)) {
687
+ static_cast<mydsp_poly*>(arg)->allNotesOff(true);
688
+ }
689
+ }
690
+
691
+ // Check if the DSP is polyphonic
692
+ bool checkPolyphony()
693
+ {
694
+ if (fVoiceTable.size() > 0) {
695
+ return true;
696
+ } else {
697
+ fprintf(stderr, "DSP is not polyphonic...\n");
698
+ return false;
699
+ }
700
+ }
701
+
702
+ public:
703
+
704
+ /**
705
+ * Constructor.
706
+ *
707
+ * @param dsp - the dsp to be used for one voice. Beware: mydsp_poly will use and finally delete the pointer.
708
+ * @param nvoices - number of polyphony voices, should be at least 1
709
+ * @param control - whether voices will be dynamically allocated and controlled (typically by a MIDI controler).
710
+ * If false all voices are always running.
711
+ * @param group - if true, voices are not individually accessible, a global "Voices" tab will automatically dispatch
712
+ * a given control on all voices, assuming GUI::updateAllGuis() is called.
713
+ * If false, all voices can be individually controlled.
714
+ *
715
+ */
716
+ mydsp_poly(dsp* dsp,
717
+ int nvoices,
718
+ bool control = false,
719
+ bool group = true)
720
+ : dsp_voice_group(panic, this, control, group), dsp_poly(dsp) // dsp parameter is deallocated by ~dsp_poly
721
+ {
722
+ fDate = 0;
723
+ fMidiHandler = nullptr;
724
+
725
+ // Create voices
726
+ assert(nvoices > 0);
727
+ for (int i = 0; i < nvoices; i++) {
728
+ addVoice(new dsp_voice(dsp->clone()));
729
+ }
730
+
731
+ // Init audio output buffers
732
+ fMixBuffer = new FAUSTFLOAT*[getNumOutputs()];
733
+ fOutBuffer = new FAUSTFLOAT*[getNumOutputs()];
734
+ for (int chan = 0; chan < getNumOutputs(); chan++) {
735
+ fMixBuffer[chan] = new FAUSTFLOAT[MIX_BUFFER_SIZE];
736
+ fOutBuffer[chan] = new FAUSTFLOAT[MIX_BUFFER_SIZE];
737
+ }
738
+
739
+ dsp_voice_group::init();
740
+ }
741
+
742
+ virtual ~mydsp_poly()
743
+ {
744
+ // Remove from fMidiHandler
745
+ if (fMidiHandler) fMidiHandler->removeMidiIn(this);
746
+ for (int chan = 0; chan < getNumOutputs(); chan++) {
747
+ delete[] fMixBuffer[chan];
748
+ delete[] fOutBuffer[chan];
749
+ }
750
+ delete[] fMixBuffer;
751
+ delete[] fOutBuffer;
752
+
753
+ }
754
+
755
+ // DSP API
756
+ void buildUserInterface(UI* ui_interface)
757
+ {
758
+ // MidiUI ui_interface contains the midi_handler connected to the MIDI driver
759
+ if (dynamic_cast<midi_interface*>(ui_interface)) {
760
+ fMidiHandler = dynamic_cast<midi_interface*>(ui_interface);
761
+ fMidiHandler->addMidiIn(this);
762
+ }
763
+ dsp_voice_group::buildUserInterface(ui_interface);
764
+ }
765
+
766
+ void init(int sample_rate)
767
+ {
768
+ decorator_dsp::init(sample_rate);
769
+ fVoiceGroup->init(sample_rate);
770
+ fPanic = FAUSTFLOAT(0);
771
+
772
+ // Init voices
773
+ for (size_t i = 0; i < fVoiceTable.size(); i++) {
774
+ fVoiceTable[i]->init(sample_rate);
775
+ }
776
+ }
777
+
778
+ void instanceInit(int samplingFreq)
779
+ {
780
+ instanceConstants(samplingFreq);
781
+ instanceResetUserInterface();
782
+ instanceClear();
783
+ }
784
+
785
+ void instanceConstants(int sample_rate)
786
+ {
787
+ decorator_dsp::instanceConstants(sample_rate);
788
+ fVoiceGroup->instanceConstants(sample_rate);
789
+
790
+ // Init voices
791
+ for (size_t i = 0; i < fVoiceTable.size(); i++) {
792
+ fVoiceTable[i]->instanceConstants(sample_rate);
793
+ }
794
+ }
795
+
796
+ void instanceResetUserInterface()
797
+ {
798
+ decorator_dsp::instanceResetUserInterface();
799
+ fVoiceGroup->instanceResetUserInterface();
800
+ fPanic = FAUSTFLOAT(0);
801
+
802
+ for (size_t i = 0; i < fVoiceTable.size(); i++) {
803
+ fVoiceTable[i]->instanceResetUserInterface();
804
+ }
805
+ }
806
+
807
+ void instanceClear()
808
+ {
809
+ decorator_dsp::instanceClear();
810
+ fVoiceGroup->instanceClear();
811
+
812
+ for (size_t i = 0; i < fVoiceTable.size(); i++) {
813
+ fVoiceTable[i]->instanceClear();
814
+ }
815
+ }
816
+
817
+ virtual mydsp_poly* clone()
818
+ {
819
+ return new mydsp_poly(fDSP->clone(), int(fVoiceTable.size()), fVoiceControl, fGroupControl);
820
+ }
821
+
822
+ void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs)
823
+ {
824
+ assert(count <= MIX_BUFFER_SIZE);
825
+
826
+ // First clear the intermediate fOutBuffer
827
+ clear(count, fOutBuffer);
828
+
829
+ if (fVoiceControl) {
830
+ // Mix all playing voices
831
+ for (size_t i = 0; i < fVoiceTable.size(); i++) {
832
+ dsp_voice* voice = fVoiceTable[i];
833
+ if (voice->fCurNote == kLegatoVoice) {
834
+ // Play from current note and next note
835
+ voice->computeLegato(count, inputs, fMixBuffer);
836
+ // FadeOut on first half buffer
837
+ fadeOut(count/2, fMixBuffer);
838
+ // Mix it in result
839
+ voice->fLevel = mixCheckVoice(count, fMixBuffer, fOutBuffer);
840
+ } else if (voice->fCurNote != kFreeVoice) {
841
+ // Compute current note
842
+ voice->compute(count, inputs, fMixBuffer);
843
+ // Mix it in result
844
+ voice->fLevel = mixCheckVoice(count, fMixBuffer, fOutBuffer);
845
+ // Check the level to possibly set the voice in kFreeVoice again
846
+ voice->fRelease -= count;
847
+ if ((voice->fCurNote == kReleaseVoice)
848
+ && (voice->fRelease < 0)
849
+ && (voice->fLevel < VOICE_STOP_LEVEL)) {
850
+ voice->fCurNote = kFreeVoice;
851
+ }
852
+ }
853
+ }
854
+ } else {
855
+ // Mix all voices
856
+ for (size_t i = 0; i < fVoiceTable.size(); i++) {
857
+ fVoiceTable[i]->compute(count, inputs, fMixBuffer);
858
+ mixVoice(count, fMixBuffer, fOutBuffer);
859
+ }
860
+ }
861
+
862
+ // Finally copy intermediate buffer to outputs
863
+ copy(count, fOutBuffer, outputs);
864
+ }
865
+
866
+ void compute(double date_usec, int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs)
867
+ {
868
+ compute(count, inputs, outputs);
869
+ }
870
+
871
+ // Terminate all active voices, gently or immediately (depending of 'hard' value)
872
+ void allNotesOff(bool hard = false)
873
+ {
874
+ for (size_t i = 0; i < fVoiceTable.size(); i++) {
875
+ fVoiceTable[i]->keyOff(hard);
876
+ }
877
+ }
878
+
879
+ // Additional polyphonic API
880
+ MapUI* newVoice()
881
+ {
882
+ return fVoiceTable[getFreeVoice()];
883
+ }
884
+
885
+ void deleteVoice(MapUI* voice)
886
+ {
887
+ auto it = find(fVoiceTable.begin(), fVoiceTable.end(), reinterpret_cast<dsp_voice*>(voice));
888
+ if (it != fVoiceTable.end()) {
889
+ dsp_voice* voice = *it;
890
+ voice->keyOff();
891
+ voice->reset();
892
+ } else {
893
+ fprintf(stderr, "Voice not found\n");
894
+ }
895
+ }
896
+
897
+ // MIDI API
898
+ MapUI* keyOn(int channel, int pitch, int velocity)
899
+ {
900
+ if (checkPolyphony()) {
901
+ int voice = getFreeVoice();
902
+ fVoiceTable[voice]->keyOn(pitch, velocity, fVoiceTable[voice]->fCurNote == kLegatoVoice);
903
+ return fVoiceTable[voice];
904
+ } else {
905
+ return 0;
906
+ }
907
+ }
908
+
909
+ void keyOff(int channel, int pitch, int velocity = 127)
910
+ {
911
+ if (checkPolyphony()) {
912
+ int voice = getPlayingVoice(pitch);
913
+ if (voice != kNoVoice) {
914
+ fVoiceTable[voice]->keyOff();
915
+ } else {
916
+ fprintf(stderr, "Playing pitch = %d not found\n", pitch);
917
+ }
918
+ }
919
+ }
920
+
921
+ void ctrlChange(int channel, int ctrl, int value)
922
+ {
923
+ if (ctrl == ALL_NOTES_OFF || ctrl == ALL_SOUND_OFF) {
924
+ allNotesOff();
925
+ }
926
+ }
927
+
928
+ // Change the voice release
929
+ void setReleaseLength(double seconds)
930
+ {
931
+ for (size_t i = 0; i < fVoiceTable.size(); i++) {
932
+ fVoiceTable[i]->setReleaseLength(seconds);
933
+ }
934
+ }
935
+
936
+ };
937
+
938
+ /**
939
+ * Polyphonic DSP with an integrated effect.
940
+ */
941
+ class dsp_poly_effect : public dsp_poly {
942
+
943
+ private:
944
+
945
+ // fPolyDSP will respond to MIDI messages.
946
+ dsp_poly* fPolyDSP;
947
+
948
+ public:
949
+
950
+ dsp_poly_effect(dsp_poly* voice, dsp* combined)
951
+ :dsp_poly(combined), fPolyDSP(voice)
952
+ {}
953
+
954
+ virtual ~dsp_poly_effect()
955
+ {
956
+ // dsp_poly_effect is also a decorator_dsp, which will free fPolyDSP
957
+ }
958
+
959
+ // MIDI API
960
+ MapUI* keyOn(int channel, int pitch, int velocity)
961
+ {
962
+ return fPolyDSP->keyOn(channel, pitch, velocity);
963
+ }
964
+ void keyOff(int channel, int pitch, int velocity)
965
+ {
966
+ fPolyDSP->keyOff(channel, pitch, velocity);
967
+ }
968
+ void keyPress(int channel, int pitch, int press)
969
+ {
970
+ fPolyDSP->keyPress(channel, pitch, press);
971
+ }
972
+ void chanPress(int channel, int press)
973
+ {
974
+ fPolyDSP->chanPress(channel, press);
975
+ }
976
+ void ctrlChange(int channel, int ctrl, int value)
977
+ {
978
+ fPolyDSP->ctrlChange(channel, ctrl, value);
979
+ }
980
+ void ctrlChange14bits(int channel, int ctrl, int value)
981
+ {
982
+ fPolyDSP->ctrlChange14bits(channel, ctrl, value);
983
+ }
984
+ void pitchWheel(int channel, int wheel)
985
+ {
986
+ fPolyDSP->pitchWheel(channel, wheel);
987
+ }
988
+ void progChange(int channel, int pgm)
989
+ {
990
+ fPolyDSP->progChange(channel, pgm);
991
+ }
992
+
993
+ // Change the voice release
994
+ void setReleaseLength(double sec)
995
+ {
996
+ fPolyDSP->setReleaseLength(sec);
997
+ }
998
+
999
+ };
1000
+
1001
+ /**
1002
+ * Polyphonic DSP factory class. Helper code to support polyphonic DSP source with an integrated effect.
1003
+ */
1004
+ struct dsp_poly_factory : public dsp_factory {
1005
+
1006
+ dsp_factory* fProcessFactory;
1007
+ dsp_factory* fEffectFactory;
1008
+
1009
+ dsp* adaptDSP(dsp* dsp, bool is_double)
1010
+ {
1011
+ return (is_double) ? new dsp_sample_adapter<double, float>(dsp) : dsp;
1012
+ }
1013
+
1014
+ dsp_poly_factory(dsp_factory* process_factory = nullptr,
1015
+ dsp_factory* effect_factory = nullptr):
1016
+ fProcessFactory(process_factory)
1017
+ ,fEffectFactory(effect_factory)
1018
+ {}
1019
+
1020
+ virtual ~dsp_poly_factory()
1021
+ {}
1022
+
1023
+ std::string getName() { return fProcessFactory->getName(); }
1024
+ std::string getSHAKey() { return fProcessFactory->getSHAKey(); }
1025
+ std::string getDSPCode() { return fProcessFactory->getDSPCode(); }
1026
+ std::string getCompileOptions() { return fProcessFactory->getCompileOptions(); }
1027
+ std::vector<std::string> getLibraryList() { return fProcessFactory->getLibraryList(); }
1028
+ std::vector<std::string> getIncludePathnames() { return fProcessFactory->getIncludePathnames(); }
1029
+ std::vector<std::string> getWarningMessages() { return fProcessFactory->getWarningMessages(); }
1030
+
1031
+ std::string getEffectCode(const std::string& dsp_content)
1032
+ {
1033
+ std::stringstream effect_code;
1034
+ effect_code << "adapt(1,1) = _; adapt(2,2) = _,_; adapt(1,2) = _ <: _,_; adapt(2,1) = _,_ :> _;";
1035
+ effect_code << "adaptor(F,G) = adapt(outputs(F),inputs(G)); dsp_code = environment{ " << dsp_content << " };";
1036
+ effect_code << "process = adaptor(dsp_code.process, dsp_code.effect) : dsp_code.effect;";
1037
+ return effect_code.str();
1038
+ }
1039
+
1040
+ virtual void setMemoryManager(dsp_memory_manager* manager)
1041
+ {
1042
+ fProcessFactory->setMemoryManager(manager);
1043
+ if (fEffectFactory) {
1044
+ fEffectFactory->setMemoryManager(manager);
1045
+ }
1046
+ }
1047
+ virtual dsp_memory_manager* getMemoryManager() { return fProcessFactory->getMemoryManager(); }
1048
+
1049
+ /* Create a new polyphonic DSP instance with global effect, to be deleted with C++ 'delete'
1050
+ *
1051
+ * @param nvoices - number of polyphony voices, should be at least 1
1052
+ * @param control - whether voices will be dynamically allocated and controlled (typically by a MIDI controler).
1053
+ * If false all voices are always running.
1054
+ * @param group - if true, voices are not individually accessible, a global "Voices" tab will automatically dispatch
1055
+ * a given control on all voices, assuming GUI::updateAllGuis() is called.
1056
+ * If false, all voices can be individually controlled.
1057
+ * @param is_double - if true, internally allocated DSPs will be adapted to receive 'double' samples.
1058
+ */
1059
+ dsp_poly* createPolyDSPInstance(int nvoices, bool control, bool group, bool is_double = false)
1060
+ {
1061
+ dsp_poly* dsp_poly = new mydsp_poly(adaptDSP(fProcessFactory->createDSPInstance(), is_double), nvoices, control, group);
1062
+ if (fEffectFactory) {
1063
+ // the 'dsp_poly' object has to be controlled with MIDI, so kept separated from new dsp_sequencer(...) object
1064
+ return new dsp_poly_effect(dsp_poly, new dsp_sequencer(dsp_poly, adaptDSP(fEffectFactory->createDSPInstance(), is_double)));
1065
+ } else {
1066
+ return new dsp_poly_effect(dsp_poly, dsp_poly);
1067
+ }
1068
+ }
1069
+
1070
+ /* Create a new DSP instance, to be deleted with C++ 'delete' */
1071
+ dsp* createDSPInstance()
1072
+ {
1073
+ return fProcessFactory->createDSPInstance();
1074
+ }
1075
+
1076
+ };
1077
+
1078
+ #endif // __poly_dsp__
1079
+ /************************** END poly-dsp.h **************************/