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,1414 @@
1
+ /************************** BEGIN GTKUI.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 FAUST_GTKUI_H
26
+ #define FAUST_GTKUI_H
27
+
28
+ /******************************************************************************
29
+ *******************************************************************************
30
+
31
+ GRAPHIC USER INTERFACE
32
+ gtk interface
33
+
34
+ *******************************************************************************
35
+ *******************************************************************************/
36
+ #include <set>
37
+ #include <string>
38
+
39
+ #include <math.h>
40
+ #include <stdlib.h>
41
+ #include <string.h>
42
+
43
+ #include <algorithm>
44
+ #include <assert.h>
45
+ #include <gdk/gdkkeysyms.h>
46
+ #include <gtk/gtk.h>
47
+
48
+ #include "faust/gui/GUI.h"
49
+ #include "faust/gui/MetaDataUI.h"
50
+
51
+ #define kStackSize 256
52
+
53
+ // Insertion modes
54
+
55
+ #define kSingleMode 0
56
+ #define kBoxMode 1
57
+ #define kTabMode 2
58
+
59
+ //------------ calculate needed precision
60
+ static int precision(double n)
61
+ {
62
+ if (n < 0.009999)
63
+ return 3;
64
+ else if (n < 0.099999)
65
+ return 2;
66
+ else if (n < 0.999999)
67
+ return 1;
68
+ else
69
+ return 0;
70
+ }
71
+
72
+ namespace gtk_knob {
73
+
74
+ class GtkKnob {
75
+ private:
76
+ public:
77
+ GtkRange parent;
78
+ int last_quadrant;
79
+ GtkKnob();
80
+ ~GtkKnob();
81
+ GtkWidget* gtk_knob_new_with_adjustment(GtkAdjustment* _adjustment);
82
+ };
83
+
84
+ #define GTK_TYPE_KNOB (gtk_knob_get_type())
85
+ #define GTK_KNOB(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_KNOB, GtkKnob))
86
+ #define GTK_IS_KNOB(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_KNOB))
87
+ #define GTK_KNOB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_KNOB, GtkKnobClass))
88
+ #define GTK_IS_KNOB_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_KNOB))
89
+
90
+ GtkKnob::GtkKnob()
91
+ // GtkKnob constructor
92
+ {
93
+ }
94
+
95
+ GtkKnob::~GtkKnob()
96
+ {
97
+ // Nothing specific to do...
98
+ }
99
+
100
+ struct GtkKnobClass {
101
+ GtkRangeClass parent_class;
102
+ int knob_x;
103
+ int knob_y;
104
+ int knob_step;
105
+ int button_is;
106
+ };
107
+
108
+ //------forward declaration
109
+ GType gtk_knob_get_type();
110
+
111
+ /****************************************************************
112
+ ** calculate the knop pointer with dead zone
113
+ */
114
+
115
+ const double scale_zero = 20 * (M_PI / 180); // defines "dead zone" for knobs
116
+
117
+ static void knob_expose(GtkWidget* widget, int knob_x, int knob_y, GdkEventExpose* event, int arc_offset)
118
+ {
119
+ /** check resize **/
120
+ int grow;
121
+ if (widget->allocation.width > widget->allocation.height) {
122
+ grow = widget->allocation.height;
123
+ } else {
124
+ grow = widget->allocation.width;
125
+ }
126
+ knob_x = grow - 4;
127
+ knob_y = grow - 4;
128
+ /** get values for the knob **/
129
+ GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(widget));
130
+ int knobx = (widget->allocation.x + 2 + (widget->allocation.width - 4 - knob_x) * 0.5);
131
+ int knoby = (widget->allocation.y + 2 + (widget->allocation.height - 4 - knob_y) * 0.5);
132
+ int knobx1 = (widget->allocation.x + 2 + (widget->allocation.width - 4) * 0.5);
133
+ int knoby1 = (widget->allocation.y + 2 + (widget->allocation.height - 4) * 0.5);
134
+ double knobstate = (adj->value - adj->lower) / (adj->upper - adj->lower);
135
+ double angle = scale_zero + knobstate * 2 * (M_PI - scale_zero);
136
+ double knobstate1 = (0. - adj->lower) / (adj->upper - adj->lower);
137
+ double pointer_off = knob_x / 6;
138
+ double radius = std::min<double>(knob_x - pointer_off, knob_y - pointer_off) / 2;
139
+ double lengh_x = (knobx + radius + pointer_off / 2) - radius * sin(angle);
140
+ double lengh_y = (knoby + radius + pointer_off / 2) + radius * cos(angle);
141
+ double radius1 = std::min<double>(knob_x, knob_y) / 2;
142
+
143
+ /** get widget forground color convert to cairo **/
144
+ GtkStyle* style = gtk_widget_get_style(widget);
145
+ double r = std::min<double>(0.6, style->fg[gtk_widget_get_state(widget)].red / 65535.0),
146
+ g = std::min<double>(0.6, style->fg[gtk_widget_get_state(widget)].green / 65535.0),
147
+ b = std::min<double>(0.6, style->fg[gtk_widget_get_state(widget)].blue / 65535.0);
148
+
149
+ /** paint focus **/
150
+ if (GTK_WIDGET_HAS_FOCUS(widget)) {
151
+ gtk_paint_focus(widget->style, widget->window, GTK_STATE_NORMAL, NULL, widget, NULL, knobx - 2, knoby - 2,
152
+ knob_x + 4, knob_y + 4);
153
+ }
154
+ /** create clowing knobs with cairo **/
155
+ cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window));
156
+ GdkRegion* region;
157
+ region = gdk_region_rectangle(&widget->allocation);
158
+ gdk_region_intersect(region, event->region);
159
+ gdk_cairo_region(cr, region);
160
+ cairo_clip(cr);
161
+
162
+ cairo_arc(cr, knobx1 + arc_offset, knoby1 + arc_offset, knob_x / 2.1, 0, 2 * M_PI);
163
+ cairo_pattern_t* pat =
164
+ cairo_pattern_create_radial(knobx1 + arc_offset - knob_x / 6, knoby1 + arc_offset - knob_x / 6, 1,
165
+ knobx1 + arc_offset, knoby1 + arc_offset, knob_x / 2.1);
166
+ if (adj->lower < 0 && adj->value > 0.) {
167
+ cairo_pattern_add_color_stop_rgb(pat, 0, r + 0.4, g + 0.4 + knobstate - knobstate1, b + 0.4);
168
+ cairo_pattern_add_color_stop_rgb(pat, 0.7, r + 0.15, g + 0.15 + (knobstate - knobstate1) * 0.5, b + 0.15);
169
+ cairo_pattern_add_color_stop_rgb(pat, 1, r, g, b);
170
+ } else if (adj->lower < 0 && adj->value <= 0.) {
171
+ cairo_pattern_add_color_stop_rgb(pat, 0, r + 0.4 + knobstate1 - knobstate, g + 0.4, b + 0.4);
172
+ cairo_pattern_add_color_stop_rgb(pat, 0.7, r + 0.15 + (knobstate1 - knobstate) * 0.5, g + 0.15, b + 0.15);
173
+ cairo_pattern_add_color_stop_rgb(pat, 1, r, g, b);
174
+ } else {
175
+ cairo_pattern_add_color_stop_rgb(pat, 0, r + 0.4, g + 0.4 + knobstate, b + 0.4);
176
+ cairo_pattern_add_color_stop_rgb(pat, 0.7, r + 0.15, g + 0.15 + knobstate * 0.5, b + 0.15);
177
+ cairo_pattern_add_color_stop_rgb(pat, 1, r, g, b);
178
+ }
179
+ cairo_set_source(cr, pat);
180
+ cairo_fill_preserve(cr);
181
+ gdk_cairo_set_source_color(cr, gtk_widget_get_style(widget)->fg);
182
+ cairo_set_line_width(cr, 2.0);
183
+ cairo_stroke(cr);
184
+
185
+ /** create a rotating pointer on the kob**/
186
+ cairo_set_source_rgb(cr, 0.1, 0.1, 0.1);
187
+ cairo_set_line_width(cr, std::max<double>(3, std::min<double>(7, knob_x / 15)));
188
+ cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
189
+ cairo_set_line_join(cr, CAIRO_LINE_JOIN_BEVEL);
190
+ cairo_move_to(cr, knobx + radius1, knoby + radius1);
191
+ cairo_line_to(cr, lengh_x, lengh_y);
192
+ cairo_stroke(cr);
193
+ cairo_set_source_rgb(cr, 0.9, 0.9, 0.9);
194
+ cairo_set_line_width(cr, std::min<double>(5, std::max<double>(1, knob_x / 30)));
195
+ cairo_move_to(cr, knobx + radius1, knoby + radius1);
196
+ cairo_line_to(cr, lengh_x, lengh_y);
197
+ cairo_stroke(cr);
198
+ cairo_pattern_destroy(pat);
199
+ gdk_region_destroy(region);
200
+ cairo_destroy(cr);
201
+ }
202
+
203
+ /****************************************************************
204
+ ** general expose events for all "knob" controllers
205
+ */
206
+
207
+ //----------- draw the Knob when moved
208
+ static gboolean gtk_knob_expose(GtkWidget* widget, GdkEventExpose* event)
209
+ {
210
+ g_assert(GTK_IS_KNOB(widget));
211
+ GtkKnobClass* klass = GTK_KNOB_CLASS(GTK_OBJECT_GET_CLASS(widget));
212
+ knob_expose(widget, klass->knob_x, klass->knob_y, event, 0);
213
+ return true;
214
+ }
215
+
216
+ /****************************************************************
217
+ ** set initial size for GdkDrawable per type
218
+ */
219
+
220
+ static void gtk_knob_size_request(GtkWidget* widget, GtkRequisition* requisition)
221
+ {
222
+ g_assert(GTK_IS_KNOB(widget));
223
+ GtkKnobClass* klass = GTK_KNOB_CLASS(GTK_OBJECT_GET_CLASS(widget));
224
+ requisition->width = klass->knob_x;
225
+ requisition->height = klass->knob_y;
226
+ }
227
+
228
+ /****************************************************************
229
+ ** set value from key bindings
230
+ */
231
+
232
+ static void gtk_knob_set_value(GtkWidget* widget, int dir_down)
233
+ {
234
+ g_assert(GTK_IS_KNOB(widget));
235
+
236
+ GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(widget));
237
+
238
+ int oldstep = (int)(0.5f + (adj->value - adj->lower) / adj->step_increment);
239
+ int step;
240
+ int nsteps = (int)(0.5f + (adj->upper - adj->lower) / adj->step_increment);
241
+ if (dir_down) {
242
+ step = oldstep - 1;
243
+ } else {
244
+ step = oldstep + 1;
245
+ }
246
+ FAUSTFLOAT value = adj->lower + step * double(adj->upper - adj->lower) / nsteps;
247
+ gtk_widget_grab_focus(widget);
248
+ gtk_range_set_value(GTK_RANGE(widget), value);
249
+ }
250
+
251
+ /****************************************************************
252
+ ** keyboard bindings
253
+ */
254
+
255
+ static gboolean gtk_knob_key_press(GtkWidget* widget, GdkEventKey* event)
256
+ {
257
+ g_assert(GTK_IS_KNOB(widget));
258
+
259
+ GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(widget));
260
+ switch (event->keyval) {
261
+ case GDK_Home:
262
+ gtk_range_set_value(GTK_RANGE(widget), adj->lower);
263
+ return true;
264
+ case GDK_End:
265
+ gtk_range_set_value(GTK_RANGE(widget), adj->upper);
266
+ return true;
267
+ case GDK_Up:
268
+ gtk_knob_set_value(widget, 0);
269
+ return true;
270
+ case GDK_Right:
271
+ gtk_knob_set_value(widget, 0);
272
+ return true;
273
+ case GDK_Down:
274
+ gtk_knob_set_value(widget, 1);
275
+ return true;
276
+ case GDK_Left:
277
+ gtk_knob_set_value(widget, 1);
278
+ return true;
279
+ }
280
+
281
+ return false;
282
+ }
283
+
284
+ /****************************************************************
285
+ ** alternative (radial) knob motion mode (ctrl + mouse pressed)
286
+ */
287
+
288
+ static void knob_pointer_event(GtkWidget* widget, gdouble x, gdouble y, int knob_x, int knob_y, bool drag, int state)
289
+ {
290
+ static double last_y = 2e20;
291
+ GtkKnob* knob = GTK_KNOB(widget);
292
+ GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(widget));
293
+ double radius = std::min<double>(knob_x, knob_y) / 2;
294
+ int knobx = (widget->allocation.width - knob_x) / 2;
295
+ int knoby = (widget->allocation.height - knob_y) / 2;
296
+ double posx = (knobx + radius) - x; // x axis right -> left
297
+ double posy = (knoby + radius) - y; // y axis top -> bottom
298
+ double value;
299
+ if (!drag) {
300
+ if (state & GDK_CONTROL_MASK) {
301
+ last_y = 2e20;
302
+ return;
303
+ } else {
304
+ last_y = posy;
305
+ }
306
+ }
307
+ if (last_y < 1e20) { // in drag started with Control Key
308
+ const double scaling = 0.005;
309
+ double scal = (state & GDK_SHIFT_MASK ? scaling * 0.1 : scaling);
310
+ value = (last_y - posy) * scal;
311
+ last_y = posy;
312
+ gtk_range_set_value(GTK_RANGE(widget), adj->value - value * (adj->upper - adj->lower));
313
+ return;
314
+ }
315
+
316
+ double angle = atan2(-posx, posy) + M_PI; // clockwise, zero at 6 o'clock, 0 .. 2*M_PI
317
+ if (drag) {
318
+ // block "forbidden zone" and direct moves between quadrant 1 and 4
319
+ int quadrant = 1 + int(angle / M_PI_2);
320
+ if (knob->last_quadrant == 1 && (quadrant == 3 || quadrant == 4)) {
321
+ angle = scale_zero;
322
+ } else if (knob->last_quadrant == 4 && (quadrant == 1 || quadrant == 2)) {
323
+ angle = 2 * M_PI - scale_zero;
324
+ } else {
325
+ if (angle < scale_zero) {
326
+ angle = scale_zero;
327
+ } else if (angle > 2 * M_PI - scale_zero) {
328
+ angle = 2 * M_PI - scale_zero;
329
+ }
330
+ knob->last_quadrant = quadrant;
331
+ }
332
+ } else {
333
+ if (angle < scale_zero) {
334
+ angle = scale_zero;
335
+ } else if (angle > 2 * M_PI - scale_zero) {
336
+ angle = 2 * M_PI - scale_zero;
337
+ }
338
+ knob->last_quadrant = 0;
339
+ }
340
+ angle = (angle - scale_zero) / (2 * (M_PI - scale_zero)); // normalize to 0..1
341
+ gtk_range_set_value(GTK_RANGE(widget), adj->lower + angle * (adj->upper - adj->lower));
342
+ }
343
+
344
+ /****************************************************************
345
+ ** mouse button pressed set value
346
+ */
347
+
348
+ static gboolean gtk_knob_button_press(GtkWidget* widget, GdkEventButton* event)
349
+ {
350
+ g_assert(GTK_IS_KNOB(widget));
351
+
352
+ GtkKnobClass* klass = GTK_KNOB_CLASS(GTK_OBJECT_GET_CLASS(widget));
353
+
354
+ switch (event->button) {
355
+ case 1: // left button
356
+ gtk_widget_grab_focus(widget);
357
+ gtk_widget_grab_default(widget);
358
+ gtk_grab_add(widget);
359
+ klass->button_is = 1;
360
+ knob_pointer_event(widget, event->x, event->y, klass->knob_x, klass->knob_y, false, event->state);
361
+ break;
362
+ case 2: // wheel
363
+ klass->button_is = 2;
364
+ break;
365
+ case 3: // right button
366
+ klass->button_is = 3;
367
+ break;
368
+ default: // do nothing
369
+ break;
370
+ }
371
+ return true;
372
+ }
373
+
374
+ /****************************************************************
375
+ ** mouse button release
376
+ */
377
+
378
+ static gboolean gtk_knob_button_release(GtkWidget* widget, GdkEventButton* event)
379
+ {
380
+ g_assert(GTK_IS_KNOB(widget));
381
+ GTK_KNOB_CLASS(GTK_OBJECT_GET_CLASS(widget))->button_is = 0;
382
+ if (GTK_WIDGET_HAS_GRAB(widget)) gtk_grab_remove(widget);
383
+ return false;
384
+ }
385
+
386
+ /****************************************************************
387
+ ** set the value from mouse movement
388
+ */
389
+
390
+ static gboolean gtk_knob_pointer_motion(GtkWidget* widget, GdkEventMotion* event)
391
+ {
392
+ g_assert(GTK_IS_KNOB(widget));
393
+ GtkKnobClass* klass = GTK_KNOB_CLASS(GTK_OBJECT_GET_CLASS(widget));
394
+
395
+ gdk_event_request_motions(event);
396
+
397
+ if (GTK_WIDGET_HAS_GRAB(widget)) {
398
+ knob_pointer_event(widget, event->x, event->y, klass->knob_x, klass->knob_y, true, event->state);
399
+ }
400
+ return false;
401
+ }
402
+
403
+ /****************************************************************
404
+ ** set value from mouseweel
405
+ */
406
+
407
+ static gboolean gtk_knob_scroll(GtkWidget* widget, GdkEventScroll* event)
408
+ {
409
+ usleep(5000);
410
+ gtk_knob_set_value(widget, event->direction);
411
+ return false;
412
+ }
413
+
414
+ /****************************************************************
415
+ ** init the GtkKnobClass
416
+ */
417
+
418
+ static void gtk_knob_class_init(GtkKnobClass* klass)
419
+ {
420
+ GtkWidgetClass* widget_class = GTK_WIDGET_CLASS(klass);
421
+
422
+ /** set here the sizes and steps for the used knob **/
423
+ //--------- small knob size and steps
424
+
425
+ klass->knob_x = 30;
426
+ klass->knob_y = 30;
427
+ klass->knob_step = 86;
428
+
429
+ //--------- event button
430
+ klass->button_is = 0;
431
+
432
+ //--------- connect the events with funktions
433
+ widget_class->expose_event = gtk_knob_expose;
434
+ widget_class->size_request = gtk_knob_size_request;
435
+ widget_class->button_press_event = gtk_knob_button_press;
436
+ widget_class->button_release_event = gtk_knob_button_release;
437
+ widget_class->motion_notify_event = gtk_knob_pointer_motion;
438
+ widget_class->key_press_event = gtk_knob_key_press;
439
+ widget_class->scroll_event = gtk_knob_scroll;
440
+ }
441
+
442
+ /****************************************************************
443
+ ** init the Knob type/size
444
+ */
445
+
446
+ static void gtk_knob_init(GtkKnob* knob)
447
+ {
448
+ GtkWidget* widget = GTK_WIDGET(knob);
449
+ GtkKnobClass* klass = GTK_KNOB_CLASS(GTK_OBJECT_GET_CLASS(widget));
450
+
451
+ GTK_WIDGET_SET_FLAGS(GTK_WIDGET(knob), GTK_CAN_FOCUS);
452
+ GTK_WIDGET_SET_FLAGS(GTK_WIDGET(knob), GTK_CAN_DEFAULT);
453
+
454
+ widget->requisition.width = klass->knob_x;
455
+ widget->requisition.height = klass->knob_y;
456
+ }
457
+
458
+ /****************************************************************
459
+ ** redraw when value changed
460
+ */
461
+
462
+ static gboolean gtk_knob_value_changed(gpointer obj)
463
+ {
464
+ GtkWidget* widget = (GtkWidget*)obj;
465
+ gtk_widget_queue_draw(widget);
466
+ return false;
467
+ }
468
+
469
+ /****************************************************************
470
+ ** create small knob
471
+ */
472
+
473
+ GtkWidget* GtkKnob::gtk_knob_new_with_adjustment(GtkAdjustment* _adjustment)
474
+ {
475
+ GtkWidget* widget = GTK_WIDGET(g_object_new(GTK_TYPE_KNOB, NULL));
476
+ GtkKnob* knob = GTK_KNOB(widget);
477
+ knob->last_quadrant = 0;
478
+ if (widget) {
479
+ gtk_range_set_adjustment(GTK_RANGE(widget), _adjustment);
480
+ g_signal_connect(GTK_OBJECT(widget), "value-changed", G_CALLBACK(gtk_knob_value_changed), widget);
481
+ }
482
+ return widget;
483
+ }
484
+
485
+ /****************************************************************
486
+ ** get the Knob type
487
+ */
488
+
489
+ GType gtk_knob_get_type(void)
490
+ {
491
+ static GType kn_type = 0;
492
+ if (!kn_type) {
493
+ static const GTypeInfo kn_info = {sizeof(GtkKnobClass),
494
+ NULL,
495
+ NULL,
496
+ (GClassInitFunc)gtk_knob_class_init,
497
+ NULL,
498
+ NULL,
499
+ sizeof(GtkKnob),
500
+ 0,
501
+ (GInstanceInitFunc)gtk_knob_init,
502
+ NULL};
503
+ kn_type = g_type_register_static(GTK_TYPE_RANGE, "GtkKnob", &kn_info, (GTypeFlags)0);
504
+ }
505
+ return kn_type;
506
+ }
507
+ } // namespace gtk_knob
508
+
509
+ gtk_knob::GtkKnob myGtkKnob;
510
+
511
+ class GTKUI : public GUI, public MetaDataUI {
512
+ protected:
513
+ GtkWidget* fWindow;
514
+ GtkWidget* fScrolledWindow;
515
+ int fTop;
516
+ GtkWidget* fBox[kStackSize];
517
+ int fMode[kStackSize];
518
+
519
+ GtkWidget* addWidget(const char* label, GtkWidget* w);
520
+ virtual void pushBox(int mode, GtkWidget* w);
521
+
522
+ public:
523
+ static const gboolean expand = true;
524
+ static const gboolean fill = true;
525
+ static const gboolean homogene = false;
526
+ static gboolean gInitialized;
527
+
528
+ GTKUI(char* name, int* pargc, char*** pargv);
529
+
530
+ // -- Labels and metadata
531
+
532
+ virtual void declare(FAUSTFLOAT* zone, const char* key, const char* value);
533
+ virtual int checkLabelOptions(GtkWidget* widget, const std::string& fullLabel, std::string& simplifiedLabel);
534
+ virtual void checkForTooltip(FAUSTFLOAT* zone, GtkWidget* widget);
535
+
536
+ // -- layout groups
537
+
538
+ virtual void openTabBox(const char* label = "");
539
+ virtual void openHorizontalBox(const char* label = "");
540
+ virtual void openVerticalBox(const char* label = "");
541
+ virtual void closeBox();
542
+
543
+ // -- active widgets
544
+
545
+ virtual void addButton(const char* label, FAUSTFLOAT* zone);
546
+ virtual void addCheckButton(const char* label, FAUSTFLOAT* zone);
547
+ virtual void addVerticalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max,
548
+ FAUSTFLOAT step);
549
+ virtual void addHorizontalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min,
550
+ FAUSTFLOAT max, FAUSTFLOAT step);
551
+ virtual void addNumEntry(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max,
552
+ FAUSTFLOAT step);
553
+
554
+ // -- passive display widgets
555
+
556
+ virtual void addHorizontalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max);
557
+ virtual void addVerticalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max);
558
+
559
+ // -- layout groups - internal
560
+
561
+ virtual void openFrameBox(const char* label);
562
+
563
+ // -- extra widget's layouts
564
+
565
+ virtual void openDialogBox(const char* label, FAUSTFLOAT* zone);
566
+ virtual void openEventBox(const char* label = "");
567
+ virtual void openHandleBox(const char* label = "");
568
+ virtual void openExpanderBox(const char* label, FAUSTFLOAT* zone);
569
+
570
+ virtual void adjustStack(int n);
571
+
572
+ // -- active widgets - internal
573
+ virtual void addToggleButton(const char* label, FAUSTFLOAT* zone);
574
+ virtual void addKnob(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max,
575
+ FAUSTFLOAT step);
576
+
577
+ // -- passive display widgets - internal
578
+
579
+ virtual void addNumDisplay(const char* label, FAUSTFLOAT* zone, int precision);
580
+ virtual void addTextDisplay(const char* label, FAUSTFLOAT* zone, const char* names[], FAUSTFLOAT min,
581
+ FAUSTFLOAT max);
582
+
583
+ virtual bool run();
584
+ virtual void stop();
585
+ };
586
+
587
+ /******************************************************************************
588
+ *******************************************************************************
589
+
590
+ GRAPHIC USER INTERFACE (v2)
591
+ gtk implementation
592
+
593
+ *******************************************************************************
594
+ *******************************************************************************/
595
+
596
+ // global static fields
597
+ gboolean GTKUI::gInitialized = false;
598
+
599
+ static gboolean delete_event(GtkWidget* widget, GdkEvent* event, gpointer data)
600
+ {
601
+ return false;
602
+ }
603
+
604
+ static void destroy_event(GtkWidget* widget, gpointer data)
605
+ {
606
+ if (GTKUI::gInitialized) {
607
+ gtk_main_quit();
608
+ GTKUI::gInitialized = false;
609
+ }
610
+ }
611
+
612
+ GTKUI::GTKUI(char* name, int* pargc, char*** pargv)
613
+ {
614
+ if (!gInitialized) {
615
+ gtk_init(pargc, pargv);
616
+ gInitialized = true;
617
+ }
618
+ fWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
619
+ // gtk_container_set_border_width (GTK_CONTAINER (fWindow), 10);
620
+ gtk_window_set_title(GTK_WINDOW(fWindow), name);
621
+ gtk_signal_connect(GTK_OBJECT(fWindow), "delete_event", GTK_SIGNAL_FUNC(delete_event), NULL);
622
+ gtk_signal_connect(GTK_OBJECT(fWindow), "destroy", GTK_SIGNAL_FUNC(destroy_event), NULL);
623
+
624
+ fTop = 0;
625
+ fBox[fTop] = gtk_vbox_new(homogene, 4);
626
+ fMode[fTop] = kBoxMode;
627
+ }
628
+
629
+ // Stack a box
630
+ void GTKUI::pushBox(int mode, GtkWidget* w)
631
+ {
632
+ ++fTop;
633
+ assert(fTop < kStackSize);
634
+ fMode[fTop] = mode;
635
+ fBox[fTop] = w;
636
+ }
637
+
638
+ /**
639
+ * Remove n levels from the stack S before the top level
640
+ * adjustStack(n): S -> S' with S' = S(0),S(n+1),S(n+2),...
641
+ */
642
+ void GTKUI::adjustStack(int n)
643
+ {
644
+ if (n > 0) {
645
+ assert(fTop >= n);
646
+ fTop -= n;
647
+ fMode[fTop] = fMode[fTop + n];
648
+ fBox[fTop] = fBox[fTop + n];
649
+ }
650
+ }
651
+
652
+ void GTKUI::closeBox()
653
+ {
654
+ --fTop;
655
+ assert(fTop >= 0);
656
+ }
657
+
658
+ /**
659
+ * Analyses the widget zone metadata declarations and takes
660
+ * appropriate actions
661
+ */
662
+ void GTKUI::declare(FAUSTFLOAT* zone, const char* key, const char* value)
663
+ {
664
+ MetaDataUI::declare(zone, key, value);
665
+ }
666
+
667
+ /**
668
+ * Analyses a full label and activates the relevant options. returns a simplified
669
+ * label (without options) and an amount of stack adjustement (in case additional
670
+ * containers were pushed on the stack).
671
+ */
672
+
673
+ int GTKUI::checkLabelOptions(GtkWidget* widget, const std::string& fullLabel, std::string& simplifiedLabel)
674
+ {
675
+ std::map<std::string, std::string> metadata;
676
+ extractMetadata(fullLabel, simplifiedLabel, metadata);
677
+
678
+ if (metadata.count("tooltip")) {
679
+ gtk_tooltips_set_tip(gtk_tooltips_new(), widget, metadata["tooltip"].c_str(), NULL);
680
+ }
681
+ if (metadata["option"] == "detachable") {
682
+ openHandleBox(simplifiedLabel.c_str());
683
+ return 1;
684
+ }
685
+
686
+ //---------------------
687
+ if (fGroupTooltip != "") {
688
+ gtk_tooltips_set_tip(gtk_tooltips_new(), widget, fGroupTooltip.c_str(), NULL);
689
+ fGroupTooltip = "";
690
+ }
691
+
692
+ //----------------------
693
+ // no adjustement of the stack needed
694
+ return 0;
695
+ }
696
+
697
+ /**
698
+ * Check if a tooltip is associated to a zone and add it to the corresponding widget
699
+ */
700
+ void GTKUI::checkForTooltip(FAUSTFLOAT* zone, GtkWidget* widget)
701
+ {
702
+ if (fTooltip.count(zone)) {
703
+ gtk_tooltips_set_tip(gtk_tooltips_new(), widget, fTooltip[zone].c_str(), NULL);
704
+ }
705
+ }
706
+
707
+ // The different boxes
708
+ void GTKUI::openFrameBox(const char* label)
709
+ {
710
+ GtkWidget* box = gtk_frame_new(label);
711
+ // gtk_container_set_border_width (GTK_CONTAINER (box), 10);
712
+
713
+ pushBox(kSingleMode, addWidget(label, box));
714
+ }
715
+
716
+ void GTKUI::openTabBox(const char* fullLabel)
717
+ {
718
+ std::string label;
719
+ GtkWidget* widget = gtk_notebook_new();
720
+
721
+ int adjust = checkLabelOptions(widget, fullLabel, label);
722
+
723
+ pushBox(kTabMode, addWidget(label.c_str(), widget));
724
+
725
+ // adjust stack because otherwise Handlebox will remain open
726
+ adjustStack(adjust);
727
+ }
728
+
729
+ void GTKUI::openHorizontalBox(const char* fullLabel)
730
+ {
731
+ std::string label;
732
+ GtkWidget* box = gtk_hbox_new(homogene, 4);
733
+ int adjust = checkLabelOptions(box, fullLabel, label);
734
+
735
+ gtk_container_set_border_width(GTK_CONTAINER(box), 10);
736
+ label = startWith(label, "0x") ? "" : label;
737
+
738
+ if (fMode[fTop] != kTabMode && label[0] != 0) {
739
+ GtkWidget* frame = addWidget(label.c_str(), gtk_frame_new(label.c_str()));
740
+ gtk_container_add(GTK_CONTAINER(frame), box);
741
+ gtk_widget_show(box);
742
+ pushBox(kBoxMode, box);
743
+ } else {
744
+ pushBox(kBoxMode, addWidget(label.c_str(), box));
745
+ }
746
+
747
+ // adjust stack because otherwise Handlebox will remain open
748
+ adjustStack(adjust);
749
+ }
750
+
751
+ void GTKUI::openVerticalBox(const char* fullLabel)
752
+ {
753
+ std::string label;
754
+ GtkWidget* box = gtk_vbox_new(homogene, 4);
755
+ int adjust = checkLabelOptions(box, fullLabel, label);
756
+
757
+ gtk_container_set_border_width(GTK_CONTAINER(box), 10);
758
+ label = startWith(label, "0x") ? "" : label;
759
+
760
+ if (fMode[fTop] != kTabMode && label[0] != 0) {
761
+ GtkWidget* frame = addWidget(label.c_str(), gtk_frame_new(label.c_str()));
762
+ gtk_container_add(GTK_CONTAINER(frame), box);
763
+ gtk_widget_show(box);
764
+ pushBox(kBoxMode, box);
765
+ } else {
766
+ pushBox(kBoxMode, addWidget(label.c_str(), box));
767
+ }
768
+
769
+ // adjust stack because otherwise Handlebox will remain open
770
+ adjustStack(adjust);
771
+ }
772
+
773
+ void GTKUI::openHandleBox(const char* label)
774
+ {
775
+ GtkWidget* box = gtk_hbox_new(homogene, 4);
776
+ gtk_container_set_border_width(GTK_CONTAINER(box), 2);
777
+ label = startWith(label, "0x") ? "" : label;
778
+ if (fMode[fTop] != kTabMode && label[0] != 0) {
779
+ GtkWidget* frame = addWidget(label, gtk_handle_box_new());
780
+ gtk_container_add(GTK_CONTAINER(frame), box);
781
+ gtk_widget_show(box);
782
+ pushBox(kBoxMode, box);
783
+ } else {
784
+ pushBox(kBoxMode, addWidget(label, box));
785
+ }
786
+ }
787
+
788
+ void GTKUI::openEventBox(const char* label)
789
+ {
790
+ GtkWidget* box = gtk_hbox_new(homogene, 4);
791
+ gtk_container_set_border_width(GTK_CONTAINER(box), 2);
792
+ label = startWith(label, "0x") ? "" : label;
793
+ if (fMode[fTop] != kTabMode && label[0] != 0) {
794
+ GtkWidget* frame = addWidget(label, gtk_event_box_new());
795
+ gtk_container_add(GTK_CONTAINER(frame), box);
796
+ gtk_widget_show(box);
797
+ pushBox(kBoxMode, box);
798
+ } else {
799
+ pushBox(kBoxMode, addWidget(label, box));
800
+ }
801
+ }
802
+
803
+ struct uiExpanderBox : public uiItem {
804
+ GtkExpander* fButton;
805
+ uiExpanderBox(GUI* ui, FAUSTFLOAT* zone, GtkExpander* b) : uiItem(ui, zone), fButton(b) {}
806
+ static void expanded(GtkWidget* widget, gpointer data)
807
+ {
808
+ FAUSTFLOAT v = gtk_expander_get_expanded(GTK_EXPANDER(widget));
809
+ if (v == 1.000000) {
810
+ v = 0;
811
+ } else {
812
+ v = 1;
813
+ }
814
+ ((uiItem*)data)->modifyZone(v);
815
+ }
816
+
817
+ virtual void reflectZone()
818
+ {
819
+ FAUSTFLOAT v = *fZone;
820
+ fCache = v;
821
+ gtk_expander_set_expanded(GTK_EXPANDER(fButton), v);
822
+ }
823
+ };
824
+
825
+ void GTKUI::openExpanderBox(const char* label, FAUSTFLOAT* zone)
826
+ {
827
+ *zone = 0.0;
828
+ GtkWidget* box = gtk_hbox_new(homogene, 4);
829
+ gtk_container_set_border_width(GTK_CONTAINER(box), 2);
830
+ label = startWith(label, "0x") ? "" : label;
831
+ if (fMode[fTop] != kTabMode && label[0] != 0) {
832
+ GtkWidget* frame = addWidget(label, gtk_expander_new(label));
833
+ gtk_container_add(GTK_CONTAINER(frame), box);
834
+ uiExpanderBox* c = new uiExpanderBox(this, zone, GTK_EXPANDER(frame));
835
+ gtk_signal_connect(GTK_OBJECT(frame), "activate", GTK_SIGNAL_FUNC(uiExpanderBox::expanded), (gpointer)c);
836
+ gtk_widget_show(box);
837
+ pushBox(kBoxMode, box);
838
+ } else {
839
+ pushBox(kBoxMode, addWidget(label, box));
840
+ }
841
+ }
842
+
843
+ GtkWidget* GTKUI::addWidget(const char* label, GtkWidget* w)
844
+ {
845
+ switch (fMode[fTop]) {
846
+ case kSingleMode:
847
+ gtk_container_add(GTK_CONTAINER(fBox[fTop]), w);
848
+ break;
849
+ case kBoxMode:
850
+ gtk_box_pack_start(GTK_BOX(fBox[fTop]), w, expand, fill, 0);
851
+ break;
852
+ case kTabMode:
853
+ gtk_notebook_append_page(GTK_NOTEBOOK(fBox[fTop]), w, gtk_label_new(label));
854
+ break;
855
+ }
856
+ gtk_widget_show(w);
857
+ return w;
858
+ }
859
+
860
+ // --------------------------- Press button ---------------------------
861
+
862
+ struct uiButton : public uiItem {
863
+ GtkButton* fButton;
864
+
865
+ uiButton(GUI* ui, FAUSTFLOAT* zone, GtkButton* b) : uiItem(ui, zone), fButton(b) {}
866
+
867
+ static void pressed(GtkWidget* widget, gpointer data)
868
+ {
869
+ uiItem* c = (uiItem*)data;
870
+ c->modifyZone(1.0);
871
+ }
872
+
873
+ static void released(GtkWidget* widget, gpointer data)
874
+ {
875
+ uiItem* c = (uiItem*)data;
876
+ c->modifyZone(0.0);
877
+ }
878
+
879
+ virtual void reflectZone()
880
+ {
881
+ FAUSTFLOAT v = *fZone;
882
+ fCache = v;
883
+ if (v > 0.0)
884
+ gtk_button_pressed(fButton);
885
+ else
886
+ gtk_button_released(fButton);
887
+ }
888
+ };
889
+
890
+ void GTKUI::addButton(const char* label, FAUSTFLOAT* zone)
891
+ {
892
+ *zone = 0.0;
893
+ GtkWidget* button = gtk_button_new_with_label(label);
894
+ addWidget(label, button);
895
+
896
+ uiButton* c = new uiButton(this, zone, GTK_BUTTON(button));
897
+
898
+ gtk_signal_connect(GTK_OBJECT(button), "pressed", GTK_SIGNAL_FUNC(uiButton::pressed), (gpointer)c);
899
+ gtk_signal_connect(GTK_OBJECT(button), "released", GTK_SIGNAL_FUNC(uiButton::released), (gpointer)c);
900
+
901
+ checkForTooltip(zone, button);
902
+ }
903
+
904
+ // --------------------------- Toggle Buttons ---------------------------
905
+
906
+ struct uiToggleButton : public uiItem {
907
+ GtkToggleButton* fButton;
908
+
909
+ uiToggleButton(GUI* ui, FAUSTFLOAT* zone, GtkToggleButton* b) : uiItem(ui, zone), fButton(b) {}
910
+
911
+ static void toggled(GtkWidget* widget, gpointer data)
912
+ {
913
+ FAUSTFLOAT v = (GTK_TOGGLE_BUTTON(widget)->active) ? 1.0 : 0.0;
914
+ ((uiItem*)data)->modifyZone(v);
915
+ }
916
+
917
+ virtual void reflectZone()
918
+ {
919
+ FAUSTFLOAT v = *fZone;
920
+ fCache = v;
921
+ gtk_toggle_button_set_active(fButton, v > 0.0);
922
+ }
923
+ };
924
+
925
+ void GTKUI::addToggleButton(const char* label, FAUSTFLOAT* zone)
926
+ {
927
+ *zone = 0.0;
928
+ GtkWidget* button = gtk_toggle_button_new_with_label(label);
929
+ addWidget(label, button);
930
+
931
+ uiToggleButton* c = new uiToggleButton(this, zone, GTK_TOGGLE_BUTTON(button));
932
+ gtk_signal_connect(GTK_OBJECT(button), "toggled", GTK_SIGNAL_FUNC(uiToggleButton::toggled), (gpointer)c);
933
+
934
+ checkForTooltip(zone, button);
935
+ }
936
+
937
+ void show_dialog(GtkWidget* widget, gpointer data)
938
+ {
939
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
940
+ gtk_widget_show(GTK_WIDGET(data));
941
+ gint root_x, root_y;
942
+ gtk_window_get_position(GTK_WINDOW(data), &root_x, &root_y);
943
+ root_y -= 120;
944
+ gtk_window_move(GTK_WINDOW(data), root_x, root_y);
945
+ } else
946
+ gtk_widget_hide(GTK_WIDGET(data));
947
+ }
948
+
949
+ static gboolean deleteevent(GtkWidget* widget, gpointer data)
950
+ {
951
+ return true;
952
+ }
953
+
954
+ void GTKUI::openDialogBox(const char* label, FAUSTFLOAT* zone)
955
+ {
956
+ // create toplevel window and set properties
957
+ GtkWidget* dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
958
+ gtk_window_set_decorated(GTK_WINDOW(dialog), true);
959
+ gtk_window_set_deletable(GTK_WINDOW(dialog), false);
960
+ gtk_window_set_resizable(GTK_WINDOW(dialog), false);
961
+ gtk_window_set_gravity(GTK_WINDOW(dialog), GDK_GRAVITY_SOUTH);
962
+ gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(fWindow));
963
+ gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);
964
+ gtk_window_set_keep_below(GTK_WINDOW(dialog), false);
965
+ gtk_window_set_title(GTK_WINDOW(dialog), label);
966
+ g_signal_connect(G_OBJECT(dialog), "delete_event", G_CALLBACK(deleteevent), NULL);
967
+ gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), true);
968
+
969
+ GtkWidget* box = gtk_hbox_new(homogene, 4);
970
+
971
+ *zone = 0.0;
972
+ GtkWidget* button = gtk_toggle_button_new();
973
+ gtk_signal_connect(GTK_OBJECT(button), "toggled", GTK_SIGNAL_FUNC(show_dialog), (gpointer)dialog);
974
+
975
+ gtk_container_add(GTK_CONTAINER(fBox[fTop]), button);
976
+ gtk_container_add(GTK_CONTAINER(dialog), box);
977
+ gtk_widget_show(button);
978
+ gtk_widget_show(box);
979
+ pushBox(kBoxMode, box);
980
+ }
981
+
982
+ // --------------------------- Check Button ---------------------------
983
+
984
+ struct uiCheckButton : public uiItem {
985
+ GtkToggleButton* fButton;
986
+
987
+ uiCheckButton(GUI* ui, FAUSTFLOAT* zone, GtkToggleButton* b) : uiItem(ui, zone), fButton(b) {}
988
+
989
+ static void toggled(GtkWidget* widget, gpointer data)
990
+ {
991
+ FAUSTFLOAT v = (GTK_TOGGLE_BUTTON(widget)->active) ? 1.0 : 0.0;
992
+ ((uiItem*)data)->modifyZone(v);
993
+ }
994
+
995
+ virtual void reflectZone()
996
+ {
997
+ FAUSTFLOAT v = *fZone;
998
+ fCache = v;
999
+ gtk_toggle_button_set_active(fButton, v > 0.0);
1000
+ }
1001
+ };
1002
+
1003
+ void GTKUI::addCheckButton(const char* label, FAUSTFLOAT* zone)
1004
+ {
1005
+ *zone = 0.0;
1006
+ GtkWidget* button = gtk_check_button_new_with_label(label);
1007
+ addWidget(label, button);
1008
+
1009
+ uiCheckButton* c = new uiCheckButton(this, zone, GTK_TOGGLE_BUTTON(button));
1010
+ gtk_signal_connect(GTK_OBJECT(button), "toggled", GTK_SIGNAL_FUNC(uiCheckButton::toggled), (gpointer)c);
1011
+
1012
+ checkForTooltip(zone, button);
1013
+ }
1014
+
1015
+ // --------------------------- Adjustmenty based widgets ---------------------------
1016
+
1017
+ struct uiAdjustment : public uiItem {
1018
+ GtkAdjustment* fAdj;
1019
+
1020
+ uiAdjustment(GUI* ui, FAUSTFLOAT* zone, GtkAdjustment* adj) : uiItem(ui, zone), fAdj(adj) {}
1021
+
1022
+ static void changed(GtkWidget* widget, gpointer data)
1023
+ {
1024
+ FAUSTFLOAT v = GTK_ADJUSTMENT(widget)->value;
1025
+ ((uiItem*)data)->modifyZone(v);
1026
+ }
1027
+
1028
+ virtual void reflectZone()
1029
+ {
1030
+ FAUSTFLOAT v = *fZone;
1031
+ fCache = v;
1032
+ gtk_adjustment_set_value(fAdj, v);
1033
+ }
1034
+ };
1035
+
1036
+ // --------------------------- format knob value display ---------------------------
1037
+
1038
+ struct uiValueDisplay : public uiItem {
1039
+ GtkLabel* fLabel;
1040
+ int fPrecision;
1041
+
1042
+ uiValueDisplay(GUI* ui, FAUSTFLOAT* zone, GtkLabel* label, int precision)
1043
+ : uiItem(ui, zone), fLabel(label), fPrecision(precision)
1044
+ {
1045
+ }
1046
+
1047
+ virtual void reflectZone()
1048
+ {
1049
+ FAUSTFLOAT v = *fZone;
1050
+ fCache = v;
1051
+ char s[64];
1052
+ if (fPrecision <= 0) {
1053
+ snprintf(s, 63, "%d", int(v));
1054
+ } else if (fPrecision > 3) {
1055
+ snprintf(s, 63, "%f", v);
1056
+ } else if (fPrecision == 1) {
1057
+ const char* format[] = {"%.1f", "%.2f", "%.3f"};
1058
+ snprintf(s, 63, format[1 - 1], v);
1059
+ } else if (fPrecision == 2) {
1060
+ const char* format[] = {"%.1f", "%.2f", "%.3f"};
1061
+ snprintf(s, 63, format[2 - 1], v);
1062
+ } else {
1063
+ const char* format[] = {"%.1f", "%.2f", "%.3f"};
1064
+ snprintf(s, 63, format[3 - 1], v);
1065
+ }
1066
+ gtk_label_set_text(fLabel, s);
1067
+ }
1068
+ };
1069
+
1070
+ // ------------------------------- Knob -----------------------------------------
1071
+
1072
+ void GTKUI::addKnob(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max,
1073
+ FAUSTFLOAT step)
1074
+ {
1075
+ *zone = init;
1076
+ GtkObject* adj = gtk_adjustment_new(init, min, max, step, 10 * step, 0);
1077
+
1078
+ uiAdjustment* c = new uiAdjustment(this, zone, GTK_ADJUSTMENT(adj));
1079
+
1080
+ gtk_signal_connect(GTK_OBJECT(adj), "value-changed", GTK_SIGNAL_FUNC(uiAdjustment::changed), (gpointer)c);
1081
+
1082
+ GtkWidget* slider = gtk_vbox_new(false, 0);
1083
+ GtkWidget* fil = gtk_vbox_new(false, 0);
1084
+ GtkWidget* rei = gtk_vbox_new(false, 0);
1085
+ GtkWidget* re = myGtkKnob.gtk_knob_new_with_adjustment(GTK_ADJUSTMENT(adj));
1086
+ GtkWidget* lw = gtk_label_new("");
1087
+ new uiValueDisplay(this, zone, GTK_LABEL(lw), precision(step));
1088
+ gtk_container_add(GTK_CONTAINER(rei), re);
1089
+ if (fGuiSize[zone]) {
1090
+ FAUSTFLOAT size = 30 * fGuiSize[zone];
1091
+ gtk_widget_set_size_request(rei, size, size);
1092
+ gtk_box_pack_start(GTK_BOX(slider), fil, true, true, 0);
1093
+ gtk_box_pack_start(GTK_BOX(slider), rei, false, false, 0);
1094
+ } else {
1095
+ gtk_container_add(GTK_CONTAINER(slider), fil);
1096
+ gtk_container_add(GTK_CONTAINER(slider), rei);
1097
+ }
1098
+ gtk_container_add(GTK_CONTAINER(slider), lw);
1099
+ gtk_widget_show_all(slider);
1100
+
1101
+ label = startWith(label, "0x") ? "" : label;
1102
+ if (label && label[0] != 0) {
1103
+ openFrameBox(label);
1104
+ addWidget(label, slider);
1105
+ closeBox();
1106
+ } else {
1107
+ addWidget(label, slider);
1108
+ }
1109
+
1110
+ checkForTooltip(zone, slider);
1111
+ }
1112
+
1113
+ // -------------------------- Vertical Slider -----------------------------------
1114
+
1115
+ void GTKUI::addVerticalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max,
1116
+ FAUSTFLOAT step)
1117
+ {
1118
+ if (isKnob(zone)) {
1119
+ addKnob(label, zone, init, min, max, step);
1120
+ return;
1121
+ }
1122
+ *zone = init;
1123
+ GtkObject* adj = gtk_adjustment_new(init, min, max, step, 10 * step, 0);
1124
+
1125
+ uiAdjustment* c = new uiAdjustment(this, zone, GTK_ADJUSTMENT(adj));
1126
+ gtk_signal_connect(GTK_OBJECT(adj), "value-changed", GTK_SIGNAL_FUNC(uiAdjustment::changed), (gpointer)c);
1127
+
1128
+ GtkWidget* slider = gtk_vscale_new(GTK_ADJUSTMENT(adj));
1129
+ gtk_scale_set_digits(GTK_SCALE(slider), precision(step));
1130
+ FAUSTFLOAT size = 160;
1131
+ if (fGuiSize[zone]) {
1132
+ size = 160 * fGuiSize[zone];
1133
+ }
1134
+ gtk_widget_set_size_request(slider, -1, size);
1135
+ gtk_range_set_inverted(GTK_RANGE(slider), true);
1136
+
1137
+ label = startWith(label, "0x") ? "" : label;
1138
+ if (label && label[0] != 0) {
1139
+ openFrameBox(label);
1140
+ addWidget(label, slider);
1141
+ closeBox();
1142
+ } else {
1143
+ addWidget(label, slider);
1144
+ }
1145
+
1146
+ checkForTooltip(zone, slider);
1147
+ }
1148
+
1149
+ // -------------------------- Horizontal Slider -----------------------------------
1150
+
1151
+ void GTKUI::addHorizontalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max,
1152
+ FAUSTFLOAT step)
1153
+ {
1154
+ if (isKnob(zone)) {
1155
+ addKnob(label, zone, init, min, max, step);
1156
+ return;
1157
+ }
1158
+ *zone = init;
1159
+ GtkObject* adj = gtk_adjustment_new(init, min, max, step, 10 * step, 0);
1160
+
1161
+ uiAdjustment* c = new uiAdjustment(this, zone, GTK_ADJUSTMENT(adj));
1162
+
1163
+ gtk_signal_connect(GTK_OBJECT(adj), "value-changed", GTK_SIGNAL_FUNC(uiAdjustment::changed), (gpointer)c);
1164
+
1165
+ GtkWidget* slider = gtk_hscale_new(GTK_ADJUSTMENT(adj));
1166
+ gtk_scale_set_digits(GTK_SCALE(slider), precision(step));
1167
+ FAUSTFLOAT size = 160;
1168
+ if (fGuiSize[zone]) {
1169
+ size = 160 * fGuiSize[zone];
1170
+ }
1171
+ gtk_widget_set_size_request(slider, size, -1);
1172
+
1173
+ label = startWith(label, "0x") ? "" : label;
1174
+ if (label && label[0] != 0) {
1175
+ openFrameBox(label);
1176
+ addWidget(label, slider);
1177
+ closeBox();
1178
+ } else {
1179
+ addWidget(label, slider);
1180
+ }
1181
+
1182
+ checkForTooltip(zone, slider);
1183
+ }
1184
+
1185
+ // ------------------------------ Num Entry -----------------------------------
1186
+
1187
+ void GTKUI::addNumEntry(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max,
1188
+ FAUSTFLOAT step)
1189
+ {
1190
+ if (isKnob(zone)) {
1191
+ addKnob(label, zone, init, min, max, step);
1192
+ return;
1193
+ }
1194
+ *zone = init;
1195
+ GtkObject* adj = gtk_adjustment_new(init, min, max, step, 10 * step, step);
1196
+
1197
+ uiAdjustment* c = new uiAdjustment(this, zone, GTK_ADJUSTMENT(adj));
1198
+ gtk_signal_connect(GTK_OBJECT(adj), "value-changed", GTK_SIGNAL_FUNC(uiAdjustment::changed), (gpointer)c);
1199
+ GtkWidget* spinner = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 0.005, precision(step));
1200
+
1201
+ label = startWith(label, "0x") ? "" : label;
1202
+ if (label && label[0] != 0) {
1203
+ openFrameBox(label);
1204
+ addWidget(label, spinner);
1205
+ closeBox();
1206
+ } else {
1207
+ addWidget(label, spinner);
1208
+ }
1209
+
1210
+ checkForTooltip(zone, spinner);
1211
+ }
1212
+
1213
+ // ========================== passive widgets ===============================
1214
+
1215
+ // ------------------------------ Progress Bar -----------------------------------
1216
+
1217
+ struct uiBargraph : public uiItem {
1218
+ GtkProgressBar* fProgressBar;
1219
+ FAUSTFLOAT fMin;
1220
+ FAUSTFLOAT fMax;
1221
+
1222
+ uiBargraph(GUI* ui, FAUSTFLOAT* zone, GtkProgressBar* pbar, FAUSTFLOAT lo, FAUSTFLOAT hi)
1223
+ : uiItem(ui, zone), fProgressBar(pbar), fMin(lo), fMax(hi)
1224
+ {
1225
+ }
1226
+
1227
+ FAUSTFLOAT scale(FAUSTFLOAT v) { return (v - fMin) / (fMax - fMin); }
1228
+ FAUSTFLOAT clip(FAUSTFLOAT v) { return std::max<double>(0.0, std::min<double>(1.0, v)); }
1229
+
1230
+ virtual void reflectZone()
1231
+ {
1232
+ FAUSTFLOAT v = *fZone;
1233
+ fCache = v;
1234
+ gtk_progress_bar_set_fraction(fProgressBar, clip(scale(v)));
1235
+ }
1236
+ };
1237
+
1238
+ void GTKUI::addVerticalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT lo, FAUSTFLOAT hi)
1239
+ {
1240
+ GtkWidget* pb = gtk_progress_bar_new();
1241
+ gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(pb), GTK_PROGRESS_BOTTOM_TO_TOP);
1242
+ gtk_widget_set_size_request(pb, 8, -1);
1243
+ new uiBargraph(this, zone, GTK_PROGRESS_BAR(pb), lo, hi);
1244
+
1245
+ label = startWith(label, "0x") ? "" : label;
1246
+ if (label && label[0] != 0) {
1247
+ openFrameBox(label);
1248
+ addWidget(label, pb);
1249
+ closeBox();
1250
+ } else {
1251
+ addWidget(label, pb);
1252
+ }
1253
+
1254
+ checkForTooltip(zone, pb);
1255
+ }
1256
+
1257
+ void GTKUI::addHorizontalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT lo, FAUSTFLOAT hi)
1258
+ {
1259
+ GtkWidget* pb = gtk_progress_bar_new();
1260
+ gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(pb), GTK_PROGRESS_LEFT_TO_RIGHT);
1261
+ gtk_widget_set_size_request(pb, -1, 8);
1262
+ new uiBargraph(this, zone, GTK_PROGRESS_BAR(pb), lo, hi);
1263
+
1264
+ label = startWith(label, "0x") ? "" : label;
1265
+ if (label && label[0] != 0) {
1266
+ openFrameBox(label);
1267
+ addWidget(label, pb);
1268
+ closeBox();
1269
+ } else {
1270
+ addWidget(label, pb);
1271
+ }
1272
+
1273
+ checkForTooltip(zone, pb);
1274
+ }
1275
+
1276
+ // ------------------------------ Num Display -----------------------------------
1277
+
1278
+ struct uiNumDisplay : public uiItem {
1279
+ GtkLabel* fLabel;
1280
+ int fPrecision;
1281
+
1282
+ uiNumDisplay(GUI* ui, FAUSTFLOAT* zone, GtkLabel* label, int precision)
1283
+ : uiItem(ui, zone), fLabel(label), fPrecision(precision)
1284
+ {
1285
+ }
1286
+
1287
+ virtual void reflectZone()
1288
+ {
1289
+ FAUSTFLOAT v = *fZone;
1290
+ fCache = v;
1291
+ char s[64];
1292
+ if (fPrecision <= 0) {
1293
+ snprintf(s, 63, "%d", int(v));
1294
+ } else if (fPrecision > 3) {
1295
+ snprintf(s, 63, "%f", v);
1296
+ } else {
1297
+ const char* format[] = {"%.1f", "%.2f", "%.3f"};
1298
+ snprintf(s, 63, format[fPrecision - 1], v);
1299
+ }
1300
+ gtk_label_set_text(fLabel, s);
1301
+ }
1302
+ };
1303
+
1304
+ void GTKUI::addNumDisplay(const char* label, FAUSTFLOAT* zone, int precision)
1305
+ {
1306
+ GtkWidget* lw = gtk_label_new("");
1307
+ new uiNumDisplay(this, zone, GTK_LABEL(lw), precision);
1308
+ openFrameBox(label);
1309
+ addWidget(label, lw);
1310
+ closeBox();
1311
+
1312
+ checkForTooltip(zone, lw);
1313
+ }
1314
+
1315
+ // ------------------------------ Text Display -----------------------------------
1316
+
1317
+ struct uiTextDisplay : public uiItem {
1318
+ GtkLabel* fLabel;
1319
+ const char** fNames;
1320
+ FAUSTFLOAT fMin;
1321
+ FAUSTFLOAT fMax;
1322
+ int fNum;
1323
+
1324
+ uiTextDisplay(GUI* ui, FAUSTFLOAT* zone, GtkLabel* label, const char* names[], FAUSTFLOAT lo, FAUSTFLOAT hi)
1325
+ : uiItem(ui, zone), fLabel(label), fNames(names), fMin(lo), fMax(hi)
1326
+ {
1327
+ fNum = 0;
1328
+ while (fNames[fNum] != 0) fNum++;
1329
+ }
1330
+
1331
+ virtual void reflectZone()
1332
+ {
1333
+ FAUSTFLOAT v = *fZone;
1334
+ fCache = v;
1335
+
1336
+ int idx = int(fNum * (v - fMin) / (fMax - fMin));
1337
+
1338
+ if (idx < 0)
1339
+ idx = 0;
1340
+ else if (idx >= fNum)
1341
+ idx = fNum - 1;
1342
+
1343
+ gtk_label_set_text(fLabel, fNames[idx]);
1344
+ }
1345
+ };
1346
+
1347
+ void GTKUI::addTextDisplay(const char* label, FAUSTFLOAT* zone, const char* names[], FAUSTFLOAT lo, FAUSTFLOAT hi)
1348
+ {
1349
+ GtkWidget* lw = gtk_label_new("");
1350
+ new uiTextDisplay(this, zone, GTK_LABEL(lw), names, lo, hi);
1351
+ openFrameBox(label);
1352
+ addWidget(label, lw);
1353
+ closeBox();
1354
+ checkForTooltip(zone, lw);
1355
+ }
1356
+
1357
+ /**
1358
+ * Update all user items reflecting zone z
1359
+ */
1360
+
1361
+ static gboolean callUpdateAllGuis(gpointer)
1362
+ {
1363
+ GUI::updateAllGuis();
1364
+ return true;
1365
+ }
1366
+
1367
+ bool GTKUI::run()
1368
+ {
1369
+ assert(fTop == 0);
1370
+ gtk_container_add(GTK_CONTAINER(fWindow), fBox[fTop]);
1371
+
1372
+ gtk_widget_show_all(fWindow);
1373
+ gtk_widget_show(fBox[0]);
1374
+ gtk_widget_show(fWindow);
1375
+
1376
+ // Discover main screen
1377
+ GdkScreen* screen = gdk_screen_get_default();
1378
+ GdkRectangle rect;
1379
+ gdk_screen_get_monitor_geometry(screen, gdk_screen_get_primary_monitor(screen), &rect);
1380
+
1381
+ // Possibly setup scroll window
1382
+ if (fWindow->allocation.width > rect.width || fWindow->allocation.height > rect.height) {
1383
+ g_object_ref(fBox[fTop]); // To avoid desallocation with 'gtk_container_remove'
1384
+ gtk_container_remove(GTK_CONTAINER(fWindow), fBox[fTop]);
1385
+ fScrolledWindow = gtk_scrolled_window_new(NULL, NULL);
1386
+ gtk_widget_set_size_request(fScrolledWindow, rect.width / 2, rect.height / 2);
1387
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(fScrolledWindow), GTK_POLICY_AUTOMATIC,
1388
+ GTK_POLICY_AUTOMATIC);
1389
+ gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(fScrolledWindow), fBox[fTop]);
1390
+ gtk_container_add(GTK_CONTAINER(fWindow), fScrolledWindow);
1391
+ }
1392
+
1393
+ gtk_widget_show_all(fWindow);
1394
+ gtk_widget_show(fBox[0]);
1395
+ gtk_widget_show(fWindow);
1396
+
1397
+ gtk_timeout_add(40, callUpdateAllGuis, 0);
1398
+ gtk_main();
1399
+ return true;
1400
+ }
1401
+
1402
+ void GTKUI::stop()
1403
+ {
1404
+ GUI::stop();
1405
+ if (gInitialized) {
1406
+ gInitialized = false;
1407
+ gtk_main_quit();
1408
+ gtk_signal_emit_by_name((GtkObject*)fWindow, "destroy");
1409
+ }
1410
+ }
1411
+
1412
+ #endif
1413
+
1414
+ /************************** END GTKUI.h **************************/