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.
- cyfaust/CMakeLists.txt +93 -0
- cyfaust/__init__.py +0 -0
- cyfaust/__main__.py +819 -0
- cyfaust/box.pxd +46 -0
- cyfaust/box.pyx +2459 -0
- cyfaust/common.pxd +5 -0
- cyfaust/common.pyx +61 -0
- cyfaust/cyfaust.cpython-311-darwin.so +0 -0
- cyfaust/faust_box.pxd +298 -0
- cyfaust/faust_box_oo.pyx +66 -0
- cyfaust/faust_gui.pxd +261 -0
- cyfaust/faust_interp.pxd +160 -0
- cyfaust/faust_player.pxd +80 -0
- cyfaust/faust_signal.pxd +257 -0
- cyfaust/gui_statics.cpp +15 -0
- cyfaust/interp.pyx +673 -0
- cyfaust/player.cpp +32519 -0
- cyfaust/player.pyx +191 -0
- cyfaust/resources/architecture/AU/AUPublic/AUBase/AUBase.cpp +2327 -0
- cyfaust/resources/architecture/AU/AUPublic/AUBase/AUBase.h +1019 -0
- cyfaust/resources/architecture/AU/AUPublic/AUBase/AUDispatch.cpp +423 -0
- cyfaust/resources/architecture/AU/AUPublic/AUBase/AUDispatch.h +82 -0
- cyfaust/resources/architecture/AU/AUPublic/AUBase/AUInputElement.cpp +151 -0
- cyfaust/resources/architecture/AU/AUPublic/AUBase/AUInputElement.h +119 -0
- cyfaust/resources/architecture/AU/AUPublic/AUBase/AUOutputElement.cpp +62 -0
- cyfaust/resources/architecture/AU/AUPublic/AUBase/AUOutputElement.h +66 -0
- cyfaust/resources/architecture/AU/AUPublic/AUBase/AUPlugInDispatch.cpp +615 -0
- cyfaust/resources/architecture/AU/AUPublic/AUBase/AUPlugInDispatch.h +128 -0
- cyfaust/resources/architecture/AU/AUPublic/AUBase/AUScopeElement.cpp +512 -0
- cyfaust/resources/architecture/AU/AUPublic/AUBase/AUScopeElement.h +544 -0
- cyfaust/resources/architecture/AU/AUPublic/AUBase/ComponentBase.cpp +370 -0
- cyfaust/resources/architecture/AU/AUPublic/AUBase/ComponentBase.h +340 -0
- cyfaust/resources/architecture/AU/AUPublic/AUEffectBase/AUEffectBase.cpp +463 -0
- cyfaust/resources/architecture/AU/AUPublic/AUEffectBase/AUEffectBase.h +391 -0
- cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/AUInstrumentBase.cpp +837 -0
- cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/AUInstrumentBase.h +267 -0
- cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/AUMIDIBase.cpp +495 -0
- cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/AUMIDIBase.h +213 -0
- cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/LockFreeFIFO.h +168 -0
- cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/MIDIControlHandler.h +92 -0
- cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/MusicDeviceBase.cpp +354 -0
- cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/MusicDeviceBase.h +126 -0
- cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/SynthElement.cpp +419 -0
- cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/SynthElement.h +227 -0
- cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/SynthEvent.h +145 -0
- cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/SynthNote.cpp +138 -0
- cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/SynthNote.h +186 -0
- cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/SynthNoteList.cpp +93 -0
- cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/SynthNoteList.h +232 -0
- cyfaust/resources/architecture/AU/AUPublic/Utility/AUBaseHelper.cpp +134 -0
- cyfaust/resources/architecture/AU/AUPublic/Utility/AUBaseHelper.h +80 -0
- cyfaust/resources/architecture/AU/AUPublic/Utility/AUBuffer.cpp +217 -0
- cyfaust/resources/architecture/AU/AUPublic/Utility/AUBuffer.h +267 -0
- cyfaust/resources/architecture/AU/AUPublic/Utility/AUMIDIDefs.h +136 -0
- cyfaust/resources/architecture/AU/AUPublic/Utility/AUSilentTimeout.h +93 -0
- cyfaust/resources/architecture/AU/English.lproj/InfoPlist.strings +0 -0
- cyfaust/resources/architecture/AU/FaustAU.exp +2 -0
- cyfaust/resources/architecture/AU/FaustAU.xcodeproj/project.pbxproj +968 -0
- cyfaust/resources/architecture/AU/FaustAU.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- cyfaust/resources/architecture/AU/FaustAUCustomView.plist +14 -0
- cyfaust/resources/architecture/AU/Info.plist +47 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAAtomic.h +305 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAAtomicStack.h +239 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAAudioChannelLayout.cpp +153 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAAudioChannelLayout.h +199 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAAutoDisposer.h +508 -0
- cyfaust/resources/architecture/AU/PublicUtility/CABufferList.cpp +264 -0
- cyfaust/resources/architecture/AU/PublicUtility/CABufferList.h +319 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAByteOrder.h +161 -0
- cyfaust/resources/architecture/AU/PublicUtility/CADebugMacros.cpp +88 -0
- cyfaust/resources/architecture/AU/PublicUtility/CADebugMacros.h +580 -0
- cyfaust/resources/architecture/AU/PublicUtility/CADebugPrintf.cpp +89 -0
- cyfaust/resources/architecture/AU/PublicUtility/CADebugPrintf.h +115 -0
- cyfaust/resources/architecture/AU/PublicUtility/CADebugger.cpp +77 -0
- cyfaust/resources/architecture/AU/PublicUtility/CADebugger.h +56 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAException.h +83 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAGuard.cpp +339 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAGuard.h +133 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAHostTimeBase.cpp +110 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAHostTimeBase.h +231 -0
- cyfaust/resources/architecture/AU/PublicUtility/CALogMacros.h +140 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAMath.h +68 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAMutex.cpp +345 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAMutex.h +163 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAReferenceCounted.h +87 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAStreamBasicDescription.cpp +795 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAStreamBasicDescription.h +409 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAThreadSafeList.h +255 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAVectorUnit.cpp +191 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAVectorUnit.h +100 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAVectorUnitTypes.h +59 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAXException.cpp +49 -0
- cyfaust/resources/architecture/AU/PublicUtility/CAXException.h +338 -0
- cyfaust/resources/architecture/AU/SectionPatternLight.tiff +0 -0
- cyfaust/resources/architecture/AU/Source/AUSource/FaustAU.h +38 -0
- cyfaust/resources/architecture/AU/Source/AUSource/FaustAU.r +153 -0
- cyfaust/resources/architecture/AU/Source/AUSource/FaustAUVersion.h +64 -0
- cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Bargraph.h +18 -0
- cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Bargraph.m +21 -0
- cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Button.h +20 -0
- cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Button.m +56 -0
- cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_CustomView.h +87 -0
- cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_CustomView.m +834 -0
- cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_CustomViewFactory.h +13 -0
- cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_CustomViewFactory.m +22 -0
- cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Knob.h +81 -0
- cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Knob.m +199 -0
- cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Slider.h +18 -0
- cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Slider.m +21 -0
- cyfaust/resources/architecture/AU/version.plist +16 -0
- cyfaust/resources/architecture/VST/Info.plist +28 -0
- cyfaust/resources/architecture/VST/PkgInfo +1 -0
- cyfaust/resources/architecture/VST/README +11 -0
- cyfaust/resources/architecture/VST/VST.xcode/project.pbxproj +655 -0
- cyfaust/resources/architecture/alsa-console.cpp +246 -0
- cyfaust/resources/architecture/alsa-gtk.cpp +220 -0
- cyfaust/resources/architecture/alsa-qt.cpp +229 -0
- cyfaust/resources/architecture/api/DspFaust.cpp +612 -0
- cyfaust/resources/architecture/api/DspFaust.h +511 -0
- cyfaust/resources/architecture/api/README.md +237 -0
- cyfaust/resources/architecture/api/doc/Generic.md +38 -0
- cyfaust/resources/architecture/au-effect.cpp +487 -0
- cyfaust/resources/architecture/au-instrument.cpp +573 -0
- cyfaust/resources/architecture/bench.cpp +91 -0
- cyfaust/resources/architecture/c-jack-gtk.c +227 -0
- cyfaust/resources/architecture/ca-gtk.cpp +284 -0
- cyfaust/resources/architecture/ca-qt.cpp +424 -0
- cyfaust/resources/architecture/cpal.rs +195 -0
- cyfaust/resources/architecture/csound.cpp +245 -0
- cyfaust/resources/architecture/csvplot.cpp +227 -0
- cyfaust/resources/architecture/daisy/Makefile +14 -0
- cyfaust/resources/architecture/daisy/README.md +50 -0
- cyfaust/resources/architecture/daisy/ex_faust.cpp +173 -0
- cyfaust/resources/architecture/dssi.cpp +1262 -0
- cyfaust/resources/architecture/dummy-mem.cpp +186 -0
- cyfaust/resources/architecture/dummy.cpp +294 -0
- cyfaust/resources/architecture/faust/au/AUUI.h +404 -0
- cyfaust/resources/architecture/faust/audio/alsa-dsp.h +693 -0
- cyfaust/resources/architecture/faust/audio/android-dsp.h +583 -0
- cyfaust/resources/architecture/faust/audio/audio.h +115 -0
- cyfaust/resources/architecture/faust/audio/channels.h +122 -0
- cyfaust/resources/architecture/faust/audio/coreaudio-dsp.h +1543 -0
- cyfaust/resources/architecture/faust/audio/coreaudio-ios-dsp.h +743 -0
- cyfaust/resources/architecture/faust/audio/dummy-audio.h +255 -0
- cyfaust/resources/architecture/faust/audio/esp32-dsp.h +284 -0
- cyfaust/resources/architecture/faust/audio/fpe.h +164 -0
- cyfaust/resources/architecture/faust/audio/jack-dsp.h +534 -0
- cyfaust/resources/architecture/faust/audio/juce-dsp.h +119 -0
- cyfaust/resources/architecture/faust/audio/netjack-dsp.h +354 -0
- cyfaust/resources/architecture/faust/audio/oboe-dsp.h +308 -0
- cyfaust/resources/architecture/faust/audio/ofaudio-dsp.h +155 -0
- cyfaust/resources/architecture/faust/audio/opensles-android-dsp.h +631 -0
- cyfaust/resources/architecture/faust/audio/osc-dsp.h +120 -0
- cyfaust/resources/architecture/faust/audio/portaudio-dsp.h +236 -0
- cyfaust/resources/architecture/faust/audio/rtaudio-dsp.h +241 -0
- cyfaust/resources/architecture/faust/audio/samAudio.h +140 -0
- cyfaust/resources/architecture/faust/audio/teensy-dsp.h +171 -0
- cyfaust/resources/architecture/faust/dsp/cmajor-cpp-dsp.h +253 -0
- cyfaust/resources/architecture/faust/dsp/cmajorpatch-dsp.h +483 -0
- cyfaust/resources/architecture/faust/dsp/cpp-dsp-adapter.h +38 -0
- cyfaust/resources/architecture/faust/dsp/dsp-adapter.h +836 -0
- cyfaust/resources/architecture/faust/dsp/dsp-bench.h +611 -0
- cyfaust/resources/architecture/faust/dsp/dsp-checker.h +115 -0
- cyfaust/resources/architecture/faust/dsp/dsp-combiner.h +810 -0
- cyfaust/resources/architecture/faust/dsp/dsp-compute-adapter.h +159 -0
- cyfaust/resources/architecture/faust/dsp/dsp-multi.h +702 -0
- cyfaust/resources/architecture/faust/dsp/dsp-multifun.h +90 -0
- cyfaust/resources/architecture/faust/dsp/dsp-optimizer.h +511 -0
- cyfaust/resources/architecture/faust/dsp/dsp-tools.h +229 -0
- cyfaust/resources/architecture/faust/dsp/dsp.h +321 -0
- cyfaust/resources/architecture/faust/dsp/fastmath.cpp +301 -0
- cyfaust/resources/architecture/faust/dsp/faust-dynamic-engine.cpp +494 -0
- cyfaust/resources/architecture/faust/dsp/faust-dynamic-engine.h +386 -0
- cyfaust/resources/architecture/faust/dsp/faust-engine.h +75 -0
- cyfaust/resources/architecture/faust/dsp/faust-poly-engine.h +638 -0
- cyfaust/resources/architecture/faust/dsp/interpreter-dsp-c.h +288 -0
- cyfaust/resources/architecture/faust/dsp/interpreter-dsp.h +362 -0
- cyfaust/resources/architecture/faust/dsp/interpreter-machine-dsp.h +233 -0
- cyfaust/resources/architecture/faust/dsp/libfaust-box-c.h +817 -0
- cyfaust/resources/architecture/faust/dsp/libfaust-box.h +889 -0
- cyfaust/resources/architecture/faust/dsp/libfaust-c.h +116 -0
- cyfaust/resources/architecture/faust/dsp/libfaust-signal-c.h +649 -0
- cyfaust/resources/architecture/faust/dsp/libfaust-signal.h +731 -0
- cyfaust/resources/architecture/faust/dsp/llvm-dsp-adapter.h +160 -0
- cyfaust/resources/architecture/faust/dsp/llvm-dsp-c.h +524 -0
- cyfaust/resources/architecture/faust/dsp/llvm-dsp.h +575 -0
- cyfaust/resources/architecture/faust/dsp/llvm-machine-dsp.h +215 -0
- cyfaust/resources/architecture/faust/dsp/one-sample-dsp.h +477 -0
- cyfaust/resources/architecture/faust/dsp/poly-dsp.h +1079 -0
- cyfaust/resources/architecture/faust/dsp/poly-interpreter-dsp.h +143 -0
- cyfaust/resources/architecture/faust/dsp/poly-llvm-dsp.h +249 -0
- cyfaust/resources/architecture/faust/dsp/poly-wasm-dsp.h +257 -0
- cyfaust/resources/architecture/faust/dsp/proxy-dsp.h +108 -0
- cyfaust/resources/architecture/faust/dsp/proxy-osc-dsp.h +109 -0
- cyfaust/resources/architecture/faust/dsp/rnbo-dsp.h +187 -0
- cyfaust/resources/architecture/faust/dsp/sound-player.h +428 -0
- cyfaust/resources/architecture/faust/dsp/timed-dsp.h +279 -0
- cyfaust/resources/architecture/faust/dsp/wasm-dsp-imp.h +188 -0
- cyfaust/resources/architecture/faust/dsp/wasm-dsp.h +309 -0
- cyfaust/resources/architecture/faust/dsp/ysfx-dsp.h +188 -0
- cyfaust/resources/architecture/faust/export.h +61 -0
- cyfaust/resources/architecture/faust/gui/APIUI.h +726 -0
- cyfaust/resources/architecture/faust/gui/BelaOSCUI.h +170 -0
- cyfaust/resources/architecture/faust/gui/CGlue.h +667 -0
- cyfaust/resources/architecture/faust/gui/CInterface.h +142 -0
- cyfaust/resources/architecture/faust/gui/ControlSequenceUI.h +197 -0
- cyfaust/resources/architecture/faust/gui/ControlUI.h +137 -0
- cyfaust/resources/architecture/faust/gui/DaisyControlUI.h +283 -0
- cyfaust/resources/architecture/faust/gui/DaisyPatchInitControlUI.h +254 -0
- cyfaust/resources/architecture/faust/gui/DecoratorUI.h +115 -0
- cyfaust/resources/architecture/faust/gui/Esp32ControlUI.h +341 -0
- cyfaust/resources/architecture/faust/gui/Esp32Reader.h +102 -0
- cyfaust/resources/architecture/faust/gui/Esp32SensorUI.h +137 -0
- cyfaust/resources/architecture/faust/gui/FUI.h +147 -0
- cyfaust/resources/architecture/faust/gui/GTKUI.h +1414 -0
- cyfaust/resources/architecture/faust/gui/GUI.h +465 -0
- cyfaust/resources/architecture/faust/gui/JSONControl.h +48 -0
- cyfaust/resources/architecture/faust/gui/JSONUI.h +722 -0
- cyfaust/resources/architecture/faust/gui/JSONUIDecoder.h +589 -0
- cyfaust/resources/architecture/faust/gui/JuceGUI.h +2061 -0
- cyfaust/resources/architecture/faust/gui/JuceOSCUI.h +163 -0
- cyfaust/resources/architecture/faust/gui/JuceParameterUI.h +158 -0
- cyfaust/resources/architecture/faust/gui/JuceReader.h +103 -0
- cyfaust/resources/architecture/faust/gui/JuceStateUI.h +88 -0
- cyfaust/resources/architecture/faust/gui/LayoutUI.h +423 -0
- cyfaust/resources/architecture/faust/gui/LibsndfileReader.h +366 -0
- cyfaust/resources/architecture/faust/gui/MapUI.h +370 -0
- cyfaust/resources/architecture/faust/gui/MemoryReader.h +111 -0
- cyfaust/resources/architecture/faust/gui/MetaDataUI.h +357 -0
- cyfaust/resources/architecture/faust/gui/MidiUI.h +939 -0
- cyfaust/resources/architecture/faust/gui/OCVUI.h +688 -0
- cyfaust/resources/architecture/faust/gui/OSCUI.h +219 -0
- cyfaust/resources/architecture/faust/gui/PathBuilder.h +228 -0
- cyfaust/resources/architecture/faust/gui/PresetUI.h +337 -0
- cyfaust/resources/architecture/faust/gui/PrintCUI.h +152 -0
- cyfaust/resources/architecture/faust/gui/PrintUI.h +121 -0
- cyfaust/resources/architecture/faust/gui/QTUI.h +1891 -0
- cyfaust/resources/architecture/faust/gui/RosCI.h +493 -0
- cyfaust/resources/architecture/faust/gui/RosUI.h +488 -0
- cyfaust/resources/architecture/faust/gui/SaveUI.h +163 -0
- cyfaust/resources/architecture/faust/gui/SimpleParser.h +583 -0
- cyfaust/resources/architecture/faust/gui/SoundUI.h +217 -0
- cyfaust/resources/architecture/faust/gui/Soundfile.h +342 -0
- cyfaust/resources/architecture/faust/gui/Styles/Blue.qrc +5 -0
- cyfaust/resources/architecture/faust/gui/Styles/Blue.qss +177 -0
- cyfaust/resources/architecture/faust/gui/Styles/Default.qrc +5 -0
- cyfaust/resources/architecture/faust/gui/Styles/Default.qss +117 -0
- cyfaust/resources/architecture/faust/gui/Styles/Grey.qrc +5 -0
- cyfaust/resources/architecture/faust/gui/Styles/Grey.qss +174 -0
- cyfaust/resources/architecture/faust/gui/Styles/Salmon.qrc +5 -0
- cyfaust/resources/architecture/faust/gui/Styles/Salmon.qss +171 -0
- cyfaust/resources/architecture/faust/gui/UI.h +87 -0
- cyfaust/resources/architecture/faust/gui/ValueConverter.h +543 -0
- cyfaust/resources/architecture/faust/gui/WaveReader.h +364 -0
- cyfaust/resources/architecture/faust/gui/console.h +322 -0
- cyfaust/resources/architecture/faust/gui/httpdUI.h +372 -0
- cyfaust/resources/architecture/faust/gui/meta.h +39 -0
- cyfaust/resources/architecture/faust/gui/mspUI.h +580 -0
- cyfaust/resources/architecture/faust/gui/qrcodegen.h +269 -0
- cyfaust/resources/architecture/faust/gui/qrcodegen.impl.h +1025 -0
- cyfaust/resources/architecture/faust/gui/ring-buffer.h +414 -0
- cyfaust/resources/architecture/faust/midi/RtMidi.cpp +3054 -0
- cyfaust/resources/architecture/faust/midi/RtMidi.h +1034 -0
- cyfaust/resources/architecture/faust/midi/bela-midi.h +266 -0
- cyfaust/resources/architecture/faust/midi/daisy-midi.h +116 -0
- cyfaust/resources/architecture/faust/midi/esp32-midi.h +185 -0
- cyfaust/resources/architecture/faust/midi/gramophone-midi.h +107 -0
- cyfaust/resources/architecture/faust/midi/iplug2-midi.h +148 -0
- cyfaust/resources/architecture/faust/midi/jack-midi.h +247 -0
- cyfaust/resources/architecture/faust/midi/juce-midi.h +275 -0
- cyfaust/resources/architecture/faust/midi/midi.h +475 -0
- cyfaust/resources/architecture/faust/midi/rt-midi.h +315 -0
- cyfaust/resources/architecture/faust/midi/teensy-midi.h +89 -0
- cyfaust/resources/architecture/faust/misc.h +106 -0
- cyfaust/resources/architecture/faust/sound-file.h +132 -0
- cyfaust/resources/architecture/faust/unity/AudioPluginInterface.h +301 -0
- cyfaust/resources/architecture/faust/vst/faust.h +141 -0
- cyfaust/resources/architecture/faust/vst/voice.h +43 -0
- cyfaust/resources/architecture/faust/vst/vstui.h +524 -0
- cyfaust/resources/architecture/faustvst.cpp +3435 -0
- cyfaust/resources/architecture/faustvstqt.h +91 -0
- cyfaust/resources/architecture/gen-json.cpp +76 -0
- cyfaust/resources/architecture/jack-console.cpp +267 -0
- cyfaust/resources/architecture/jack-gtk-ros.cpp +139 -0
- cyfaust/resources/architecture/jack-gtk.cpp +282 -0
- cyfaust/resources/architecture/jack-internal.cpp +560 -0
- cyfaust/resources/architecture/jack-qt-chain-footer.cpp +87 -0
- cyfaust/resources/architecture/jack-qt-chain-header.cpp +92 -0
- cyfaust/resources/architecture/jack-qt.cpp +281 -0
- cyfaust/resources/architecture/jack.rs +171 -0
- cyfaust/resources/architecture/juce/README.md +84 -0
- cyfaust/resources/architecture/juce/juce-plugin.cpp +809 -0
- cyfaust/resources/architecture/juce/juce-standalone.cpp +413 -0
- cyfaust/resources/architecture/juce/plugin/plugin-llvm.jucer +184 -0
- cyfaust/resources/architecture/juce/plugin/plugin.jucer +159 -0
- cyfaust/resources/architecture/juce/standalone/standalone-llvm.jucer +216 -0
- cyfaust/resources/architecture/juce/standalone/standalone.jucer +191 -0
- cyfaust/resources/architecture/ladspa.cpp +543 -0
- cyfaust/resources/architecture/latexheader.tex +65 -0
- cyfaust/resources/architecture/lv2.cpp +2090 -0
- cyfaust/resources/architecture/lv2qtgui.h +62 -0
- cyfaust/resources/architecture/lv2ui.cpp +1966 -0
- cyfaust/resources/architecture/max-msp/README.md +109 -0
- cyfaust/resources/architecture/max-msp/faustgen-wrapper-poly.maxpat +184 -0
- cyfaust/resources/architecture/max-msp/faustgen-wrapper.maxpat +163 -0
- cyfaust/resources/architecture/max-msp/max-msp.cpp +734 -0
- cyfaust/resources/architecture/max-msp/max-msp64.cpp +789 -0
- cyfaust/resources/architecture/max-msp/py2max/README.md +277 -0
- cyfaust/resources/architecture/max-msp/py2max/py2max/__init__.py +3 -0
- cyfaust/resources/architecture/max-msp/py2max/py2max/common.py +7 -0
- cyfaust/resources/architecture/max-msp/py2max/py2max/core.py +1387 -0
- cyfaust/resources/architecture/max-msp/py2max/py2max/maxclassdb.py +318 -0
- cyfaust/resources/architecture/max-msp/py2max/py2max/utils.py +20 -0
- cyfaust/resources/architecture/max-msp/rnbo.py +1591 -0
- cyfaust/resources/architecture/max-msp/sndfile/sndfile.h +857 -0
- cyfaust/resources/architecture/max-msp/ui.js +230 -0
- cyfaust/resources/architecture/max-msp/wrapper-poly.maxpat +153 -0
- cyfaust/resources/architecture/max-msp/wrapper.maxpat +131 -0
- cyfaust/resources/architecture/minimal-bench.cpp +100 -0
- cyfaust/resources/architecture/minimal-effect.c +149 -0
- cyfaust/resources/architecture/minimal-effect.cpp +70 -0
- cyfaust/resources/architecture/minimal-fixed-point.cpp +195 -0
- cyfaust/resources/architecture/minimal-static.cpp +160 -0
- cyfaust/resources/architecture/minimal.c +103 -0
- cyfaust/resources/architecture/minimal.cpp +84 -0
- cyfaust/resources/architecture/minimal.rs +223 -0
- cyfaust/resources/architecture/module.cpp +91 -0
- cyfaust/resources/architecture/octave.cpp +471 -0
- cyfaust/resources/architecture/oscio-gtk.cpp +115 -0
- cyfaust/resources/architecture/oscio-qt.cpp +121 -0
- cyfaust/resources/architecture/owl.cpp +345 -0
- cyfaust/resources/architecture/pa-gtk.cpp +119 -0
- cyfaust/resources/architecture/pa-qt.cpp +261 -0
- cyfaust/resources/architecture/path-printer.cpp +100 -0
- cyfaust/resources/architecture/plot.cpp +128 -0
- cyfaust/resources/architecture/portaudio.rs +192 -0
- cyfaust/resources/architecture/puredata.cpp +636 -0
- cyfaust/resources/architecture/ra-qt.cpp +238 -0
- cyfaust/resources/architecture/sam/fast_pow2.h +69 -0
- cyfaust/resources/architecture/sam/fastexp.h +140 -0
- cyfaust/resources/architecture/sam/samFaustDSP.cpp +125 -0
- cyfaust/resources/architecture/sam/samFaustDSP.h +107 -0
- cyfaust/resources/architecture/scheduler.cpp +1391 -0
- cyfaust/resources/architecture/sndfile.cpp +291 -0
- cyfaust/resources/architecture/supercollider.cpp +611 -0
- cyfaust/resources/architecture/teensy/README.md +13 -0
- cyfaust/resources/architecture/teensy/teensy.cpp +214 -0
- cyfaust/resources/architecture/teensy/teensy.h +71 -0
- cyfaust/resources/architecture/thread.h +373 -0
- cyfaust/resources/architecture/vcvrack/README.md +78 -0
- cyfaust/resources/architecture/vcvrack/template/.gitignore +6 -0
- cyfaust/resources/architecture/vcvrack/template/Makefile +22 -0
- cyfaust/resources/architecture/vcvrack/template/res/FaustModule.svg +299 -0
- cyfaust/resources/architecture/vcvrack/template/src/FaustModule.cpp +942 -0
- cyfaust/resources/architecture/vst.cpp +947 -0
- cyfaust/resources/libraries/aanl.lib +900 -0
- cyfaust/resources/libraries/all.lib +36 -0
- cyfaust/resources/libraries/analyzers.lib +980 -0
- cyfaust/resources/libraries/basics.lib +2681 -0
- cyfaust/resources/libraries/compressors.lib +1341 -0
- cyfaust/resources/libraries/delays.lib +401 -0
- cyfaust/resources/libraries/demos.lib +1556 -0
- cyfaust/resources/libraries/dx7.lib +1036 -0
- cyfaust/resources/libraries/effect.lib +1645 -0
- cyfaust/resources/libraries/envelopes.lib +666 -0
- cyfaust/resources/libraries/examples/README.md +13 -0
- cyfaust/resources/libraries/examples/ambisonics/fourSourcesToOcto.dsp +20 -0
- cyfaust/resources/libraries/examples/ambisonics/oneSourceToStereo.dsp +12 -0
- cyfaust/resources/libraries/examples/analysis/FFT.dsp +26 -0
- cyfaust/resources/libraries/examples/analysis/dbmeter.dsp +19 -0
- cyfaust/resources/libraries/examples/analysis/spectralLevel.dsp +8 -0
- cyfaust/resources/libraries/examples/analysis/spectralTiltLab.dsp +20 -0
- cyfaust/resources/libraries/examples/analysis/vumeter.dsp +18 -0
- cyfaust/resources/libraries/examples/autodiff/delay/diff.dsp +2 -0
- cyfaust/resources/libraries/examples/autodiff/delay/gt.dsp +2 -0
- cyfaust/resources/libraries/examples/autodiff/gain/diff.dsp +7 -0
- cyfaust/resources/libraries/examples/autodiff/gain/gt.dsp +1 -0
- cyfaust/resources/libraries/examples/autodiff/gain_dc/diff.dsp +7 -0
- cyfaust/resources/libraries/examples/autodiff/gain_dc/gt.dsp +4 -0
- cyfaust/resources/libraries/examples/autodiff/gain_exp/diff.dsp +9 -0
- cyfaust/resources/libraries/examples/autodiff/gain_exp/gt.dsp +1 -0
- cyfaust/resources/libraries/examples/autodiff/gain_pow/diff.dsp +9 -0
- cyfaust/resources/libraries/examples/autodiff/gain_pow/gt.dsp +1 -0
- cyfaust/resources/libraries/examples/autodiff/gain_pow_trig/diff.dsp +12 -0
- cyfaust/resources/libraries/examples/autodiff/gain_pow_trig/gt.dsp +1 -0
- cyfaust/resources/libraries/examples/autodiff/gain_sq/diff.dsp +7 -0
- cyfaust/resources/libraries/examples/autodiff/gain_sq/gt.dsp +1 -0
- cyfaust/resources/libraries/examples/autodiff/mem/diff.dsp +1 -0
- cyfaust/resources/libraries/examples/autodiff/mem/gt.dsp +1 -0
- cyfaust/resources/libraries/examples/autodiff/noise.dsp +2 -0
- cyfaust/resources/libraries/examples/autodiff/noop.dsp +2 -0
- cyfaust/resources/libraries/examples/autodiff/one_zero/diff.dsp +2 -0
- cyfaust/resources/libraries/examples/autodiff/one_zero/gt.dsp +2 -0
- cyfaust/resources/libraries/examples/autodiff/ramp.dsp +1 -0
- cyfaust/resources/libraries/examples/autodiff/recursion/diff.dsp +2 -0
- cyfaust/resources/libraries/examples/autodiff/recursion/gt.dsp +1 -0
- cyfaust/resources/libraries/examples/autodiff/recursion/target.dsp +13 -0
- cyfaust/resources/libraries/examples/autodiff/tremolo/diff.dsp +14 -0
- cyfaust/resources/libraries/examples/autodiff/tremolo/diffable.lib +7 -0
- cyfaust/resources/libraries/examples/autodiff/tremolo/gt.dsp +11 -0
- cyfaust/resources/libraries/examples/delayEcho/echo.dsp +15 -0
- cyfaust/resources/libraries/examples/delayEcho/quadEcho.dsp +21 -0
- cyfaust/resources/libraries/examples/delayEcho/smoothDelay.dsp +26 -0
- cyfaust/resources/libraries/examples/delayEcho/stereoEcho.dsp +16 -0
- cyfaust/resources/libraries/examples/delayEcho/tapiir.dsp +44 -0
- cyfaust/resources/libraries/examples/dynamic/compressor.dsp +8 -0
- cyfaust/resources/libraries/examples/dynamic/distortion.dsp +8 -0
- cyfaust/resources/libraries/examples/dynamic/gateCompressor.dsp +10 -0
- cyfaust/resources/libraries/examples/dynamic/noiseGate.dsp +8 -0
- cyfaust/resources/libraries/examples/dynamic/volume.dsp +15 -0
- cyfaust/resources/libraries/examples/filtering/APF.dsp +13 -0
- cyfaust/resources/libraries/examples/filtering/BPF.dsp +13 -0
- cyfaust/resources/libraries/examples/filtering/DNN.dsp +25 -0
- cyfaust/resources/libraries/examples/filtering/HPF.dsp +13 -0
- cyfaust/resources/libraries/examples/filtering/LPF.dsp +13 -0
- cyfaust/resources/libraries/examples/filtering/bandFilter.dsp +44 -0
- cyfaust/resources/libraries/examples/filtering/cryBaby.dsp +4 -0
- cyfaust/resources/libraries/examples/filtering/diodeLadder.dsp +12 -0
- cyfaust/resources/libraries/examples/filtering/filterBank.dsp +6 -0
- cyfaust/resources/libraries/examples/filtering/graphicEqLab.dsp +10 -0
- cyfaust/resources/libraries/examples/filtering/highShelf.dsp +13 -0
- cyfaust/resources/libraries/examples/filtering/korg35HPF.dsp +13 -0
- cyfaust/resources/libraries/examples/filtering/korg35LPF.dsp +13 -0
- cyfaust/resources/libraries/examples/filtering/lfBoost.dsp +40 -0
- cyfaust/resources/libraries/examples/filtering/lowBoost.dsp +40 -0
- cyfaust/resources/libraries/examples/filtering/lowCut.dsp +40 -0
- cyfaust/resources/libraries/examples/filtering/lowShelf.dsp +13 -0
- cyfaust/resources/libraries/examples/filtering/moogHalfLadder.dsp +12 -0
- cyfaust/resources/libraries/examples/filtering/moogLadder.dsp +12 -0
- cyfaust/resources/libraries/examples/filtering/moogVCF.dsp +6 -0
- cyfaust/resources/libraries/examples/filtering/multibandFilter.dsp +14 -0
- cyfaust/resources/libraries/examples/filtering/notch.dsp +13 -0
- cyfaust/resources/libraries/examples/filtering/oberheim.dsp +14 -0
- cyfaust/resources/libraries/examples/filtering/oberheimBPF.dsp +13 -0
- cyfaust/resources/libraries/examples/filtering/oberheimBSF.dsp +13 -0
- cyfaust/resources/libraries/examples/filtering/oberheimHPF.dsp +13 -0
- cyfaust/resources/libraries/examples/filtering/oberheimLPF.dsp +13 -0
- cyfaust/resources/libraries/examples/filtering/parametricEqLab.dsp +10 -0
- cyfaust/resources/libraries/examples/filtering/parametricEqualizer.dsp +6 -0
- cyfaust/resources/libraries/examples/filtering/peakNotch.dsp +13 -0
- cyfaust/resources/libraries/examples/filtering/peakingEQ.dsp +13 -0
- cyfaust/resources/libraries/examples/filtering/sallenKey2ndOrder.dsp +14 -0
- cyfaust/resources/libraries/examples/filtering/sallenKey2ndOrderBPF.dsp +13 -0
- cyfaust/resources/libraries/examples/filtering/sallenKey2ndOrderHPF.dsp +13 -0
- cyfaust/resources/libraries/examples/filtering/sallenKey2ndOrderLPF.dsp +13 -0
- cyfaust/resources/libraries/examples/filtering/sallenKeyOnePole.dsp +13 -0
- cyfaust/resources/libraries/examples/filtering/sallenKeyOnePoleHPF.dsp +12 -0
- cyfaust/resources/libraries/examples/filtering/sallenKeyOnePoleLPF.dsp +12 -0
- cyfaust/resources/libraries/examples/filtering/spectralTilt.dsp +8 -0
- cyfaust/resources/libraries/examples/filtering/vcfWahLab.dsp +12 -0
- cyfaust/resources/libraries/examples/filtering/vocoder.dsp +8 -0
- cyfaust/resources/libraries/examples/filtering/wahPedal.dsp +6 -0
- cyfaust/resources/libraries/examples/gameaudio/bubble.dsp +42 -0
- cyfaust/resources/libraries/examples/gameaudio/door.dsp +58 -0
- cyfaust/resources/libraries/examples/gameaudio/fire.dsp +46 -0
- cyfaust/resources/libraries/examples/gameaudio/insects.dsp +148 -0
- cyfaust/resources/libraries/examples/gameaudio/rain.dsp +27 -0
- cyfaust/resources/libraries/examples/gameaudio/wind.dsp +23 -0
- cyfaust/resources/libraries/examples/generator/filterOsc.dsp +8 -0
- cyfaust/resources/libraries/examples/generator/noise.dsp +52 -0
- cyfaust/resources/libraries/examples/generator/noiseMetadata.dsp +74 -0
- cyfaust/resources/libraries/examples/generator/osc.dsp +17 -0
- cyfaust/resources/libraries/examples/generator/osci.dsp +17 -0
- cyfaust/resources/libraries/examples/generator/sawtoothLab.dsp +8 -0
- cyfaust/resources/libraries/examples/generator/virtualAnalog.dsp +8 -0
- cyfaust/resources/libraries/examples/generator/virtualAnalogLab.dsp +10 -0
- cyfaust/resources/libraries/examples/misc/UITester.dsp +71 -0
- cyfaust/resources/libraries/examples/misc/autopan.dsp +59 -0
- cyfaust/resources/libraries/examples/misc/capture.dsp +24 -0
- cyfaust/resources/libraries/examples/misc/drumkit.dsp +36 -0
- cyfaust/resources/libraries/examples/misc/guitarix.dsp +184 -0
- cyfaust/resources/libraries/examples/misc/matrix.dsp +17 -0
- cyfaust/resources/libraries/examples/misc/midiTester.dsp +122 -0
- cyfaust/resources/libraries/examples/misc/mixer.dsp +27 -0
- cyfaust/resources/libraries/examples/misc/statespace.dsp +39 -0
- cyfaust/resources/libraries/examples/misc/switcher.dsp +20 -0
- cyfaust/resources/libraries/examples/misc/tester.dsp +32 -0
- cyfaust/resources/libraries/examples/misc/tester2.dsp +31 -0
- cyfaust/resources/libraries/examples/old/README.md +5 -0
- cyfaust/resources/libraries/examples/old/freeverb.dsp +109 -0
- cyfaust/resources/libraries/examples/old/rewriting/Makefile +21 -0
- cyfaust/resources/libraries/examples/old/rewriting/fact.dsp +3 -0
- cyfaust/resources/libraries/examples/old/rewriting/fold.dsp +61 -0
- cyfaust/resources/libraries/examples/old/rewriting/mesh.dsp +43 -0
- cyfaust/resources/libraries/examples/old/rewriting/mesh.pd +37 -0
- cyfaust/resources/libraries/examples/old/rewriting/sample.pd +12 -0
- cyfaust/resources/libraries/examples/old/rewriting/serial.dsp +7 -0
- cyfaust/resources/libraries/examples/old/rewriting/sum.dsp +55 -0
- cyfaust/resources/libraries/examples/old/rewriting/test.pd +48 -0
- cyfaust/resources/libraries/examples/phasing/flanger.dsp +8 -0
- cyfaust/resources/libraries/examples/phasing/phaser.dsp +8 -0
- cyfaust/resources/libraries/examples/phasing/phaserFlangerLab.dsp +12 -0
- cyfaust/resources/libraries/examples/physicalModeling/brass.dsp +8 -0
- cyfaust/resources/libraries/examples/physicalModeling/brassMIDI.dsp +8 -0
- cyfaust/resources/libraries/examples/physicalModeling/churchBell.dsp +8 -0
- cyfaust/resources/libraries/examples/physicalModeling/clarinet.dsp +8 -0
- cyfaust/resources/libraries/examples/physicalModeling/clarinetMIDI.dsp +8 -0
- cyfaust/resources/libraries/examples/physicalModeling/djembeMIDI.dsp +8 -0
- cyfaust/resources/libraries/examples/physicalModeling/elecGuitarMIDI.dsp +10 -0
- cyfaust/resources/libraries/examples/physicalModeling/englishBell.dsp +8 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/NLFeks.dsp +91 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/NLFfm.dsp +70 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/README +125 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/bass.dsp +84 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/bass.h +91 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/blowBottle.dsp +102 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/bowed.dsp +114 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/brass.dsp +103 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/clarinet.dsp +110 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/flute.dsp +116 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/fluteStk.dsp +121 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/glassHarmonica.dsp +131 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/harpsi.dsp +90 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/harpsichord.h +185 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/instrument.h +114 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/modalBar.dsp +122 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/modalBar.h +48 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/audio-out.pd +33 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/bottle.pd +10 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/clarinets.pd +15 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/canon/audio-out.pd +33 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/canon/bass.pd +162 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/canon/canon.pd +55 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/canon/flute.pd +343 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/canon/pachelbel.mid +0 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/daisy/audio-out.pd +33 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/daisy/daisy.mid +0 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/daisy/daisy.pd +45 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/daisy/piano.pd +205 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/daisy/voiceForm.pd +340 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/take5/audio-out.pd +33 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/take5/blowHole.pd +330 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/take5/piano.pd +205 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/take5/take5.mid +0 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/take5/take5.pd +45 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/turkish-march/audio-out.pd +33 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/turkish-march/harpsi.pd +204 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/turkish-march/turkish-march.mid +0 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/turkish-march/turkish-march.pd +31 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/what-a-friend/audio-out.pd +33 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/what-a-friend/bass.pd +162 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/what-a-friend/modalBar.pd +258 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/what-a-friend/piano.pd +205 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/what-a-friend/what-a-friend.pd +52 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/what-a-friend/what_a_friend.mid +0 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/flutes.pd +15 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fm.pd +10 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/glassBare.pd +10 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/harpsichord-poly.pd +10 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/ironBare.pd +10 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/midi-in.pd +111 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/modal.pd +10 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/osc.pd +26 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/piano-poly.pd +10 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/plucked.pd +20 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/saxophone.pd +10 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/tibetan.pd +10 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/trumpet.pd +10 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/violin.pd +10 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/voiceSynth.pd +10 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/woodenBare.pd +10 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/phonemes.h +189 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/piano.dsp +255 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/piano.h +751 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/saxophony.dsp +114 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/sitar.dsp +48 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/tibetanBowl.dsp +155 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/tunedBar.dsp +123 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/uniBar.dsp +100 -0
- cyfaust/resources/libraries/examples/physicalModeling/faust-stk/voiceForm.dsp +125 -0
- cyfaust/resources/libraries/examples/physicalModeling/fds/1dDampedWaveEquation.dsp +43 -0
- cyfaust/resources/libraries/examples/physicalModeling/fds/2dKirchhoffThinPlate.dsp +75 -0
- cyfaust/resources/libraries/examples/physicalModeling/fds/BowedString.dsp +61 -0
- cyfaust/resources/libraries/examples/physicalModeling/fds/ControllableNonPhysicalString.dsp +72 -0
- cyfaust/resources/libraries/examples/physicalModeling/fds/HammeredString.dsp +74 -0
- cyfaust/resources/libraries/examples/physicalModeling/fds/PianoHammeredString.dsp +85 -0
- cyfaust/resources/libraries/examples/physicalModeling/fds/StiffString.dsp +54 -0
- cyfaust/resources/libraries/examples/physicalModeling/flute.dsp +8 -0
- cyfaust/resources/libraries/examples/physicalModeling/fluteMIDI.dsp +8 -0
- cyfaust/resources/libraries/examples/physicalModeling/frenchBell.dsp +8 -0
- cyfaust/resources/libraries/examples/physicalModeling/germanBell.dsp +8 -0
- cyfaust/resources/libraries/examples/physicalModeling/guitarMIDI.dsp +8 -0
- cyfaust/resources/libraries/examples/physicalModeling/karplus.dsp +8 -0
- cyfaust/resources/libraries/examples/physicalModeling/marimbaMIDI.dsp +10 -0
- cyfaust/resources/libraries/examples/physicalModeling/mi-faust/00_BasicOscillator/harmonicOscillator.dsp +58 -0
- cyfaust/resources/libraries/examples/physicalModeling/mi-faust/00_BasicOscillator/harmonicOscillator2.dsp +62 -0
- cyfaust/resources/libraries/examples/physicalModeling/mi-faust/00_BasicOscillator/harmonicOscillator3.dsp +65 -0
- cyfaust/resources/libraries/examples/physicalModeling/mi-faust/01_ParamControl/paramOsc.dsp +63 -0
- cyfaust/resources/libraries/examples/physicalModeling/mi-faust/02_AudioParamControl/audioParamOsc.dsp +63 -0
- cyfaust/resources/libraries/examples/physicalModeling/mi-faust/03_HammerTime/hammerOsc.dsp +71 -0
- cyfaust/resources/libraries/examples/physicalModeling/mi-faust/04_Gravity/bouncingOsc.dsp +64 -0
- cyfaust/resources/libraries/examples/physicalModeling/mi-faust/05_PluckedOscillator/pluckedOsc.dsp +57 -0
- cyfaust/resources/libraries/examples/physicalModeling/mi-faust/06_BowedOscillator/bowedOsc.dsp +65 -0
- cyfaust/resources/libraries/examples/physicalModeling/mi-faust/07_NonLinearOscillator/nlOsc.dsp +78 -0
- cyfaust/resources/libraries/examples/physicalModeling/mi-faust/08_TwoMassChain/2massChain.dsp +75 -0
- cyfaust/resources/libraries/examples/physicalModeling/mi-faust/09_TinyString/tinyString.dsp +101 -0
- cyfaust/resources/libraries/examples/physicalModeling/mi-faust/10_PluckedString/pluckedString.dsp +678 -0
- cyfaust/resources/libraries/examples/physicalModeling/mi-faust/11_BowedString/bowedString.dsp +671 -0
- cyfaust/resources/libraries/examples/physicalModeling/mi-faust/12_TriangleMesh/triangleMesh.dsp +448 -0
- cyfaust/resources/libraries/examples/physicalModeling/mi-faust/13_Construction/construction.dsp +1036 -0
- cyfaust/resources/libraries/examples/physicalModeling/mi-faust/14_Polyphonic/polyTriangle.dsp +79 -0
- cyfaust/resources/libraries/examples/physicalModeling/mi-faust/15_PhysicalLFO/physicalLFO.dsp +107 -0
- cyfaust/resources/libraries/examples/physicalModeling/modularInterpInstrMIDI.dsp +8 -0
- cyfaust/resources/libraries/examples/physicalModeling/nylonGuitarMIDI.dsp +8 -0
- cyfaust/resources/libraries/examples/physicalModeling/old/harpe.dsp +45 -0
- cyfaust/resources/libraries/examples/physicalModeling/old/karplus.dsp +34 -0
- cyfaust/resources/libraries/examples/physicalModeling/old/karplus32.dsp +47 -0
- cyfaust/resources/libraries/examples/physicalModeling/russianBell.dsp +8 -0
- cyfaust/resources/libraries/examples/physicalModeling/standardBell.dsp +8 -0
- cyfaust/resources/libraries/examples/physicalModeling/violin.dsp +8 -0
- cyfaust/resources/libraries/examples/physicalModeling/violinMIDI.dsp +8 -0
- cyfaust/resources/libraries/examples/physicalModeling/vocalBP.dsp +8 -0
- cyfaust/resources/libraries/examples/physicalModeling/vocalBPMIDI.dsp +8 -0
- cyfaust/resources/libraries/examples/physicalModeling/vocalFOF.dsp +8 -0
- cyfaust/resources/libraries/examples/physicalModeling/vocalFOFMIDI.dsp +8 -0
- cyfaust/resources/libraries/examples/pitchShifting/pitchShifter.dsp +20 -0
- cyfaust/resources/libraries/examples/psychoacoustic/harmonicExciter.dsp +10 -0
- cyfaust/resources/libraries/examples/quantizing/quantizedChords.dsp +49 -0
- cyfaust/resources/libraries/examples/reverb/dattorro.dsp +8 -0
- cyfaust/resources/libraries/examples/reverb/fdnRev.dsp +8 -0
- cyfaust/resources/libraries/examples/reverb/freeverb.dsp +8 -0
- cyfaust/resources/libraries/examples/reverb/greyhole.dsp +8 -0
- cyfaust/resources/libraries/examples/reverb/jprev.dsp +8 -0
- cyfaust/resources/libraries/examples/reverb/reverbDesigner.dsp +12 -0
- cyfaust/resources/libraries/examples/reverb/reverbTester.dsp +8 -0
- cyfaust/resources/libraries/examples/reverb/zitaRev.dsp +8 -0
- cyfaust/resources/libraries/examples/reverb/zitaRevFDN.dsp +8 -0
- cyfaust/resources/libraries/examples/smartKeyboard/acGuitar.dsp +100 -0
- cyfaust/resources/libraries/examples/smartKeyboard/associatedEffects/elecGuitarEffect.dsp +8 -0
- cyfaust/resources/libraries/examples/smartKeyboard/associatedEffects/myEffect.dsp +5 -0
- cyfaust/resources/libraries/examples/smartKeyboard/associatedEffects/reverb.dsp +5 -0
- cyfaust/resources/libraries/examples/smartKeyboard/bells.dsp +80 -0
- cyfaust/resources/libraries/examples/smartKeyboard/bowed.dsp +87 -0
- cyfaust/resources/libraries/examples/smartKeyboard/brass.dsp +82 -0
- cyfaust/resources/libraries/examples/smartKeyboard/clarinet.dsp +113 -0
- cyfaust/resources/libraries/examples/smartKeyboard/crazyGuiro.dsp +96 -0
- cyfaust/resources/libraries/examples/smartKeyboard/drums.dsp +74 -0
- cyfaust/resources/libraries/examples/smartKeyboard/dubDub.dsp +87 -0
- cyfaust/resources/libraries/examples/smartKeyboard/elecGuitar.dsp +67 -0
- cyfaust/resources/libraries/examples/smartKeyboard/fm.dsp +78 -0
- cyfaust/resources/libraries/examples/smartKeyboard/frog.dsp +74 -0
- cyfaust/resources/libraries/examples/smartKeyboard/harp.dsp +84 -0
- cyfaust/resources/libraries/examples/smartKeyboard/midiOnly.dsp +62 -0
- cyfaust/resources/libraries/examples/smartKeyboard/multiSynth.dsp +75 -0
- cyfaust/resources/libraries/examples/smartKeyboard/toy.dsp +71 -0
- cyfaust/resources/libraries/examples/smartKeyboard/trumpet.dsp +59 -0
- cyfaust/resources/libraries/examples/smartKeyboard/turenas.dsp +114 -0
- cyfaust/resources/libraries/examples/smartKeyboard/violin.dsp +91 -0
- cyfaust/resources/libraries/examples/smartKeyboard/violin2.dsp +84 -0
- cyfaust/resources/libraries/examples/smartKeyboard/vocal.dsp +43 -0
- cyfaust/resources/libraries/examples/spat/panpot.dsp +17 -0
- cyfaust/resources/libraries/examples/spat/spat.dsp +25 -0
- cyfaust/resources/libraries/fds.lib +535 -0
- cyfaust/resources/libraries/filter.lib +1710 -0
- cyfaust/resources/libraries/filters.lib +3125 -0
- cyfaust/resources/libraries/hoa.lib +1081 -0
- cyfaust/resources/libraries/instruments.lib +263 -0
- cyfaust/resources/libraries/interpolators.lib +675 -0
- cyfaust/resources/libraries/math.lib +602 -0
- cyfaust/resources/libraries/maths.lib +798 -0
- cyfaust/resources/libraries/maxmsp.lib +237 -0
- cyfaust/resources/libraries/mi.lib +528 -0
- cyfaust/resources/libraries/misceffects.lib +998 -0
- cyfaust/resources/libraries/music.lib +496 -0
- cyfaust/resources/libraries/noises.lib +487 -0
- cyfaust/resources/libraries/oscillator.lib +450 -0
- cyfaust/resources/libraries/oscillators.lib +1838 -0
- cyfaust/resources/libraries/phaflangers.lib +235 -0
- cyfaust/resources/libraries/physmodels.lib +3990 -0
- cyfaust/resources/libraries/platform.lib +59 -0
- cyfaust/resources/libraries/quantizers.lib +310 -0
- cyfaust/resources/libraries/reducemaps.lib +235 -0
- cyfaust/resources/libraries/reverbs.lib +686 -0
- cyfaust/resources/libraries/routes.lib +262 -0
- cyfaust/resources/libraries/sf.lib +53 -0
- cyfaust/resources/libraries/signals.lib +570 -0
- cyfaust/resources/libraries/soundfiles.lib +234 -0
- cyfaust/resources/libraries/spats.lib +173 -0
- cyfaust/resources/libraries/stdfaust.lib +38 -0
- cyfaust/resources/libraries/synths.lib +322 -0
- cyfaust/resources/libraries/tonestacks.lib +427 -0
- cyfaust/resources/libraries/tubes.lib +5039 -0
- cyfaust/resources/libraries/vaeffects.lib +984 -0
- cyfaust/resources/libraries/version.lib +22 -0
- cyfaust/resources/libraries/wdmodels.lib +2276 -0
- cyfaust/resources/libraries/webaudio.lib +402 -0
- cyfaust/signal.pxd +44 -0
- cyfaust/signal.pyx +1993 -0
- cyfaust-0.1.0.dist-info/METADATA +355 -0
- cyfaust-0.1.0.dist-info/RECORD +693 -0
- cyfaust-0.1.0.dist-info/WHEEL +5 -0
- cyfaust-0.1.0.dist-info/entry_points.txt +3 -0
- cyfaust-0.1.0.dist-info/licenses/LICENSE +26 -0
|
@@ -0,0 +1,2061 @@
|
|
|
1
|
+
/************************** BEGIN JuceGUI.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 JUCE_GUI_H
|
|
26
|
+
#define JUCE_GUI_H
|
|
27
|
+
|
|
28
|
+
#ifndef FAUSTFLOAT
|
|
29
|
+
#define FAUSTFLOAT float
|
|
30
|
+
#endif
|
|
31
|
+
|
|
32
|
+
#include <stack>
|
|
33
|
+
|
|
34
|
+
#include "../JuceLibraryCode/JuceHeader.h"
|
|
35
|
+
|
|
36
|
+
#include "faust/gui/GUI.h"
|
|
37
|
+
#include "faust/gui/MetaDataUI.h"
|
|
38
|
+
#include "faust/gui/ValueConverter.h"
|
|
39
|
+
|
|
40
|
+
// Definition of the standard size of the different elements
|
|
41
|
+
|
|
42
|
+
#define kKnobWidth 100
|
|
43
|
+
#define kKnobHeight 100
|
|
44
|
+
|
|
45
|
+
#define kVSliderWidth 80
|
|
46
|
+
#define kVSliderHeight 250
|
|
47
|
+
|
|
48
|
+
#define kHSliderWidth 350
|
|
49
|
+
#define kHSliderHeight 50
|
|
50
|
+
|
|
51
|
+
#define kButtonWidth 100
|
|
52
|
+
#define kButtonHeight 50
|
|
53
|
+
|
|
54
|
+
#define kCheckButtonWidth 60
|
|
55
|
+
#define kCheckButtonHeight 40
|
|
56
|
+
|
|
57
|
+
#define kMenuWidth 100
|
|
58
|
+
#define kMenuHeight 50
|
|
59
|
+
|
|
60
|
+
#define kRadioButtonWidth 100
|
|
61
|
+
#define kRadioButtonHeight 55
|
|
62
|
+
|
|
63
|
+
#define kNumEntryWidth 100
|
|
64
|
+
#define kNumEntryHeight 50
|
|
65
|
+
|
|
66
|
+
#define kNumDisplayWidth 75
|
|
67
|
+
#define kNumDisplayHeight 50
|
|
68
|
+
|
|
69
|
+
#define kVBargraphWidth 60
|
|
70
|
+
#define kVBargraphHeight 250
|
|
71
|
+
|
|
72
|
+
#define kHBargraphWidth 350
|
|
73
|
+
#define kHBargraphHeight 50
|
|
74
|
+
|
|
75
|
+
#define kLedWidth 25
|
|
76
|
+
#define kLedHeight 25
|
|
77
|
+
|
|
78
|
+
#define kNameHeight 14
|
|
79
|
+
|
|
80
|
+
#define kMargin 4
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* \brief Custom LookAndFeel class.
|
|
84
|
+
* \details Define the appearance of all the JUCE widgets.
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
struct CustomLookAndFeel : public juce::LookAndFeel_V3
|
|
88
|
+
{
|
|
89
|
+
void drawRoundThumb (juce::Graphics& g, const float x, const float y,
|
|
90
|
+
const float diameter, const juce::Colour& colour, float outlineThickness)
|
|
91
|
+
{
|
|
92
|
+
const juce::Rectangle<float> a (x, y, diameter, diameter);
|
|
93
|
+
const float halfThickness = outlineThickness * 0.5f;
|
|
94
|
+
|
|
95
|
+
juce::Path p;
|
|
96
|
+
p.addEllipse (x + halfThickness, y + halfThickness, diameter - outlineThickness, diameter - outlineThickness);
|
|
97
|
+
|
|
98
|
+
const juce::DropShadow ds (juce::Colours::black, 1, juce::Point<int> (0, 0));
|
|
99
|
+
ds.drawForPath (g, p);
|
|
100
|
+
|
|
101
|
+
g.setColour (colour);
|
|
102
|
+
g.fillPath (p);
|
|
103
|
+
|
|
104
|
+
g.setColour (colour.brighter());
|
|
105
|
+
g.strokePath (p, juce::PathStrokeType (outlineThickness));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
void drawButtonBackground (juce::Graphics& g, juce::Button& button, const juce::Colour& backgroundColour,
|
|
109
|
+
bool isMouseOverButton, bool isButtonDown) override
|
|
110
|
+
{
|
|
111
|
+
juce::Colour baseColour (backgroundColour.withMultipliedSaturation (button.hasKeyboardFocus (true) ? 1.3f : 0.9f)
|
|
112
|
+
.withMultipliedAlpha (button.isEnabled() ? 0.9f : 0.5f));
|
|
113
|
+
|
|
114
|
+
if (isButtonDown || isMouseOverButton)
|
|
115
|
+
baseColour = baseColour.contrasting (isButtonDown ? 0.2f : 0.1f);
|
|
116
|
+
|
|
117
|
+
const bool flatOnLeft = button.isConnectedOnLeft();
|
|
118
|
+
const bool flatOnRight = button.isConnectedOnRight();
|
|
119
|
+
const bool flatOnTop = button.isConnectedOnTop();
|
|
120
|
+
const bool flatOnBottom = button.isConnectedOnBottom();
|
|
121
|
+
|
|
122
|
+
const float width = button.getWidth() - 1.0f;
|
|
123
|
+
const float height = button.getHeight() - 1.0f;
|
|
124
|
+
|
|
125
|
+
if (width > 0 && height > 0)
|
|
126
|
+
{
|
|
127
|
+
const float cornerSize = juce::jmin(15.0f, juce::jmin(width, height) * 0.45f);
|
|
128
|
+
const float lineThickness = cornerSize * 0.1f;
|
|
129
|
+
const float halfThickness = lineThickness * 0.5f;
|
|
130
|
+
|
|
131
|
+
juce::Path outline;
|
|
132
|
+
outline.addRoundedRectangle (0.5f + halfThickness, 0.5f + halfThickness, width - lineThickness, height - lineThickness,
|
|
133
|
+
cornerSize, cornerSize,
|
|
134
|
+
! (flatOnLeft || flatOnTop),
|
|
135
|
+
! (flatOnRight || flatOnTop),
|
|
136
|
+
! (flatOnLeft || flatOnBottom),
|
|
137
|
+
! (flatOnRight || flatOnBottom));
|
|
138
|
+
|
|
139
|
+
const juce::Colour outlineColour (button.findColour (button.getToggleState() ? juce::TextButton::textColourOnId
|
|
140
|
+
: juce::TextButton::textColourOffId));
|
|
141
|
+
|
|
142
|
+
g.setColour (baseColour);
|
|
143
|
+
g.fillPath (outline);
|
|
144
|
+
|
|
145
|
+
if (! button.getToggleState()) {
|
|
146
|
+
g.setColour (outlineColour);
|
|
147
|
+
g.strokePath (outline, juce::PathStrokeType (lineThickness));
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
void drawTickBox (juce::Graphics& g, juce::Component& component,
|
|
153
|
+
float x, float y, float w, float h,
|
|
154
|
+
bool ticked,
|
|
155
|
+
bool isEnabled,
|
|
156
|
+
bool isMouseOverButton,
|
|
157
|
+
bool isButtonDown) override
|
|
158
|
+
{
|
|
159
|
+
const float boxSize = w * 0.7f;
|
|
160
|
+
|
|
161
|
+
bool isDownOrDragging = component.isEnabled() && (component.isMouseOverOrDragging() || component.isMouseButtonDown());
|
|
162
|
+
const juce::Colour colour (component.findColour (juce::TextButton::buttonColourId).withMultipliedSaturation ((component.hasKeyboardFocus (false) || isDownOrDragging) ? 1.3f : 0.9f)
|
|
163
|
+
.withMultipliedAlpha (component.isEnabled() ? 1.0f : 0.7f));
|
|
164
|
+
|
|
165
|
+
drawRoundThumb (g, x, y + (h - boxSize) * 0.5f, boxSize, colour,
|
|
166
|
+
isEnabled ? ((isButtonDown || isMouseOverButton) ? 1.1f : 0.5f) : 0.3f);
|
|
167
|
+
|
|
168
|
+
if (ticked) {
|
|
169
|
+
const juce::Path tick (juce::LookAndFeel_V2::getTickShape (6.0f));
|
|
170
|
+
g.setColour (isEnabled ? findColour (juce::TextButton::buttonOnColourId) : juce::Colours::grey);
|
|
171
|
+
|
|
172
|
+
const float scale = 9.0f;
|
|
173
|
+
const juce::AffineTransform trans (juce::AffineTransform::scale (w / scale, h / scale)
|
|
174
|
+
.translated (x - 2.5f, y + 1.0f));
|
|
175
|
+
g.fillPath (tick, trans);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
void drawLinearSliderThumb (juce::Graphics& g, int x, int y, int width, int height,
|
|
180
|
+
float sliderPos, float minSliderPos, float maxSliderPos,
|
|
181
|
+
const juce::Slider::SliderStyle style, juce::Slider& slider) override
|
|
182
|
+
{
|
|
183
|
+
const float sliderRadius = (float)(getSliderThumbRadius (slider) - 2);
|
|
184
|
+
|
|
185
|
+
bool isDownOrDragging = slider.isEnabled() && (slider.isMouseOverOrDragging() || slider.isMouseButtonDown());
|
|
186
|
+
juce::Colour knobColour (slider.findColour (juce::Slider::thumbColourId).withMultipliedSaturation ((slider.hasKeyboardFocus (false) || isDownOrDragging) ? 1.3f : 0.9f)
|
|
187
|
+
.withMultipliedAlpha (slider.isEnabled() ? 1.0f : 0.7f));
|
|
188
|
+
|
|
189
|
+
if (style == juce::Slider::LinearHorizontal || style == juce::Slider::LinearVertical) {
|
|
190
|
+
float kx, ky;
|
|
191
|
+
|
|
192
|
+
if (style == juce::Slider::LinearVertical) {
|
|
193
|
+
kx = x + width * 0.5f;
|
|
194
|
+
ky = sliderPos;
|
|
195
|
+
} else {
|
|
196
|
+
kx = sliderPos;
|
|
197
|
+
ky = y + height * 0.5f;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const float outlineThickness = slider.isEnabled() ? 0.8f : 0.3f;
|
|
201
|
+
|
|
202
|
+
drawRoundThumb (g,
|
|
203
|
+
kx - sliderRadius,
|
|
204
|
+
ky - sliderRadius,
|
|
205
|
+
sliderRadius * 2.0f,
|
|
206
|
+
knobColour, outlineThickness);
|
|
207
|
+
} else {
|
|
208
|
+
// Just call the base class for the demo
|
|
209
|
+
juce::LookAndFeel_V2::drawLinearSliderThumb (g, x, y, width, height, sliderPos, minSliderPos, maxSliderPos, style, slider);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
void drawLinearSlider (juce::Graphics& g, int x, int y, int width, int height,
|
|
214
|
+
float sliderPos, float minSliderPos, float maxSliderPos,
|
|
215
|
+
const juce::Slider::SliderStyle style, juce::Slider& slider) override
|
|
216
|
+
{
|
|
217
|
+
g.fillAll (slider.findColour (juce::Slider::backgroundColourId));
|
|
218
|
+
|
|
219
|
+
if (style == juce::Slider::LinearBar || style == juce::Slider::LinearBarVertical) {
|
|
220
|
+
const float fx = (float)x, fy = (float)y, fw = (float)width, fh = (float)height;
|
|
221
|
+
|
|
222
|
+
juce::Path p;
|
|
223
|
+
|
|
224
|
+
if (style == juce::Slider::LinearBarVertical)
|
|
225
|
+
p.addRectangle (fx, sliderPos, fw, 1.0f + fh - sliderPos);
|
|
226
|
+
else
|
|
227
|
+
p.addRectangle (fx, fy, sliderPos - fx, fh);
|
|
228
|
+
|
|
229
|
+
juce::Colour baseColour (slider.findColour (juce::Slider::rotarySliderFillColourId)
|
|
230
|
+
.withMultipliedSaturation (slider.isEnabled() ? 1.0f : 0.5f)
|
|
231
|
+
.withMultipliedAlpha (0.8f));
|
|
232
|
+
|
|
233
|
+
g.setColour (baseColour);
|
|
234
|
+
g.fillPath (p);
|
|
235
|
+
|
|
236
|
+
const float lineThickness = juce::jmin(15.0f, juce::jmin(width, height) * 0.45f) * 0.1f;
|
|
237
|
+
g.drawRect (slider.getLocalBounds().toFloat(), lineThickness);
|
|
238
|
+
} else {
|
|
239
|
+
drawLinearSliderBackground (g, x, y, width, height, sliderPos, minSliderPos, maxSliderPos, style, slider);
|
|
240
|
+
drawLinearSliderThumb (g, x, y, width, height, sliderPos, minSliderPos, maxSliderPos, style, slider);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
void drawLinearSliderBackground (juce::Graphics& g, int x, int y, int width, int height,
|
|
245
|
+
float /*sliderPos*/,
|
|
246
|
+
float /*minSliderPos*/,
|
|
247
|
+
float /*maxSliderPos*/,
|
|
248
|
+
const juce::Slider::SliderStyle /*style*/, juce::Slider& slider) override
|
|
249
|
+
{
|
|
250
|
+
const float sliderRadius = getSliderThumbRadius (slider) - 5.0f;
|
|
251
|
+
juce::Path on, off;
|
|
252
|
+
|
|
253
|
+
if (slider.isHorizontal()) {
|
|
254
|
+
const float iy = y + height * 0.5f - sliderRadius * 0.5f;
|
|
255
|
+
juce::Rectangle<float> r (x - sliderRadius * 0.5f, iy, width + sliderRadius, sliderRadius);
|
|
256
|
+
const float onW = r.getWidth() * ((float)slider.valueToProportionOfLength (slider.getValue()));
|
|
257
|
+
|
|
258
|
+
on.addRectangle (r.removeFromLeft (onW));
|
|
259
|
+
off.addRectangle (r);
|
|
260
|
+
} else {
|
|
261
|
+
const float ix = x + width * 0.5f - sliderRadius * 0.5f;
|
|
262
|
+
juce::Rectangle<float> r (ix, y - sliderRadius * 0.5f, sliderRadius, height + sliderRadius);
|
|
263
|
+
const float onH = r.getHeight() * ((float)slider.valueToProportionOfLength (slider.getValue()));
|
|
264
|
+
|
|
265
|
+
on.addRectangle (r.removeFromBottom (onH));
|
|
266
|
+
off.addRectangle (r);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
g.setColour (slider.findColour (juce::Slider::rotarySliderFillColourId));
|
|
270
|
+
g.fillPath (on);
|
|
271
|
+
|
|
272
|
+
g.setColour (slider.findColour (juce::Slider::trackColourId));
|
|
273
|
+
g.fillPath (off);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
void drawRotarySlider (juce::Graphics& g, int x, int y, int width, int height, float sliderPos,
|
|
277
|
+
float rotaryStartAngle, float rotaryEndAngle, juce::Slider& slider) override
|
|
278
|
+
{
|
|
279
|
+
const float radius = juce::jmin(width / 2, height / 2) - 4.0f;
|
|
280
|
+
const float centreX = x + width * 0.5f;
|
|
281
|
+
const float centreY = y + height * 0.5f;
|
|
282
|
+
const float rx = centreX - radius;
|
|
283
|
+
const float ry = centreY - radius;
|
|
284
|
+
const float rw = radius * 2.0f;
|
|
285
|
+
const float angle = rotaryStartAngle + sliderPos * (rotaryEndAngle - rotaryStartAngle);
|
|
286
|
+
const bool isMouseOver = slider.isMouseOverOrDragging() && slider.isEnabled();
|
|
287
|
+
|
|
288
|
+
//Background
|
|
289
|
+
{
|
|
290
|
+
g.setColour(juce::Colours::lightgrey.withAlpha (isMouseOver ? 1.0f : 0.7f));
|
|
291
|
+
juce::Path intFilledArc;
|
|
292
|
+
intFilledArc.addPieSegment(rx, ry, rw, rw, rotaryStartAngle, rotaryEndAngle, 0.8);
|
|
293
|
+
g.fillPath(intFilledArc);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if (slider.isEnabled()) {
|
|
297
|
+
g.setColour(slider.findColour (juce::Slider::rotarySliderFillColourId).withAlpha (isMouseOver ? 1.0f : 0.7f));
|
|
298
|
+
} else {
|
|
299
|
+
g.setColour(juce::Colour (0x80808080));
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
//Render knob value
|
|
303
|
+
{
|
|
304
|
+
juce::Path pathArc;
|
|
305
|
+
pathArc.addPieSegment(rx, ry, rw, rw, rotaryStartAngle, angle, 0.8);
|
|
306
|
+
g.fillPath(pathArc);
|
|
307
|
+
|
|
308
|
+
juce::Path cursor, cursorShadow;
|
|
309
|
+
float rectWidth = radius*0.4;
|
|
310
|
+
float rectHeight = rectWidth/2;
|
|
311
|
+
float rectX = centreX + radius*0.9 - rectHeight/2;
|
|
312
|
+
float rectY = centreY - rectWidth/2;
|
|
313
|
+
|
|
314
|
+
cursor.addRectangle(rectX, rectY, rectWidth, rectHeight);
|
|
315
|
+
cursorShadow.addRectangle(rectX-1, rectY-1, rectWidth+2, rectHeight+2);
|
|
316
|
+
|
|
317
|
+
juce::AffineTransform t = juce::AffineTransform::translation(-rectWidth + 2, rectHeight/2);
|
|
318
|
+
t = t.rotated((angle - juce::MathConstants<float>::pi/2), centreX, centreY);
|
|
319
|
+
|
|
320
|
+
cursor.applyTransform(t);
|
|
321
|
+
cursorShadow.applyTransform(t);
|
|
322
|
+
|
|
323
|
+
g.setColour(juce::Colours::black);
|
|
324
|
+
g.fillPath(cursor);
|
|
325
|
+
|
|
326
|
+
g.setColour(juce::Colours::black .withAlpha(0.15f));
|
|
327
|
+
g.fillPath(cursorShadow);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* \brief Different kind of slider available
|
|
334
|
+
* \see uiSlider
|
|
335
|
+
*/
|
|
336
|
+
enum SliderType {
|
|
337
|
+
HSlider, /*!< Horizontal Slider */
|
|
338
|
+
VSlider, /*!< Vertical Slider */
|
|
339
|
+
NumEntry, /*!< Numerical Entry Box */
|
|
340
|
+
Knob /*!< Circular Slider */
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* \brief Different kind of VU-meter available.
|
|
345
|
+
*/
|
|
346
|
+
enum VUMeterType {
|
|
347
|
+
HVUMeter, /*!< Horizontal VU-meter */
|
|
348
|
+
VVUMeter, /*!< Vertical VU-meter */
|
|
349
|
+
Led, /*!< LED VU-meter */
|
|
350
|
+
NumDisplay /*!< TextBox VU-meter */
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* \brief Intern class for all FAUST widgets.
|
|
355
|
+
* \details Every active, passive or box widgets derive from this class.
|
|
356
|
+
*/
|
|
357
|
+
class uiBase
|
|
358
|
+
{
|
|
359
|
+
|
|
360
|
+
protected:
|
|
361
|
+
|
|
362
|
+
int fTotalWidth, fTotalHeight; // Size with margins included (for a uiBox)
|
|
363
|
+
int fDisplayRectWidth, fDisplayRectHeight; // Size without margin, just the child dimensions, sum on one dimension, max on the other
|
|
364
|
+
float fHRatio, fVRatio;
|
|
365
|
+
|
|
366
|
+
public:
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* \brief Constructor.
|
|
370
|
+
* \details Initialize a uiBase with all its sizes.
|
|
371
|
+
*
|
|
372
|
+
* \param totWidth Minimal total width.
|
|
373
|
+
* \param totHeight Minimal total Height.
|
|
374
|
+
*/
|
|
375
|
+
uiBase(int totWidth = 0, int totHeight = 0):
|
|
376
|
+
fTotalWidth(totWidth), fTotalHeight(totHeight),
|
|
377
|
+
fDisplayRectWidth(0), fDisplayRectHeight(0),
|
|
378
|
+
fHRatio(1), fVRatio(1)
|
|
379
|
+
{}
|
|
380
|
+
|
|
381
|
+
virtual ~uiBase()
|
|
382
|
+
{}
|
|
383
|
+
|
|
384
|
+
/** Return the size. */
|
|
385
|
+
juce::Rectangle<int> getSize()
|
|
386
|
+
{
|
|
387
|
+
return juce::Rectangle<int>(0, 0, fTotalWidth, fTotalHeight);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/** Return the total height in pixels. */
|
|
391
|
+
int getTotalHeight()
|
|
392
|
+
{
|
|
393
|
+
return fTotalHeight;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/** Return the total width in pixels. */
|
|
397
|
+
int getTotalWidth()
|
|
398
|
+
{
|
|
399
|
+
return fTotalWidth;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/** Return the horizontal ratio, between 0 and 1. */
|
|
403
|
+
float getHRatio()
|
|
404
|
+
{
|
|
405
|
+
return fHRatio;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/** Return the vertical ratio, between 0 and 1. */
|
|
409
|
+
float getVRatio()
|
|
410
|
+
{
|
|
411
|
+
return fVRatio;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* \brief Set the uiBase bounds.
|
|
416
|
+
* \details Convert absolute bounds to relative bounds,
|
|
417
|
+
* used in JUCE Component mechanics.
|
|
418
|
+
*
|
|
419
|
+
* \param r The absolute bounds.
|
|
420
|
+
*
|
|
421
|
+
*/
|
|
422
|
+
void setRelativeSize(juce::Component* comp, const juce::Rectangle<int>& r)
|
|
423
|
+
{
|
|
424
|
+
comp->setBounds(r.getX() - comp->getParentComponent()->getX(),
|
|
425
|
+
r.getY() - comp->getParentComponent()->getY(),
|
|
426
|
+
r.getWidth(),
|
|
427
|
+
r.getHeight());
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
virtual void init(juce::Component* comp = nullptr)
|
|
431
|
+
{
|
|
432
|
+
/** Initialize both vertical and horizontal ratios. */
|
|
433
|
+
assert(comp);
|
|
434
|
+
uiBase* parentBox = comp->findParentComponentOfClass<uiBase>();
|
|
435
|
+
if (parentBox != nullptr) {
|
|
436
|
+
fHRatio = (float)fTotalWidth / (float)parentBox->fDisplayRectWidth;
|
|
437
|
+
fVRatio = (float)fTotalHeight / (float)parentBox->fDisplayRectHeight;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
virtual void setRecommendedSize()
|
|
442
|
+
{}
|
|
443
|
+
|
|
444
|
+
virtual void add(juce::Component* comp)
|
|
445
|
+
{}
|
|
446
|
+
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* \brief Intern class for all FAUST active or passive widgets.
|
|
451
|
+
* \details Every activ or passive widgets derive from this class.
|
|
452
|
+
*/
|
|
453
|
+
class uiComponent : public uiBase, public juce::Component, public uiItem
|
|
454
|
+
{
|
|
455
|
+
|
|
456
|
+
public:
|
|
457
|
+
/**
|
|
458
|
+
* \brief Constructor.
|
|
459
|
+
* \details Initialize all uiItem, uiBase and the tooltip variables.
|
|
460
|
+
*
|
|
461
|
+
* \param gui Current FAUST GUI.
|
|
462
|
+
* \param zone Zone of the widget.
|
|
463
|
+
* \param w Width of the widget.
|
|
464
|
+
* \param h Height of the widget.
|
|
465
|
+
* \param name Name of the widget.
|
|
466
|
+
*/
|
|
467
|
+
uiComponent(GUI* gui, FAUSTFLOAT* zone, int w, int h, juce::String name):uiBase(w, h), Component(name), uiItem(gui, zone)
|
|
468
|
+
{}
|
|
469
|
+
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* \brief Intern class for all kind of sliders.
|
|
474
|
+
* \see SliderType
|
|
475
|
+
*/
|
|
476
|
+
class uiSlider : public uiComponent, public uiConverter, private juce::Slider::Listener
|
|
477
|
+
{
|
|
478
|
+
|
|
479
|
+
private:
|
|
480
|
+
|
|
481
|
+
juce::Slider::SliderStyle fStyle;
|
|
482
|
+
juce::Label fLabel;
|
|
483
|
+
SliderType fType;
|
|
484
|
+
juce::Slider fSlider;
|
|
485
|
+
|
|
486
|
+
public:
|
|
487
|
+
/**
|
|
488
|
+
* \brief Constructor.
|
|
489
|
+
* \details Initialize all uiComponent variables, and Slider specific ones.
|
|
490
|
+
* Initialize juce::Slider parameters.
|
|
491
|
+
*
|
|
492
|
+
* \param gui, zone, w, h, tooltip, name uiComponent variables.
|
|
493
|
+
* \param min Minimum value of the slider.
|
|
494
|
+
* \param max Maximum value of the slider.
|
|
495
|
+
* \param cur Initial value of the slider.
|
|
496
|
+
* \param step Step of the slider.
|
|
497
|
+
* \param unit Unit of the slider value.
|
|
498
|
+
* \param scale Scale of the slider, exponential, logarithmic, or linear.
|
|
499
|
+
* \param type Type of slider (see SliderType).
|
|
500
|
+
*/
|
|
501
|
+
uiSlider(GUI* gui, FAUSTFLOAT* zone, FAUSTFLOAT w, FAUSTFLOAT h, FAUSTFLOAT cur, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step, juce::String name, juce::String unit, juce::String tooltip, MetaDataUI::Scale scale, SliderType type)
|
|
502
|
+
: uiComponent(gui, zone, w, h, name), uiConverter(scale, min, max, min, max), fType(type)
|
|
503
|
+
{
|
|
504
|
+
// Set the JUCE widget initalization variables.
|
|
505
|
+
switch(fType) {
|
|
506
|
+
case HSlider:
|
|
507
|
+
fStyle = juce::Slider::SliderStyle::LinearHorizontal;
|
|
508
|
+
break;
|
|
509
|
+
case VSlider:
|
|
510
|
+
fStyle = juce::Slider::SliderStyle::LinearVertical;
|
|
511
|
+
fSlider.setTextBoxStyle(juce::Slider::TextBoxBelow, false, 60, 20);
|
|
512
|
+
break;
|
|
513
|
+
case NumEntry:
|
|
514
|
+
fSlider.setIncDecButtonsMode(juce::Slider::incDecButtonsDraggable_AutoDirection);
|
|
515
|
+
fStyle = juce::Slider::SliderStyle::IncDecButtons;
|
|
516
|
+
break;
|
|
517
|
+
case Knob:
|
|
518
|
+
fStyle = juce::Slider::SliderStyle::Rotary;
|
|
519
|
+
fSlider.setTextBoxStyle(juce::Slider::TextBoxBelow, false, 60, 20);
|
|
520
|
+
break;
|
|
521
|
+
default:
|
|
522
|
+
break;
|
|
523
|
+
}
|
|
524
|
+
addAndMakeVisible(fSlider);
|
|
525
|
+
|
|
526
|
+
// Slider settings
|
|
527
|
+
fSlider.setRange(min, max, step);
|
|
528
|
+
fSlider.setValue(fConverter->faust2ui(cur));
|
|
529
|
+
fSlider.addListener(this);
|
|
530
|
+
fSlider.setSliderStyle(fStyle);
|
|
531
|
+
fSlider.setTextValueSuffix(" " + unit);
|
|
532
|
+
fSlider.setTooltip(tooltip);
|
|
533
|
+
switch (scale) {
|
|
534
|
+
case MetaDataUI::kLog:
|
|
535
|
+
fSlider.setSkewFactor(0.25);
|
|
536
|
+
break;
|
|
537
|
+
case MetaDataUI::kExp:
|
|
538
|
+
fSlider.setSkewFactor(0.75);
|
|
539
|
+
break;
|
|
540
|
+
default:
|
|
541
|
+
break;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// Label settings, only happens for a horizontal of numerical entry slider
|
|
545
|
+
// because the method attachToComponent only give the choice to place the
|
|
546
|
+
// slider name on centered top, which is what we want. It's done manually
|
|
547
|
+
// in the paint method.
|
|
548
|
+
if (fType == HSlider || fType == NumEntry) {
|
|
549
|
+
fLabel.setText(getName(), juce::dontSendNotification);
|
|
550
|
+
fLabel.attachToComponent(&fSlider, true);
|
|
551
|
+
fLabel.setTooltip(tooltip);
|
|
552
|
+
addAndMakeVisible(fLabel);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/** Draw the name of a vertical or circular slider. */
|
|
557
|
+
virtual void paint(juce::Graphics& g) override
|
|
558
|
+
{
|
|
559
|
+
if (fType == VSlider || fType == Knob) {
|
|
560
|
+
g.setColour(juce::Colours::black);
|
|
561
|
+
g.drawText(getName(), getLocalBounds(), juce::Justification::centredTop);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/** Allow to control the slider when its value is changed, but not by the user. */
|
|
566
|
+
void reflectZone() override
|
|
567
|
+
{
|
|
568
|
+
FAUSTFLOAT v = *fZone;
|
|
569
|
+
fCache = v;
|
|
570
|
+
fSlider.setValue(fConverter->faust2ui(v));
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/** JUCE callback for a slider value change, give the value to the FAUST module. */
|
|
574
|
+
void sliderValueChanged(juce::Slider* slider) override
|
|
575
|
+
{
|
|
576
|
+
float v = slider->getValue();
|
|
577
|
+
modifyZone(FAUSTFLOAT(fConverter->ui2faust(v)));
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Set the good coordinates and size for the juce::Slider object depending
|
|
582
|
+
* on its SliderType, whenever the layout size changes.
|
|
583
|
+
*/
|
|
584
|
+
void resized() override
|
|
585
|
+
{
|
|
586
|
+
int x, y, width, height;
|
|
587
|
+
|
|
588
|
+
switch (fType) {
|
|
589
|
+
|
|
590
|
+
case HSlider: {
|
|
591
|
+
int nameWidth = juce::Font().getStringWidth(getName()) + kMargin * 2;
|
|
592
|
+
x = nameWidth;
|
|
593
|
+
y = 0;
|
|
594
|
+
width = getWidth() - nameWidth;
|
|
595
|
+
height = getHeight();
|
|
596
|
+
break;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
case VSlider:
|
|
600
|
+
x = 0;
|
|
601
|
+
y = kNameHeight; // kNameHeight pixels for the name
|
|
602
|
+
height = getHeight() - kNameHeight;
|
|
603
|
+
width = getWidth();
|
|
604
|
+
break;
|
|
605
|
+
|
|
606
|
+
case NumEntry:
|
|
607
|
+
width = kNumEntryWidth;
|
|
608
|
+
height = kNumEntryHeight;
|
|
609
|
+
// x position is the top left corner horizontal position of the box
|
|
610
|
+
// and not the top left of the NumEntry label, so we have to do that
|
|
611
|
+
x = (getWidth() - width)/2 + (juce::Font().getStringWidth(getName()) + kMargin)/2;
|
|
612
|
+
y = (getHeight() - height)/2;
|
|
613
|
+
break;
|
|
614
|
+
|
|
615
|
+
case Knob:
|
|
616
|
+
// The knob name needs to be displayed, kNameHeight pixels
|
|
617
|
+
height = width = juce::jmin(getHeight() - kNameHeight, kKnobHeight);
|
|
618
|
+
x = (getWidth() - width)/2;
|
|
619
|
+
// kNameHeight pixels for the knob name still
|
|
620
|
+
y = juce::jmax((getHeight() - height)/2, kNameHeight);
|
|
621
|
+
break;
|
|
622
|
+
|
|
623
|
+
default:
|
|
624
|
+
assert(false);
|
|
625
|
+
break;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
fSlider.setBounds(x, y, width, height);
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
/** Intern class for button */
|
|
634
|
+
class uiButton : public uiComponent, private juce::Button::Listener
|
|
635
|
+
{
|
|
636
|
+
|
|
637
|
+
private:
|
|
638
|
+
|
|
639
|
+
juce::TextButton fButton;
|
|
640
|
+
|
|
641
|
+
public:
|
|
642
|
+
/**
|
|
643
|
+
* \brief Constructor.
|
|
644
|
+
* \details Initialize all uiComponent variables and juce::TextButton parameters.
|
|
645
|
+
*
|
|
646
|
+
* \param gui, zone, w, h, tooltip, label uiComponent variable.
|
|
647
|
+
*/
|
|
648
|
+
uiButton(GUI* gui, FAUSTFLOAT* zone, FAUSTFLOAT w, FAUSTFLOAT h, juce::String label, juce::String tooltip) : uiComponent(gui, zone, w, h, label)
|
|
649
|
+
{
|
|
650
|
+
int x = 0;
|
|
651
|
+
int y = (getHeight() - kButtonHeight)/2;
|
|
652
|
+
|
|
653
|
+
fButton.setButtonText(label);
|
|
654
|
+
fButton.setBounds(x, y, kButtonWidth, kButtonHeight);
|
|
655
|
+
fButton.addListener(this);
|
|
656
|
+
fButton.setTooltip(tooltip);
|
|
657
|
+
addAndMakeVisible(fButton);
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Has to be defined because its a pure virtual function of juce::Button::Listener,
|
|
662
|
+
* which uiButton derives from. Control of user actions is done in buttonStateChanged.
|
|
663
|
+
* \see buttonStateChanged
|
|
664
|
+
*/
|
|
665
|
+
void buttonClicked (juce::Button* button) override
|
|
666
|
+
{}
|
|
667
|
+
|
|
668
|
+
/** Indicate to the FAUST module when the button is pressed and released. */
|
|
669
|
+
void buttonStateChanged (juce::Button* button) override
|
|
670
|
+
{
|
|
671
|
+
if (button->isDown()) {
|
|
672
|
+
modifyZone(FAUSTFLOAT(1));
|
|
673
|
+
} else {
|
|
674
|
+
modifyZone(FAUSTFLOAT(0));
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
void reflectZone() override
|
|
679
|
+
{
|
|
680
|
+
FAUSTFLOAT v = *fZone;
|
|
681
|
+
fCache = v;
|
|
682
|
+
if (v == FAUSTFLOAT(1)) {
|
|
683
|
+
fButton.triggerClick();
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
/** Set the good coordinates and size to the juce::TextButton widget whenever the layout size changes. */
|
|
688
|
+
virtual void resized() override
|
|
689
|
+
{
|
|
690
|
+
int x = kMargin;
|
|
691
|
+
int width = getWidth() - 2 * kMargin;
|
|
692
|
+
int height = juce::jmin(getHeight(), kButtonHeight);
|
|
693
|
+
int y = (getHeight()-height)/2;
|
|
694
|
+
fButton.setBounds(x, y, width, height);
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
/** Intern class for checkButton */
|
|
700
|
+
class uiCheckButton : public uiComponent, private juce::Button::Listener
|
|
701
|
+
{
|
|
702
|
+
|
|
703
|
+
private:
|
|
704
|
+
|
|
705
|
+
juce::ToggleButton fCheckButton;
|
|
706
|
+
|
|
707
|
+
public:
|
|
708
|
+
/**
|
|
709
|
+
* \brief Constructor.
|
|
710
|
+
* \details Initialize all uiComponent variables and juce::ToggleButton parameters.
|
|
711
|
+
*
|
|
712
|
+
* \param gui, zone, w, h, label, tooltip uiComponent variables.
|
|
713
|
+
*/
|
|
714
|
+
uiCheckButton(GUI* gui, FAUSTFLOAT* zone, FAUSTFLOAT w, FAUSTFLOAT h, juce::String label, juce::String tooltip) : uiComponent(gui, zone, w, h, label)
|
|
715
|
+
{
|
|
716
|
+
int x = 0;
|
|
717
|
+
int y = (getHeight()-h)/2;
|
|
718
|
+
|
|
719
|
+
fCheckButton.setButtonText(label);
|
|
720
|
+
fCheckButton.setBounds(x, y, w, h);
|
|
721
|
+
fCheckButton.addListener(this);
|
|
722
|
+
fCheckButton.setTooltip(tooltip);
|
|
723
|
+
addAndMakeVisible(fCheckButton);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
/** Indicate to the FAUST module when the button is toggled or not. */
|
|
727
|
+
void buttonClicked(juce::Button* button) override
|
|
728
|
+
{
|
|
729
|
+
//std::cout << getName() << " : " << button->getToggleState() << std::endl;
|
|
730
|
+
modifyZone(button->getToggleState());
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
void reflectZone() override
|
|
734
|
+
{
|
|
735
|
+
FAUSTFLOAT v = *fZone;
|
|
736
|
+
fCache = v;
|
|
737
|
+
fCheckButton.triggerClick();
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
/** Set the good coordinates and size to the juce::ToggleButton widget, whenever the layout size changes. */
|
|
741
|
+
virtual void resized() override
|
|
742
|
+
{
|
|
743
|
+
fCheckButton.setBounds(getLocalBounds());
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
};
|
|
747
|
+
|
|
748
|
+
/** Intern class for Menu */
|
|
749
|
+
class uiMenu : public uiComponent, private juce::ComboBox::Listener
|
|
750
|
+
{
|
|
751
|
+
|
|
752
|
+
private:
|
|
753
|
+
|
|
754
|
+
juce::ComboBox fComboBox;
|
|
755
|
+
std::vector<double> fValues;
|
|
756
|
+
|
|
757
|
+
public:
|
|
758
|
+
/**
|
|
759
|
+
* \brief Constructor.
|
|
760
|
+
* \details Initialize the uiComponent and Menu specific variables, and the juce::ComboBox parameters.
|
|
761
|
+
* Menu is considered as a slider in the FAUST logic, with a step of one. The first item
|
|
762
|
+
* would be 0 on a slider, the second 1, etc. Each "slider value" is associated with a
|
|
763
|
+
* string.
|
|
764
|
+
*
|
|
765
|
+
* \param gui, zone, w, h, tooltip, label uiComponent variables.
|
|
766
|
+
* \param cur Current "slider value" associated with the current item selected.
|
|
767
|
+
* \param low Lowest value possible.
|
|
768
|
+
* \param hi Highest value possible.
|
|
769
|
+
* \param mdescr Menu description. Contains the names of the items associated with their "value".
|
|
770
|
+
*/
|
|
771
|
+
uiMenu(GUI* gui, FAUSTFLOAT* zone, juce::String label, FAUSTFLOAT w, FAUSTFLOAT h, FAUSTFLOAT cur, FAUSTFLOAT lo, FAUSTFLOAT hi, juce::String tooltip, const char* mdescr) : uiComponent(gui, zone, w, h, label)
|
|
772
|
+
{
|
|
773
|
+
//Init ComboBox parameters
|
|
774
|
+
fComboBox.setEditableText(false);
|
|
775
|
+
fComboBox.setJustificationType(juce::Justification::centred);
|
|
776
|
+
fComboBox.addListener(this);
|
|
777
|
+
addAndMakeVisible(fComboBox);
|
|
778
|
+
|
|
779
|
+
std::vector<std::string> names;
|
|
780
|
+
std::vector<double> values;
|
|
781
|
+
|
|
782
|
+
if (parseMenuList(mdescr, names, values)) {
|
|
783
|
+
|
|
784
|
+
int defaultitem = -1;
|
|
785
|
+
double mindelta = FLT_MAX;
|
|
786
|
+
int item = 1;
|
|
787
|
+
|
|
788
|
+
// Go through all the Menu's items.
|
|
789
|
+
for (int i = 0; i < names.size(); i++) {
|
|
790
|
+
double v = values[i];
|
|
791
|
+
if ((v >= lo) && (v <= hi)) {
|
|
792
|
+
// It is a valid value : add corresponding menu item
|
|
793
|
+
// item astrating at 1 because index 0 is reserved for a non-defined item.
|
|
794
|
+
fComboBox.addItem(juce::String(names[i].c_str()), item++);
|
|
795
|
+
fValues.push_back(v);
|
|
796
|
+
|
|
797
|
+
// Check if this item is a good candidate to represent the current value
|
|
798
|
+
double delta = fabs(cur-v);
|
|
799
|
+
if (delta < mindelta) {
|
|
800
|
+
mindelta = delta;
|
|
801
|
+
defaultitem = fComboBox.getNumItems();
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
// check the best candidate to represent the current value
|
|
806
|
+
if (defaultitem > -1) {
|
|
807
|
+
fComboBox.setSelectedItemIndex(defaultitem);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
*fZone = cur;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
/** Indicate to the FAUST module when the selected items is changed. */
|
|
815
|
+
void comboBoxChanged (juce::ComboBox* cb) override
|
|
816
|
+
{
|
|
817
|
+
//std::cout << getName( )<< " : " << cb->getSelectedId() - 1 << std::endl;
|
|
818
|
+
// -1 because of the starting item at 1 at the initialization
|
|
819
|
+
modifyZone(fValues[cb->getSelectedId() - 1]);
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
virtual void reflectZone() override
|
|
823
|
+
{
|
|
824
|
+
FAUSTFLOAT v = *fZone;
|
|
825
|
+
fCache = v;
|
|
826
|
+
|
|
827
|
+
// search closest value
|
|
828
|
+
int defaultitem = -1;
|
|
829
|
+
double mindelta = FLT_MAX;
|
|
830
|
+
|
|
831
|
+
for (unsigned int i = 0; i < fValues.size(); i++) {
|
|
832
|
+
double delta = fabs(fValues[i]-v);
|
|
833
|
+
if (delta < mindelta) {
|
|
834
|
+
mindelta = delta;
|
|
835
|
+
defaultitem = i;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
if (defaultitem > -1) {
|
|
839
|
+
fComboBox.setSelectedItemIndex(defaultitem);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
/** Set the good coordinates and size to the juce::ComboBox widget whenever the layout get reiszed */
|
|
844
|
+
virtual void resized() override
|
|
845
|
+
{
|
|
846
|
+
fComboBox.setBounds(0, 0 + kMenuHeight/2, getWidth(), kMenuHeight/2);
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
/** Display the name of the Menu */
|
|
850
|
+
virtual void paint(juce::Graphics& g) override
|
|
851
|
+
{
|
|
852
|
+
g.setColour(juce::Colours::black);
|
|
853
|
+
g.drawText(getName(), getLocalBounds().withHeight(getHeight()/2), juce::Justification::centredTop);
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
};
|
|
857
|
+
|
|
858
|
+
/** Intern class for RadioButton */
|
|
859
|
+
class uiRadioButton : public uiComponent, private juce::Button::Listener
|
|
860
|
+
{
|
|
861
|
+
|
|
862
|
+
private:
|
|
863
|
+
|
|
864
|
+
bool fIsVertical;
|
|
865
|
+
juce::OwnedArray<juce::ToggleButton> fButtons;
|
|
866
|
+
std::vector<double> fValues;
|
|
867
|
+
|
|
868
|
+
public:
|
|
869
|
+
/**
|
|
870
|
+
* \brief Constructor.
|
|
871
|
+
* \details Initialize the uiComponent variables, and the RadioButton specific variables
|
|
872
|
+
* and parameters. Works in a similar way to the Menu, because it is a special
|
|
873
|
+
* kind of sliders in the faust logic.
|
|
874
|
+
* \see uiMenu
|
|
875
|
+
*
|
|
876
|
+
* \param gui, zone, tooltip, label uiComponent variables.
|
|
877
|
+
* \param w uiComponent variable and width of the RadioButton widget.
|
|
878
|
+
* \param h uiComponent variable and height of the RadioButton widget.
|
|
879
|
+
* \param cur Current "value" associated with the item selected.
|
|
880
|
+
* \param low Lowest "value" possible.
|
|
881
|
+
* \param hi Highest "value" possible.
|
|
882
|
+
* \param vert True if vertical, false if horizontal.
|
|
883
|
+
* \param names Contain the names of the different items.
|
|
884
|
+
* \param values Contain the "values" of the different items.
|
|
885
|
+
* \param fRadioGroupID RadioButton being multiple CheckButton in JUCE,
|
|
886
|
+
* we need an ID to know which are linked together.
|
|
887
|
+
*/
|
|
888
|
+
uiRadioButton(GUI* gui, FAUSTFLOAT* zone, juce::String label, FAUSTFLOAT w, FAUSTFLOAT h, FAUSTFLOAT cur, FAUSTFLOAT lo, FAUSTFLOAT hi, bool vert, std::vector<std::string>& names, std::vector<double>& values, juce::String tooltip, int radioGroupID) : uiComponent(gui, zone, w, h, label), fIsVertical(vert)
|
|
889
|
+
{
|
|
890
|
+
juce::ToggleButton* defaultbutton = 0;
|
|
891
|
+
double mindelta = FLT_MAX;
|
|
892
|
+
|
|
893
|
+
for (int i = 0; i < names.size(); i++) {
|
|
894
|
+
double v = values[i];
|
|
895
|
+
if ((v >= lo) && (v <= hi)) {
|
|
896
|
+
|
|
897
|
+
// It is a valid value included in slider's range
|
|
898
|
+
juce::ToggleButton* tb = new juce::ToggleButton(names[i]);
|
|
899
|
+
addAndMakeVisible(tb);
|
|
900
|
+
tb->setRadioGroupId (radioGroupID);
|
|
901
|
+
tb->addListener(this);
|
|
902
|
+
tb->setTooltip(tooltip);
|
|
903
|
+
fValues.push_back(v);
|
|
904
|
+
fButtons.add(tb);
|
|
905
|
+
|
|
906
|
+
// Check if this item is a good candidate to represent the current value
|
|
907
|
+
double delta = fabs(cur-v);
|
|
908
|
+
if (delta < mindelta) {
|
|
909
|
+
mindelta = delta;
|
|
910
|
+
defaultbutton = tb;
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
// check the best candidate to represent the current value
|
|
915
|
+
if (defaultbutton) {
|
|
916
|
+
defaultbutton->setToggleState (true, juce::dontSendNotification);
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
virtual void reflectZone() override
|
|
921
|
+
{
|
|
922
|
+
FAUSTFLOAT v = *fZone;
|
|
923
|
+
fCache = v;
|
|
924
|
+
|
|
925
|
+
// select closest value
|
|
926
|
+
int defaultitem = -1;
|
|
927
|
+
double mindelta = FLT_MAX;
|
|
928
|
+
|
|
929
|
+
for (unsigned int i = 0; i < fValues.size(); i++) {
|
|
930
|
+
double delta = fabs(fValues[i]-v);
|
|
931
|
+
if (delta < mindelta) {
|
|
932
|
+
mindelta = delta;
|
|
933
|
+
defaultitem = i;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
if (defaultitem > -1) {
|
|
937
|
+
fButtons.operator[](defaultitem)->setToggleState (true, juce::dontSendNotification);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
/** Handle the placement of each juce::ToggleButton everytime the layout size is changed. */
|
|
942
|
+
virtual void resized() override
|
|
943
|
+
{
|
|
944
|
+
int width, height;
|
|
945
|
+
fIsVertical ? (height = (getHeight() - kNameHeight) / fButtons.size()) : (width = getWidth() / fButtons.size());
|
|
946
|
+
|
|
947
|
+
for (int i = 0; i < fButtons.size(); i++) {
|
|
948
|
+
if (fIsVertical) {
|
|
949
|
+
fButtons.operator[](i)->setBounds(0, i * height + kNameHeight, getWidth(), height);
|
|
950
|
+
} else {
|
|
951
|
+
// kNameHeight pixels offset for the title
|
|
952
|
+
fButtons.operator[](i)->setBounds(i * width, kNameHeight, width, getHeight() - kNameHeight);
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
/** Display the RadioButton name */
|
|
958
|
+
virtual void paint(juce::Graphics& g) override
|
|
959
|
+
{
|
|
960
|
+
g.setColour(juce::Colours::black);
|
|
961
|
+
g.drawText(getName(), getLocalBounds().withHeight(kNameHeight), juce::Justification::centredTop);
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
/** Check which button is checked, and give its "value" to the FAUST module */
|
|
965
|
+
void buttonClicked(juce::Button* button) override
|
|
966
|
+
{
|
|
967
|
+
juce::ToggleButton* checkButton = dynamic_cast<juce::ToggleButton*>(button);
|
|
968
|
+
//std::cout << getName() << " : " << fButtons.indexOf(checkButton) << std::endl;
|
|
969
|
+
modifyZone(fButtons.indexOf(checkButton));
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
};
|
|
973
|
+
|
|
974
|
+
/**
|
|
975
|
+
* \brief Intern class for VU-meter
|
|
976
|
+
* \details There is no JUCE widgets for VU-meter, so its fully designed in this class.
|
|
977
|
+
*/
|
|
978
|
+
class uiVUMeter : public uiComponent, public juce::SettableTooltipClient, public juce::Timer
|
|
979
|
+
{
|
|
980
|
+
|
|
981
|
+
private:
|
|
982
|
+
|
|
983
|
+
FAUSTFLOAT fLevel; // Current level of the VU-meter.
|
|
984
|
+
FAUSTFLOAT fMin, fMax; // Linear range of the VU-meter.
|
|
985
|
+
FAUSTFLOAT fScaleMin, fScaleMax; // Range in dB if needed.
|
|
986
|
+
bool fDB; // True if it's a dB VU-meter, false otherwise.
|
|
987
|
+
VUMeterType fStyle;
|
|
988
|
+
juce::String fUnit;
|
|
989
|
+
juce::Label fLabel; // Name of the VU-meter.
|
|
990
|
+
|
|
991
|
+
bool isNameDisplayed()
|
|
992
|
+
{
|
|
993
|
+
return (!(getName().startsWith("0x")) && getName().isNotEmpty());
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
/** Give the right coordinates and size to the text of Label depending on the VU-meter style */
|
|
997
|
+
void setLabelPos()
|
|
998
|
+
{
|
|
999
|
+
if (fStyle == VVUMeter) {
|
|
1000
|
+
// -22 on the height because of the text box.
|
|
1001
|
+
fLabel.setBounds((getWidth()-50)/2, getHeight()-22, 50, 20);
|
|
1002
|
+
} else if (fStyle == HVUMeter) {
|
|
1003
|
+
isNameDisplayed() ? fLabel.setBounds(63, (getHeight()-20)/2, 50, 20)
|
|
1004
|
+
: fLabel.setBounds(3, (getHeight()-20)/2, 50, 20);
|
|
1005
|
+
} else if (fStyle == NumDisplay) {
|
|
1006
|
+
fLabel.setBounds((getWidth()-kNumDisplayWidth)/2,
|
|
1007
|
+
(getHeight()-kNumDisplayHeight/2)/2,
|
|
1008
|
+
kNumDisplayWidth,
|
|
1009
|
+
kNumDisplayHeight/2);
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
/** Contain all the initialization need for our Label */
|
|
1014
|
+
void setupLabel(juce::String tooltip)
|
|
1015
|
+
{
|
|
1016
|
+
setLabelPos();
|
|
1017
|
+
fLabel.setEditable(false, false, false);
|
|
1018
|
+
fLabel.setJustificationType(juce::Justification::centred);
|
|
1019
|
+
fLabel.setText(juce::String(*fZone) + " " + fUnit, juce::dontSendNotification);
|
|
1020
|
+
fLabel.setTooltip(tooltip);
|
|
1021
|
+
addAndMakeVisible(fLabel);
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* \brief Generic method to draw an horizontal VU-meter.
|
|
1026
|
+
* \details Draw the background of the bargraph, and the TextBox box, without taking
|
|
1027
|
+
* care of the actual level of the VU-meter
|
|
1028
|
+
* \see drawHBargraphDB
|
|
1029
|
+
* \see drawHBargraphLin
|
|
1030
|
+
*
|
|
1031
|
+
* \param g JUCE graphics context, used to draw components or images.
|
|
1032
|
+
* \param width Width of the VU-meter widget.
|
|
1033
|
+
* \param height Height of the VU-meter widget.
|
|
1034
|
+
* \param level Current level that needs to be displayed.
|
|
1035
|
+
* \param dB True if it's a db level, false otherwise.
|
|
1036
|
+
*/
|
|
1037
|
+
void drawHBargraph(juce::Graphics& g, int width, int height)
|
|
1038
|
+
{
|
|
1039
|
+
float x;
|
|
1040
|
+
float y = (float)(getHeight()-height)/2;
|
|
1041
|
+
if (isNameDisplayed()) {
|
|
1042
|
+
x = 120;
|
|
1043
|
+
width -= x;
|
|
1044
|
+
// VUMeter Name
|
|
1045
|
+
g.setColour(juce::Colours::black);
|
|
1046
|
+
g.drawText(getName(), 0, y, 60, height, juce::Justification::centredRight);
|
|
1047
|
+
} else {
|
|
1048
|
+
x = 60;
|
|
1049
|
+
width -= x;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
// VUMeter Background
|
|
1053
|
+
g.setColour(juce::Colours::lightgrey);
|
|
1054
|
+
g.fillRect(x, y, (float)width, (float)height);
|
|
1055
|
+
g.setColour(juce::Colours::black);
|
|
1056
|
+
g.fillRect(x+1.0f, y+1.0f, (float)width-2, (float)height-2);
|
|
1057
|
+
|
|
1058
|
+
// Label Window
|
|
1059
|
+
g.setColour(juce::Colours::darkgrey);
|
|
1060
|
+
g.fillRect((int)x-58, (getHeight()-22)/2, 52, 22);
|
|
1061
|
+
g.setColour(juce::Colours::white.withAlpha(0.8f));
|
|
1062
|
+
g.fillRect((int)x-57, (getHeight()-20)/2, 50, 20);
|
|
1063
|
+
|
|
1064
|
+
// Call the appropriate drawing method for the level.
|
|
1065
|
+
fDB ? drawHBargraphDB (g, y, height) : drawHBargraphLin(g, x, y, width, height);
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* Method in charge of drawing the level of a horizontal dB VU-meter.
|
|
1070
|
+
*
|
|
1071
|
+
* \param g JUCE graphics context, used to draw components or images.
|
|
1072
|
+
* \param y y coordinate of the VU-meter.
|
|
1073
|
+
* \param height Height of the VU-meter.
|
|
1074
|
+
* \param level Current level of the VU-meter, in dB.
|
|
1075
|
+
*/
|
|
1076
|
+
void drawHBargraphDB(juce::Graphics& g, int y, int height)
|
|
1077
|
+
{
|
|
1078
|
+
// Drawing Scale
|
|
1079
|
+
g.setFont(9.0f);
|
|
1080
|
+
g.setColour(juce::Colours::white);
|
|
1081
|
+
for (int i = -10; i > fMin; i -= 10) {
|
|
1082
|
+
paintScale(g, i);
|
|
1083
|
+
}
|
|
1084
|
+
for (int i = -6; i < fMax; i += 3) {
|
|
1085
|
+
paintScale(g, i);
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
int alpha = 200;
|
|
1089
|
+
FAUSTFLOAT dblevel = dB2Scale(fLevel);
|
|
1090
|
+
|
|
1091
|
+
// We need to test here every color changing levels, to avoid to mix colors because of the alpha,
|
|
1092
|
+
// and so to start the new color rectangle at the end of the previous one.
|
|
1093
|
+
|
|
1094
|
+
// Drawing from the minimal range to the current level, or -10dB.
|
|
1095
|
+
g.setColour(juce::Colour((juce::uint8)40, (juce::uint8)160, (juce::uint8)40, (juce::uint8)alpha));
|
|
1096
|
+
g.fillRect(dB2x(fMin), y+1.0f, juce::jmin(dB2x(fLevel)-dB2x(fMin), dB2x(-10)-dB2x(fMin)), (float)height-2);
|
|
1097
|
+
|
|
1098
|
+
// Drawing from -10dB to the current level, or -6dB.
|
|
1099
|
+
if (dblevel > dB2Scale(-10)) {
|
|
1100
|
+
g.setColour(juce::Colour((juce::uint8)160, (juce::uint8)220, (juce::uint8)20, (juce::uint8)alpha));
|
|
1101
|
+
g.fillRect(dB2x(-10), y+1.0f, juce::jmin(dB2x(fLevel)-dB2x(-10), dB2x(-6)-dB2x(-10)), (float)height-2);
|
|
1102
|
+
}
|
|
1103
|
+
// Drawing from -6dB to the current level, or -3dB.
|
|
1104
|
+
if (dblevel > dB2Scale(-6)) {
|
|
1105
|
+
g.setColour(juce::Colour((juce::uint8)220, (juce::uint8)220, (juce::uint8)20, (juce::uint8)alpha));
|
|
1106
|
+
g.fillRect(dB2x(-6), y+1.0f, juce::jmin(dB2x(fLevel)-dB2x(-6), dB2x(-3)-dB2x(-6)), (float)height-2);
|
|
1107
|
+
}
|
|
1108
|
+
// Drawing from -3dB to the current level, or 0dB.
|
|
1109
|
+
if (dblevel > dB2Scale(-3)) {
|
|
1110
|
+
g.setColour(juce::Colour((juce::uint8)240, (juce::uint8)160, (juce::uint8)20, (juce::uint8)alpha));
|
|
1111
|
+
g.fillRect(dB2x(-3), y+1.0f, juce::jmin(dB2x(fLevel)-dB2x(-3), dB2x(0)-dB2x(-3)), (float)height-2);
|
|
1112
|
+
}
|
|
1113
|
+
// Drawing from 0dB to the current level, or the max range.
|
|
1114
|
+
if (dblevel > dB2Scale(0)) {
|
|
1115
|
+
g.setColour(juce::Colour((juce::uint8)240, (juce::uint8)0, (juce::uint8)20, (juce::uint8)alpha));
|
|
1116
|
+
g.fillRect(dB2x(0), y+1.0f, juce::jmin(dB2x(fLevel)-dB2x(0), dB2x(fMax)-dB2x(0)), (float)height-2);
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
/**
|
|
1121
|
+
* Method in charge of drawing the level of a horizontal linear VU-meter.
|
|
1122
|
+
*
|
|
1123
|
+
* \param g JUCE graphics context, used to draw components or images.
|
|
1124
|
+
* \param x x coordinate of the VU-meter.
|
|
1125
|
+
* \param y y coordinate of the VU-meter.
|
|
1126
|
+
* \param height Height of the VU-meter.
|
|
1127
|
+
* \param width Width of the VU-meter.
|
|
1128
|
+
* \param level Current level of the VU-meter, in linear logic.
|
|
1129
|
+
*/
|
|
1130
|
+
void drawHBargraphLin(juce::Graphics& g, int x, int y, int width, int height)
|
|
1131
|
+
{
|
|
1132
|
+
int alpha = 200;
|
|
1133
|
+
juce::Colour c = juce::Colour((juce::uint8)255, (juce::uint8)165, (juce::uint8)0, (juce::uint8)alpha);
|
|
1134
|
+
|
|
1135
|
+
// Drawing from the minimal range to the current level, or 20% of the VU-meter
|
|
1136
|
+
g.setColour(c.brighter());
|
|
1137
|
+
g.fillRect(x+1.0f, y+1.0f, juce::jmin<float>(fLevel*(width-2), 0.2f*(width-2)), (float)height-2);
|
|
1138
|
+
// Drawing from 20% of the VU-meter to the current level, or 90% of the VU-meter
|
|
1139
|
+
if (fLevel > 0.2f) {
|
|
1140
|
+
g.setColour(c);
|
|
1141
|
+
g.fillRect(x+1.0f + 0.2f*(width-2), y+1.0f, juce::jmin<float>((fLevel-0.2f) * (width-2), (0.9f-0.2f) * (width-2)), (float)height-2);
|
|
1142
|
+
}
|
|
1143
|
+
// Drawing from 90% of the VU-meter to the current level, or the maximal range of the VU-meter
|
|
1144
|
+
if (fLevel > 0.9f) {
|
|
1145
|
+
g.setColour(c.darker());
|
|
1146
|
+
g.fillRect(x+1.0f + 0.9f*(width-2), y+1.0f, juce::jmin<float>((fLevel-0.9f) * (width-2), (1.0f-0.9f) * (width-2)), (float)height-2);
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* \brief Generic method to draw a vertical VU-meter.
|
|
1151
|
+
* \details Draw the background of the bargraph, and the TextBox box, without taking
|
|
1152
|
+
* care of the actual level of the VU-meter
|
|
1153
|
+
* \see drawHBargraphDB
|
|
1154
|
+
* \see drawHBargraphLin
|
|
1155
|
+
*
|
|
1156
|
+
* \param g JUCE graphics context, used to draw components or images.
|
|
1157
|
+
* \param width Width of the VU-meter widget.
|
|
1158
|
+
* \param height Height of the VU-meter widget.
|
|
1159
|
+
* \param level Current level that needs to be displayed.
|
|
1160
|
+
* \param dB True if it's a db level, false otherwise.
|
|
1161
|
+
*/
|
|
1162
|
+
void drawVBargraph(juce::Graphics& g, int width, int height)
|
|
1163
|
+
{
|
|
1164
|
+
float x = (float)(getWidth()-width)/2;
|
|
1165
|
+
float y;
|
|
1166
|
+
if (isNameDisplayed()) {
|
|
1167
|
+
y = (float)getHeight()-height+15;
|
|
1168
|
+
height -= 40;
|
|
1169
|
+
// VUMeter Name
|
|
1170
|
+
g.setColour(juce::Colours::black);
|
|
1171
|
+
g.drawText(getName(), getLocalBounds(), juce::Justification::centredTop);
|
|
1172
|
+
} else {
|
|
1173
|
+
y = (float)getHeight()-height;
|
|
1174
|
+
height -= 25;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
// VUMeter Background
|
|
1178
|
+
g.setColour(juce::Colours::lightgrey);
|
|
1179
|
+
g.fillRect(x, y, (float)width, (float)height);
|
|
1180
|
+
g.setColour(juce::Colours::black);
|
|
1181
|
+
g.fillRect(x+1.0f, y+1.0f, (float)width-2, (float)height-2);
|
|
1182
|
+
|
|
1183
|
+
// Label window
|
|
1184
|
+
g.setColour(juce::Colours::darkgrey);
|
|
1185
|
+
g.fillRect(juce::jmax((getWidth()-50)/2, 0), getHeight()-23, juce::jmin(getWidth(), 50), 22);
|
|
1186
|
+
g.setColour(juce::Colours::white.withAlpha(0.8f));
|
|
1187
|
+
g.fillRect(juce::jmax((getWidth()-48)/2, 1), getHeight()-22, juce::jmin(getWidth()-2, 48), 20);
|
|
1188
|
+
|
|
1189
|
+
fDB ? drawVBargraphDB (g, x, width) : drawVBargraphLin(g, x, width);
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
/**
|
|
1193
|
+
* Method in charge of drawing the level of a vertical dB VU-meter.
|
|
1194
|
+
*
|
|
1195
|
+
* \param g JUCE graphics context, used to draw components or images.
|
|
1196
|
+
* \param x x coordinate of the VU-meter.
|
|
1197
|
+
* \param width Width of the VU-meter.
|
|
1198
|
+
* \param level Current level of the VU-meter, in dB.
|
|
1199
|
+
*/
|
|
1200
|
+
void drawVBargraphDB(juce::Graphics& g, int x, int width)
|
|
1201
|
+
{
|
|
1202
|
+
// Drawing Scale
|
|
1203
|
+
g.setFont(9.0f);
|
|
1204
|
+
g.setColour(juce::Colours::white);
|
|
1205
|
+
for (int i = -10; i > fMin; i -= 10) {
|
|
1206
|
+
paintScale(g, i);
|
|
1207
|
+
}
|
|
1208
|
+
for (int i = -6; i < fMax; i += 3) {
|
|
1209
|
+
paintScale(g, i);
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
int alpha = 200;
|
|
1213
|
+
FAUSTFLOAT dblevel = dB2Scale(fLevel);
|
|
1214
|
+
|
|
1215
|
+
// We need to test here every color changing levels, to avoid to mix colors because of the alpha,
|
|
1216
|
+
// and so to start the new color rectangle at the end of the previous one.
|
|
1217
|
+
|
|
1218
|
+
// Drawing from the minimal range to the current level, or -10dB.
|
|
1219
|
+
g.setColour(juce::Colour((juce::uint8)40, (juce::uint8)160, (juce::uint8)40, (juce::uint8)alpha));
|
|
1220
|
+
g.fillRect(x+1.0f, juce::jmax(dB2y(fLevel), dB2y(-10)), (float)width-2, dB2y(fMin)-juce::jmax(dB2y(fLevel), dB2y(-10)));
|
|
1221
|
+
|
|
1222
|
+
// Drawing from -10dB to the current level, or -6dB.
|
|
1223
|
+
if (dblevel > dB2Scale(-10)) {
|
|
1224
|
+
g.setColour(juce::Colour((juce::uint8)160, (juce::uint8)220, (juce::uint8)20, (juce::uint8)alpha));
|
|
1225
|
+
g.fillRect(x+1.0f, juce::jmax(dB2y(fLevel), dB2y(-6)), (float)width-2, dB2y(-10)-juce::jmax(dB2y(fLevel), dB2y(-6)));
|
|
1226
|
+
}
|
|
1227
|
+
// Drawing from -6dB to the current level, or -3dB.
|
|
1228
|
+
if (dblevel > dB2Scale(-6)) {
|
|
1229
|
+
g.setColour(juce::Colour((juce::uint8)220, (juce::uint8)220, (juce::uint8)20, (juce::uint8)alpha));
|
|
1230
|
+
g.fillRect(x+1.0f, juce::jmax(dB2y(fLevel), dB2y(-3)), (float)width-2, dB2y(-6)-juce::jmax(dB2y(fLevel), dB2y(-3)));
|
|
1231
|
+
}
|
|
1232
|
+
// Drawing from -3dB to the current level, or 0dB.
|
|
1233
|
+
if (dblevel > dB2Scale(-3)) {
|
|
1234
|
+
g.setColour(juce::Colour((juce::uint8)240, (juce::uint8)160, (juce::uint8)20, (juce::uint8)alpha));
|
|
1235
|
+
g.fillRect(x+1.0f, juce::jmax(dB2y(fLevel), dB2y(0)), (float)width-2, dB2y(-3)-juce::jmax(dB2y(fLevel), dB2y(0)));
|
|
1236
|
+
}
|
|
1237
|
+
// Drawing from 0dB to the current level, or the maximum range.
|
|
1238
|
+
if (dblevel > dB2Scale(0)) {
|
|
1239
|
+
g.setColour(juce::Colour((juce::uint8)240, (juce::uint8)0, (juce::uint8)20, (juce::uint8)alpha));
|
|
1240
|
+
g.fillRect(x+1.0f, juce::jmax(dB2y(fLevel), dB2y(fMax)), (float)width-2, dB2y(0)-juce::jmax(dB2y(fLevel), dB2y(fMax)));
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
/**
|
|
1245
|
+
* Method in charge of drawing the level of a vertical linear VU-meter.
|
|
1246
|
+
*
|
|
1247
|
+
* \param g JUCE graphics context, used to draw components or images.
|
|
1248
|
+
* \param x x coordinate of the VU-meter.
|
|
1249
|
+
* \param width Width of the VU-meter.
|
|
1250
|
+
* \param level Current level of the VU-meter, in linear logic.
|
|
1251
|
+
*/
|
|
1252
|
+
void drawVBargraphLin(juce::Graphics& g, int x, int width)
|
|
1253
|
+
{
|
|
1254
|
+
int alpha = 200;
|
|
1255
|
+
juce::Colour c = juce::Colour((juce::uint8)255, (juce::uint8)165, (juce::uint8)0, (juce::uint8)alpha);
|
|
1256
|
+
|
|
1257
|
+
// Drawing from the minimal range to the current level, or 20% of the VU-meter.
|
|
1258
|
+
g.setColour(c.brighter());
|
|
1259
|
+
g.fillRect(x+1.0f, juce::jmax(lin2y(fLevel), lin2y(0.2)), (float)width-2, lin2y(fMin)-juce::jmax(lin2y(fLevel), lin2y(0.2)));
|
|
1260
|
+
|
|
1261
|
+
// Drawing from 20% of the VU-meter to the current level, or 90% of the VU-meter.
|
|
1262
|
+
if (fLevel > 0.2f) {
|
|
1263
|
+
g.setColour(c);
|
|
1264
|
+
g.fillRect(x+1.0f, juce::jmax(lin2y(fLevel), lin2y(0.9)), (float)width-2, lin2y(0.2)-juce::jmax(lin2y(fLevel), lin2y(0.9)));
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
// Drawing from 90% of the VU-meter to the current level, or the maximum range.
|
|
1268
|
+
if (fLevel > 0.9f) {
|
|
1269
|
+
g.setColour(c.darker());
|
|
1270
|
+
g.fillRect(x+1.0f, juce::jmax(lin2y(fLevel), lin2y(fMax)), (float)width-2, lin2y(0.9)-juce::jmax(lin2y(fLevel), lin2y(fMax)));
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
/**
|
|
1275
|
+
* Method in charge of drawing the LED VU-meter, dB or not.
|
|
1276
|
+
*
|
|
1277
|
+
* \param g JUCE graphics context, used to draw components or images.
|
|
1278
|
+
* \param width Width of the LED.
|
|
1279
|
+
* \param height Height of the LED.
|
|
1280
|
+
* \param level Current level of the VU-meter, dB or not.
|
|
1281
|
+
*/
|
|
1282
|
+
void drawLed(juce::Graphics& g, int width, int height)
|
|
1283
|
+
{
|
|
1284
|
+
float x = (float)(getWidth() - width)/2;
|
|
1285
|
+
float y = (float)(getHeight() - height)/2;
|
|
1286
|
+
g.setColour(juce::Colours::black);
|
|
1287
|
+
g.fillEllipse(x, y, width, height);
|
|
1288
|
+
|
|
1289
|
+
if (fDB) {
|
|
1290
|
+
int alpha = 200;
|
|
1291
|
+
FAUSTFLOAT dblevel = dB2Scale(fLevel);
|
|
1292
|
+
|
|
1293
|
+
// Adjust the color depending on the current level
|
|
1294
|
+
g.setColour(juce::Colour((juce::uint8)40, (juce::uint8)160, (juce::uint8)40, (juce::uint8)alpha));
|
|
1295
|
+
if (dblevel > dB2Scale(-10)) {
|
|
1296
|
+
g.setColour(juce::Colour((juce::uint8)160, (juce::uint8)220, (juce::uint8)20, (juce::uint8)alpha));
|
|
1297
|
+
}
|
|
1298
|
+
if (dblevel > dB2Scale(-6)) {
|
|
1299
|
+
g.setColour(juce::Colour((juce::uint8)220, (juce::uint8)220, (juce::uint8)20, (juce::uint8)alpha));
|
|
1300
|
+
}
|
|
1301
|
+
if (dblevel > dB2Scale(-3)) {
|
|
1302
|
+
g.setColour(juce::Colour((juce::uint8)240, (juce::uint8)160, (juce::uint8)20, (juce::uint8)alpha));
|
|
1303
|
+
}
|
|
1304
|
+
if (dblevel > dB2Scale(0)) {
|
|
1305
|
+
g.setColour(juce::Colour((juce::uint8)240, (juce::uint8)0, (juce::uint8)20, (juce::uint8)alpha));
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
g.fillEllipse(x+1, y+1, width-2, height-2);
|
|
1309
|
+
} else {
|
|
1310
|
+
// The alpha depend on the level, from 0 to 1
|
|
1311
|
+
g.setColour(juce::Colours::red.withAlpha((float)fLevel));
|
|
1312
|
+
g.fillEllipse(x+1, y+1, width-2, height-2);
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
/**
|
|
1317
|
+
* Method in charge of drawing the Numerical Display VU-meter, dB or not.
|
|
1318
|
+
*
|
|
1319
|
+
* \param g JUCE graphics context, used to draw components or images.
|
|
1320
|
+
* \param width Width of the Numerical Display.
|
|
1321
|
+
* \param height Height of the Numerical Display.
|
|
1322
|
+
* \param level Current level of the VU-meter.
|
|
1323
|
+
*/
|
|
1324
|
+
void drawNumDisplay(juce::Graphics& g, int width, int height)
|
|
1325
|
+
{
|
|
1326
|
+
// Centering it
|
|
1327
|
+
int x = (getWidth()-width) / 2;
|
|
1328
|
+
int y = (getHeight()-height) / 2;
|
|
1329
|
+
|
|
1330
|
+
// Draw box.
|
|
1331
|
+
g.setColour(juce::Colours::darkgrey);
|
|
1332
|
+
g.fillRect(x, y, width, height);
|
|
1333
|
+
g.setColour(juce::Colours::white.withAlpha(0.8f));
|
|
1334
|
+
g.fillRect(x+1, y+1, width-2, height-2);
|
|
1335
|
+
|
|
1336
|
+
// Text is handled by the setLabelPos() function
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
/** Convert a dB level to a y coordinate, for easier draw methods. */
|
|
1340
|
+
FAUSTFLOAT dB2y(FAUSTFLOAT dB)
|
|
1341
|
+
{
|
|
1342
|
+
FAUSTFLOAT s0 = fScaleMin; // Minimal range.
|
|
1343
|
+
FAUSTFLOAT s1 = fScaleMax; // Maximum range.
|
|
1344
|
+
FAUSTFLOAT sx = dB2Scale(dB); // Current level.
|
|
1345
|
+
|
|
1346
|
+
int h;
|
|
1347
|
+
int treshold; // Value depend if the name is displayed
|
|
1348
|
+
|
|
1349
|
+
if (isNameDisplayed()) {
|
|
1350
|
+
h = getHeight()-42; // 15 pixels for the VU-Meter name,
|
|
1351
|
+
// 25 for the textBox, 2 pixels margin.
|
|
1352
|
+
treshold = 16; // 15 pixels for the VU-Meter name.
|
|
1353
|
+
} else {
|
|
1354
|
+
h = getHeight()-27; // 25 for the textBox, 2 pixels margin.
|
|
1355
|
+
treshold = 1; // 1 pixel margin.
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
return (h - h*(s0-sx)/(s0-s1)) + treshold;
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
/** Convert a linear level to a y coordinate, for easier draw methods. */
|
|
1362
|
+
FAUSTFLOAT lin2y(FAUSTFLOAT level)
|
|
1363
|
+
{
|
|
1364
|
+
int h;
|
|
1365
|
+
int treshold;
|
|
1366
|
+
|
|
1367
|
+
if (isNameDisplayed()) {
|
|
1368
|
+
h = getHeight()-42; // 15 pixels for the VU-Meter name,
|
|
1369
|
+
// 25 for the textBox, 2 pixels margin.
|
|
1370
|
+
treshold = 16; // 15 pixels for the VU-Meter name.
|
|
1371
|
+
} else {
|
|
1372
|
+
h = getHeight()-27; // 25 for the textBox, 2 pixels margin.
|
|
1373
|
+
treshold = 1; // 1 pixel margin.
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
return h * (1 - level) + treshold;
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
/** Convert a dB level to a x coordinate, for easier draw methods. */
|
|
1380
|
+
FAUSTFLOAT dB2x(FAUSTFLOAT dB)
|
|
1381
|
+
{
|
|
1382
|
+
FAUSTFLOAT s0 = fScaleMin; // Minimal range.
|
|
1383
|
+
FAUSTFLOAT s1 = fScaleMax; // Maximal range.
|
|
1384
|
+
FAUSTFLOAT sx = dB2Scale(dB); // Current level.
|
|
1385
|
+
|
|
1386
|
+
int w;
|
|
1387
|
+
int treshold;
|
|
1388
|
+
|
|
1389
|
+
if (isNameDisplayed()) {
|
|
1390
|
+
w = getWidth()-122; // 60 pixels for the VU-Meter name,
|
|
1391
|
+
// 60 for the TextBox, 2 pixels margin.
|
|
1392
|
+
treshold = 121; // 60 pixels for the VU-Meter name,
|
|
1393
|
+
// 60 for the TextBox, and 1 pixel margin.
|
|
1394
|
+
} else {
|
|
1395
|
+
w = getWidth()-62; // 60 pixels for the TextBox, 2 pixels margin.
|
|
1396
|
+
treshold = 61; // 60 pixels for the TextBox, 1 pixel margin.
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
return treshold + w - w*(s1-sx)/(s1-s0);
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
/** Write the different level included in the VU-Meter range. */
|
|
1403
|
+
void paintScale(juce::Graphics& g, float num)
|
|
1404
|
+
{
|
|
1405
|
+
juce::Rectangle<int> r;
|
|
1406
|
+
|
|
1407
|
+
if (fStyle == VVUMeter) {
|
|
1408
|
+
r = juce::Rectangle<int>((getWidth()-(kVBargraphWidth/2))/2 + 1, // Left side of the VU-Meter.
|
|
1409
|
+
dB2y(num), // Vertically centred with 20 height.
|
|
1410
|
+
(kVBargraphWidth/2)-2, // VU-Meter width with margin.
|
|
1411
|
+
20); // 20 height.
|
|
1412
|
+
g.drawText(juce::String(num), r, juce::Justification::centredRight, false);
|
|
1413
|
+
} else {
|
|
1414
|
+
r = juce::Rectangle<int>(dB2x(num)-10, // Horizontally centred with 20 width.
|
|
1415
|
+
(getHeight()-kHBargraphHeight/2)/2 + 1, // Top side of the VU-Meter.
|
|
1416
|
+
20, // 20 width.
|
|
1417
|
+
(kHBargraphHeight/2)-2); // VU-Meter height with margin
|
|
1418
|
+
g.drawText(juce::String(num), r, juce::Justification::centredTop, false);
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
/** Set the level, keep it in the range of the VU-Meter, and set the TextBox text. */
|
|
1423
|
+
void setLevel()
|
|
1424
|
+
{
|
|
1425
|
+
FAUSTFLOAT rawLevel = *fZone;
|
|
1426
|
+
#if JUCE_DEBUG
|
|
1427
|
+
if (std::isnan(rawLevel)) {
|
|
1428
|
+
std::cerr << "uiVUMeter: NAN\n";
|
|
1429
|
+
}
|
|
1430
|
+
#endif
|
|
1431
|
+
if (fDB) {
|
|
1432
|
+
fLevel = range(rawLevel);
|
|
1433
|
+
} else {
|
|
1434
|
+
fLevel = range((rawLevel-fMin)/(fMax-fMin));
|
|
1435
|
+
}
|
|
1436
|
+
fLabel.setText(juce::String(rawLevel) + " " + fUnit, juce::dontSendNotification);
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
FAUSTFLOAT range(FAUSTFLOAT level) { return (level > fMax) ? fMax : ((level < fMin) ? fMin : level); }
|
|
1440
|
+
|
|
1441
|
+
public:
|
|
1442
|
+
|
|
1443
|
+
/**
|
|
1444
|
+
* \brief Constructor.
|
|
1445
|
+
* \details Initialize the uiComponent variables and the VU-meter specific ones.
|
|
1446
|
+
*
|
|
1447
|
+
* \param gui, zone, w, h, tooltip, label uiComponent variables.
|
|
1448
|
+
* \param mini Minimal value of the VU-meter range.
|
|
1449
|
+
* \param maxi Maximal value of the VU-meter range.
|
|
1450
|
+
* \param unit Unit of the VU-meter (dB or not).
|
|
1451
|
+
* \param style Type of the VU-meter (see VUMeterType).
|
|
1452
|
+
* \param vert True if vertical, false if horizontal.
|
|
1453
|
+
*/
|
|
1454
|
+
uiVUMeter (GUI* gui, FAUSTFLOAT* zone, FAUSTFLOAT w, FAUSTFLOAT h, juce::String label, FAUSTFLOAT mini, FAUSTFLOAT maxi, juce::String unit, juce::String tooltip, VUMeterType style, bool vert)
|
|
1455
|
+
: uiComponent(gui, zone, w, h, label), fMin(mini), fMax(maxi), fStyle(style)
|
|
1456
|
+
{
|
|
1457
|
+
fLevel = 0; // Initialization of the level
|
|
1458
|
+
startTimer(50); // Launch a timer that trigger a callback every 50ms
|
|
1459
|
+
this->fUnit = unit;
|
|
1460
|
+
fDB = (unit == "dB");
|
|
1461
|
+
|
|
1462
|
+
if (fDB) {
|
|
1463
|
+
// Conversion in dB of the range
|
|
1464
|
+
fScaleMin = dB2Scale(fMin);
|
|
1465
|
+
fScaleMax = dB2Scale(fMax);
|
|
1466
|
+
}
|
|
1467
|
+
setTooltip(tooltip);
|
|
1468
|
+
|
|
1469
|
+
// No text editor for LEDs
|
|
1470
|
+
if (fStyle != Led) {
|
|
1471
|
+
setupLabel(tooltip);
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
/** Method called by the timer every 50ms, to refresh the VU-meter if it needs to */
|
|
1476
|
+
void timerCallback() override
|
|
1477
|
+
{
|
|
1478
|
+
if (isShowing()) {
|
|
1479
|
+
//Force painting at the initialisation
|
|
1480
|
+
bool forceRepaint = (fLevel == 0);
|
|
1481
|
+
FAUSTFLOAT lastLevel = fLevel; //t-1
|
|
1482
|
+
setLevel(); //t
|
|
1483
|
+
|
|
1484
|
+
// Following condition means that we're repainting our VUMeter only if
|
|
1485
|
+
// there's one or more changing pixels between last state and this one,
|
|
1486
|
+
// and if the curent level is included in the VUMeter range. It improves
|
|
1487
|
+
// performances a lot in IDLE. It's the same for the other style of VUMeter
|
|
1488
|
+
|
|
1489
|
+
if (fDB) {
|
|
1490
|
+
switch (fStyle) {
|
|
1491
|
+
case VVUMeter:
|
|
1492
|
+
if (((int)dB2y(lastLevel) != (int)dB2y(fLevel) && fLevel >= fMin && fLevel <= fMax) || forceRepaint) {
|
|
1493
|
+
repaint();
|
|
1494
|
+
}
|
|
1495
|
+
break;
|
|
1496
|
+
case HVUMeter:
|
|
1497
|
+
if (((int)dB2x(lastLevel) != (int)dB2x(fLevel) && fLevel >= fMin && fLevel <= fMax) || forceRepaint) {
|
|
1498
|
+
repaint();
|
|
1499
|
+
}
|
|
1500
|
+
break;
|
|
1501
|
+
case NumDisplay:
|
|
1502
|
+
if (((int)lastLevel != (int)fLevel && fLevel >= fMin && fLevel <= fMax) || forceRepaint) {
|
|
1503
|
+
repaint();
|
|
1504
|
+
}
|
|
1505
|
+
break;
|
|
1506
|
+
case Led:
|
|
1507
|
+
if ((dB2Scale(lastLevel) != dB2Scale(fLevel) && fLevel >= fMin && fLevel <= fMax) || forceRepaint) {
|
|
1508
|
+
repaint();
|
|
1509
|
+
}
|
|
1510
|
+
break;
|
|
1511
|
+
default:
|
|
1512
|
+
break;
|
|
1513
|
+
}
|
|
1514
|
+
} else {
|
|
1515
|
+
switch (fStyle) {
|
|
1516
|
+
case VVUMeter:
|
|
1517
|
+
if (((int)lin2y(lastLevel) != (int)lin2y(fLevel) && fLevel >= fMin && fLevel <= fMax) || forceRepaint) {
|
|
1518
|
+
repaint();
|
|
1519
|
+
}
|
|
1520
|
+
break;
|
|
1521
|
+
case HVUMeter:
|
|
1522
|
+
if ((std::abs(lastLevel-fLevel) > 0.01 && fLevel >= fMin && fLevel <= fMax) || forceRepaint) {
|
|
1523
|
+
repaint();
|
|
1524
|
+
}
|
|
1525
|
+
break;
|
|
1526
|
+
case NumDisplay:
|
|
1527
|
+
if ((std::abs(lastLevel-fLevel) > 0.01 && fLevel >= fMin && fLevel <= fMax) || forceRepaint) {
|
|
1528
|
+
repaint();
|
|
1529
|
+
}
|
|
1530
|
+
break;
|
|
1531
|
+
case Led:
|
|
1532
|
+
if (((int)lastLevel != (int)fLevel && fLevel >= fMin && fLevel <= fMax) || forceRepaint) {
|
|
1533
|
+
repaint();
|
|
1534
|
+
}
|
|
1535
|
+
break;
|
|
1536
|
+
default:
|
|
1537
|
+
break;
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
} else {
|
|
1541
|
+
fLevel = 0;
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
/**
|
|
1546
|
+
* Call the appropriate drawing method according to the VU-meter style
|
|
1547
|
+
* \see drawLed
|
|
1548
|
+
* \see drawNumDisplay
|
|
1549
|
+
* \see drawVBargraph
|
|
1550
|
+
* \see drawHBargraph
|
|
1551
|
+
*/
|
|
1552
|
+
void paint(juce::Graphics& g) override
|
|
1553
|
+
{
|
|
1554
|
+
switch (fStyle) {
|
|
1555
|
+
case Led:
|
|
1556
|
+
drawLed(g, kLedWidth, kLedHeight);
|
|
1557
|
+
break;
|
|
1558
|
+
case NumDisplay:
|
|
1559
|
+
drawNumDisplay(g, kNumDisplayWidth, kNumDisplayHeight/2);
|
|
1560
|
+
break;
|
|
1561
|
+
case VVUMeter:
|
|
1562
|
+
drawVBargraph(g, kVBargraphWidth/2, getHeight());
|
|
1563
|
+
break;
|
|
1564
|
+
case HVUMeter:
|
|
1565
|
+
drawHBargraph(g, getWidth(), kHBargraphHeight/2);
|
|
1566
|
+
break;
|
|
1567
|
+
default:
|
|
1568
|
+
break;
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
/** Set the Label position whenever the layout size changes. */
|
|
1573
|
+
void resized() override
|
|
1574
|
+
{
|
|
1575
|
+
setLabelPos();
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
void reflectZone() override
|
|
1579
|
+
{
|
|
1580
|
+
FAUSTFLOAT v = *fZone;
|
|
1581
|
+
fCache = v;
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
};
|
|
1585
|
+
|
|
1586
|
+
/** Intern class for tab widget */
|
|
1587
|
+
class uiTabBox : public uiBase, public juce::TabbedComponent
|
|
1588
|
+
{
|
|
1589
|
+
|
|
1590
|
+
public:
|
|
1591
|
+
/**
|
|
1592
|
+
* \brief Constructor.
|
|
1593
|
+
* \details Initalize the juce::TabbedComponent tabs to be at top, and the uiTabBox size at 0
|
|
1594
|
+
*/
|
|
1595
|
+
uiTabBox(juce::String label):uiBase(),juce::TabbedComponent(juce::TabbedButtonBar::TabsAtTop)
|
|
1596
|
+
{
|
|
1597
|
+
setName(label);
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
/**
|
|
1601
|
+
* Initialize all his child ratios (1 uiBox per tabs), the LookAndFeel
|
|
1602
|
+
* and the uiTabBox size to fit the biggest of its child.
|
|
1603
|
+
*/
|
|
1604
|
+
void init(juce::Component* comp = nullptr) override
|
|
1605
|
+
{
|
|
1606
|
+
for (int i = 0; i < getNumTabs(); i++) {
|
|
1607
|
+
Component* comp = getTabContentComponent(i);
|
|
1608
|
+
uiBase* base_comp = dynamic_cast<uiBase*>(comp);
|
|
1609
|
+
base_comp->init(comp);
|
|
1610
|
+
|
|
1611
|
+
// The TabbedComponent size should be as big as its bigger child's dimension, done here
|
|
1612
|
+
fTotalWidth = juce::jmax(fTotalWidth, base_comp->getTotalWidth());
|
|
1613
|
+
fTotalHeight = juce::jmax(fTotalHeight, base_comp->getTotalHeight());
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
fTotalHeight += 30; // 30 height for the TabBar.
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
void setRecommendedSize() override
|
|
1620
|
+
{
|
|
1621
|
+
for (int i = 0; i < getNumTabs(); i++) {
|
|
1622
|
+
uiBase* comp = dynamic_cast<uiBase*>(getTabContentComponent(i));
|
|
1623
|
+
comp->setRecommendedSize();
|
|
1624
|
+
|
|
1625
|
+
// The TabbedComponent size should be as big as its bigger child's dimension, done here
|
|
1626
|
+
fTotalWidth = juce::jmax(fTotalWidth, comp->getTotalWidth());
|
|
1627
|
+
fTotalHeight = juce::jmax(fTotalHeight, comp->getTotalHeight());
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
fTotalHeight += 30; // 30 height for the TabBar
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
void add(Component* comp) override
|
|
1634
|
+
{
|
|
1635
|
+
// Name of the component is moved in Tab (so removed from component)
|
|
1636
|
+
juce::TabbedComponent::addTab(comp->getName(), juce::Colours::white, comp, true);
|
|
1637
|
+
comp->setName("");
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
};
|
|
1641
|
+
|
|
1642
|
+
/**
|
|
1643
|
+
* \brief Intern class for box widgets
|
|
1644
|
+
* \details That's the class where the whole layout is calculated.
|
|
1645
|
+
*/
|
|
1646
|
+
class uiBox : public uiBase, public juce::Component
|
|
1647
|
+
{
|
|
1648
|
+
|
|
1649
|
+
private:
|
|
1650
|
+
|
|
1651
|
+
bool fIsVertical;
|
|
1652
|
+
|
|
1653
|
+
bool isNameDisplayed()
|
|
1654
|
+
{
|
|
1655
|
+
return (!(getName().startsWith("0x")) && getName().isNotEmpty());
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
/**
|
|
1659
|
+
* \brief Return the vertical dimension size for a child to be displayed in.
|
|
1660
|
+
*
|
|
1661
|
+
*/
|
|
1662
|
+
int getVSpaceToRemove()
|
|
1663
|
+
{
|
|
1664
|
+
// Checking if the name is displayed, to give to good amount space for child components
|
|
1665
|
+
// kNameHeight pixels is the bix name, kMargin pixel per child components for the margins
|
|
1666
|
+
if (isNameDisplayed()) {
|
|
1667
|
+
return (getHeight() - kNameHeight - kMargin * getNumChildComponents());
|
|
1668
|
+
} else {
|
|
1669
|
+
return (getHeight() - kMargin * getNumChildComponents());
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
/**
|
|
1674
|
+
* \brief Return the vertical dimension size for a child to be displayed in.
|
|
1675
|
+
*
|
|
1676
|
+
*/
|
|
1677
|
+
int getHSpaceToRemove()
|
|
1678
|
+
{
|
|
1679
|
+
// Don't need to check for an horizontal box, as it height doesn't matter
|
|
1680
|
+
return (getWidth() - kMargin * getNumChildComponents());
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
public:
|
|
1684
|
+
/**
|
|
1685
|
+
* \brief Constructor.
|
|
1686
|
+
* \details Initialize uiBase variables and uiBox specific ones.
|
|
1687
|
+
*
|
|
1688
|
+
* \param vert True if it's a vertical box, false otherwise.
|
|
1689
|
+
* \param boxName Name of the uiBox.
|
|
1690
|
+
*/
|
|
1691
|
+
uiBox(bool vert, juce::String boxName): uiBase(0,0), juce::Component(boxName), fIsVertical(vert)
|
|
1692
|
+
{}
|
|
1693
|
+
|
|
1694
|
+
/**
|
|
1695
|
+
* \brief Destructor.
|
|
1696
|
+
* \details Delete all uiBox recusively, but not the uiComponent,
|
|
1697
|
+
* because it's handled by the uiItem FAUST objects.
|
|
1698
|
+
*/
|
|
1699
|
+
virtual ~uiBox()
|
|
1700
|
+
{
|
|
1701
|
+
/*
|
|
1702
|
+
Deleting boxes, from leaves to root:
|
|
1703
|
+
- leaves (uiComponent) are deleted by the uiItem mechanism
|
|
1704
|
+
- containers (uiBox and uiTabBox) have to be explicitly deleted
|
|
1705
|
+
*/
|
|
1706
|
+
for (int i = getNumChildComponents()-1; i >= 0; i--) {
|
|
1707
|
+
delete dynamic_cast<uiBox*>(getChildComponent(i));
|
|
1708
|
+
delete dynamic_cast<uiTabBox*>(getChildComponent(i));
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
/**
|
|
1713
|
+
* \brief Initialization of the DisplayRect and Total size.
|
|
1714
|
+
* \details Calculate the correct size for each box, depending on its child sizes.
|
|
1715
|
+
*/
|
|
1716
|
+
void setRecommendedSize() override
|
|
1717
|
+
{
|
|
1718
|
+
// Initialized each time
|
|
1719
|
+
fDisplayRectWidth = fDisplayRectHeight = 0;
|
|
1720
|
+
|
|
1721
|
+
// Display rectangle size is the sum of a dimension on a side, and the max of the other one
|
|
1722
|
+
// on the other side, depending on its orientation (horizontal/vertical).
|
|
1723
|
+
// Using child's totalSize, because the display rectangle size need to be as big as
|
|
1724
|
+
// all of its child components with their margins included.
|
|
1725
|
+
for (int j = 0; j < getNumChildComponents(); j++) {
|
|
1726
|
+
uiBase* base_comp = dynamic_cast<uiBase*>(getChildComponent(j));
|
|
1727
|
+
if (fIsVertical) {
|
|
1728
|
+
fDisplayRectWidth = juce::jmax(fDisplayRectWidth, base_comp->getTotalWidth());
|
|
1729
|
+
fDisplayRectHeight += base_comp->getTotalHeight();
|
|
1730
|
+
} else {
|
|
1731
|
+
fDisplayRectWidth += base_comp->getTotalWidth();
|
|
1732
|
+
fDisplayRectHeight = juce::jmax(fDisplayRectHeight, base_comp->getTotalHeight());
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
fTotalHeight = fDisplayRectHeight;
|
|
1737
|
+
fTotalWidth = fDisplayRectWidth;
|
|
1738
|
+
|
|
1739
|
+
// Adding kMargin pixels of margins per child component on a dimension, and just kMargin on
|
|
1740
|
+
// the other one, depending on its orientation
|
|
1741
|
+
|
|
1742
|
+
if (fIsVertical) {
|
|
1743
|
+
fTotalHeight += kMargin * getNumChildComponents();
|
|
1744
|
+
fTotalWidth += kMargin;
|
|
1745
|
+
} else {
|
|
1746
|
+
fTotalWidth += kMargin * getNumChildComponents();
|
|
1747
|
+
fTotalHeight += kMargin;
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
// Adding kNameHeight pixels on its height to allow the name to be displayed
|
|
1751
|
+
if (isNameDisplayed()) {
|
|
1752
|
+
fTotalHeight += kNameHeight;
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
/** Initiate the current box ratio, and its child's ones recursively. */
|
|
1757
|
+
void init(juce::Component* comp = nullptr) override
|
|
1758
|
+
{
|
|
1759
|
+
uiBase::init(this);
|
|
1760
|
+
|
|
1761
|
+
// Going through the Component tree recursively
|
|
1762
|
+
for (int i = 0; i < getNumChildComponents(); i++) {
|
|
1763
|
+
Component* comp = getChildComponent(i);
|
|
1764
|
+
uiBase* base_comp = dynamic_cast<uiBase*>(comp);
|
|
1765
|
+
base_comp->init(comp);
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
/**
|
|
1770
|
+
* \brief Main layout function.
|
|
1771
|
+
* \details Allow to place all uiBase child correctly according to their ratios
|
|
1772
|
+
* and the current box size.
|
|
1773
|
+
*
|
|
1774
|
+
* \param displayRect Absolute raw bounds of the current box (with margins
|
|
1775
|
+
* and space for the title).
|
|
1776
|
+
*/
|
|
1777
|
+
void resized() override
|
|
1778
|
+
{
|
|
1779
|
+
juce::Rectangle<int> displayRect = getBounds();
|
|
1780
|
+
|
|
1781
|
+
// Deleting space for the box name if it needs to be shown
|
|
1782
|
+
if (isNameDisplayed()) {
|
|
1783
|
+
displayRect.removeFromTop(kNameHeight);
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
// Putting the margins
|
|
1787
|
+
displayRect.reduce(kMargin/2, kMargin/2);
|
|
1788
|
+
|
|
1789
|
+
// Give child components an adapt size depending on its ratio and the current box size
|
|
1790
|
+
for (int i = 0; i < getNumChildComponents(); i++) {
|
|
1791
|
+
juce::Component* comp = getChildComponent(i);
|
|
1792
|
+
uiBase* base_comp = dynamic_cast<uiBase*>(comp);
|
|
1793
|
+
|
|
1794
|
+
if (fIsVertical) {
|
|
1795
|
+
int heightToRemove = getVSpaceToRemove() * base_comp->getVRatio();
|
|
1796
|
+
// Remove the space needed from the displayRect, and translate it to show the margins
|
|
1797
|
+
base_comp->setRelativeSize(comp, displayRect.removeFromTop(heightToRemove).translated(0, kMargin * i));
|
|
1798
|
+
} else {
|
|
1799
|
+
int widthToRemove = getHSpaceToRemove() * base_comp->getHRatio();
|
|
1800
|
+
// Remove the space needed from the displayRect, and translate it to show the margins
|
|
1801
|
+
base_comp->setRelativeSize(comp, displayRect.removeFromLeft(widthToRemove).translated(kMargin * i, 0));
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
/**
|
|
1807
|
+
* Fill the uiBox bounds with a grey color, different shades depending on its order.
|
|
1808
|
+
* Write the uiBox name if it needs to.
|
|
1809
|
+
*/
|
|
1810
|
+
void paint(juce::Graphics& g) override
|
|
1811
|
+
{
|
|
1812
|
+
// Fill the box background in gray shades
|
|
1813
|
+
g.setColour(juce::Colours::black.withAlpha(0.5f)); // 0.05, used until 2023-08-5, is not readable on the Mac
|
|
1814
|
+
g.fillRect(getLocalBounds());
|
|
1815
|
+
|
|
1816
|
+
// Display the name if it's needed
|
|
1817
|
+
if (isNameDisplayed()) {
|
|
1818
|
+
g.setColour(juce::Colours::black);
|
|
1819
|
+
g.drawText(getName(), getLocalBounds().withHeight(kNameHeight), juce::Justification::centred);
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
void add(juce::Component* comp) override
|
|
1824
|
+
{
|
|
1825
|
+
addAndMakeVisible(comp);
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
};
|
|
1829
|
+
|
|
1830
|
+
/** Class in charge of doing the glue between FAUST and JUCE */
|
|
1831
|
+
class JuceGUI : public GUI, public MetaDataUI, public juce::Component
|
|
1832
|
+
{
|
|
1833
|
+
|
|
1834
|
+
private:
|
|
1835
|
+
|
|
1836
|
+
std::stack<uiBase*> fBoxStack;
|
|
1837
|
+
uiBase* fCurrentBox = nullptr; // Current box used in buildUserInterface logic.
|
|
1838
|
+
|
|
1839
|
+
int fRadioGroupID; // In case of radio buttons.
|
|
1840
|
+
std::unique_ptr<juce::LookAndFeel> fLaf = std::make_unique<juce::LookAndFeel_V4>();
|
|
1841
|
+
|
|
1842
|
+
/** Add generic box to the user interface. */
|
|
1843
|
+
void openBox(uiBase* box)
|
|
1844
|
+
{
|
|
1845
|
+
if (fCurrentBox) {
|
|
1846
|
+
fCurrentBox->add(dynamic_cast<juce::Component*>(box));
|
|
1847
|
+
fBoxStack.push(fCurrentBox);
|
|
1848
|
+
}
|
|
1849
|
+
fCurrentBox = box;
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
/** Add a slider to the user interface. */
|
|
1853
|
+
void addSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step, int kWidth, int kHeight, SliderType type)
|
|
1854
|
+
{
|
|
1855
|
+
if (isKnob(zone)) {
|
|
1856
|
+
addKnob(label, zone, *zone, min, max, step);
|
|
1857
|
+
} else if (isRadio(zone)) {
|
|
1858
|
+
addRadioButtons(label, zone, *zone, min, max, step, fRadioDescription[zone].c_str(), false);
|
|
1859
|
+
} else if (isMenu(zone)) {
|
|
1860
|
+
addMenu(label, zone, *zone, min, max, step, fMenuDescription[zone].c_str());
|
|
1861
|
+
} else {
|
|
1862
|
+
fCurrentBox->add(new uiSlider(this, zone, kWidth, kHeight, *zone, min, max, step, juce::String(label), juce::String(fUnit[zone]), juce::String(fTooltip[zone]), getScale(zone), type));
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
/** Add a radio buttons to the user interface. */
|
|
1867
|
+
void addRadioButtons(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step, const char* mdescr, bool vert)
|
|
1868
|
+
{
|
|
1869
|
+
std::vector<std::string> names;
|
|
1870
|
+
std::vector<double> values;
|
|
1871
|
+
parseMenuList(mdescr, names, values); // Set names and values vectors
|
|
1872
|
+
|
|
1873
|
+
// and not just n checkButtons :
|
|
1874
|
+
// TODO : check currently unused checkButtonWidth...
|
|
1875
|
+
int checkButtonWidth = 0;
|
|
1876
|
+
for (int i = 0; i < names.size(); i++) {
|
|
1877
|
+
// Checking the maximum of horizontal space needed to display the radio buttons
|
|
1878
|
+
checkButtonWidth = juce::jmax(juce::Font().getStringWidth(juce::String(names[i])) + 15, checkButtonWidth);
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
if (vert) {
|
|
1882
|
+
fCurrentBox->add(new uiRadioButton(this, zone, juce::String(label), kCheckButtonWidth, names.size() * (kRadioButtonHeight - 25) + 25, *zone, min, max, true, names, values, juce::String(fTooltip[zone]), fRadioGroupID++));
|
|
1883
|
+
} else {
|
|
1884
|
+
fCurrentBox->add(new uiRadioButton(this, zone, juce::String(label), kCheckButtonWidth, kRadioButtonHeight, *zone, min, max, false, names, values, juce::String(fTooltip[zone]), fRadioGroupID++));
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
/** Add a menu to the user interface. */
|
|
1889
|
+
void addMenu(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step, const char* mdescr)
|
|
1890
|
+
{
|
|
1891
|
+
fCurrentBox->add(new uiMenu(this, zone, juce::String(label), kMenuWidth, kMenuHeight, *zone, min, max, juce::String(fTooltip[zone]), mdescr));
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
/** Add a ciruclar slider to the user interface. */
|
|
1895
|
+
void addKnob(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step) {
|
|
1896
|
+
fCurrentBox->add(new uiSlider(this, zone, kKnobWidth, kKnobHeight, *zone, min, max, step, juce::String(label), juce::String(fUnit[zone]), juce::String(fTooltip[zone]), getScale(zone), Knob));
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
/** Add a bargraph to the user interface. */
|
|
1900
|
+
void addBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max, int kWidth, int kHeight, VUMeterType type)
|
|
1901
|
+
{
|
|
1902
|
+
if (isLed(zone)) {
|
|
1903
|
+
addLed(juce::String(label), zone, min, max);
|
|
1904
|
+
} else if (isNumerical(zone)) {
|
|
1905
|
+
addNumericalDisplay(juce::String(label), zone, min, max);
|
|
1906
|
+
} else {
|
|
1907
|
+
fCurrentBox->add(new uiVUMeter (this, zone, kWidth, kHeight, juce::String(label), min, max, juce::String(fUnit[zone]), juce::String(fTooltip[zone]), type, false));
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
public:
|
|
1912
|
+
/**
|
|
1913
|
+
* \brief Constructor, displaying the *current state* of all controller zones.
|
|
1914
|
+
* \details Initialize the JuceGUI specific variables.
|
|
1915
|
+
*/
|
|
1916
|
+
JuceGUI():fRadioGroupID(1) // fRadioGroupID must start at 1
|
|
1917
|
+
{
|
|
1918
|
+
setLookAndFeel(fLaf.get());
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
/**
|
|
1922
|
+
* \brief Destructor.
|
|
1923
|
+
* \details Delete root box used in buildUserInterface logic.
|
|
1924
|
+
*/
|
|
1925
|
+
virtual ~JuceGUI()
|
|
1926
|
+
{
|
|
1927
|
+
setLookAndFeel(nullptr);
|
|
1928
|
+
delete fCurrentBox;
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
/** Return the size of the FAUST program */
|
|
1932
|
+
juce::Rectangle<int> getSize()
|
|
1933
|
+
{
|
|
1934
|
+
// Mininum size in case of empty GUI
|
|
1935
|
+
if (fCurrentBox) {
|
|
1936
|
+
juce::Rectangle<int> res = fCurrentBox->getSize();
|
|
1937
|
+
res.setSize(std::max<int>(1, res.getWidth()), std::max<int>(1, res.getHeight()));
|
|
1938
|
+
return res;
|
|
1939
|
+
} else {
|
|
1940
|
+
return juce::Rectangle<int>(0, 0, 1, 1);
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
/** Initialize the uiTabBox component to be visible. */
|
|
1945
|
+
virtual void openTabBox(const char* label) override
|
|
1946
|
+
{
|
|
1947
|
+
openBox(new uiTabBox(juce::String(label)));
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
/** Add a new vertical box to the user interface. */
|
|
1951
|
+
virtual void openVerticalBox(const char* label) override
|
|
1952
|
+
{
|
|
1953
|
+
openBox(new uiBox(true, juce::String(label)));
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
/** Add a new horizontal box to the user interface. */
|
|
1957
|
+
virtual void openHorizontalBox(const char* label) override
|
|
1958
|
+
{
|
|
1959
|
+
openBox(new uiBox(false, juce::String(label)));
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
/** Close the current box. */
|
|
1963
|
+
virtual void closeBox() override
|
|
1964
|
+
{
|
|
1965
|
+
fCurrentBox->setRecommendedSize();
|
|
1966
|
+
|
|
1967
|
+
if (fBoxStack.empty()) {
|
|
1968
|
+
// Add root box in JuceGUI component
|
|
1969
|
+
addAndMakeVisible(dynamic_cast<juce::Component*>(fCurrentBox));
|
|
1970
|
+
fCurrentBox->init();
|
|
1971
|
+
// Force correct draw
|
|
1972
|
+
resized();
|
|
1973
|
+
} else {
|
|
1974
|
+
fCurrentBox = fBoxStack.top();
|
|
1975
|
+
fBoxStack.pop();
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
/** Add an horizontal slider to the user interface. */
|
|
1980
|
+
virtual void addHorizontalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step) override
|
|
1981
|
+
{
|
|
1982
|
+
if (isHidden(zone)) return;
|
|
1983
|
+
addSlider(label, zone, init, min, max, step, kHSliderWidth, kHSliderHeight, HSlider);
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
/** Add a vertical slider to the user interface. */
|
|
1987
|
+
virtual void addVerticalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step) override
|
|
1988
|
+
{
|
|
1989
|
+
if (isHidden(zone)) return;
|
|
1990
|
+
int newWidth = juce::jmax(juce::Font().getStringWidth(juce::String(label)), kVSliderWidth) + kMargin;
|
|
1991
|
+
addSlider(label, zone, init, min, max, step, newWidth, kVSliderHeight, VSlider);
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
/** Add a button to the user interface. */
|
|
1995
|
+
virtual void addButton(const char* label, FAUSTFLOAT* zone) override
|
|
1996
|
+
{
|
|
1997
|
+
if (isHidden(zone)) return;
|
|
1998
|
+
fCurrentBox->add(new uiButton(this, zone, kButtonWidth, kButtonHeight, juce::String(label), juce::String(fTooltip[zone])));
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
/** Add a check button to the user interface. */
|
|
2002
|
+
virtual void addCheckButton(const char* label, FAUSTFLOAT* zone) override
|
|
2003
|
+
{
|
|
2004
|
+
if (isHidden(zone)) return;
|
|
2005
|
+
// newWidth is his text size, plus the check box size
|
|
2006
|
+
int newWidth = juce::Font().getStringWidth(juce::String(label)) + kCheckButtonWidth;
|
|
2007
|
+
fCurrentBox->add(new uiCheckButton(this, zone, newWidth, kCheckButtonHeight, juce::String(label), juce::String(fTooltip[zone])));
|
|
2008
|
+
}
|
|
2009
|
+
|
|
2010
|
+
/** Add a numerical entry to the user interface. */
|
|
2011
|
+
virtual void addNumEntry(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step) override
|
|
2012
|
+
{
|
|
2013
|
+
if (isHidden(zone)) return;
|
|
2014
|
+
// kMargin pixels between the slider and his name
|
|
2015
|
+
int newWidth = juce::Font().getStringWidth(juce::String(label)) + kNumEntryWidth + kMargin;
|
|
2016
|
+
fCurrentBox->add(new uiSlider(this, zone, newWidth, kNumEntryHeight, *zone, min, max, step, juce::String(label), juce::String(fUnit[zone]), juce::String(fTooltip[zone]), getScale(zone), NumEntry));
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
/** Add a vertical bargraph to the user interface. */
|
|
2020
|
+
virtual void addVerticalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max) override
|
|
2021
|
+
{
|
|
2022
|
+
if (isHidden(zone)) return;
|
|
2023
|
+
addBargraph(label, zone, min, max, kVBargraphWidth, kVBargraphHeight, VVUMeter);
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
/** Add a vertical bargraph to the user interface. */
|
|
2027
|
+
virtual void addHorizontalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max) override
|
|
2028
|
+
{
|
|
2029
|
+
if (isHidden(zone)) return;
|
|
2030
|
+
addBargraph(label, zone, min, max, kHBargraphWidth, kHBargraphHeight, HVUMeter);
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2033
|
+
/** Add a LED to the user interface. */
|
|
2034
|
+
void addLed(juce::String label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max)
|
|
2035
|
+
{
|
|
2036
|
+
fCurrentBox->add(new uiVUMeter(this, zone, kLedWidth, kLedHeight, label, min, max, juce::String(fUnit[zone]), juce::String(fTooltip[zone]), Led, false));
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
/** Add a numerical display to the user interface. */
|
|
2040
|
+
void addNumericalDisplay(juce::String label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max) {
|
|
2041
|
+
fCurrentBox->add(new uiVUMeter(this, zone, kNumDisplayWidth, kNumDisplayHeight, label, min, max, juce::String(fUnit[zone]), juce::String(fTooltip[zone]), NumDisplay, false));
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
/** Declare a metadata. */
|
|
2045
|
+
virtual void declare(FAUSTFLOAT* zone, const char* key, const char* value) override
|
|
2046
|
+
{
|
|
2047
|
+
MetaDataUI::declare(zone, key, value);
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
/** Resize its child to match the new bounds */
|
|
2051
|
+
void resized() override
|
|
2052
|
+
{
|
|
2053
|
+
if (fCurrentBox) {
|
|
2054
|
+
dynamic_cast<Component*>(fCurrentBox)->setBounds(getLocalBounds());
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
|
|
2058
|
+
};
|
|
2059
|
+
|
|
2060
|
+
#endif
|
|
2061
|
+
/************************** END JuceGUI.h **************************/
|