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,1387 @@
|
|
|
1
|
+
"""py2max: a pure python library to generate .maxpat patcher files.
|
|
2
|
+
|
|
3
|
+
basic usage:
|
|
4
|
+
|
|
5
|
+
>>> p = Patcher('out.maxpat')
|
|
6
|
+
>>> osc1 = p.add_textbox('cycle~ 440')
|
|
7
|
+
>>> gain = p.add_textbox('gain~')
|
|
8
|
+
>>> dac = p.add_textbox('ezdac~')
|
|
9
|
+
>>> p.add_line(osc1, gain)
|
|
10
|
+
>>> p.add_line(gain, dac)
|
|
11
|
+
>>> p.save()
|
|
12
|
+
|
|
13
|
+
"""
|
|
14
|
+
import abc
|
|
15
|
+
import json
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
from typing import Optional, Union, Tuple, List
|
|
18
|
+
|
|
19
|
+
from .maxclassdb import MAXCLASS_DEFAULTS
|
|
20
|
+
from .common import Rect
|
|
21
|
+
|
|
22
|
+
# ---------------------------------------------------------------------------
|
|
23
|
+
# CONSTANTS
|
|
24
|
+
|
|
25
|
+
MAX_VER_MAJOR = 8
|
|
26
|
+
MAX_VER_MINOR = 5
|
|
27
|
+
MAX_VER_REVISION = 5
|
|
28
|
+
|
|
29
|
+
# ---------------------------------------------------------------------------
|
|
30
|
+
# Utility Classes and functions
|
|
31
|
+
|
|
32
|
+
# ---------------------------------------------------------------------------
|
|
33
|
+
# Layout Classes
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class LayoutManager(abc.ABC):
|
|
37
|
+
"""Utility class to help with object layout.
|
|
38
|
+
|
|
39
|
+
This is a basic horizontal layout manager.
|
|
40
|
+
i.e. objects flow and wrap to the right.
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
DEFAULT_PAD = 1.5 * 32.0
|
|
44
|
+
DEFAULT_BOX_WIDTH = 66.0
|
|
45
|
+
DEFAULT_BOX_HEIGHT = 22.0
|
|
46
|
+
DEFAULT_COMMENT_PAD = 2
|
|
47
|
+
|
|
48
|
+
def __init__(
|
|
49
|
+
self,
|
|
50
|
+
parent: "Patcher",
|
|
51
|
+
pad: Optional[int] = None,
|
|
52
|
+
box_width: Optional[int] = None,
|
|
53
|
+
box_height: Optional[int] = None,
|
|
54
|
+
comment_pad: Optional[int] = None,
|
|
55
|
+
):
|
|
56
|
+
self.parent = parent
|
|
57
|
+
self.pad = pad or self.DEFAULT_PAD
|
|
58
|
+
self.box_width = box_width or self.DEFAULT_BOX_WIDTH
|
|
59
|
+
self.box_height = box_height or self.DEFAULT_BOX_HEIGHT
|
|
60
|
+
self.comment_pad = comment_pad or self.DEFAULT_COMMENT_PAD
|
|
61
|
+
self.x_layout_counter = 0
|
|
62
|
+
self.y_layout_counter = 0
|
|
63
|
+
self.prior_rect = None
|
|
64
|
+
self.mclass_rect = None
|
|
65
|
+
|
|
66
|
+
def get_rect_from_maxclass(self, maxclass: str) -> Optional[Rect]:
|
|
67
|
+
"""retrieves default patching_rect from defaults dictionary."""
|
|
68
|
+
try:
|
|
69
|
+
return MAXCLASS_DEFAULTS[maxclass]["patching_rect"]
|
|
70
|
+
except KeyError:
|
|
71
|
+
return None
|
|
72
|
+
|
|
73
|
+
def get_absolute_pos(self, rect: Rect) -> Rect:
|
|
74
|
+
"""returns an absolute position for the object"""
|
|
75
|
+
x, y, w, h = rect
|
|
76
|
+
|
|
77
|
+
pad = self.pad
|
|
78
|
+
|
|
79
|
+
if x > 0.5 * self.parent.width:
|
|
80
|
+
x1 = x - (w + pad)
|
|
81
|
+
x = x1 - (x1 - self.parent.width) if x1 > self.parent.width else x1
|
|
82
|
+
else:
|
|
83
|
+
x1 = x + pad
|
|
84
|
+
|
|
85
|
+
y1 = y - (h + pad)
|
|
86
|
+
y = y1 - (y1 - self.parent.height) if y1 > self.parent.height else y1
|
|
87
|
+
|
|
88
|
+
return Rect(x, y, w, h)
|
|
89
|
+
|
|
90
|
+
@abc.abstractmethod
|
|
91
|
+
def get_relative_pos(self, rect: Rect) -> Rect:
|
|
92
|
+
"""returns a relative position for the object"""
|
|
93
|
+
|
|
94
|
+
def get_pos(self, maxclass: Optional[str] = None) -> Rect:
|
|
95
|
+
"""helper func providing very rough auto-layout of objects"""
|
|
96
|
+
x = 0.0
|
|
97
|
+
y = 0.0
|
|
98
|
+
w = self.box_width # 66.0
|
|
99
|
+
h = self.box_height # 22.0
|
|
100
|
+
|
|
101
|
+
if maxclass:
|
|
102
|
+
mclass_rect = self.get_rect_from_maxclass(maxclass)
|
|
103
|
+
if mclass_rect and (mclass_rect.x or mclass_rect.y):
|
|
104
|
+
if mclass_rect.x:
|
|
105
|
+
x = float(mclass_rect.x * self.parent.width)
|
|
106
|
+
if mclass_rect.y:
|
|
107
|
+
y = float(mclass_rect.y * self.parent.height)
|
|
108
|
+
|
|
109
|
+
_rect = Rect(x, y, mclass_rect.w, mclass_rect.h)
|
|
110
|
+
return self.get_absolute_pos(_rect)
|
|
111
|
+
|
|
112
|
+
_rect = Rect(x, y, w, h)
|
|
113
|
+
return self.get_relative_pos(_rect)
|
|
114
|
+
|
|
115
|
+
@property
|
|
116
|
+
def patcher_rect(self) -> Rect:
|
|
117
|
+
"""return rect coordinates of the parent patcher"""
|
|
118
|
+
return self.parent.rect
|
|
119
|
+
|
|
120
|
+
def above(self, rect: Rect) -> Rect:
|
|
121
|
+
"""Return a position of a comment above the object"""
|
|
122
|
+
x, y, w, h = rect
|
|
123
|
+
return Rect(x, y - h, w, h)
|
|
124
|
+
|
|
125
|
+
def below(self, rect: Rect) -> Rect:
|
|
126
|
+
"""Return a position of a comment below the object"""
|
|
127
|
+
x, y, w, h = rect
|
|
128
|
+
return Rect(x, y + h, w, h)
|
|
129
|
+
|
|
130
|
+
def left(self, rect: Rect) -> Rect:
|
|
131
|
+
"""Return a position of a comment left of the object"""
|
|
132
|
+
x, y, w, h = rect
|
|
133
|
+
return Rect(x - (w + self.comment_pad), y, w, h)
|
|
134
|
+
|
|
135
|
+
def right(self, rect: Rect) -> Rect:
|
|
136
|
+
"""Return a position of a comment right of the object"""
|
|
137
|
+
x, y, w, h = rect
|
|
138
|
+
return Rect(x + (w + self.comment_pad), y, w, h)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
class HorizontalLayoutManager(LayoutManager):
|
|
142
|
+
"""Utility class to help with object layout.
|
|
143
|
+
|
|
144
|
+
This is a basic horizontal layout manager.
|
|
145
|
+
i.e. objects fill from left to right of the
|
|
146
|
+
grid and and wrap horizontally.
|
|
147
|
+
"""
|
|
148
|
+
|
|
149
|
+
def get_relative_pos(self, rect: Rect) -> Rect:
|
|
150
|
+
"""returns a relative horizontal position for the object"""
|
|
151
|
+
x, y, w, h = rect
|
|
152
|
+
|
|
153
|
+
pad = self.pad # 32.0
|
|
154
|
+
|
|
155
|
+
x_shift = 3 * pad * self.x_layout_counter
|
|
156
|
+
y_shift = 1.5 * pad * self.y_layout_counter
|
|
157
|
+
x = pad + x_shift
|
|
158
|
+
|
|
159
|
+
self.x_layout_counter += 1
|
|
160
|
+
if x + w + 2 * pad > self.parent.width:
|
|
161
|
+
self.x_layout_counter = 0
|
|
162
|
+
self.y_layout_counter += 1
|
|
163
|
+
|
|
164
|
+
y = pad + y_shift
|
|
165
|
+
|
|
166
|
+
return Rect(x, y, w, h)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
class VerticalLayoutManager(LayoutManager):
|
|
170
|
+
"""Utility class to help with obadject layout.
|
|
171
|
+
|
|
172
|
+
This is a basic vertical layout manager.
|
|
173
|
+
i.e. objects fill from top to bottom of the
|
|
174
|
+
grid and and wrap vertically.
|
|
175
|
+
"""
|
|
176
|
+
|
|
177
|
+
def get_relative_pos(self, rect: Rect) -> Rect:
|
|
178
|
+
"""returns a relative vertical position for the object"""
|
|
179
|
+
x, y, w, h = rect
|
|
180
|
+
|
|
181
|
+
pad = self.pad # 32.0
|
|
182
|
+
|
|
183
|
+
x_shift = 3 * pad * self.x_layout_counter
|
|
184
|
+
y_shift = 1.5 * pad * self.y_layout_counter
|
|
185
|
+
y = pad + y_shift
|
|
186
|
+
|
|
187
|
+
self.y_layout_counter += 1
|
|
188
|
+
if y + h + 2 * pad > self.parent.height:
|
|
189
|
+
self.x_layout_counter += 1
|
|
190
|
+
self.y_layout_counter = 0
|
|
191
|
+
|
|
192
|
+
x = pad + x_shift
|
|
193
|
+
|
|
194
|
+
return Rect(x, y, w, h)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
# ---------------------------------------------------------------------------
|
|
198
|
+
# Primary Classes
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
class Patcher:
|
|
202
|
+
"""Core Patcher class describing a Max patchers from the ground up.
|
|
203
|
+
|
|
204
|
+
Any Patcher can be converted to a .maxpat file.
|
|
205
|
+
"""
|
|
206
|
+
|
|
207
|
+
def __init__(
|
|
208
|
+
self,
|
|
209
|
+
path: Optional[Union[str, Path]] = None,
|
|
210
|
+
title: Optional[str] = None,
|
|
211
|
+
parent: Optional["Patcher"] = None,
|
|
212
|
+
classnamespace: Optional[str] = None,
|
|
213
|
+
reset_on_render: bool = True,
|
|
214
|
+
layout: str = "horizontal",
|
|
215
|
+
auto_hints: bool = False,
|
|
216
|
+
openinpresentation: int = 0,
|
|
217
|
+
):
|
|
218
|
+
self._path = path
|
|
219
|
+
self._parent = parent
|
|
220
|
+
self._node_ids: list[str] = [] # ids by order of creation
|
|
221
|
+
self._objects: dict[str, Box] = {} # dict of objects by id
|
|
222
|
+
self._boxes: list[Box] = [] # store child objects (boxes, etc.)
|
|
223
|
+
self._lines: list[Patchline] = [] # store patchline objects
|
|
224
|
+
self._edge_ids: list[
|
|
225
|
+
tuple[str, str]
|
|
226
|
+
] = [] # store edge-ids by order of creation
|
|
227
|
+
self._id_counter = 0
|
|
228
|
+
self._link_counter = 0
|
|
229
|
+
self._last_link: Optional[tuple[str, str]] = None
|
|
230
|
+
self._reset_on_render = reset_on_render
|
|
231
|
+
self._layout_mgr: LayoutManager = {
|
|
232
|
+
"horizontal": HorizontalLayoutManager,
|
|
233
|
+
"vertical": VerticalLayoutManager,
|
|
234
|
+
}[layout](self)
|
|
235
|
+
self._auto_hints = auto_hints
|
|
236
|
+
self._maxclass_methods = {
|
|
237
|
+
# specialized methods
|
|
238
|
+
"m": self.add_message, # custom -- like keyboard shortcut
|
|
239
|
+
"c": self.add_comment, # custom -- like keyboard shortcut
|
|
240
|
+
"coll": self.add_coll,
|
|
241
|
+
"dict": self.add_dict,
|
|
242
|
+
"table": self.add_table,
|
|
243
|
+
"itable": self.add_itable,
|
|
244
|
+
"umenu": self.add_umenu,
|
|
245
|
+
"bpatcher": self.add_bpatcher,
|
|
246
|
+
}
|
|
247
|
+
# --------------------------------------------------------------------
|
|
248
|
+
# begin max attributes
|
|
249
|
+
if title: # not a default attribute
|
|
250
|
+
self.title = title
|
|
251
|
+
self.fileversion: int = 1
|
|
252
|
+
self.appversion = {
|
|
253
|
+
"major": MAX_VER_MAJOR,
|
|
254
|
+
"minor": MAX_VER_MINOR,
|
|
255
|
+
"revision": MAX_VER_REVISION,
|
|
256
|
+
"architecture": "x64",
|
|
257
|
+
"modernui": 1,
|
|
258
|
+
}
|
|
259
|
+
self.classnamespace = classnamespace or "box"
|
|
260
|
+
self.rect = Rect(85.0, 104.0, 640.0, 480.0)
|
|
261
|
+
self.bglocked = 0
|
|
262
|
+
self.openinpresentation = openinpresentation
|
|
263
|
+
self.default_fontsize = 12.0
|
|
264
|
+
self.default_fontface = 0
|
|
265
|
+
self.default_fontname = "Arial"
|
|
266
|
+
self.gridonopen = 1
|
|
267
|
+
self.gridsize = [15.0, 15.0]
|
|
268
|
+
self.gridsnaponopen = 1
|
|
269
|
+
self.objectsnaponopen = 1
|
|
270
|
+
self.statusbarvisible = 2
|
|
271
|
+
self.toolbarvisible = 1
|
|
272
|
+
self.lefttoolbarpinned = 0
|
|
273
|
+
self.toptoolbarpinned = 0
|
|
274
|
+
self.righttoolbarpinned = 0
|
|
275
|
+
self.bottomtoolbarpinned = 0
|
|
276
|
+
self.toolbars_unpinned_last_save = 0
|
|
277
|
+
self.tallnewobj = 0
|
|
278
|
+
self.boxanimatetime = 200
|
|
279
|
+
self.enablehscroll = 1
|
|
280
|
+
self.enablevscroll = 1
|
|
281
|
+
self.devicewidth = 0.0
|
|
282
|
+
self.description = ""
|
|
283
|
+
self.digest = ""
|
|
284
|
+
self.tags = ""
|
|
285
|
+
self.style = ""
|
|
286
|
+
self.subpatcher_template = ""
|
|
287
|
+
self.assistshowspatchername = 0
|
|
288
|
+
self.boxes: list[dict] = []
|
|
289
|
+
self.lines: list[dict] = []
|
|
290
|
+
# self.parameters: dict = {}
|
|
291
|
+
self.dependency_cache: list = []
|
|
292
|
+
self.autosave = 0
|
|
293
|
+
|
|
294
|
+
def __repr__(self):
|
|
295
|
+
return f"{self.__class__.__name__}(path='{self._path}')"
|
|
296
|
+
|
|
297
|
+
def __iter__(self):
|
|
298
|
+
yield self
|
|
299
|
+
for box in self._boxes:
|
|
300
|
+
yield from iter(box)
|
|
301
|
+
|
|
302
|
+
@property
|
|
303
|
+
def width(self) -> float:
|
|
304
|
+
"""width of patcher window."""
|
|
305
|
+
return self.rect.w
|
|
306
|
+
|
|
307
|
+
@property
|
|
308
|
+
def height(self) -> float:
|
|
309
|
+
"""height of patcher windows."""
|
|
310
|
+
return self.rect.h
|
|
311
|
+
|
|
312
|
+
@classmethod
|
|
313
|
+
def from_dict(cls, patcher_dict: dict, save_to: Optional[str] = None) -> "Patcher":
|
|
314
|
+
"""create a patcher instance from a dict"""
|
|
315
|
+
|
|
316
|
+
if save_to:
|
|
317
|
+
patcher = cls(save_to)
|
|
318
|
+
else:
|
|
319
|
+
patcher = cls()
|
|
320
|
+
patcher.__dict__.update(patcher_dict)
|
|
321
|
+
|
|
322
|
+
for box_dict in patcher.boxes:
|
|
323
|
+
box = box_dict["box"]
|
|
324
|
+
b = Box.from_dict(box)
|
|
325
|
+
assert b.id, "box must have id"
|
|
326
|
+
patcher._objects[b.id] = b
|
|
327
|
+
# b = patcher.box_from_dict(box)
|
|
328
|
+
patcher._boxes.append(b)
|
|
329
|
+
|
|
330
|
+
for line_dict in patcher.lines:
|
|
331
|
+
line = line_dict["patchline"]
|
|
332
|
+
pl = Patchline.from_dict(line)
|
|
333
|
+
patcher._lines.append(pl)
|
|
334
|
+
|
|
335
|
+
return patcher
|
|
336
|
+
|
|
337
|
+
@classmethod
|
|
338
|
+
def from_file(
|
|
339
|
+
cls, path: Union[str, Path], save_to: Optional[str] = None
|
|
340
|
+
) -> "Patcher":
|
|
341
|
+
"""create a patcher instance from a .maxpat json file"""
|
|
342
|
+
|
|
343
|
+
with open(path, encoding="utf8") as f:
|
|
344
|
+
maxpat = json.load(f)
|
|
345
|
+
return Patcher.from_dict(maxpat["patcher"], save_to)
|
|
346
|
+
|
|
347
|
+
def to_dict(self) -> dict:
|
|
348
|
+
"""create dict from object with extra kwds included"""
|
|
349
|
+
d = vars(self).copy()
|
|
350
|
+
to_del = [k for k in d if k.startswith("_")]
|
|
351
|
+
for k in to_del:
|
|
352
|
+
del d[k]
|
|
353
|
+
if not self._parent:
|
|
354
|
+
return dict(patcher=d)
|
|
355
|
+
return d
|
|
356
|
+
|
|
357
|
+
def to_json(self) -> str:
|
|
358
|
+
"""cascade convert to json"""
|
|
359
|
+
self.render()
|
|
360
|
+
return json.dumps(self.to_dict(), indent=4)
|
|
361
|
+
|
|
362
|
+
def find(self, text: str) -> Optional["Box"]:
|
|
363
|
+
"""find (recursively) box object by maxclass or type
|
|
364
|
+
|
|
365
|
+
returns box if found else None
|
|
366
|
+
"""
|
|
367
|
+
for obj in self:
|
|
368
|
+
if not isinstance(obj, Patcher):
|
|
369
|
+
if obj.maxclass == text:
|
|
370
|
+
return obj
|
|
371
|
+
if hasattr(obj, "text"):
|
|
372
|
+
if obj.text and obj.text.startswith(text):
|
|
373
|
+
return obj
|
|
374
|
+
return None
|
|
375
|
+
|
|
376
|
+
def find_box(self, text: str) -> Optional["Box"]:
|
|
377
|
+
"""find box object by maxclass or type
|
|
378
|
+
|
|
379
|
+
returns box if found else None
|
|
380
|
+
"""
|
|
381
|
+
for box in self._objects.values():
|
|
382
|
+
if box.maxclass == text:
|
|
383
|
+
return box
|
|
384
|
+
if hasattr(box, "text"):
|
|
385
|
+
if box.text and box.text.startswith(text):
|
|
386
|
+
return box
|
|
387
|
+
return None
|
|
388
|
+
|
|
389
|
+
def find_box_with_index(self, text: str) -> Optional[Tuple[int, "Box"]]:
|
|
390
|
+
"""find box object by maxclass or type
|
|
391
|
+
|
|
392
|
+
returns (index, box) if found
|
|
393
|
+
"""
|
|
394
|
+
for i, box in enumerate(self._boxes):
|
|
395
|
+
if box.maxclass == text:
|
|
396
|
+
return (i, box)
|
|
397
|
+
if hasattr(box, "text"):
|
|
398
|
+
if box.text and box.text.startswith(text):
|
|
399
|
+
return (i, box)
|
|
400
|
+
return None
|
|
401
|
+
|
|
402
|
+
def render(self, reset: bool = False):
|
|
403
|
+
"""cascade convert py2max objects to dicts."""
|
|
404
|
+
if reset or self._reset_on_render:
|
|
405
|
+
self.boxes = []
|
|
406
|
+
self.lines = []
|
|
407
|
+
for box in self._boxes:
|
|
408
|
+
box.render()
|
|
409
|
+
self.boxes.append(box.to_dict())
|
|
410
|
+
self.lines = [line.to_dict() for line in self._lines]
|
|
411
|
+
|
|
412
|
+
def save_as(self, path: Union[str, Path]):
|
|
413
|
+
"""save as .maxpat json file"""
|
|
414
|
+
path = Path(path)
|
|
415
|
+
if path.parent:
|
|
416
|
+
path.parent.mkdir(exist_ok=True)
|
|
417
|
+
self.render()
|
|
418
|
+
with open(path, "w", encoding="utf8") as f:
|
|
419
|
+
json.dump(self.to_dict(), f, indent=4)
|
|
420
|
+
|
|
421
|
+
def save(self):
|
|
422
|
+
"""save as json .maxpat file"""
|
|
423
|
+
if self._path:
|
|
424
|
+
self.save_as(self._path)
|
|
425
|
+
|
|
426
|
+
def get_id(self) -> str:
|
|
427
|
+
"""helper func to increment object ids"""
|
|
428
|
+
self._id_counter += 1
|
|
429
|
+
return f"obj-{self._id_counter}"
|
|
430
|
+
|
|
431
|
+
def get_pos(self, maxclass: Optional[str] = None) -> Rect:
|
|
432
|
+
"""get box rect (position) via maxclass or layout_manager"""
|
|
433
|
+
if maxclass:
|
|
434
|
+
return self._layout_mgr.get_pos(maxclass)
|
|
435
|
+
return self._layout_mgr.get_pos()
|
|
436
|
+
|
|
437
|
+
def add_box(
|
|
438
|
+
self,
|
|
439
|
+
box: "Box",
|
|
440
|
+
comment: Optional[str] = None,
|
|
441
|
+
comment_pos: Optional[str] = None,
|
|
442
|
+
) -> "Box":
|
|
443
|
+
"""registers the box and adds it to the patcher"""
|
|
444
|
+
|
|
445
|
+
assert box.id, f"object {box} must have an id"
|
|
446
|
+
self._node_ids.append(box.id)
|
|
447
|
+
self._objects[box.id] = box
|
|
448
|
+
self._boxes.append(box)
|
|
449
|
+
if comment:
|
|
450
|
+
self.add_associated_comment(box, comment, comment_pos)
|
|
451
|
+
return box
|
|
452
|
+
|
|
453
|
+
def add_associated_comment(
|
|
454
|
+
self, box: "Box", comment: str, comment_pos: Optional[str] = None
|
|
455
|
+
):
|
|
456
|
+
"""add a comment associated with the object"""
|
|
457
|
+
|
|
458
|
+
rect = box.patching_rect
|
|
459
|
+
x, y, w, h = rect
|
|
460
|
+
if h != self._layout_mgr.box_height:
|
|
461
|
+
if box.maxclass in MAXCLASS_DEFAULTS:
|
|
462
|
+
dh: float = 0.0
|
|
463
|
+
_, _, _, dh = MAXCLASS_DEFAULTS[box.maxclass]["patching_rect"]
|
|
464
|
+
rect = Rect(x, y, w, dh)
|
|
465
|
+
else:
|
|
466
|
+
h = self._layout_mgr.box_height
|
|
467
|
+
rect = Rect(x, y, w, h)
|
|
468
|
+
# rect = x, y, self._layout_mgr.box_width, self._layout_mgr.box_height
|
|
469
|
+
if comment_pos:
|
|
470
|
+
assert comment_pos in [
|
|
471
|
+
"above",
|
|
472
|
+
"below",
|
|
473
|
+
"right",
|
|
474
|
+
"left",
|
|
475
|
+
], f"comment:{comment} / comment_pos: {comment_pos}"
|
|
476
|
+
patching_rect = getattr(self._layout_mgr, comment_pos)(rect)
|
|
477
|
+
else:
|
|
478
|
+
patching_rect = self._layout_mgr.above(rect)
|
|
479
|
+
if comment_pos == "left": # special case
|
|
480
|
+
self.add_comment(comment, patching_rect, justify="right")
|
|
481
|
+
else:
|
|
482
|
+
self.add_comment(comment, patching_rect)
|
|
483
|
+
|
|
484
|
+
def add_patchline_by_index(
|
|
485
|
+
self, src_id: str, dst_id: str, dst_inlet: int = 0, src_outlet: int = 0
|
|
486
|
+
) -> "Patchline":
|
|
487
|
+
"""Patchline creation between two objects using stored indexes"""
|
|
488
|
+
|
|
489
|
+
src = self._objects[src_id]
|
|
490
|
+
dst = self._objects[dst_id]
|
|
491
|
+
assert src.id and dst.id, f"object {src} and {dst} require ids"
|
|
492
|
+
return self.add_patchline(src.id, src_outlet, dst.id, dst_inlet)
|
|
493
|
+
|
|
494
|
+
def add_patchline(
|
|
495
|
+
self, src_id: str, src_outlet: int, dst_id: str, dst_inlet: int
|
|
496
|
+
) -> "Patchline":
|
|
497
|
+
"""primary patchline creation method"""
|
|
498
|
+
|
|
499
|
+
# get order of lines between same pair of objects
|
|
500
|
+
if (src_id, dst_id) == self._last_link:
|
|
501
|
+
self._link_counter += 1
|
|
502
|
+
else:
|
|
503
|
+
self._link_counter = 0
|
|
504
|
+
self._last_link = (src_id, dst_id)
|
|
505
|
+
|
|
506
|
+
order = self._link_counter
|
|
507
|
+
src, dst = [src_id, src_outlet], [dst_id, dst_inlet]
|
|
508
|
+
patchline = Patchline(source=src, destination=dst, order=order)
|
|
509
|
+
self._lines.append(patchline)
|
|
510
|
+
self._edge_ids.append((src_id, dst_id))
|
|
511
|
+
return patchline
|
|
512
|
+
|
|
513
|
+
def add_line(
|
|
514
|
+
self, src_obj: "Box", dst_obj: "Box", inlet: int = 0, outlet: int = 0
|
|
515
|
+
) -> "Patchline":
|
|
516
|
+
"""convenience line adding taking objects with default outlet to inlet"""
|
|
517
|
+
assert src_obj.id and dst_obj.id, f"objects {src_obj} and {dst_obj} require ids"
|
|
518
|
+
return self.add_patchline(src_obj.id, outlet, dst_obj.id, inlet)
|
|
519
|
+
|
|
520
|
+
# alias for add_line
|
|
521
|
+
link = add_line
|
|
522
|
+
|
|
523
|
+
def add_textbox(
|
|
524
|
+
self,
|
|
525
|
+
text: str,
|
|
526
|
+
maxclass: Optional[str] = None,
|
|
527
|
+
numinlets: Optional[int] = None,
|
|
528
|
+
numoutlets: Optional[int] = None,
|
|
529
|
+
outlettype: Optional[List[str]] = None,
|
|
530
|
+
patching_rect: Optional[Rect] = None,
|
|
531
|
+
id: Optional[str] = None,
|
|
532
|
+
comment: Optional[str] = None,
|
|
533
|
+
comment_pos: Optional[str] = None,
|
|
534
|
+
**kwds,
|
|
535
|
+
) -> "Box":
|
|
536
|
+
"""Add a generic textbox object to the patcher.
|
|
537
|
+
|
|
538
|
+
Looks up default attributes from a dictionary.
|
|
539
|
+
"""
|
|
540
|
+
_maxclass, *tail = text.split()
|
|
541
|
+
if _maxclass in MAXCLASS_DEFAULTS and not maxclass:
|
|
542
|
+
maxclass = _maxclass
|
|
543
|
+
|
|
544
|
+
kwds = self._textbox_helper(_maxclass, kwds)
|
|
545
|
+
|
|
546
|
+
return self.add_box(
|
|
547
|
+
Box(
|
|
548
|
+
id=id or self.get_id(),
|
|
549
|
+
text=text,
|
|
550
|
+
maxclass=maxclass or "newobj",
|
|
551
|
+
numinlets=numinlets or 1,
|
|
552
|
+
numoutlets=numoutlets or 0,
|
|
553
|
+
outlettype=outlettype or [""],
|
|
554
|
+
patching_rect=patching_rect or self.get_pos(maxclass)
|
|
555
|
+
if maxclass
|
|
556
|
+
else self.get_pos(),
|
|
557
|
+
**kwds,
|
|
558
|
+
),
|
|
559
|
+
comment,
|
|
560
|
+
comment_pos,
|
|
561
|
+
)
|
|
562
|
+
|
|
563
|
+
def _textbox_helper(self, maxclass, kwds: dict) -> dict:
|
|
564
|
+
"""adds special case support for textbox"""
|
|
565
|
+
if self.classnamespace == "rnbo":
|
|
566
|
+
kwds["rnbo_classname"] = maxclass
|
|
567
|
+
if maxclass in ["codebox", "codebox~"]:
|
|
568
|
+
if "code" in kwds and "rnbo_extra_attributes" not in kwds:
|
|
569
|
+
if "\r" not in kwds["code"]:
|
|
570
|
+
kwds["code"] = kwds["code"].replace("\n", "\r\n")
|
|
571
|
+
kwds["rnbo_extra_attributes"] = dict(
|
|
572
|
+
code=kwds["code"],
|
|
573
|
+
hot=0,
|
|
574
|
+
)
|
|
575
|
+
return kwds
|
|
576
|
+
|
|
577
|
+
def _add_float(self, value, *args, **kwds) -> "Box":
|
|
578
|
+
"""type-handler for float values in `add`"""
|
|
579
|
+
|
|
580
|
+
assert isinstance(value, float)
|
|
581
|
+
name = None
|
|
582
|
+
if args:
|
|
583
|
+
name = args[0]
|
|
584
|
+
elif "name" in kwds:
|
|
585
|
+
name = kwds.get("name")
|
|
586
|
+
else:
|
|
587
|
+
return self.add_floatparam(longname="", initial=value, **kwds)
|
|
588
|
+
|
|
589
|
+
if isinstance(name, str):
|
|
590
|
+
return self.add_floatparam(longname=name, initial=value, **kwds)
|
|
591
|
+
raise ValueError(
|
|
592
|
+
"should be: .add(<float>, '<name>') OR .add(<float>, name='<name>')"
|
|
593
|
+
)
|
|
594
|
+
|
|
595
|
+
def _add_int(self, value, *args, **kwds) -> "Box":
|
|
596
|
+
"""type-handler for int values in `add`"""
|
|
597
|
+
|
|
598
|
+
assert isinstance(value, int)
|
|
599
|
+
name = None
|
|
600
|
+
if args:
|
|
601
|
+
name = args[0]
|
|
602
|
+
elif "name" in kwds:
|
|
603
|
+
name = kwds.get("name")
|
|
604
|
+
else:
|
|
605
|
+
return self.add_intparam(longname="", initial=value, **kwds)
|
|
606
|
+
|
|
607
|
+
if isinstance(name, str):
|
|
608
|
+
return self.add_intparam(longname=name, initial=value, **kwds)
|
|
609
|
+
raise ValueError(
|
|
610
|
+
"should be: .add(<int>, '<name>') OR .add(<int>, name='<name>')"
|
|
611
|
+
)
|
|
612
|
+
|
|
613
|
+
def _add_str(self, value, *args, **kwds) -> "Box":
|
|
614
|
+
"""type-handler for str values in `add`"""
|
|
615
|
+
|
|
616
|
+
assert isinstance(value, str)
|
|
617
|
+
|
|
618
|
+
maxclass, *text = value.split()
|
|
619
|
+
txt = " ".join(text)
|
|
620
|
+
|
|
621
|
+
# first check _maxclass_methods
|
|
622
|
+
# these methods don't need the maxclass, just the `text` tail of value
|
|
623
|
+
if maxclass in self._maxclass_methods:
|
|
624
|
+
return self._maxclass_methods[maxclass](txt, **kwds) # type: ignore
|
|
625
|
+
# next two require value as a whole
|
|
626
|
+
if maxclass == "p":
|
|
627
|
+
return self.add_subpatcher(value, **kwds)
|
|
628
|
+
if maxclass == "gen~":
|
|
629
|
+
return self.add_gen_tilde(**kwds)
|
|
630
|
+
if maxclass == "rnbo~":
|
|
631
|
+
return self.add_rnbo(value, **kwds)
|
|
632
|
+
return self.add_textbox(text=value, **kwds)
|
|
633
|
+
|
|
634
|
+
def add(self, value, *args, **kwds) -> "Box":
|
|
635
|
+
"""generic adder: value can be a number or a list or text for an object."""
|
|
636
|
+
|
|
637
|
+
if isinstance(value, float):
|
|
638
|
+
return self._add_float(value, *args, **kwds)
|
|
639
|
+
|
|
640
|
+
if isinstance(value, int):
|
|
641
|
+
return self._add_int(value, *args, **kwds)
|
|
642
|
+
|
|
643
|
+
if isinstance(value, str):
|
|
644
|
+
return self._add_str(value, *args, **kwds)
|
|
645
|
+
|
|
646
|
+
raise NotImplementedError
|
|
647
|
+
|
|
648
|
+
def add_codebox(
|
|
649
|
+
self,
|
|
650
|
+
code: str,
|
|
651
|
+
patching_rect: Optional[Rect] = None,
|
|
652
|
+
id: Optional[str] = None,
|
|
653
|
+
comment: Optional[str] = None,
|
|
654
|
+
comment_pos: Optional[str] = None,
|
|
655
|
+
tilde=False,
|
|
656
|
+
**kwds,
|
|
657
|
+
) -> "Box":
|
|
658
|
+
"""Add a codebox."""
|
|
659
|
+
|
|
660
|
+
_maxclass = "codebox~" if tilde else "codebox"
|
|
661
|
+
if "\r" not in code:
|
|
662
|
+
code = code.replace("\n", "\r\n")
|
|
663
|
+
|
|
664
|
+
if self.classnamespace == "rnbo":
|
|
665
|
+
kwds["rnbo_classname"] = _maxclass
|
|
666
|
+
if "rnbo_extra_attributes" not in kwds:
|
|
667
|
+
kwds["rnbo_extra_attributes"] = dict(
|
|
668
|
+
code=code,
|
|
669
|
+
hot=0,
|
|
670
|
+
)
|
|
671
|
+
|
|
672
|
+
return self.add_box(
|
|
673
|
+
Box(
|
|
674
|
+
id=id or self.get_id(),
|
|
675
|
+
code=code,
|
|
676
|
+
maxclass=_maxclass,
|
|
677
|
+
outlettype=[""],
|
|
678
|
+
patching_rect=patching_rect or self.get_pos(),
|
|
679
|
+
**kwds,
|
|
680
|
+
),
|
|
681
|
+
comment,
|
|
682
|
+
comment_pos,
|
|
683
|
+
)
|
|
684
|
+
|
|
685
|
+
def add_codebox_tilde(
|
|
686
|
+
self,
|
|
687
|
+
code: str,
|
|
688
|
+
patching_rect: Optional[Rect] = None,
|
|
689
|
+
id: Optional[str] = None,
|
|
690
|
+
comment: Optional[str] = None,
|
|
691
|
+
comment_pos: Optional[str] = None,
|
|
692
|
+
**kwds,
|
|
693
|
+
) -> "Box":
|
|
694
|
+
"""Add a codebox_tilde"""
|
|
695
|
+
return self.add_codebox(
|
|
696
|
+
code, patching_rect, id, comment, comment_pos, tilde=True, **kwds
|
|
697
|
+
)
|
|
698
|
+
|
|
699
|
+
def add_message(
|
|
700
|
+
self,
|
|
701
|
+
text: Optional[str] = None,
|
|
702
|
+
patching_rect: Optional[Rect] = None,
|
|
703
|
+
id: Optional[str] = None,
|
|
704
|
+
comment: Optional[str] = None,
|
|
705
|
+
comment_pos: Optional[str] = None,
|
|
706
|
+
**kwds,
|
|
707
|
+
) -> "Box":
|
|
708
|
+
"""Add a max message."""
|
|
709
|
+
|
|
710
|
+
return self.add_box(
|
|
711
|
+
Box(
|
|
712
|
+
id=id or self.get_id(),
|
|
713
|
+
text=text or "",
|
|
714
|
+
maxclass="message",
|
|
715
|
+
numinlets=2,
|
|
716
|
+
numoutlets=1,
|
|
717
|
+
outlettype=[""],
|
|
718
|
+
patching_rect=patching_rect or self.get_pos(),
|
|
719
|
+
**kwds,
|
|
720
|
+
),
|
|
721
|
+
comment,
|
|
722
|
+
comment_pos,
|
|
723
|
+
)
|
|
724
|
+
|
|
725
|
+
def add_comment(
|
|
726
|
+
self,
|
|
727
|
+
text: str,
|
|
728
|
+
patching_rect: Optional[Rect] = None,
|
|
729
|
+
id: Optional[str] = None,
|
|
730
|
+
justify: Optional[str] = None,
|
|
731
|
+
**kwds,
|
|
732
|
+
) -> "Box":
|
|
733
|
+
"""Add a basic comment object."""
|
|
734
|
+
if justify:
|
|
735
|
+
kwds["textjustification"] = {"left": 0, "center": 1, "right": 2}[justify]
|
|
736
|
+
return self.add_box(
|
|
737
|
+
Box(
|
|
738
|
+
id=id or self.get_id(),
|
|
739
|
+
text=text,
|
|
740
|
+
maxclass="comment",
|
|
741
|
+
patching_rect=patching_rect or self.get_pos(),
|
|
742
|
+
**kwds,
|
|
743
|
+
)
|
|
744
|
+
)
|
|
745
|
+
|
|
746
|
+
def add_intbox(
|
|
747
|
+
self,
|
|
748
|
+
comment: Optional[str] = None,
|
|
749
|
+
comment_pos: Optional[str] = None,
|
|
750
|
+
patching_rect: Optional[Rect] = None,
|
|
751
|
+
id: Optional[str] = None,
|
|
752
|
+
**kwds,
|
|
753
|
+
) -> "Box":
|
|
754
|
+
"""Add an int box object."""
|
|
755
|
+
|
|
756
|
+
return self.add_box(
|
|
757
|
+
Box(
|
|
758
|
+
id=id or self.get_id(),
|
|
759
|
+
maxclass="number",
|
|
760
|
+
numinlets=1,
|
|
761
|
+
numoutlets=2,
|
|
762
|
+
outlettype=["", "bang"],
|
|
763
|
+
patching_rect=patching_rect or self.get_pos(),
|
|
764
|
+
**kwds,
|
|
765
|
+
),
|
|
766
|
+
comment,
|
|
767
|
+
comment_pos,
|
|
768
|
+
)
|
|
769
|
+
|
|
770
|
+
# alias
|
|
771
|
+
add_int = add_intbox
|
|
772
|
+
|
|
773
|
+
def add_floatbox(
|
|
774
|
+
self,
|
|
775
|
+
comment: Optional[str] = None,
|
|
776
|
+
comment_pos: Optional[str] = None,
|
|
777
|
+
patching_rect: Optional[Rect] = None,
|
|
778
|
+
id: Optional[str] = None,
|
|
779
|
+
**kwds,
|
|
780
|
+
) -> "Box":
|
|
781
|
+
"""Add an float box object."""
|
|
782
|
+
|
|
783
|
+
return self.add_box(
|
|
784
|
+
Box(
|
|
785
|
+
id=id or self.get_id(),
|
|
786
|
+
maxclass="flonum",
|
|
787
|
+
numinlets=1,
|
|
788
|
+
numoutlets=2,
|
|
789
|
+
outlettype=["", "bang"],
|
|
790
|
+
patching_rect=patching_rect or self.get_pos(),
|
|
791
|
+
**kwds,
|
|
792
|
+
),
|
|
793
|
+
comment,
|
|
794
|
+
comment_pos,
|
|
795
|
+
)
|
|
796
|
+
|
|
797
|
+
# alias
|
|
798
|
+
add_float = add_floatbox
|
|
799
|
+
|
|
800
|
+
def add_floatparam(
|
|
801
|
+
self,
|
|
802
|
+
longname: str,
|
|
803
|
+
initial: Optional[float] = None,
|
|
804
|
+
minimum: Optional[float] = None,
|
|
805
|
+
maximum: Optional[float] = None,
|
|
806
|
+
shortname: Optional[str] = None,
|
|
807
|
+
id: Optional[str] = None,
|
|
808
|
+
rect: Optional[Rect] = None,
|
|
809
|
+
hint: Optional[str] = None,
|
|
810
|
+
comment: Optional[str] = None,
|
|
811
|
+
comment_pos: Optional[str] = None,
|
|
812
|
+
**kwds,
|
|
813
|
+
) -> "Box":
|
|
814
|
+
"""Add a float parameter object."""
|
|
815
|
+
|
|
816
|
+
return self.add_box(
|
|
817
|
+
Box(
|
|
818
|
+
id=id or self.get_id(),
|
|
819
|
+
maxclass="flonum",
|
|
820
|
+
numinlets=1,
|
|
821
|
+
numoutlets=2,
|
|
822
|
+
outlettype=["", "bang"],
|
|
823
|
+
parameter_enable=1,
|
|
824
|
+
saved_attribute_attributes=dict(
|
|
825
|
+
valueof=dict(
|
|
826
|
+
parameter_initial=[initial or 0.5],
|
|
827
|
+
parameter_initial_enable=1,
|
|
828
|
+
parameter_longname=longname,
|
|
829
|
+
# parameter_mmax=maximum,
|
|
830
|
+
parameter_shortname=shortname or "",
|
|
831
|
+
parameter_type=0,
|
|
832
|
+
)
|
|
833
|
+
),
|
|
834
|
+
maximum=maximum,
|
|
835
|
+
minimum=minimum,
|
|
836
|
+
patching_rect=rect or self.get_pos(),
|
|
837
|
+
hint=hint or (longname if self._auto_hints else ""),
|
|
838
|
+
**kwds,
|
|
839
|
+
),
|
|
840
|
+
comment or longname, # units can also be added here
|
|
841
|
+
comment_pos,
|
|
842
|
+
)
|
|
843
|
+
|
|
844
|
+
def add_intparam(
|
|
845
|
+
self,
|
|
846
|
+
longname: str,
|
|
847
|
+
initial: Optional[int] = None,
|
|
848
|
+
minimum: Optional[int] = None,
|
|
849
|
+
maximum: Optional[int] = None,
|
|
850
|
+
shortname: Optional[str] = None,
|
|
851
|
+
id: Optional[str] = None,
|
|
852
|
+
rect: Optional[Rect] = None,
|
|
853
|
+
hint: Optional[str] = None,
|
|
854
|
+
comment: Optional[str] = None,
|
|
855
|
+
comment_pos: Optional[str] = None,
|
|
856
|
+
**kwds,
|
|
857
|
+
) -> "Box":
|
|
858
|
+
"""Add an int parameter object."""
|
|
859
|
+
|
|
860
|
+
return self.add_box(
|
|
861
|
+
Box(
|
|
862
|
+
id=id or self.get_id(),
|
|
863
|
+
maxclass="number",
|
|
864
|
+
numinlets=1,
|
|
865
|
+
numoutlets=2,
|
|
866
|
+
outlettype=["", "bang"],
|
|
867
|
+
parameter_enable=1,
|
|
868
|
+
saved_attribute_attributes=dict(
|
|
869
|
+
valueof=dict(
|
|
870
|
+
parameter_initial=[initial or 1],
|
|
871
|
+
parameter_initial_enable=1,
|
|
872
|
+
parameter_longname=longname,
|
|
873
|
+
parameter_mmax=maximum,
|
|
874
|
+
parameter_shortname=shortname or "",
|
|
875
|
+
parameter_type=1,
|
|
876
|
+
)
|
|
877
|
+
),
|
|
878
|
+
maximum=maximum,
|
|
879
|
+
minimum=minimum,
|
|
880
|
+
patching_rect=rect or self.get_pos(),
|
|
881
|
+
hint=hint or (longname if self._auto_hints else ""),
|
|
882
|
+
**kwds,
|
|
883
|
+
),
|
|
884
|
+
comment or longname, # units can also be added here
|
|
885
|
+
comment_pos,
|
|
886
|
+
)
|
|
887
|
+
|
|
888
|
+
def add_attr(
|
|
889
|
+
self,
|
|
890
|
+
name: str,
|
|
891
|
+
value: float,
|
|
892
|
+
shortname: Optional[str] = None,
|
|
893
|
+
id: Optional[str] = None,
|
|
894
|
+
rect: Optional[Rect] = None,
|
|
895
|
+
hint: Optional[str] = None,
|
|
896
|
+
comment: Optional[str] = None,
|
|
897
|
+
comment_pos: Optional[str] = None,
|
|
898
|
+
autovar=True,
|
|
899
|
+
show_label=False,
|
|
900
|
+
**kwds,
|
|
901
|
+
) -> "Box":
|
|
902
|
+
"""create a param-linke attrui entry"""
|
|
903
|
+
if autovar:
|
|
904
|
+
kwds["varname"] = name
|
|
905
|
+
|
|
906
|
+
return self.add_box(
|
|
907
|
+
Box(
|
|
908
|
+
id=id or self.get_id(),
|
|
909
|
+
text="attrui",
|
|
910
|
+
maxclass="attrui",
|
|
911
|
+
attr=name,
|
|
912
|
+
parameter_enable=1,
|
|
913
|
+
attr_display=show_label,
|
|
914
|
+
saved_attribute_attributes=dict(
|
|
915
|
+
valueof=dict(
|
|
916
|
+
parameter_initial=[name, value],
|
|
917
|
+
parameter_initial_enable=1,
|
|
918
|
+
parameter_longname=name,
|
|
919
|
+
parameter_shortname=shortname or "",
|
|
920
|
+
)
|
|
921
|
+
),
|
|
922
|
+
patching_rect=rect or self.get_pos(),
|
|
923
|
+
hint=name if self._auto_hints else hint or "",
|
|
924
|
+
**kwds,
|
|
925
|
+
),
|
|
926
|
+
comment or name, # units can also be added here
|
|
927
|
+
comment_pos,
|
|
928
|
+
)
|
|
929
|
+
|
|
930
|
+
def add_subpatcher(
|
|
931
|
+
self,
|
|
932
|
+
text: str,
|
|
933
|
+
maxclass: Optional[str] = None,
|
|
934
|
+
numinlets: Optional[int] = None,
|
|
935
|
+
numoutlets: Optional[int] = None,
|
|
936
|
+
outlettype: Optional[List[str]] = None,
|
|
937
|
+
patching_rect: Optional[Rect] = None,
|
|
938
|
+
id: Optional[str] = None,
|
|
939
|
+
patcher: Optional["Patcher"] = None,
|
|
940
|
+
**kwds,
|
|
941
|
+
) -> "Box":
|
|
942
|
+
"""Add a subpatcher object."""
|
|
943
|
+
|
|
944
|
+
return self.add_box(
|
|
945
|
+
Box(
|
|
946
|
+
id=id or self.get_id(),
|
|
947
|
+
text=text,
|
|
948
|
+
maxclass=maxclass or "newobj",
|
|
949
|
+
numinlets=numinlets or 1,
|
|
950
|
+
numoutlets=numoutlets or 0,
|
|
951
|
+
outlettype=outlettype or [""],
|
|
952
|
+
patching_rect=patching_rect or self.get_pos(),
|
|
953
|
+
patcher=patcher or Patcher(parent=self),
|
|
954
|
+
**kwds,
|
|
955
|
+
)
|
|
956
|
+
)
|
|
957
|
+
|
|
958
|
+
def add_gen(self, tilde=False, **kwds):
|
|
959
|
+
"""Add a gen object."""
|
|
960
|
+
text = "gen~" if tilde else "gen"
|
|
961
|
+
return self.add_subpatcher(
|
|
962
|
+
text, patcher=Patcher(parent=self, classnamespace="dsp.gen"), **kwds
|
|
963
|
+
)
|
|
964
|
+
|
|
965
|
+
def add_gen_tilde(self, **kwds):
|
|
966
|
+
"""Add a gen~ object."""
|
|
967
|
+
return self.add_gen(tilde=True, **kwds)
|
|
968
|
+
|
|
969
|
+
def add_rnbo(self, text: str = "rnbo~", **kwds):
|
|
970
|
+
"""Add an rnbo~ object."""
|
|
971
|
+
if "inletInfo" not in kwds:
|
|
972
|
+
if "numinlets" in kwds:
|
|
973
|
+
inletInfo: dict[str, list] = {"IOInfo": []}
|
|
974
|
+
for i in range(kwds["numinlets"]):
|
|
975
|
+
inletInfo["IOInfo"].append(
|
|
976
|
+
dict(comment="", index=i + 1, tag=f"in{i+1}", type="signal")
|
|
977
|
+
)
|
|
978
|
+
kwds["inletInfo"] = inletInfo
|
|
979
|
+
if "outletInfo" not in kwds:
|
|
980
|
+
if "numoutlets" in kwds:
|
|
981
|
+
outletInfo: dict[str, list] = {"IOInfo": []}
|
|
982
|
+
for i in range(kwds["numoutlets"]):
|
|
983
|
+
outletInfo["IOInfo"].append(
|
|
984
|
+
dict(comment="", index=i + 1, tag=f"out{i+1}", type="signal")
|
|
985
|
+
)
|
|
986
|
+
kwds["outletInfo"] = outletInfo
|
|
987
|
+
|
|
988
|
+
return self.add_subpatcher(
|
|
989
|
+
text, patcher=Patcher(parent=self, classnamespace="rnbo"), **kwds
|
|
990
|
+
)
|
|
991
|
+
|
|
992
|
+
def add_coll(
|
|
993
|
+
self,
|
|
994
|
+
name: Optional[str] = None,
|
|
995
|
+
dictionary: Optional[dict] = None,
|
|
996
|
+
embed: int = 1,
|
|
997
|
+
patching_rect: Optional[Rect] = None,
|
|
998
|
+
text: Optional[str] = None,
|
|
999
|
+
id: Optional[str] = None,
|
|
1000
|
+
comment: Optional[str] = None,
|
|
1001
|
+
comment_pos: Optional[str] = None,
|
|
1002
|
+
**kwds,
|
|
1003
|
+
):
|
|
1004
|
+
"""Add a coll object with option to pre-populate from a py dictionary."""
|
|
1005
|
+
extra = {"saved_object_attributes": {"embed": embed, "precision": 6}}
|
|
1006
|
+
if dictionary:
|
|
1007
|
+
extra["coll_data"] = { # type: ignore
|
|
1008
|
+
"count": len(dictionary.keys()),
|
|
1009
|
+
"data": [{"key": k, "value": v} for k, v in dictionary.items()], # type: ignore
|
|
1010
|
+
}
|
|
1011
|
+
kwds.update(extra)
|
|
1012
|
+
return self.add_box(
|
|
1013
|
+
Box(
|
|
1014
|
+
id=id or self.get_id(),
|
|
1015
|
+
text=text or f"coll {name} @embed {embed}"
|
|
1016
|
+
if name
|
|
1017
|
+
else f"coll @embed {embed}",
|
|
1018
|
+
maxclass="newobj",
|
|
1019
|
+
numinlets=1,
|
|
1020
|
+
numoutlets=4,
|
|
1021
|
+
outlettype=["", "", "", ""],
|
|
1022
|
+
patching_rect=patching_rect or self.get_pos(),
|
|
1023
|
+
**kwds,
|
|
1024
|
+
),
|
|
1025
|
+
comment,
|
|
1026
|
+
comment_pos,
|
|
1027
|
+
)
|
|
1028
|
+
|
|
1029
|
+
def add_dict(
|
|
1030
|
+
self,
|
|
1031
|
+
name: Optional[str] = None,
|
|
1032
|
+
dictionary: Optional[dict] = None,
|
|
1033
|
+
embed: int = 1,
|
|
1034
|
+
patching_rect: Optional[Rect] = None,
|
|
1035
|
+
text: Optional[str] = None,
|
|
1036
|
+
id: Optional[str] = None,
|
|
1037
|
+
comment: Optional[str] = None,
|
|
1038
|
+
comment_pos: Optional[str] = None,
|
|
1039
|
+
**kwds,
|
|
1040
|
+
):
|
|
1041
|
+
"""Add a dict object with option to pre-populate from a py dictionary."""
|
|
1042
|
+
extra = {
|
|
1043
|
+
"saved_object_attributes": {
|
|
1044
|
+
"embed": embed,
|
|
1045
|
+
"parameter_enable": kwds.get("parameter_enable", 0),
|
|
1046
|
+
"parameter_mappable": kwds.get("parameter_mappable", 0),
|
|
1047
|
+
},
|
|
1048
|
+
"data": dictionary or {},
|
|
1049
|
+
}
|
|
1050
|
+
kwds.update(extra)
|
|
1051
|
+
return self.add_box(
|
|
1052
|
+
Box(
|
|
1053
|
+
id=id or self.get_id(),
|
|
1054
|
+
text=text or f"dict {name} @embed {embed}"
|
|
1055
|
+
if name
|
|
1056
|
+
else f"dict @embed {embed}",
|
|
1057
|
+
maxclass="newobj",
|
|
1058
|
+
numinlets=2,
|
|
1059
|
+
numoutlets=4,
|
|
1060
|
+
outlettype=["dictionary", "", "", ""],
|
|
1061
|
+
patching_rect=patching_rect or self.get_pos(),
|
|
1062
|
+
**kwds,
|
|
1063
|
+
),
|
|
1064
|
+
comment,
|
|
1065
|
+
comment_pos,
|
|
1066
|
+
)
|
|
1067
|
+
|
|
1068
|
+
def add_table(
|
|
1069
|
+
self,
|
|
1070
|
+
name: Optional[str] = None,
|
|
1071
|
+
array: Optional[List[Union[int, float]]] = None,
|
|
1072
|
+
embed: int = 1,
|
|
1073
|
+
patching_rect: Optional[Rect] = None,
|
|
1074
|
+
text: Optional[str] = None,
|
|
1075
|
+
id: Optional[str] = None,
|
|
1076
|
+
comment: Optional[str] = None,
|
|
1077
|
+
comment_pos: Optional[str] = None,
|
|
1078
|
+
tilde=False,
|
|
1079
|
+
**kwds,
|
|
1080
|
+
):
|
|
1081
|
+
"""Add a table object with option to pre-populate from a py list."""
|
|
1082
|
+
|
|
1083
|
+
extra = {
|
|
1084
|
+
"embed": embed,
|
|
1085
|
+
"saved_object_attributes": {
|
|
1086
|
+
"name": name,
|
|
1087
|
+
"parameter_enable": kwds.get("parameter_enable", 0),
|
|
1088
|
+
"parameter_mappable": kwds.get("parameter_mappable", 0),
|
|
1089
|
+
"range": kwds.get("range", 128),
|
|
1090
|
+
"showeditor": 0,
|
|
1091
|
+
"size": len(array) if array else 128,
|
|
1092
|
+
},
|
|
1093
|
+
# "showeditor": 0,
|
|
1094
|
+
# 'size': kwds.get('size', 128),
|
|
1095
|
+
"table_data": array or [],
|
|
1096
|
+
"editor_rect": [100.0, 100.0, 300.0, 300.0],
|
|
1097
|
+
}
|
|
1098
|
+
kwds.update(extra)
|
|
1099
|
+
table_type = "table~" if tilde else "table"
|
|
1100
|
+
return self.add_box(
|
|
1101
|
+
Box(
|
|
1102
|
+
id=id or self.get_id(),
|
|
1103
|
+
text=text or f"{table_type} {name} @embed {embed}"
|
|
1104
|
+
if name
|
|
1105
|
+
else f"{table_type} @embed {embed}",
|
|
1106
|
+
maxclass="newobj",
|
|
1107
|
+
numinlets=2,
|
|
1108
|
+
numoutlets=2,
|
|
1109
|
+
outlettype=["int", "bang"],
|
|
1110
|
+
patching_rect=patching_rect or self.get_pos(),
|
|
1111
|
+
**kwds,
|
|
1112
|
+
),
|
|
1113
|
+
comment,
|
|
1114
|
+
comment_pos,
|
|
1115
|
+
)
|
|
1116
|
+
|
|
1117
|
+
def add_table_tilde(
|
|
1118
|
+
self,
|
|
1119
|
+
name: Optional[str] = None,
|
|
1120
|
+
array: Optional[List[Union[int, float]]] = None,
|
|
1121
|
+
embed: int = 1,
|
|
1122
|
+
patching_rect: Optional[Rect] = None,
|
|
1123
|
+
text: Optional[str] = None,
|
|
1124
|
+
id: Optional[str] = None,
|
|
1125
|
+
comment: Optional[str] = None,
|
|
1126
|
+
comment_pos: Optional[str] = None,
|
|
1127
|
+
**kwds,
|
|
1128
|
+
):
|
|
1129
|
+
"""Add a table~ object with option to pre-populate from a py list."""
|
|
1130
|
+
|
|
1131
|
+
return self.add_table(
|
|
1132
|
+
name,
|
|
1133
|
+
array,
|
|
1134
|
+
embed,
|
|
1135
|
+
patching_rect,
|
|
1136
|
+
text,
|
|
1137
|
+
id,
|
|
1138
|
+
comment,
|
|
1139
|
+
comment_pos,
|
|
1140
|
+
tilde=True,
|
|
1141
|
+
**kwds,
|
|
1142
|
+
)
|
|
1143
|
+
|
|
1144
|
+
def add_itable(
|
|
1145
|
+
self,
|
|
1146
|
+
name: Optional[str] = None,
|
|
1147
|
+
array: Optional[List[Union[int, float]]] = None,
|
|
1148
|
+
patching_rect: Optional[Rect] = None,
|
|
1149
|
+
text: Optional[str] = None,
|
|
1150
|
+
id: Optional[str] = None,
|
|
1151
|
+
comment: Optional[str] = None,
|
|
1152
|
+
comment_pos: Optional[str] = None,
|
|
1153
|
+
**kwds,
|
|
1154
|
+
):
|
|
1155
|
+
"""Add a itable object with option to pre-populate from a py list."""
|
|
1156
|
+
|
|
1157
|
+
extra = {
|
|
1158
|
+
"range": kwds.get("range", 128),
|
|
1159
|
+
"size": len(array) if array else 128,
|
|
1160
|
+
"table_data": array or [],
|
|
1161
|
+
}
|
|
1162
|
+
kwds.update(extra)
|
|
1163
|
+
return self.add_box(
|
|
1164
|
+
Box(
|
|
1165
|
+
id=id or self.get_id(),
|
|
1166
|
+
text=text or f"itable {name}",
|
|
1167
|
+
maxclass="itable",
|
|
1168
|
+
numinlets=2,
|
|
1169
|
+
numoutlets=2,
|
|
1170
|
+
outlettype=["int", "bang"],
|
|
1171
|
+
patching_rect=patching_rect or self.get_pos(),
|
|
1172
|
+
**kwds,
|
|
1173
|
+
),
|
|
1174
|
+
comment,
|
|
1175
|
+
comment_pos,
|
|
1176
|
+
)
|
|
1177
|
+
|
|
1178
|
+
def add_umenu(
|
|
1179
|
+
self,
|
|
1180
|
+
prefix: Optional[str] = None,
|
|
1181
|
+
autopopulate: int = 1,
|
|
1182
|
+
items: Optional[List[str]] = None,
|
|
1183
|
+
patching_rect: Optional[Rect] = None,
|
|
1184
|
+
depth: Optional[int] = None,
|
|
1185
|
+
id: Optional[str] = None,
|
|
1186
|
+
comment: Optional[str] = None,
|
|
1187
|
+
comment_pos: Optional[str] = None,
|
|
1188
|
+
**kwds,
|
|
1189
|
+
):
|
|
1190
|
+
"""Add a umenu object with option to pre-populate items from a py list."""
|
|
1191
|
+
|
|
1192
|
+
# interleave commas in a list
|
|
1193
|
+
def _commas(xs):
|
|
1194
|
+
return [i for pair in zip(xs, [","] * len(xs)) for i in pair]
|
|
1195
|
+
|
|
1196
|
+
return self.add_box(
|
|
1197
|
+
Box(
|
|
1198
|
+
id=id or self.get_id(),
|
|
1199
|
+
maxclass="umenu",
|
|
1200
|
+
numinlets=1,
|
|
1201
|
+
numoutlets=3,
|
|
1202
|
+
outlettype=["int", "", ""],
|
|
1203
|
+
autopopulate=autopopulate or 1,
|
|
1204
|
+
depth=depth or 1,
|
|
1205
|
+
items=_commas(items) or [],
|
|
1206
|
+
prefix=prefix or "",
|
|
1207
|
+
patching_rect=patching_rect or self.get_pos(),
|
|
1208
|
+
**kwds,
|
|
1209
|
+
),
|
|
1210
|
+
comment,
|
|
1211
|
+
comment_pos,
|
|
1212
|
+
)
|
|
1213
|
+
|
|
1214
|
+
def add_bpatcher(
|
|
1215
|
+
self,
|
|
1216
|
+
name: str,
|
|
1217
|
+
numinlets: int = 1,
|
|
1218
|
+
numoutlets: int = 1,
|
|
1219
|
+
outlettype: Optional[List[str]] = None,
|
|
1220
|
+
bgmode: int = 0,
|
|
1221
|
+
border: int = 0,
|
|
1222
|
+
clickthrough: int = 0,
|
|
1223
|
+
enablehscroll: int = 0,
|
|
1224
|
+
enablevscroll: int = 0,
|
|
1225
|
+
lockeddragscroll: int = 0,
|
|
1226
|
+
offset: Optional[List[float]] = None,
|
|
1227
|
+
viewvisibility: int = 1,
|
|
1228
|
+
patching_rect: Optional[Rect] = None,
|
|
1229
|
+
id: Optional[str] = None,
|
|
1230
|
+
comment: Optional[str] = None,
|
|
1231
|
+
comment_pos: Optional[str] = None,
|
|
1232
|
+
**kwds,
|
|
1233
|
+
):
|
|
1234
|
+
"""Add a bpatcher object -- name or patch of bpatcher .maxpat is required."""
|
|
1235
|
+
|
|
1236
|
+
return self.add_box(
|
|
1237
|
+
Box(
|
|
1238
|
+
id=id or self.get_id(),
|
|
1239
|
+
name=name,
|
|
1240
|
+
maxclass="bpatcher",
|
|
1241
|
+
numinlets=numinlets,
|
|
1242
|
+
numoutlets=numoutlets,
|
|
1243
|
+
bgmode=bgmode,
|
|
1244
|
+
border=border,
|
|
1245
|
+
clickthrough=clickthrough,
|
|
1246
|
+
enablehscroll=enablehscroll,
|
|
1247
|
+
enablevscroll=enablevscroll,
|
|
1248
|
+
lockeddragscroll=lockeddragscroll,
|
|
1249
|
+
viewvisibility=viewvisibility,
|
|
1250
|
+
outlettype=outlettype or ["float", "", ""],
|
|
1251
|
+
patching_rect=patching_rect or self.get_pos(),
|
|
1252
|
+
offset=offset or [0.0, 0.0],
|
|
1253
|
+
**kwds,
|
|
1254
|
+
),
|
|
1255
|
+
comment,
|
|
1256
|
+
comment_pos,
|
|
1257
|
+
)
|
|
1258
|
+
|
|
1259
|
+
def add_beap(self, name: str, **kwds):
|
|
1260
|
+
"""Add a beap bpatcher object."""
|
|
1261
|
+
|
|
1262
|
+
_varname = name if ".maxpat" not in name else name.rstrip(".maxpat")
|
|
1263
|
+
return self.add_bpatcher(name=name, varname=_varname, extract=1, **kwds)
|
|
1264
|
+
|
|
1265
|
+
|
|
1266
|
+
class Box:
|
|
1267
|
+
"""Max Box object"""
|
|
1268
|
+
|
|
1269
|
+
def __init__(
|
|
1270
|
+
self,
|
|
1271
|
+
maxclass: Optional[str] = None,
|
|
1272
|
+
numinlets: Optional[int] = None,
|
|
1273
|
+
numoutlets: Optional[int] = None,
|
|
1274
|
+
id: Optional[str] = None,
|
|
1275
|
+
patching_rect: Optional[Rect] = None,
|
|
1276
|
+
**kwds,
|
|
1277
|
+
):
|
|
1278
|
+
self.id = id
|
|
1279
|
+
self.maxclass = maxclass or "newobj"
|
|
1280
|
+
self.numinlets = numinlets or 0
|
|
1281
|
+
self.numoutlets = numoutlets or 1
|
|
1282
|
+
# self.outlettype = outlettype
|
|
1283
|
+
self.patching_rect = patching_rect or Rect(0, 0, 62, 22)
|
|
1284
|
+
|
|
1285
|
+
self._kwds = self._remove_none_entries(kwds)
|
|
1286
|
+
self._patcher = self._kwds.pop("patcher", None)
|
|
1287
|
+
|
|
1288
|
+
def _remove_none_entries(self, kwds):
|
|
1289
|
+
"""removes items in the dict which have None values.
|
|
1290
|
+
|
|
1291
|
+
TODO: make recursive in case of nested dicts.
|
|
1292
|
+
"""
|
|
1293
|
+
return {k: v for k, v in kwds.items() if v is not None}
|
|
1294
|
+
|
|
1295
|
+
def __iter__(self):
|
|
1296
|
+
yield self
|
|
1297
|
+
if self._patcher:
|
|
1298
|
+
yield from iter(self._patcher)
|
|
1299
|
+
|
|
1300
|
+
def __repr__(self):
|
|
1301
|
+
return f"{self.__class__.__name__}(id='{self.id}', maxclass='{self.maxclass}')"
|
|
1302
|
+
|
|
1303
|
+
def render(self):
|
|
1304
|
+
"""convert self and children to dictionary."""
|
|
1305
|
+
if self._patcher:
|
|
1306
|
+
self._patcher.render()
|
|
1307
|
+
self.patcher = self._patcher.to_dict()
|
|
1308
|
+
|
|
1309
|
+
def to_dict(self):
|
|
1310
|
+
"""create dict from object with extra kwds included"""
|
|
1311
|
+
d = vars(self).copy()
|
|
1312
|
+
to_del = [k for k in d if k.startswith("_")]
|
|
1313
|
+
for k in to_del:
|
|
1314
|
+
del d[k]
|
|
1315
|
+
d.update(self._kwds)
|
|
1316
|
+
return dict(box=d)
|
|
1317
|
+
|
|
1318
|
+
@classmethod
|
|
1319
|
+
def from_dict(cls, obj_dict):
|
|
1320
|
+
"""create instance from dict"""
|
|
1321
|
+
box = cls()
|
|
1322
|
+
box.__dict__.update(obj_dict)
|
|
1323
|
+
if hasattr(box, "patcher"):
|
|
1324
|
+
box._patcher = Patcher.from_dict(getattr(box, "patcher"))
|
|
1325
|
+
return box
|
|
1326
|
+
|
|
1327
|
+
@property
|
|
1328
|
+
def oid(self) -> Optional[int]:
|
|
1329
|
+
"""numerical part of object id as int"""
|
|
1330
|
+
if self.id:
|
|
1331
|
+
return int(self.id[4:])
|
|
1332
|
+
return None
|
|
1333
|
+
|
|
1334
|
+
@property
|
|
1335
|
+
def subpatcher(self):
|
|
1336
|
+
"""synonym for parent patcher object"""
|
|
1337
|
+
return self._patcher
|
|
1338
|
+
|
|
1339
|
+
|
|
1340
|
+
class Patchline:
|
|
1341
|
+
"""A class for Max patchlines."""
|
|
1342
|
+
|
|
1343
|
+
def __init__(
|
|
1344
|
+
self, source: Optional[list] = None, destination: Optional[list] = None, **kwds
|
|
1345
|
+
):
|
|
1346
|
+
self.source = source or []
|
|
1347
|
+
self.destination = destination or []
|
|
1348
|
+
self._kwds = kwds
|
|
1349
|
+
|
|
1350
|
+
def __repr__(self):
|
|
1351
|
+
return f"Patchline({self.source} -> {self.destination})"
|
|
1352
|
+
|
|
1353
|
+
@property
|
|
1354
|
+
def src(self):
|
|
1355
|
+
"""first object from source list"""
|
|
1356
|
+
return self.source[0]
|
|
1357
|
+
|
|
1358
|
+
@property
|
|
1359
|
+
def dst(self):
|
|
1360
|
+
"""first object from destination list"""
|
|
1361
|
+
return self.destination[0]
|
|
1362
|
+
|
|
1363
|
+
def to_tuple(self) -> Tuple[str, str, str, str, Union[str, int]]:
|
|
1364
|
+
"""Return a tuple describing the patchline."""
|
|
1365
|
+
return (
|
|
1366
|
+
self.source[0],
|
|
1367
|
+
self.source[1],
|
|
1368
|
+
self.destination[0],
|
|
1369
|
+
self.destination[1],
|
|
1370
|
+
self._kwds.get("order", 0),
|
|
1371
|
+
)
|
|
1372
|
+
|
|
1373
|
+
def to_dict(self):
|
|
1374
|
+
"""create dict from object with extra kwds included"""
|
|
1375
|
+
d = vars(self).copy()
|
|
1376
|
+
to_del = [k for k in d if k.startswith("_")]
|
|
1377
|
+
for k in to_del:
|
|
1378
|
+
del d[k]
|
|
1379
|
+
d.update(self._kwds)
|
|
1380
|
+
return dict(patchline=d)
|
|
1381
|
+
|
|
1382
|
+
@classmethod
|
|
1383
|
+
def from_dict(cls, obj_dict: dict):
|
|
1384
|
+
"""convert to`Patchline` object from dict"""
|
|
1385
|
+
patchline = cls()
|
|
1386
|
+
patchline.__dict__.update(obj_dict)
|
|
1387
|
+
return patchline
|