From dde84dfe13688b3f95e89e8d27dd99d49dfed77b Mon Sep 17 00:00:00 2001 From: shehab khaled <89648315+shehab299@users.noreply.github.com> Date: Fri, 16 Aug 2024 11:04:39 +0300 Subject: [PATCH] Add support for importing packages from the registry and http/https served files (#1049) * Added package manager module * Fixing Error Messages and Error handling * Added --package-only and --pkg-list options in the compiler * Changed Example to use the new package format * Changed help to contain the new options * Added a url handling library and changed the way i handle the registry url * Added WASM compatiable code * Batch to fix stackoverflow error in browsers * add node support for xhr requests * Update Downloader.cpp * change xhr requests to fetch * testing * x * xmlrequest support * remove async debug * Fix the versions in examples and add a test script * update libraries * add author in error messages * Solve the problem with XMLHttpRequest isn't a constructor --- .gitignore | 3 + build/CMakeLists.txt | 4 + build/Makefile | 3 +- build/emcc/CMakeLists.txt | 7 +- build/wasmglue/CMakeLists.txt | 6 +- compiler/boxes/boxes.cpp | 1 + compiler/global.cpp | 21 +- compiler/global.hh | 4 + compiler/libcode.cpp | 16 + compiler/parser/Downloader.cpp | 189 ++++ compiler/parser/Downloader.hh | 28 + compiler/parser/PackageManager.cpp | 139 +++ compiler/parser/PackageManager.hh | 27 + compiler/parser/PkgUrl.cpp | 66 ++ compiler/parser/PkgUrl.hh | 23 + compiler/parser/sourcereader.cpp | 126 ++- compiler/parser/sourcereader.hh | 8 +- compiler/utils/url.cpp | 955 ++++++++++++++++++ compiler/utils/url.hpp | 232 +++++ .../16_channel_volume/16_channel_volume.dsp | 4 +- .../{layout.dsp => layout.lib} | 0 examples/SAM/chorus/chorus.dsp | 4 +- examples/SAM/chorus/chorusForBrowser.dsp | 2 +- .../SAM/chorus/{layout2.dsp => layout2.lib} | 0 examples/SAM/echo/echo.dsp | 4 +- examples/SAM/echo/echoForBrowser.dsp | 2 +- .../layout2.dsp => echo/layout2.lib} | 1 + examples/SAM/effects/chorus.dsp | 4 +- examples/SAM/effects/echo.dsp | 4 +- examples/SAM/effects/effects.dsp | 4 +- examples/SAM/effects/effectsForBrowser.dsp | 4 +- examples/SAM/effects/flanger.dsp | 4 +- examples/SAM/effects/freeverb.dsp | 4 +- .../{echo/layout2.dsp => effects/layout2.lib} | 0 examples/SAM/flanger/flanger.dsp | 4 +- examples/SAM/flanger/flangerForBrowser.dsp | 2 +- .../layout2.dsp => flanger/layout2.lib} | 0 examples/SAM/freeverb/freeverb.dsp | 4 +- examples/SAM/freeverb/freeverbForBrowser.dsp | 2 +- .../layout2.dsp => freeverb/layout2.lib} | 0 .../SAM/sawtooth_synth/sawtooth_synth.dsp | 2 +- examples/SAM/sine_synth/sine_synth.dsp | 2 +- .../layout2.dsp => virtualAnalog/layout2.lib} | 0 examples/SAM/virtualAnalog/virtualAnalog.dsp | 4 +- .../virtualAnalog/virtualAnalogForBrowser.dsp | 2 +- .../virtualAnalogWithEffectsForBrowser.dsp | 2 +- examples/SAM/volume/volume.dsp | 2 +- examples/ambisonics/fourSourcesToOcto.dsp | 2 +- examples/ambisonics/oneSourceToStereo.dsp | 2 +- examples/analysis/FFT.dsp | 2 +- examples/analysis/dbmeter.dsp | 2 +- examples/analysis/spectralLevel.dsp | 2 +- examples/analysis/spectralTiltLab.dsp | 2 +- examples/analysis/vumeter.dsp | 2 +- examples/autodiff/noise.dsp | 2 +- examples/autodiff/noop.dsp | 2 +- examples/bela/AdditiveSynth.dsp | 2 +- examples/bela/AdditiveSynth_Analog.dsp | 2 +- examples/bela/FMSynth2.dsp | 2 +- examples/bela/FMSynth2_Analog.dsp | 2 +- examples/bela/FMSynth2_FX.dsp | 2 +- examples/bela/FMSynth2_FX_Analog.dsp | 2 +- examples/bela/FXChaine2.dsp | 2 +- examples/bela/GrainGenerator.dsp | 2 +- examples/bela/WaveSynth.dsp | 2 +- examples/bela/WaveSynth_Analog.dsp | 2 +- examples/bela/WaveSynth_FX.dsp | 2 +- examples/bela/WaveSynth_FX_Analog.dsp | 2 +- examples/bela/crossDelay2.dsp | 2 +- examples/bela/granulator.dsp | 2 +- examples/bela/repeater.dsp | 2 +- examples/bela/simpleFX.dsp | 2 +- examples/bela/simpleFX_Analog.dsp | 2 +- examples/bela/simpleSynth.dsp | 2 +- examples/bela/simpleSynth_Analog.dsp | 2 +- examples/bela/simpleSynth_FX.dsp | 2 +- examples/bela/simpleSynth_FX_Analog.dsp | 2 +- .../bela/trill_simple_monophonic_keyboard.dsp | 2 +- .../bela/trill_simple_polyphonic_keyboard.dsp | 2 +- examples/delayEcho/echo.dsp | 2 +- examples/delayEcho/quadEcho.dsp | 2 +- examples/delayEcho/smoothDelay.dsp | 2 +- examples/delayEcho/stereoEcho.dsp | 2 +- examples/delayEcho/tapiir.dsp | 2 +- examples/dynamic/compressor.dsp | 2 +- examples/dynamic/distortion.dsp | 2 +- examples/dynamic/gateCompressor.dsp | 2 +- examples/dynamic/noiseGate.dsp | 2 +- examples/dynamic/volume.dsp | 2 +- examples/filtering/APF.dsp | 2 +- examples/filtering/BPF.dsp | 2 +- examples/filtering/DNN.dsp | 2 +- examples/filtering/HPF.dsp | 2 +- examples/filtering/LPF.dsp | 2 +- examples/filtering/bandFilter.dsp | 2 +- examples/filtering/cryBaby.dsp | 2 +- examples/filtering/diodeLadder.dsp | 2 +- examples/filtering/filterBank.dsp | 2 +- examples/filtering/graphicEqLab.dsp | 2 +- examples/filtering/highShelf.dsp | 2 +- examples/filtering/korg35HPF.dsp | 2 +- examples/filtering/korg35LPF.dsp | 2 +- examples/filtering/lfBoost.dsp | 2 +- examples/filtering/lowBoost.dsp | 2 +- examples/filtering/lowCut.dsp | 2 +- examples/filtering/lowShelf.dsp | 2 +- examples/filtering/moogHalfLadder.dsp | 2 +- examples/filtering/moogLadder.dsp | 2 +- examples/filtering/moogVCF.dsp | 2 +- examples/filtering/notch.dsp | 2 +- examples/filtering/oberheim.dsp | 2 +- examples/filtering/oberheimBPF.dsp | 2 +- examples/filtering/oberheimBSF.dsp | 2 +- examples/filtering/oberheimHPF.dsp | 2 +- examples/filtering/oberheimLPF.dsp | 2 +- examples/filtering/parametricEqLab.dsp | 2 +- examples/filtering/parametricEqualizer.dsp | 2 +- examples/filtering/peakNotch.dsp | 2 +- examples/filtering/peakingEQ.dsp | 2 +- examples/filtering/sallenKey2ndOrder.dsp | 2 +- examples/filtering/sallenKey2ndOrderBPF.dsp | 2 +- examples/filtering/sallenKey2ndOrderHPF.dsp | 2 +- examples/filtering/sallenKey2ndOrderLPF.dsp | 2 +- examples/filtering/sallenKeyOnePole.dsp | 2 +- examples/filtering/sallenKeyOnePoleHPF.dsp | 2 +- examples/filtering/sallenKeyOnePoleLPF.dsp | 2 +- examples/filtering/spectralTilt.dsp | 2 +- examples/filtering/vcfWahLab.dsp | 2 +- examples/filtering/vocoder.dsp | 2 +- examples/filtering/wahPedal.dsp | 2 +- examples/gameaudio/bubble.dsp | 2 +- examples/gameaudio/complex_rain.dsp | 2 +- examples/gameaudio/door.dsp | 2 +- examples/gameaudio/fire.dsp | 2 +- examples/gameaudio/insects.dsp | 2 +- examples/gameaudio/rain.dsp | 2 +- examples/gameaudio/thunder.dsp | 2 +- examples/gameaudio/wind.dsp | 2 +- examples/gameaudio/windchimes.dsp | 2 +- examples/generator/churchOrgan.dsp | 2 +- examples/generator/filterOsc.dsp | 2 +- examples/generator/osc.dsp | 2 +- examples/generator/osci.dsp | 2 +- examples/generator/sawtoothLab.dsp | 2 +- examples/generator/virtualAnalog.dsp | 2 +- examples/generator/virtualAnalogLab.dsp | 2 +- examples/misc/autopan.dsp | 2 +- examples/misc/capture.dsp | 2 +- examples/misc/drumkit.dsp | 2 +- examples/misc/guitarix.dsp | 8 +- examples/misc/matrix.dsp | 2 +- examples/misc/mixer.dsp | 2 +- examples/misc/statespace.dsp | 2 +- examples/misc/tester.dsp | 2 +- examples/misc/tester2.dsp | 2 +- examples/phasing/flanger.dsp | 2 +- examples/phasing/phaser.dsp | 2 +- examples/phasing/phaserFlangerLab.dsp | 2 +- examples/physicalModeling/brass.dsp | 2 +- examples/physicalModeling/brassMIDI.dsp | 2 +- examples/physicalModeling/churchBell.dsp | 2 +- examples/physicalModeling/clarinet.dsp | 2 +- examples/physicalModeling/clarinetMIDI.dsp | 2 +- examples/physicalModeling/djembeMIDI.dsp | 2 +- examples/physicalModeling/elecGuitarMIDI.dsp | 2 +- examples/physicalModeling/englishBell.dsp | 2 +- examples/physicalModeling/flute.dsp | 2 +- examples/physicalModeling/fluteMIDI.dsp | 2 +- examples/physicalModeling/frenchBell.dsp | 2 +- examples/physicalModeling/germanBell.dsp | 2 +- examples/physicalModeling/guitarMIDI.dsp | 2 +- examples/physicalModeling/karplus.dsp | 2 +- examples/physicalModeling/marimbaMIDI.dsp | 2 +- .../modularInterpInstrMIDI.dsp | 2 +- examples/physicalModeling/nylonGuitarMIDI.dsp | 2 +- examples/physicalModeling/russianBell.dsp | 2 +- examples/physicalModeling/standardBell.dsp | 2 +- examples/physicalModeling/violin.dsp | 2 +- examples/physicalModeling/violinMIDI.dsp | 2 +- examples/physicalModeling/vocalBP.dsp | 2 +- examples/physicalModeling/vocalBPMIDI.dsp | 2 +- examples/physicalModeling/vocalFOF.dsp | 2 +- examples/physicalModeling/vocalFOFMIDI.dsp | 2 +- examples/pitchShifting/pitchShifter.dsp | 2 +- examples/psychoacoustic/harmonicExciter.dsp | 2 +- examples/quantizing/quantizedChords.dsp | 2 +- examples/reverb/dattorro.dsp | 2 +- examples/reverb/fdnRev.dsp | 2 +- examples/reverb/freeverb.dsp | 2 +- examples/reverb/greyhole.dsp | 2 +- examples/reverb/jprev.dsp | 2 +- examples/reverb/reverbDesigner.dsp | 2 +- examples/reverb/reverbTester.dsp | 2 +- examples/reverb/vital_rev.dsp | 2 +- examples/reverb/zitaRev.dsp | 2 +- examples/reverb/zitaRevFDN.dsp | 2 +- examples/smartKeyboard/acGuitar.dsp | 2 +- examples/smartKeyboard/bells.dsp | 2 +- examples/smartKeyboard/bowed.dsp | 2 +- examples/smartKeyboard/brass.dsp | 2 +- examples/smartKeyboard/clarinet.dsp | 2 +- examples/smartKeyboard/crazyGuiro.dsp | 2 +- examples/smartKeyboard/drums.dsp | 2 +- examples/smartKeyboard/dubDub.dsp | 2 +- examples/smartKeyboard/elecGuitar.dsp | 2 +- examples/smartKeyboard/fm.dsp | 2 +- examples/smartKeyboard/frog.dsp | 2 +- examples/smartKeyboard/harp.dsp | 2 +- examples/smartKeyboard/midiOnly.dsp | 2 +- examples/smartKeyboard/multiSynth.dsp | 2 +- examples/smartKeyboard/toy.dsp | 2 +- examples/smartKeyboard/trumpet.dsp | 2 +- examples/smartKeyboard/turenas.dsp | 2 +- examples/smartKeyboard/violin.dsp | 2 +- examples/smartKeyboard/violin2.dsp | 2 +- examples/smartKeyboard/vocal.dsp | 2 +- examples/spat/spat.dsp | 2 +- libraries | 2 +- test.py | 36 + 219 files changed, 2023 insertions(+), 286 deletions(-) create mode 100644 compiler/parser/Downloader.cpp create mode 100644 compiler/parser/Downloader.hh create mode 100644 compiler/parser/PackageManager.cpp create mode 100644 compiler/parser/PackageManager.hh create mode 100644 compiler/parser/PkgUrl.cpp create mode 100644 compiler/parser/PkgUrl.hh create mode 100644 compiler/utils/url.cpp create mode 100644 compiler/utils/url.hpp rename examples/SAM/16_channel_volume/{layout.dsp => layout.lib} (100%) rename examples/SAM/chorus/{layout2.dsp => layout2.lib} (100%) rename examples/SAM/{virtualAnalog/layout2.dsp => echo/layout2.lib} (99%) rename examples/SAM/{echo/layout2.dsp => effects/layout2.lib} (100%) rename examples/SAM/{effects/layout2.dsp => flanger/layout2.lib} (100%) rename examples/SAM/{flanger/layout2.dsp => freeverb/layout2.lib} (100%) rename examples/SAM/{freeverb/layout2.dsp => virtualAnalog/layout2.lib} (100%) create mode 100644 test.py diff --git a/.gitignore b/.gitignore index 53896cba83..2bd9a18244 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,6 @@ tests/impulse-tests/ir .idea/ ### Pyenv .python-version + +## filesystem +build/wasm-filesystem diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index 1283518587..abd029ca26 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -24,6 +24,8 @@ set (LIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/${LIBSDIR}) set (CMAKE_CXX_STANDARD 17) +find_package(CURL REQUIRED) + ####################################### # Output options option ( UNIVERSAL "Compiles and combines x86_64 and arm64 architectures [MacOS]" off ) @@ -192,6 +194,7 @@ if (INCLUDE_EXECUTABLE) endif() target_include_directories (faust PRIVATE ${FAUST_INC} ${LLVM_INCLUDE_DIRS}) target_link_libraries (faust PRIVATE ${FAUST_LIBS}) + target_link_libraries(faust PUBLIC ${CURL_LIBRARIES}) scan_backends (faust COMPILER) set_target_properties(faust PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${BINDIR}) set_target_properties(faust PROPERTIES COMPILE_FLAGS -DFAUST_EXE) @@ -284,6 +287,7 @@ if (${CMAKE_GENERATOR} STREQUAL Xcode OR ${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC set (INCLUDE_EMCC off) set (INCLUDE_WASM_GLUE off) endif() + if (INCLUDE_EMCC) add_subdirectory (emcc) endif() diff --git a/build/Makefile b/build/Makefile index 8765e37d45..bd6d3decf6 100644 --- a/build/Makefile +++ b/build/Makefile @@ -77,7 +77,7 @@ BUILDOPT ?= --config Release BACKENDS ?= $(shell [ -f $(BCACHE) ] && (grep BACKENDS $(BCACHE) | cut -d= -f2) || echo regular.cmake) TARGETS ?= $(shell [ -f $(TCACHE) ] && (grep TARGETS $(TCACHE) | cut -d= -f2) || echo regular.cmake) LIBSDIR ?= $(shell [ -f $(LCACHE) ] && (grep LIBSDIR $(LCACHE) | cut -d= -f2) || echo lib) -EMCC ?= emcc +EMCC ?= emcc #=============================================================== ifeq ($(GENERATOR), Xcode) @@ -331,6 +331,7 @@ cmake: $(FAUSTDIR) #=============================================================== WASMFS := wasm-filesystem WASMLIBDIR := share/faust + wasmlib: $(FAUSTDIR) $(FAUSTDIR)/Makefile @$(MAKE) checkemcc mkdir -p $(WASMFS)/$(WASMLIBDIR) && cp ../libraries/*.lib ../libraries/old/*.lib $(WASMFS)/$(WASMLIBDIR) diff --git a/build/emcc/CMakeLists.txt b/build/emcc/CMakeLists.txt index 9b47a52026..4e502c7c57 100644 --- a/build/emcc/CMakeLists.txt +++ b/build/emcc/CMakeLists.txt @@ -9,6 +9,8 @@ set ( CMAKE_OSX_SYSROOT "") set ( CMAKE_CXX_COMPILER "emcc") set (CMAKE_CXX_LINK_FLAGS "") + + if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64") message (WARNING "Compiling on M1") set (CMAKE_OSX_ARCHITECTURES " ") @@ -25,9 +27,10 @@ file (GLOB BINDINGS ${ROOT}/compiler/generator/wasm/bindings/*.cpp) set (SRC ${SRC} ${BINDINGS}) set (WASM_EXPORTED "\"['UTF8ToString', 'stringToUTF8', 'FS']\"") +set (WASM_TO_INCLUDE "\"['$allocate', '$ALLOC_STACK']\"") file (GLOB LIBSNDFILE ${WASMGLUE}/*.a) -set (WASM_LINK_FLAGS "--no-heap-copy --bind -O3 --memory-init-file 0 -s LINKABLE=0 -s DYNAMIC_EXECUTION=0 -s WASM=1 -s EXPORT_NAME=\"'FaustModule'\" -s MODULARIZE=1 --preload-file ../../wasm-filesystem@usr -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=1 -s STACK_SIZE=8MB -s DISABLE_EXCEPTION_CATCHING=1 -s EXPORTED_RUNTIME_METHODS=${WASM_EXPORTED} ${LIBSNDFILE}") +set (WASM_LINK_FLAGS " --no-heap-copy --bind -O3 --memory-init-file 0 -s LINKABLE=0 -s DYNAMIC_EXECUTION=0 -s WASM=1 -s EXPORT_NAME=\"'FaustModule'\" -s MODULARIZE=1 --preload-file ../../wasm-filesystem@usr -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=1 -s STACK_SIZE=8MB -s DISABLE_EXCEPTION_CATCHING=1 -s EXPORTED_RUNTIME_METHODS=${WASM_EXPORTED} -s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=${WASM_TO_INCLUDE}") #################################### # Add the different targets @@ -44,7 +47,7 @@ target_compile_definitions (wasmlib PRIVATE -DEMCC -DFAUST_LIB ${FAUST_DEFINITIO set_target_properties (wasmlib PROPERTIES OUTPUT_NAME libfaust-wasm LINK_FLAGS ${WASM_LINK_FLAGS} - COMPILE_FLAGS -O3 + COMPILE_FLAGS "-O3 -std=c++20" # RUNTIME_OUTPUT_DIRECTORY ${LIBDIR} generation in a non default place prevents the data file to be found SUFFIX ".js") diff --git a/build/wasmglue/CMakeLists.txt b/build/wasmglue/CMakeLists.txt index f6dcdc37e3..3837f6abcd 100644 --- a/build/wasmglue/CMakeLists.txt +++ b/build/wasmglue/CMakeLists.txt @@ -22,12 +22,12 @@ endif() if (WORKLET) message(STATUS "Compile wasm glue library for worklet") -set (WASM_COMPILE_FLAGS "-O3 -DAUDIO_WORKLET") +set (WASM_COMPILE_FLAGS "-std=c++20 -O3 -DAUDIO_WORKLET ") set (WASM_LINK_FLAGS_EXTRA "-s WASM_ASYNC_COMPILATION=0 -s SINGLE_FILE=1 -s ASSERTIONS=0") set (LIB_NAME "libfaust-worklet-glue") else() message(STATUS "Compile wasm glue library") -set (WASM_COMPILE_FLAGS "-O3") +set (WASM_COMPILE_FLAGS "-O3 -std=c++20") set (WASM_LINK_FLAGS_EXTRA "-s ASSERTIONS=1") set (LIB_NAME "libfaust-glue") endif() @@ -53,7 +53,7 @@ set (FAUST_INC ${SRCDIR} # emscripten support set (WASM_EXPORTED "\"['FS']\"") set (LIBSNDFILE "${ROOT}/build/wasmglue/libsndfile.a ${ROOT}/build/wasmglue/libogg.a ${ROOT}/build/wasmglue/libvorbis.a ${ROOT}/build/wasmglue/libvorbisenc.a ${ROOT}/build/wasmglue/libFLAC.a") -set (WASM_LINK_FLAGS "--bind --memory-init-file 0 -s LINKABLE=0 -s DYNAMIC_EXECUTION=0 -s WASM=1 -s EXPORT_NAME=\"'FaustModule'\" -s MODULARIZE=1 -s ASSERTIONS=0 -s ALLOW_MEMORY_GROWTH=1 -s STACK_SIZE=5MB -s DISABLE_EXCEPTION_CATCHING=1 -s EXPORTED_RUNTIME_METHODS=${WASM_EXPORTED} ${LIBSNDFILE} ${WASM_LINK_FLAGS_EXTRA}") +set (WASM_LINK_FLAGS "--bind --memory-init-file 0 -s LINKABLE=0 -s DYNAMIC_EXECUTION=0 -s WASM=1 -s EXPORT_NAME=\"'FaustModule'\" -s STACK_SIZE=8MB -s MODULARIZE=1 -s ASSERTIONS=0 -s ALLOW_MEMORY_GROWTH=1 -s DISABLE_EXCEPTION_CATCHING=1 -s EXPORTED_RUNTIME_METHODS=${WASM_EXPORTED} ${LIBSNDFILE} ${WASM_LINK_FLAGS_EXTRA}") #################################### # Add the different targets diff --git a/compiler/boxes/boxes.cpp b/compiler/boxes/boxes.cpp index 08b86245ed..5ef9361190 100644 --- a/compiler/boxes/boxes.cpp +++ b/compiler/boxes/boxes.cpp @@ -579,6 +579,7 @@ Tree importFile(Tree filename) { return tree(gGlobal->IMPORTFILE, filename); } + bool isImportFile(Tree s, Tree& filename) { return isTree(s, gGlobal->IMPORTFILE, filename); diff --git a/compiler/global.cpp b/compiler/global.cpp index b4fba0f575..6d81edc2c7 100644 --- a/compiler/global.cpp +++ b/compiler/global.cpp @@ -463,6 +463,7 @@ void global::reset() gFixedPointLSB = 0; gPrintFileListSwitch = false; + gPkgOnlySwitch = false; gInlineArchSwitch = false; gDSPStruct = false; @@ -1154,7 +1155,7 @@ bool global::processCmdline(int argc, const char* argv[]) } else if (isCmd(argv[i], "-lang", "--language") && (i + 1 < argc)) { gOutputLang = argv[i + 1]; i += 2; - + } else if (isCmd(argv[i], "-v", "--version")) { gVersionSwitch = true; i += 1; @@ -1437,11 +1438,15 @@ bool global::processCmdline(int argc, const char* argv[]) } else if (isCmd(argv[i], "-flist", "--file-list")) { gPrintFileListSwitch = true; i += 1; - + } else if (isCmd(argv[i], "-plist", "--package-list")){ + gPrintPackageListSwitch = true; + i += 1; + } else if(isCmd(argv[i], "-po", "--pkg-only")){ + gPkgOnlySwitch = true; + i += 1; } else if (isCmd(argv[i], "-norm", "--normalized-form")) { gDumpNorm = 0; i += 1; - } else if (isCmd(argv[i], "-norm1", "--normalized-form1")) { gDumpNorm = 1; i += 1; @@ -1944,6 +1949,7 @@ void global::parseSourceFiles() if (!gInjectFlag && gInputFiles.begin() == gInputFiles.end()) { throw faustexception("ERROR : no files specified; for help type \"faust --help\"\n"); } + for (s = gInputFiles.begin(); s != gInputFiles.end(); s++) { if (s == gInputFiles.begin()) { gMasterDocument = *s; @@ -2416,6 +2422,15 @@ string global::printHelp() << "-flist --file-list print file list (including libraries) used to " "eval process." << endl; + sstr << tab + << "-plist --package-list print packages list handled by pkgManager module used " + "to eval process." + << endl; + + sstr << tab + << "-po --pkg-only Only compiles if the dsp code depends on faust packages" + << endl; + sstr << tab << "-tg --task-graph print the internal task graph in dot format." << endl; diff --git a/compiler/global.hh b/compiler/global.hh index 8b8480bdd6..c44cf11d82 100644 --- a/compiler/global.hh +++ b/compiler/global.hh @@ -136,6 +136,10 @@ struct global { bool gSimpleNames; // -sn option bool gSimplifyDiagrams; // -sd option bool gPrintFileListSwitch; // -flist option + + bool gPrintPackageListSwitch; // -plist option + bool gPkgOnlySwitch; // --pkg-only option + bool gInlineArchSwitch; // -i option bool gUIMacroSwitch; // -uim option int gDumpNorm; // -norm option diff --git a/compiler/libcode.cpp b/compiler/libcode.cpp index 64608ab066..0f39de37b2 100644 --- a/compiler/libcode.cpp +++ b/compiler/libcode.cpp @@ -308,6 +308,22 @@ static Tree evaluateBlockDiagram(Tree expandedDefList, int& numInputs, int& numO endTiming("evaluation"); + if (gGlobal->gPrintPackageListSwitch){ + cout << "---------------------------\n"; + cout << "List of Package Dependencies :\n"; + cout << "---------------------------\n"; + + // print the package used to evaluate process + vector packages = gGlobal->gReader.listPackages(); + + for (size_t i = 0; i < packages.size(); i++) { + cout << packages[i] << endl; + } + + cout << "---------------------------\n"; + cout << endl; + } + if (gGlobal->gPrintFileListSwitch) { cout << "---------------------------\n"; cout << "List of file dependencies :\n"; diff --git a/compiler/parser/Downloader.cpp b/compiler/parser/Downloader.cpp new file mode 100644 index 0000000000..1ebed43429 --- /dev/null +++ b/compiler/parser/Downloader.cpp @@ -0,0 +1,189 @@ +#include "Downloader.hh" +#include "../errors/exception.hh" +#include +#include +#include +#include +#include + + + + + +#ifndef EMCC +#include + +size_t Downloader::write_data_file(void* ptr, size_t size, size_t nmemb, void* userData) { + + std::ofstream* file = static_cast(userData); + + if (!file->is_open()) { + throw faustexception("Internal Error: Couldn't Download Package"); + } + + file->write(static_cast(ptr), size * nmemb); + + return size * nmemb; +} + +size_t Downloader::write_data(void* ptr, size_t size, size_t nmemb, void* userData) { + + std::string* data = static_cast(userData); + data->append(static_cast(ptr), size * nmemb); + + return size * nmemb; +} + + + +void Downloader::download(const std::string url,const std::string& savePath) +{ + + std::ofstream file(savePath, std::ios::binary); + + if (!file.is_open()) { + throw faustexception("Can't open file: " + savePath); + } + + curl_easy_setopt(handle, CURLOPT_URL, url.c_str()); + curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, &Downloader::write_data_file); + curl_easy_setopt(handle, CURLOPT_WRITEDATA, &file); + + CURLcode res = curl_easy_perform(handle); + file.close(); + + if (res != CURLE_OK) { + std::filesystem::remove(savePath); + throw faustexception("Download failed: " + std::string(curl_easy_strerror(res)) + "\n"); + } + + long http_code = 0; + curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, &http_code); + + if (std::to_string(http_code)[0] != '2'){ + std::filesystem::remove(savePath); + throw faustexception("Unsuccessful download: HTTP code " + std::to_string(http_code) + "\n"); + } +} + +void Downloader::download(const std::string url,char** buffer) +{ + std::string data; + curl_easy_setopt(handle, CURLOPT_URL, url.c_str()); + curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, &Downloader::write_data); + curl_easy_setopt(handle, CURLOPT_WRITEDATA, &data); + + CURLcode res = curl_easy_perform(handle); + + if (res != CURLE_OK) { + throw faustexception("Download failed: " + std::string(curl_easy_strerror(res)) + "\n"); + } + + long http_code = 0; + curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, &http_code); + + if (std::to_string(http_code)[0] != '2'){ + throw faustexception("Unsuccessful download: HTTP code " + std::to_string(http_code) + "\n"); + } + + *buffer = new char[data.size() + 1]; + std::copy(data.begin(), data.end(), *buffer); + (*buffer)[data.size()] = '\0'; +} + +Downloader::Downloader(){ + curl_global_init(CURL_GLOBAL_DEFAULT); + handle = curl_easy_init(); +} + +Downloader::~Downloader(){ + curl_easy_cleanup(handle); + curl_global_cleanup(); +} + + +#endif + +#ifdef EMCC + +#include + +Downloader::Downloader(){ +} + +Downloader::~Downloader(){ +} + + + +EM_JS(char*, downloadFile, (const char* url), { + var dsp_code = ""; + + try { + if (typeof window !== 'undefined' && typeof window.XMLHttpRequest !== 'undefined') { + var xhr = new window.XMLHttpRequest(); + xhr.open('GET', UTF8ToString(url), false); + xhr.send(null); + + if (xhr.status >= 200 && xhr.status < 300) { + dsp_code = xhr.responseText; + } + } else if (typeof process != 'undefined' && process.versions != null && process.versions.node != null) { + var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; + var xhr = new XMLHttpRequest(); + xhr.open('GET', UTF8ToString(url), false); + xhr.send(null); + if (xhr.status >= 200 && xhr.status < 300) { + dsp_code = xhr.responseText; + } + } + } catch (error) { + console.log('Error:', error); + } + + return allocate(intArrayFromString(dsp_code), ALLOC_STACK); +}); + + + + + +void Downloader::download(const std::string url,const std::string& savePath){ + + std::ofstream file(savePath, std::ios::binary); + + if (!file.is_open()) { + throw faustexception("Can't open file: " + savePath); + } + + char* buffer = (char*) downloadFile(url.c_str()); + + if(strlen(buffer) == 0){ + std::filesystem::remove(savePath); + throw faustexception("Couldn't download file: " + url); + } + + try{ + file << buffer; + file.close(); + }catch(const std::exception& e){ + std::filesystem::remove(savePath); + throw faustexception("Couldn't download file: " + url); + } +} + + +void Downloader::download(const std::string url,char** buffer){ + + *buffer = (char*) downloadFile(url.c_str()); + + if(strlen(*buffer) == 0){ + std::stringstream error; + error << "ERROR : unable to access URL '" << url << "'" << std::endl; + throw faustexception(error.str()); + } +} +#endif + + + diff --git a/compiler/parser/Downloader.hh b/compiler/parser/Downloader.hh new file mode 100644 index 0000000000..5f825cd77f --- /dev/null +++ b/compiler/parser/Downloader.hh @@ -0,0 +1,28 @@ +#pragma once +#include + +#ifndef EMCC +#include +#endif + +class Downloader{ + +private: + +#ifndef EMCC + CURL* handle; + + static size_t write_data_file(void* ptr, size_t size, size_t nmemb, void* userData); + + static size_t write_data(void* ptr, size_t size, size_t nmemb, void* userData); +#endif + +public: + Downloader(); + + void download(const std::string url,const std::string& savePath); + + void download(const std::string url,char** buffer); + + ~Downloader(); +}; \ No newline at end of file diff --git a/compiler/parser/PackageManager.cpp b/compiler/parser/PackageManager.cpp new file mode 100644 index 0000000000..ab553e1f56 --- /dev/null +++ b/compiler/parser/PackageManager.cpp @@ -0,0 +1,139 @@ +#include "PackageManager.hh" +#include +#include +#include +#include "PkgUrl.hh" +#include "Downloader.hh" +#include "../errors/exception.hh" +#include "../utils/url.hpp" + + +namespace fs = std::filesystem; + +#ifdef _WIN32 +#include +#define setenv(name, value, overwrite) _putenv_s(name, value) +#endif + +// Define default registry paths based on the operating system +#if defined(_WIN32) || defined(_WIN64) + #define DEFAULT_REGISTRY_PATH (std::filesystem::path(std::getenv("APPDATA")) / "Faust" / "Registry") + #define DEFAULT_HOME_PATH (std::filesystem::path(std::getenv("USERPROFILE"))) +#elif defined(__APPLE__) && defined(__MACH__) + #define DEFAULT_REGISTRY_PATH (std::filesystem::path(std::getenv("HOME")) / "Library" / "Faust" / "Registry") +#else + #define DEFAULT_REGISTRY_PATH (std::filesystem::path(std::getenv("HOME")) / ".faust" / "Registry") +#endif + + +#define DEFAULT_REGISTRY_URL "https://github.com/shehab299/Registry" +#define DEFAULT_BRANCH "main"; + + +PackageManager::PackageManager(){ + config(); +} + +std::string PackageManager::registryUrlTransform(std::string& url){ + + Url u(url); + + try + { + if(u.host() == "github.com"){ + u.scheme("https"); + u.host("raw.githubusercontent.com"); + u.path(u.path() + "/" + this->branch); + } + } + catch(const std::exception& e) + { + throw faustexception("The Registry Url Provided Is Not Valid"); + } + + return u.str(); +} + + +void PackageManager::config() +{ + char* registryPath = getenv("FAUST_REGISTRY_PATH"); + char* registryUrl = getenv("FAUST_REGISTRY_URL"); + char* branch = getenv("FAUST_REGISTRY_BRANCH"); + + if(!registryPath) + { + this->registryPath = DEFAULT_REGISTRY_PATH; + setenv("FAUST_REGISTRY_PATH", this->registryPath.c_str(), 1); + } + else + { + this->registryPath = fs::path(registryPath); + } + + if(!registryUrl) + { + this->registryUrl = DEFAULT_REGISTRY_URL; + setenv("FAUST_REGISTRY_URL", this->registryUrl.c_str(), 1); + } + else + { + this->registryUrl = registryUrl; + } + + if(!branch) + { + this->branch = DEFAULT_BRANCH; + setenv("FAUST_REGISTRY_BRANCH", this->branch.c_str(), 1); + } + else + { + this->branch = branch; + } + +} + + +void PackageManager::install(std::string url, char** buffer){ + downloader.download(url,buffer); +} + +std::string PackageManager::install(std::string pkgUrl){ + + PkgUrl pkg(pkgUrl); + + fs::path path; + fs::path pkgPath = path = this->registryPath / pkg.getPath(); + std::string remoteUrl = registryUrlTransform(this->registryUrl) + "/" + pkg.getPath(); + + if(fs::exists(pkgPath)){ + return pkgPath.string(); + } + + fs::create_directories(pkgPath.parent_path()); + + try{ + downloader.download(remoteUrl, pkgPath.string()); + } + catch(const faustexception& e){ + + std::cerr << "Couldn't download library " + << pkg.getLibraryName() + << " of version " + << pkg.getVersion() + << " by author " + << pkg.getAuthor() + << std::endl; + + pkgPath = pkgPath.parent_path(); + + while(fs::is_empty(pkgPath) && fs::exists(pkgPath)){ + fs::remove(pkgPath); + pkgPath = pkgPath.parent_path(); + } + + throw e; + } + + return path.string(); +} diff --git a/compiler/parser/PackageManager.hh b/compiler/parser/PackageManager.hh new file mode 100644 index 0000000000..21ad2a6352 --- /dev/null +++ b/compiler/parser/PackageManager.hh @@ -0,0 +1,27 @@ +#pragma once + +#include +#include + +namespace fs = std::filesystem; + +class PackageManager{ + +private: + fs::path registryPath; + std::string registryUrl; + std::string branch; + Downloader downloader; + + void config(); + + std::string registryUrlTransform(std::string& url); + +public: + PackageManager(); + + void install(std::string url, char** buffer); + + std::string install(std::string pkgUrl); + +}; \ No newline at end of file diff --git a/compiler/parser/PkgUrl.cpp b/compiler/parser/PkgUrl.cpp new file mode 100644 index 0000000000..63f7503a75 --- /dev/null +++ b/compiler/parser/PkgUrl.cpp @@ -0,0 +1,66 @@ +#include "PkgUrl.hh" +#include +#include "../errors/exception.hh" + +PkgUrl::PkgUrl(std::string url) +{ + parse(url); +} + +void PkgUrl::parse(std::string url) +{ + + using namespace std::regex_constants; + + std::regex pattern("^pkg:faust(?:/([_a-zA-Z]\\w*))?/([_a-zA-Z]\\w*.lib)@((?:\\d+)(?:\\.(?:\\d+)(?:\\.(?:\\d+))?)?)$", icase | ECMAScript); + + std::smatch locater_parts; + + if(!std::regex_search(url,locater_parts,pattern)) + throw faustexception("Package URL Not Is Valid"); + + this->author = locater_parts[1].str(); + this->libName = locater_parts[2].str(); + this->version = locater_parts[3].str(); +} + +std::string PkgUrl::getAuthor() const{ + return this->author; +} + + +bool PkgUrl::isPKgUrl(std::string url) +{ + using namespace std::regex_constants; + + std::regex pattern("^pkg:faust(?:/([_a-zA-Z]\\w*))?/([_a-zA-Z]\\w*.lib)@((?:\\d+)(?:\\.(?:\\d+)(?:\\.(?:\\d+))?)?)$", icase | ECMAScript); + + return std::regex_search(url,pattern); +} + + + + +std::string PkgUrl::getLibraryName() const{ + return this->libName; +} + + +std::string PkgUrl::getVersion() const { + return this->version; +} + +std::string PkgUrl::getPath() const { + + std::string path = ""; + + if(!author.empty()){ + path += author + "/"; + } + + path += libName + "/"; + path += version + "/"; + path += libName; + + return path; +} \ No newline at end of file diff --git a/compiler/parser/PkgUrl.hh b/compiler/parser/PkgUrl.hh new file mode 100644 index 0000000000..e160537c37 --- /dev/null +++ b/compiler/parser/PkgUrl.hh @@ -0,0 +1,23 @@ +#pragma once + +#include + +class PkgUrl +{ +private: + std::string version; + std::string author; + std::string libName; + + void parse(std::string); +public: + + PkgUrl(std::string); + + std::string getVersion() const; + std::string getAuthor() const; + std::string getLibraryName() const; + std::string getPath() const; + + static bool isPKgUrl(std::string); +}; \ No newline at end of file diff --git a/compiler/parser/sourcereader.cpp b/compiler/parser/sourcereader.cpp index aaa3a93f81..89d8209813 100644 --- a/compiler/parser/sourcereader.cpp +++ b/compiler/parser/sourcereader.cpp @@ -47,6 +47,9 @@ #include "exception.hh" #include "global.hh" #include "Text.hh" +#include "PkgUrl.hh" + + using namespace std; @@ -59,6 +62,7 @@ int FAUSTlex_destroy(void); void FAUSTrestart(FILE* new_file); struct yy_buffer_state* FAUST_scan_string(const char* yy_str); // In principle YY_BUFFER_STATE +bool isPkg; int FAUSTerr; extern int FAUSTdebug; extern FILE* FAUSTin; @@ -194,6 +198,14 @@ static Tree addFunctionMetadata(Tree ldef, FunMDSet& M) void SourceReader::checkName() { + + if(!isPkg && gGlobal->gMasterDocument != FAUSTfilename && gGlobal->gPkgOnlySwitch ){ + stringstream error; + error << "ERROR : [file " << FAUSTfilename << " : " << FAUSTlineno << "] : package only mode is enabled, but the dependency is not a package" << endl; + throw faustexception(error.str()); + } + + if (gGlobal->gMasterDocument == FAUSTfilename) { Tree name = tree("name"); if (gGlobal->gMetaDataSet.find(name) == gGlobal->gMetaDataSet.end()) { @@ -214,86 +226,47 @@ void SourceReader::checkName() inline bool isURL(const char* name) { return (strstr(name, "http://") != 0) || (strstr(name, "https://") != 0); } inline bool isFILE(const char* name) { return strstr(name, "file://") != 0; } -Tree SourceReader::parseFile(const char* fname) +Tree SourceReader::parseFile(const char* pkgLoc) { FAUSTerr = 0; FAUSTlineno = 1; - FAUSTfilename = fname; - - // We are requested to parse an URL file - if (isURL(FAUSTfilename)) { + FAUSTfilename = pkgLoc; + string fileName; + isPkg = false; + + if(isURL(FAUSTfilename)) + { char* buffer = nullptr; - #ifdef EMCC - // Call JS code to load URL - buffer = (char*)EM_ASM_INT({ - var dsp_code = ""; - try { - var xmlhttp = new XMLHttpRequest(); - xmlhttp.open("GET", Module.UTF8ToString($0), false); - xmlhttp.send(); - if (xmlhttp.status == 200) { - dsp_code = xmlhttp.responseText; - } - } catch(e) { - console.log(e); - } - return allocate(intArrayFromString(dsp_code), 'i8', ALLOC_STACK); - }, FAUSTfilename); - - Tree res = nullptr; - if (strlen(buffer) == 0) { - stringstream error; - error << "ERROR : unable to access URL '" << fname << "'" << endl; - throw faustexception(error.str()); - } else { - FAUST_scan_string(buffer); - res = parseLocal(FAUSTfilename); - } - #else - // Otherwise use http URL fetch code - if (http_fetch(FAUSTfilename, &buffer) == -1) { - stringstream error; - error << "ERROR : unable to access URL '" << fname << "' : " << http_strerror() << endl; - throw faustexception(error.str()); - } + pm.install(string(FAUSTfilename), &buffer); FAUST_scan_string(buffer); Tree res = parseLocal(FAUSTfilename); - // 'http_fetch' result must be deallocated free(buffer); - #endif return res; + } + else if(PkgUrl::isPKgUrl(FAUSTfilename)) + { + fileName = pm.install(std::string(FAUSTfilename)); + pPackageLists.push_back(FAUSTfilename); + FAUSTfilename = fileName.c_str(); + isPkg = true; + } + else if(isFILE(FAUSTfilename)) + { + FAUSTfilename = &FAUSTfilename[7]; // skip 'file://' + } - } else { - // Test for local url - if (isFILE(FAUSTfilename)) { - FAUSTfilename = &FAUSTfilename[7]; // skip 'file://' - } + string fullpath1; + FILE* tmp_file = FAUSTin = fopenSearch(FAUSTfilename, fullpath1); - // Try to open local file - string fullpath1; - FILE* tmp_file = FAUSTin = fopenSearch(FAUSTfilename, fullpath1); // Keep file to properly close it - if (FAUSTin) { - Tree res = parseLocal(fullpath1.c_str()); - fclose(tmp_file); - return res; - } else { - #ifdef EMCC - // Try to open with the complete URL - Tree res = nullptr; - for (size_t i = 0; i < gGlobal->gImportDirList.size(); i++) { - if (isURL(gGlobal->gImportDirList[i].c_str())) { - // Keep the created filename in the global state, so that the 'FAUSTfilename' - // global variable always points to a valid string - gGlobal->gImportFilename = gGlobal->gImportDirList[i] + fname; - if ((res = parseFile(gGlobal->gImportFilename.c_str()))) return res; - } - } - #endif - stringstream error; - error << "ERROR : unable to open file " << FAUSTfilename << endl; - throw faustexception(error.str()); - } + if (FAUSTin) { + Tree res = parseLocal(fullpath1.c_str()); + fclose(tmp_file); + return res; + }else{ + stringstream error; + error << "ERROR : unable to open file " << FAUSTfilename << endl; + throw faustexception(error.str()); } } @@ -373,6 +346,7 @@ vector SourceReader::listSrcFiles() return fFilePathnames; } + /** * Return a vector of pathnames representing the list * of all the source files that have been required @@ -386,6 +360,17 @@ vector SourceReader::listLibraryFiles() return tmp; } +/** + * Return a vector of pathnames representing the list + * of all the packages that have been required + * to evaluate process + */ + +vector SourceReader::listPackages(){ + return pPackageLists; +} + + /** * Return the list of definitions where all imports have been expanded. * @@ -522,3 +507,6 @@ void declareDoc(Tree t) { gGlobal->gDocVector.push_back(t); } + + + diff --git a/compiler/parser/sourcereader.hh b/compiler/parser/sourcereader.hh index 12bea355d2..f8693157a0 100644 --- a/compiler/parser/sourcereader.hh +++ b/compiler/parser/sourcereader.hh @@ -27,6 +27,8 @@ #include #include +#include "PackageManager.hh" + Tree formatDefinitions(Tree rldef); Tree checkRulelist (Tree lrules); void declareMetadata(Tree key, Tree value); @@ -43,13 +45,16 @@ class SourceReader std::map fFileCache; std::vector fFilePathnames; - + std::vector pPackageLists; + PackageManager pm; + Tree parseLocal(const char* fname); Tree expandRec(Tree ldef, std::set& visited, Tree lresult); bool cached(std::string fname); Tree parseFile(const char* fname); Tree parseString(const char* fname); void checkName(); + void checkDependency(); public: @@ -62,6 +67,7 @@ class SourceReader Tree expandList(Tree ldef); std::vector listSrcFiles(); std::vector listLibraryFiles(); + std::vector listPackages(); }; diff --git a/compiler/utils/url.cpp b/compiler/utils/url.cpp new file mode 100644 index 0000000000..be9e8e531e --- /dev/null +++ b/compiler/utils/url.cpp @@ -0,0 +1,955 @@ +// The MIT License (MIT) + +// Copyright (c) 2015 Christophe Meessen + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + + + + +#include "url.hpp" +//#include +#include +#include +#include +#include +#include +#include + + + + +namespace { + +static const uint8_t tbl[256] = { + 0,0,0,0, 0,0,0,0, // NUL SOH STX ETX EOT ENQ ACK BEL + 0,0,0,0, 0,0,0,0, // BS HT LF VT FF CR SO SI + 0,0,0,0, 0,0,0,0, // DLE DC1 DC2 DC3 DC4 NAK SYN ETB + 0,0,0,0, 0,0,0,0, // CAN EM SUB ESC FS GS RS US + 0x00,0x01,0x00,0x00, 0x01,0x20,0x01,0x01, // SP ! " # $ % & ' + 0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x08, // ( ) * + , - . / + 0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01, // 0 1 2 3 4 5 6 7 + 0x01,0x01,0x04,0x01, 0x00,0x01,0x00,0x10, // 8 9 : ; < = > ? + 0x02,0x01,0x01,0x01, 0x01,0x01,0x01,0x01, // @ A B C D E F G + 0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01, // H I J K L M N O + 0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01, // P Q R S T U V W + 0x01,0x01,0x01,0x00, 0x00,0x00,0x00,0x01, // X Y Z [ \ ] ^ _ + 0x00,0x01,0x01,0x01, 0x01,0x01,0x01,0x01, // ` a b c d e f g + 0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01, // h i j k l m n o + 0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01, // p q r s t u v w + 0x01,0x01,0x01,0x00, 0x00,0x00,0x01,0x00, // x y z { | } ~ DEL + 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0 +}; + + +inline bool is_char(char c, std::uint8_t mask) { + return (tbl[static_cast(c)]&mask) != 0; +} + + +inline bool is_chars(const char* s, const char* e, std::uint8_t mask) { + while(s!=e) + if (!is_char(*s++,mask)) + return false; + return true; +} + + +inline bool is_alpha(char c) { + return (c>='A'&&c<='Z')||(c>='a'&&c<='z'); +} + + +inline bool is_num(char c) { + return c>='0'&&c<='9'; +} + + +inline bool is_alnum(char c) { + return is_alpha(c)||is_num(c); +} + + +inline bool is_hexdigit(char c) { + return is_num(c)||(c>='A'&&c<='F')||(c>='a'&&c<='f'); +} + + +inline bool is_uint(const char *&s, const char *e, uint32_t max) { + if (s==e || !is_num(*s)) + return false; + const char *t=s; + uint32_t val = *t++-'0'; + if (val) + while(t!=e && is_num(*t)) + val=val*10+(*t++-'0'); + if (val>max) + return false; + s=t; + return true; +} + + +inline char get_hex_digit(char c) { + if (c>='0'&&c<='9') + return c-'0'; + if (c>='A'&&c<='F') + return c-'A'+10; + if (c>='a'&&c<='f') + return c-'a'+10; + return -1; +} + + +inline void to_lower(std::string& s) { + for(auto& c : s) + if (c>='A' && c<='Z') + c |= 0x20; +} + + +inline const char* find_first_of(const char *s, const char *e, const char *q) { + for(; s!=e; ++s) + for(const char *t=q; *t; ++t) + if (*s==*t) + return s; + return e; +} + + +inline const char* find_char(const char *s, const char *e, const char c) { + while (s!=e && *s!=c) + ++s; + return s; +} + + +inline bool is_scheme(const char *s, const char *e) +{ + if (!s||!e||s==e||!is_alpha(*s)) + return false; + char c; + while(++s!=e) + if (!is_alnum(c=*s)&&c!='+'&&c!='-'&&c!='.') + return false; + return true; +} + + +inline bool is_scheme(const std::string &s) { + return is_scheme(s.data(),s.data()+s.length()); +} + + +std::string normalize_scheme(const char *b, const char *e) { + std::string o(b,e-b); + to_lower(o); + return o; +} + + +inline bool is_ipv4(const char *s, const char *e) { + size_t l=e-s; + if (l<7 || l>254) + return false; + for (const char *p=s; p!=e; ++p) + if (*p!='.'&&!is_num(*p)) + return false; + return true; +} + + +inline bool is_ipv4(const std::string &s) { + return is_ipv4(s.data(),s.data()+s.length()); +} + + +inline bool is_valid_ipv4(const char *s, const char *e) { + return is_uint(s,e,255) && s!=e && *s++=='.' && + is_uint(s,e,255) && s!=e && *s++=='.' && + is_uint(s,e,255) && s!=e && *s++=='.' && + is_uint(s,e,255) && s==e; +} + + +inline bool is_valid_ipv4(const std::string &s) { + return is_valid_ipv4(s.data(),s.data()+s.length()); +} + + +inline bool is_reg_name(const char *s, const char *e) { + return is_chars(s, e, 0x01); +} + + +inline bool is_reg_name(const std::string &s) { + return is_reg_name(s.data(),s.data()+s.length()); +} + + +std::string normalize_reg_name(const std::string& s) { + std::string o(s); + to_lower(o); // see rfc 4343 + return o; +} + + +bool is_ipv6(const char *s, const char *e) { + size_t l=e-s; + if (l<2 || l>254) + return false; + for (const char *p=s; p!=e; ++p) + if (*p!=':'&&*p!='.'&&!is_hexdigit(*p)) + return false; + return true; +} + + +inline bool is_ipv6(const std::string &s) { + return is_ipv6(s.data(),s.data()+s.length()); +} + + +bool is_valid_ipv6(const char *s, const char *e) { + if ((e-s)>39||(e-s)<2) + return false; + bool null_field=false; + const char *b=s, *p=s; + int nfields=0, ndigits=0; + if (p[0]==':') { + if (p[1]!=':') + return false; + null_field=true; + b=(p+=2); + if (p==e) + return true; + } + while(p!=e) { + if (*p=='.') { + return ((!null_field&&nfields==6)||(null_field&&nfields<7))&&is_valid_ipv4(b, e); + } else if (*p==':') { + if (ndigits==0) { + if (null_field) + return false; + null_field=true; + } else { + ++nfields; + ndigits=0; + } + b=++p; + } else { + if ((++ndigits>4) || !is_hexdigit(*p++)) + return false; + } + } + if (ndigits>0) + ++nfields; + else { + if (e[-1]==':') { + if (e[-2]==':' && nfields<8) + return true; + return false; + } + } + return (!null_field&&nfields==8)||(null_field&&nfields<8); +} + + +inline bool is_valid_ipv6(const std::string &s) { + return is_valid_ipv6(s.data(),s.data()+s.length()); +} + + +std::string normalize_IPv6(const char *s, const char *e) { + if (!is_ipv6(s, e)) + throw Url::parse_error("IPv6 ["+std::string(s,e-s)+"] is invalid"); + if ((e-s)==2 && s[0]==':' && s[1]==':') + return std::string(s,e-s); + + // Split IPv6 at colons + const size_t token_size = 10; + const char *p=s, *tokens[token_size]; + if (*p==':') + ++p; + if (e[-1]==':') + --e; + const char *b=p; + size_t i=0; + while (p!=e) { + if (*p++==':') { + if (i+1 >= token_size) { + throw Url::parse_error("IPv6 ["+std::string(s,e-s)+"] is invalid"); + } + tokens[i++]=b; + b=p; + } + } + if (i<8) + tokens[i++]=b; + tokens[i]=p; + size_t ntokens=i; + + // Get IPv4 address which is normalized by default + const char *ipv4_b=nullptr, *ipv4_e=nullptr; + if ((tokens[ntokens]-tokens[ntokens-1])>5) { + ipv4_b=tokens[ntokens-1]; + ipv4_e=tokens[ntokens]; + --ntokens; + } + + // Decode the fields + const size_t fields_size = 8; + std::uint16_t fields[fields_size]; + size_t null_pos=8, null_len=0, nfields=0; + for(size_t i=0; i= fields_size) { + throw Url::parse_error("IPv6 ["+std::string(s,e-s)+"] is invalid"); + } + std::uint16_t field=get_hex_digit(*p++); + while (p!=tokens[i+1] && *p!=':') + field=(field<<4)|get_hex_digit(*p++); + fields[nfields++]=field; + } + } + i = nfields; + nfields=(ipv4_b)?6:8; + if (inull_len) { + null_pos=first; + null_len=i-first; + } + if (i==nfields) + break; + } + if (null_len==1) { + null_pos=nfields; + null_len=1; + } + + // Encode normalized IPv6 + std::stringstream str; + if (null_pos==0) { + str << std::hex << ':'; + i=null_len; + } else { + str << std::hex << fields[0]; + for (i=1; i elems; + std::stringstream si(s); + + while(!std::getline(si, elem, '/').eof()){ + if (elem=="" || elem==".") + continue; + if (elem=="..") { + if (!elems.empty()) + elems.pop_back(); + continue; + } + elems.push_back(elem); + } + if (elem==".") + elems.push_back(""); + else if (elem=="..") { + if (!elems.empty()) + elems.pop_back(); + } + else + elems.push_back(elem); + + std::stringstream so; + if (s[0]=='/') + so << '/'; + if (!elems.empty()) { + auto it=elems.begin(), end=elems.end(); + so << *it; + while(++it!=end) + so << '/' << *it; + } + return so.str(); +} + + +std::string decode(const char *s, const char *e) { + std::string o; + o.reserve(e-s); + while(s!=e) { + char c=*s++, a, b; + if (c=='%') { + if (s==e || (a=get_hex_digit(*s++))<0 || s==e || (b=get_hex_digit(*s++))<0) + throw Url::parse_error("Invalid percent encoding"); + c=(a<<4)|b; + } + o.push_back(c); + } + return o; +} + + +std::string decode_plus(const char *s, const char *e) { + std::string o; + o.reserve(e-s); + while(s!=e) { + char c=*s++, a, b; + if (c=='+') + c=' '; + else if (c=='%') { + if (s==e || (a=get_hex_digit(*s++))<0 || s==e || (b=get_hex_digit(*s++))<0) + throw Url::parse_error("Invalid percent encoding"); + c=(a<<4)|b; + } + o.push_back(c); + } + return o; +} + + +class encode { + public: + encode(const std::string& s, std::uint8_t mask) : m_s(s), m_mask(mask) {} + private: + const std::string& m_s; + std::uint8_t m_mask; + friend std::ostream& operator<< (std::ostream& o, const encode& e) { + for (const char c:e.m_s) + if (is_char(c,e.m_mask)) + o<>4]<<"0123456789ABCDEF"[((uint8_t)c)&0xF]; + return o; + } +}; + + +class encode_query_key { + public: + encode_query_key(const std::string& s, std::uint8_t mask) : m_s(s), m_mask(mask) {} + private: + const std::string& m_s; + std::uint8_t m_mask; + friend std::ostream& operator<< (std::ostream& o, const encode_query_key& e) { + for (const char c:e.m_s) + if (c==' ') + o<<'+'; + else if (c=='+') + o<<"%2B"; + else if (c=='=') + o<<"%3D"; + else if (c=='&') + o<<"%26"; + else if (c==';') + o<<"%3B"; + else if (is_char(c,e.m_mask)) + o<>4]<<"0123456789ABCDEF"[((uint8_t)c)&0xF]; + return o; + } +}; + + +class encode_query_val { + public: + encode_query_val(const std::string& s, std::uint8_t mask) : m_s(s), m_mask(mask) {} + private: + const std::string& m_s; + std::uint8_t m_mask; + friend std::ostream& operator<< (std::ostream& o, const encode_query_val& e) { + for (const char c:e.m_s) + if (c==' ') + o<<'+'; + else if (c=='+') + o<<"%2B"; + else if (c=='&') + o<<"%26"; + else if (c==';') + o<<"%3B"; + else if (is_char(c,e.m_mask)) + o<>4]<<"0123456789ABCDEF"[((uint8_t)c)&0xF]; + return o; + } +}; + + + +} // end of anonymous namnespace +// --------------------------------------------------------------------- + + +// Copy assignment +void Url::assign(const Url &url) { + m_parse=url.m_parse; + m_built=url.m_built; + if (m_parse) { + m_scheme=url.m_scheme; + m_user=url.m_user; + m_host=url.m_host; + m_ip_v=url.m_ip_v; + m_port=url.m_port; + m_path=url.m_path; + m_query=url.m_query; + m_fragment=url.m_fragment; + } + if (!m_parse || m_built) + m_url=url.m_url; +} + + +// Move assignment +void Url::assign(Url&& url) { + m_parse=url.m_parse; + m_built=url.m_built; + if (m_parse) { + m_scheme=std::move(url.m_scheme); + m_user=std::move(url.m_user); + m_host=std::move(url.m_host); + m_ip_v=std::move(url.m_ip_v); + m_port=std::move(url.m_port); + m_path=std::move(url.m_path); + m_query=std::move(url.m_query); + m_fragment=std::move(url.m_fragment); + } + if (!m_parse || m_built) + m_url=std::move(url.m_url); +} + + +Url &Url::scheme(const std::string& s) { + if (!is_scheme(s)) + throw Url::parse_error("Invalid scheme '"+s+"'"); + lazy_parse(); + std::string o(s); + to_lower(o); + if (o!=m_scheme) { + m_scheme=o; + m_built=false; + if ((m_scheme=="http" && m_port=="80") || (m_scheme=="https" && m_port=="443")) + m_port=""; + } + return *this; +} + + +Url &Url::user_info(const std::string& s) { + if (s.length()>256) + throw Url::parse_error("User info is longer than 256 characters '"+s+"'"); + lazy_parse(); + if (m_user!=s) { + m_user=s; + m_built=false; + } + return *this; +} + + +Url &Url::host(const std::string& h, std::uint8_t ip_v) { + if (h.length()>253) + throw Url::parse_error("Host is longer than 253 characters '"+h+"'"); + lazy_parse(); + std::string o; + if (h.empty()) + ip_v=-1; + else if (is_ipv4(h)) { + if (!is_valid_ipv4(h)) + throw Url::parse_error("Invalid IPv4 address '"+h+"'"); + ip_v=4; + o=h; + } else if(ip_v!=0&&ip_v!=4&&ip_v!=6) { + if (!is_ipv6(h)) { + throw Url::parse_error("Invalid IPvFuture address '"+h+"'"); + } + o=h; + } else if (is_ipv6(h)) { + if (!is_valid_ipv6(h)) + throw Url::parse_error("Invalid IPv6 address '"+h+"'"); + ip_v=6; + o=normalize_IPv6(h); + } else if (is_reg_name(h)) { + ip_v=0; + o=normalize_reg_name(h); + } else + throw Url::parse_error("Invalid host '"+h+"'"); + if (m_host!=o||m_ip_v!=ip_v) { + m_host=o; + m_ip_v=ip_v; + m_built=false; + } + return *this; +} + + +Url &Url::port(const std::string& p) { + if (!is_port(p)) + throw Url::parse_error("Invalid port '"+p+"'"); + lazy_parse(); + std::string o(p); + if ((m_scheme=="http" && o=="80") || (m_scheme=="https" && o=="443")) + o=""; + if (m_port!=o) { + m_port=o; + m_built=false; + } + return *this; +} + + +Url &Url::path(const std::string& p) { + if (p.length()>8000) + throw Url::parse_error("Path is longer than 8000 characters '"+p+"'"); + lazy_parse(); + std::string o(normalize_path(p)); + if (m_path!=o) { + m_path=o; + m_built=false; + } + return *this; +} + + +Url &Url::fragment(const std::string& f) { + if (f.length()>256) + throw Url::parse_error("Fragment is longer than 256 characters '"+f+"'"); + lazy_parse(); + if (m_fragment!=f) { + m_fragment=f; + m_built=false; + } + return *this; +} + + +Url &Url::clear() { + m_url.clear(); + m_scheme.clear(); + m_user.clear(); + m_host.clear(); + m_port.clear(); + m_path.clear(); + m_query.clear(); + m_fragment.clear(); + m_ip_v=-1; + m_built=true; + m_parse=true; + return *this; +} + + +void Url::parse_url() const { + if (m_url.empty()) { + const_cast(this)->clear(); + m_parse=m_built=true; + return; + } + if (m_url.length()>8000) + throw Url::parse_error("URI is longer than 8000 characters"); + + const char *s=m_url.data(), *e=s+m_url.length(); + std::int8_t ip_v=-1; + const char *scheme_b, *scheme_e, *user_b, *user_e, *host_b, *host_e, + *port_b, *port_e, *path_b, *path_e, *query_b, *query_e, + *fragment_b, *fragment_e; + scheme_b=scheme_e=user_b=user_e=host_b=host_e=port_b=port_e=path_b= + path_e=query_b=query_e=fragment_b=fragment_e=nullptr; + + const char *b=s, *p=find_first_of(b, e, ":/?#"); + if (p==e) { + if (!is_chars(b, p, 0x2F)) + throw Url::parse_error("Path '"+std::string(b,p)+"' in '"+std::string(s,e-s)+"' is invalid"); + path_b=b; + path_e=e; + } else { + // get schema if any + if (*p==':') { + if (!is_scheme(b, p)) + throw Url::parse_error("Scheme in '"+std::string(s,e-s)+"' is invalid"); + scheme_b=b; + scheme_e=p; + p=find_first_of(b=p+1, e, "/?#"); + } + // get authority if any + if (p!=e && *p=='/' && (e-b)>1 && b[0]=='/' && b[1]=='/') { + const char *ea=find_first_of(b+=2, e, "/?#"); // locate end of authority + p=find_char(b, ea, '@'); + // get user info if any + if (p!=ea) { + if (!is_chars(b, p, 0x25)) + throw Url::parse_error("User info in '"+std::string(s,e-s)+"' is invalid"); + user_b=b; + user_e=p; + b=p+1; + } + // Get IP literal if any + if (*b=='[') { + // locate end of IP literal + p=find_char(++b, ea, ']'); + if (*p!=']') + throw Url::parse_error("Missing ] in '"+std::string(s,e-s)+"'"); + // decode IPvFuture protocol version + if (*b=='v') { + if (is_hexdigit(*++b)) { + ip_v=get_hex_digit(*b); + if (is_hexdigit(*++b)) { + ip_v=(ip_v<<8)|get_hex_digit(*b); + } + } + if (ip_v==-1||*b++!='.'||!is_chars(b,p,0x05)) + throw Url::parse_error("Host address in '"+std::string(s,e-s)+"' is invalid"); + } else if (is_ipv6(b,p)) { + ip_v=6; + } else + throw Url::parse_error("Host address in '"+std::string(s,e-s)+"' is invalid"); + host_b=b; + host_e=p; + b=p+1; + } else { + p=find_char(b, ea, ':'); + if (is_ipv4(b, p)) + ip_v=4; + else if (is_reg_name(b, p)) + ip_v=0; + else + throw Url::parse_error("Host address in '"+std::string(s,e-s)+"' is invalid"); + host_b=b; + host_e=p; + b=p; + } + //get port if any + if (b!=ea&&*b==':') { + if (!is_port(++b, ea)) + throw Url::parse_error("Port '"+std::string(b,ea-b)+"' in '"+std::string(s,e-s)+"' is invalid"); + port_b=b; + port_e=ea; + } + b=ea; + } + p=find_first_of(b,e,"?#"); + if (!is_chars(b, p, 0x2F)) + throw Url::parse_error("Path '"+std::string(b,p)+"' in '"+std::string(s,e-s)+"' is invalid"); + path_b=b; + path_e=p; + if (p!=e && *p=='?') { + p=find_char(b=p+1,e,'#'); + query_b=b; + query_e=p; + } + if (p!=e && *p=='#') { + if (!is_chars(p+1, e, 0x3F)) + throw Url::parse_error("Fragment '"+std::string(p+1,e)+"' in '"+std::string(s,e-s)+"' is invalid"); + fragment_b=p+1; + fragment_e=e; + } + } + std::string _scheme, _user, _host, _port, _path, _query, _fragment; + Query query_v; + + if (scheme_b) + _scheme=normalize_scheme(scheme_b, scheme_e); + if (user_b) + _user=decode(user_b, user_e); + if (host_b) { + _host=decode(host_b, host_e); + if (ip_v==0) + _host=normalize_reg_name(_host); + else if (ip_v==6) + _host=normalize_IPv6(_host); + } + if (port_b) + _port=std::string(port_b,port_e-port_b); + if (path_b) + _path=normalize_path(decode(path_b, path_e)); + if (query_b) { + _query=std::string(query_b, query_e); + p=b=query_b; + while (p!=query_e) { + p=find_first_of(b, query_e, "=;&"); + if (!is_chars(b, p, 0x3F)) + throw Url::parse_error("Query key '"+std::string(b,p)+"' in '"+std::string(s,e-s)+"' is invalid"); + std::string key(decode_plus(b,p)), val; + if (p!=query_e) { + if (*p=='=') { + p=find_first_of(b=p+1, query_e, ";&"); + if (!is_chars(b, p, 0x3F)) + throw Url::parse_error("Query value '"+std::string(b,p)+"' in '"+std::string(s,e-s)+"' is invalid"); + val=decode_plus(b,p); + } + b=p+1; + } + query_v.emplace_back(key, val); + } + } + if (fragment_b) + _fragment=decode(fragment_b, fragment_e); + + m_scheme=_scheme; + m_user=_user; + m_host=_host; + m_ip_v=ip_v; + m_port=_port; + m_path=_path; + m_query=query_v; + m_fragment=_fragment; + m_parse=true; + m_built=false; +} + + +void Url::build_url() const { + lazy_parse(); + std::stringstream url; + if (!m_scheme.empty()) + url<key().empty()) + throw Url::build_error("First query entry has no key"); + url<key(), 0x1F); + if (!it->val().empty()) + url<<"="<val(), 0x1F); + while(++it!=end) { + if (it->key().empty()) + throw Url::build_error("A query entry has no key"); + url<<"&"<key(), 0x1F); + if (!it->val().empty()) + url<<"="<val(), 0x1F); + } + } + if (!m_fragment.empty()) + url<<"#"< +#include +#include +#include +#include +#include + + +class Url { +public: + // Exception thut may be thrown when decoding an URL or an assigning value + class parse_error: public std::invalid_argument { + public: + parse_error(const std::string &reason) : std::invalid_argument(reason) {} + }; + + // Exception that may be thrown when building an URL + class build_error: public std::runtime_error { + public: + build_error(const std::string &reason) : std::runtime_error(reason) {} + }; + + // Default constructor + Url() : m_parse(true),m_built(true),m_ip_v(-1) {} + + // Copy initializer constructor + Url(const Url &url) : m_ip_v(-1) {assign(url);} + + // Move constructor + Url(Url&& url) : m_ip_v(-1) {assign(std::move(url));} + + // Construct Url with the given string + Url(const std::string &url_str) : m_url(url_str),m_parse(false),m_built(false),m_ip_v(-1) {} + + // Assign the given URL string + Url &operator=(const std::string &url_str) {return str(url_str);} + + // Assign the given Url object + Url &operator=(const Url &url) {assign(url); return *this;} + + // Move the given Url object + Url &operator=(Url&& url) {assign(std::move(url)); return *this;} + + // Clear the Url object + Url &clear(); + + // Build Url if needed and return it as string + std::string str() const {if(!m_built) build_url(); return m_url;} + + // Set the Url to the given string. All fields are overwritten + Url& str(const std::string &url_str) {m_url=url_str; m_built=m_parse=false; return *this;} + + // Get scheme + const std::string& scheme() const {lazy_parse(); return m_scheme;} + + // Set scheme + Url &scheme(const std::string& s); + + // Get user info + const std::string& user_info() const {lazy_parse(); return m_user;} + + // Set user info + Url &user_info(const std::string& s); + + // Get host + const std::string& host() const {lazy_parse(); return m_host;} + + // Set host + Url &host(const std::string& h, uint8_t ip_v=0); + + // Get host IP version: 0=name, 4=IPv4, 6=IPv6, -1=undefined + std::int8_t ip_version() const {lazy_parse(); return m_ip_v;} + + // Get port + const std::string& port() const {lazy_parse(); return m_port;} + + // Set Port given as string + Url &port(const std::string& str); + + // Set port given as a 16bit unsigned integer + Url &port(std::uint16_t num) {return port(std::to_string(num));} + + // Get path + const std::string& path() const {lazy_parse(); return m_path;} + + // Set path + Url &path(const std::string& str); + + class KeyVal { + public: + // Default constructor + KeyVal() {} + + // Construct with provided Key and Value strings + KeyVal(const std::string &key, const std::string &val) : m_key(key),m_val(val) {} + + // Construct with provided Key string, val will be empty + KeyVal(const std::string &key) : m_key(key) {} + + // Equality test operator + bool operator==(const KeyVal &q) const {return m_key==q.m_key&&m_val==q.m_val;} + + // Swap this with q + void swap(KeyVal& q) {std::swap(m_key,q.m_key); std::swap(m_val,q.m_val);} + + // Get key + const std::string& key() const {return m_key;} + + // Set key + void key(const std::string &k) {m_key=k;} + + // Get value + const std::string& val() const {return m_val;} + + // Set value + void val(const std::string &v) {m_val=v;} + + // Output key value pair + friend std::ostream& operator<<(std::ostream &o, const KeyVal &kv) + {o<<" "; return o;} + + private: + std::string m_key; + std::string m_val; + }; + + // Define Query as vector of Key Value pairs + typedef std::vector Query; + + // Get a reference to the query vector for read only access + const Query& query() const {lazy_parse(); return m_query;} + + // Get a reference to a specific Key Value pair in the query vector for read only access + const KeyVal& query(size_t i) const { + lazy_parse(); + if (i>=m_query.size()) + throw std::out_of_range("Invalid Url query index ("+std::to_string(i)+")"); + return m_query[i]; + } + + // Get a reference to the query vector for a writable access + Query& set_query() {lazy_parse(); m_built=false; return m_query;} + + // Get a reference to specific Key Value pair in the query vector for a writable access + KeyVal& set_query(size_t i) { + lazy_parse(); + if (i>=m_query.size()) + throw std::out_of_range("Invalid Url query index ("+std::to_string(i)+")"); + m_built=false; + return m_query[i]; + } + + // Set the query vector to the Query vector q + Url &set_query(const Query &q) + {lazy_parse(); if (q != m_query) {m_query=q; m_built=false;} return *this;} + + // Append KeyVal kv to the query + Url &add_query(const KeyVal &kv) + {lazy_parse(); m_built=false; m_query.push_back(kv); return *this;} + + // Append key val pair to the query + Url &add_query(const std::string &key, const std::string &val) + {lazy_parse(); m_built=false; m_query.emplace_back(key,val); return *this;} + + // Append key with empty val to the query + Url &add_query(const std::string &key) + {lazy_parse(); m_built=false; m_query.emplace_back(key); return *this;} + + // Get the fragment + const std::string& fragment() const {lazy_parse(); return m_fragment;} + + // Set the fragment + Url &fragment(const std::string& f); + + // Output + std::ostream& output(std::ostream &o) const; + + // Output strean operator + friend std::ostream& operator<<(std::ostream &o, const Url &u) {return u.output(o);} + +private: + void assign(const Url &url); + void assign(Url&& url); + void build_url() const; + void lazy_parse() const {if (!m_parse) parse_url();} + void parse_url() const; + + mutable std::string m_scheme; + mutable std::string m_user; + mutable std::string m_host; + mutable std::string m_port; + mutable std::string m_path; + mutable Query m_query; + mutable std::string m_fragment; + mutable std::string m_url; + mutable bool m_parse; + mutable bool m_built; + mutable std::int8_t m_ip_v; +}; + + + + +#endif // URL_HPP + diff --git a/examples/SAM/16_channel_volume/16_channel_volume.dsp b/examples/SAM/16_channel_volume/16_channel_volume.dsp index 0c8e48e06b..377097b608 100644 --- a/examples/SAM/16_channel_volume/16_channel_volume.dsp +++ b/examples/SAM/16_channel_volume/16_channel_volume.dsp @@ -2,8 +2,8 @@ // MIDI controlled 16 channel volume control in db //----------------------------------------------- -import("stdfaust.lib"); -import("layout.dsp"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); +import("layout.lib"); channel01 = v01(vslider("Volume-01 [midi:ctrl 1] [tooltip CC-1]", 0, -70, +4, 0.1) : ba.db2linear : si.smoo); channel02 = v02(vslider("Volume-02 [midi:ctrl 2] [tooltip CC-2]", 0, -70, +4, 0.1) : ba.db2linear : si.smoo); diff --git a/examples/SAM/16_channel_volume/layout.dsp b/examples/SAM/16_channel_volume/layout.lib similarity index 100% rename from examples/SAM/16_channel_volume/layout.dsp rename to examples/SAM/16_channel_volume/layout.lib diff --git a/examples/SAM/chorus/chorus.dsp b/examples/SAM/chorus/chorus.dsp index 102dc3f65f..2753406e8e 100644 --- a/examples/SAM/chorus/chorus.dsp +++ b/examples/SAM/chorus/chorus.dsp @@ -1,6 +1,6 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); -import("layout2.dsp"); +import("layout2.lib"); voices = 8; // MUST BE EVEN process = ba.bypass1to2(cbp,chorus_mono(dmax,curdel,rate,sigma,do2,voices)); diff --git a/examples/SAM/chorus/chorusForBrowser.dsp b/examples/SAM/chorus/chorusForBrowser.dsp index 255a484adf..6520a8f27a 100644 --- a/examples/SAM/chorus/chorusForBrowser.dsp +++ b/examples/SAM/chorus/chorusForBrowser.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); voices = 8; // MUST BE EVEN process = ba.bypass1to2(cbp,chorus_mono(dmax,curdel,rate,sigma,do2,voices)); diff --git a/examples/SAM/chorus/layout2.dsp b/examples/SAM/chorus/layout2.lib similarity index 100% rename from examples/SAM/chorus/layout2.dsp rename to examples/SAM/chorus/layout2.lib diff --git a/examples/SAM/echo/echo.dsp b/examples/SAM/echo/echo.dsp index b45766c55d..65212ac803 100644 --- a/examples/SAM/echo/echo.dsp +++ b/examples/SAM/echo/echo.dsp @@ -1,7 +1,7 @@ // imported by echo.dsp and echomt.dsp -import("stdfaust.lib"); -import("layout2.dsp"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); +import("layout2.lib"); echo_group(x) = x; // Let layout2.dsp lay us out knobs_group(x) = ekg(x); diff --git a/examples/SAM/echo/echoForBrowser.dsp b/examples/SAM/echo/echoForBrowser.dsp index 81aa422e69..927d2ca70a 100644 --- a/examples/SAM/echo/echoForBrowser.dsp +++ b/examples/SAM/echo/echoForBrowser.dsp @@ -1,6 +1,6 @@ // imported by echo.dsp and echomt.dsp -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); echo_group(x) = x; // Let layout2.dsp lay us out knobs_group(x) = ekg(x); diff --git a/examples/SAM/virtualAnalog/layout2.dsp b/examples/SAM/echo/layout2.lib similarity index 99% rename from examples/SAM/virtualAnalog/layout2.dsp rename to examples/SAM/echo/layout2.lib index 531084cf3b..379139202a 100644 --- a/examples/SAM/virtualAnalog/layout2.dsp +++ b/examples/SAM/echo/layout2.lib @@ -124,3 +124,4 @@ mmg(x) = hgroup("",x); // Minimoog + Effects keys(x) = kg(hgroup("[1] [tooltip:Keys]", x)); gg(x) = keys(hgroup("[0] [tooltip: Gates]",x)); // leave slot 1 open for sustain (below) + diff --git a/examples/SAM/effects/chorus.dsp b/examples/SAM/effects/chorus.dsp index 37ec4e4b5f..40e3cd7339 100644 --- a/examples/SAM/effects/chorus.dsp +++ b/examples/SAM/effects/chorus.dsp @@ -1,6 +1,6 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); -import("layout2.dsp"); +import("layout2.lib"); voices = 8; // MUST BE EVEN process = ba.bypass1to2(cbp,chorus_mono(dmax,curdel,rate,sigma,do2,voices)); diff --git a/examples/SAM/effects/echo.dsp b/examples/SAM/effects/echo.dsp index e3cbe0ebff..cc340e5801 100644 --- a/examples/SAM/effects/echo.dsp +++ b/examples/SAM/effects/echo.dsp @@ -1,7 +1,7 @@ // imported by echo.dsp and echomt.dsp -import("stdfaust.lib"); -import("layout2.dsp"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); +import("layout2.lib"); echo_group(x) = x; // Let layout2.dsp lay us out knobs_group(x) = ekg(x); diff --git a/examples/SAM/effects/effects.dsp b/examples/SAM/effects/effects.dsp index 23f7a487ac..6c8d50f0a4 100644 --- a/examples/SAM/effects/effects.dsp +++ b/examples/SAM/effects/effects.dsp @@ -1,7 +1,7 @@ // All effects used by minimoog.dsp -import("stdfaust.lib"); -import("layout2.dsp"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); +import("layout2.lib"); process = _,_ : + : component("echo.dsp") diff --git a/examples/SAM/effects/effectsForBrowser.dsp b/examples/SAM/effects/effectsForBrowser.dsp index 80a8dfa66c..5a6823dff4 100644 --- a/examples/SAM/effects/effectsForBrowser.dsp +++ b/examples/SAM/effects/effectsForBrowser.dsp @@ -1,6 +1,6 @@ // All effects used by minimoog.dsp -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = _,_ : + : component_echo @@ -144,7 +144,7 @@ chorus_mono(dmax,curdel,rate,sigma,do2,voices) component_freeverb = environment { -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); declare name "freeverb"; declare version "1.0"; diff --git a/examples/SAM/effects/flanger.dsp b/examples/SAM/effects/flanger.dsp index 33da297364..3146d042d2 100644 --- a/examples/SAM/effects/flanger.dsp +++ b/examples/SAM/effects/flanger.dsp @@ -1,7 +1,7 @@ // Created from flange.dsp 2015/06/21 -import("stdfaust.lib"); -import("layout2.dsp"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); +import("layout2.lib"); flanger_mono(dmax,curdel,depth,fb,invert,lfoshape) = _ <: _, (-:de.fdelay(dmax,curdel)) ~ *(fb) : _, diff --git a/examples/SAM/effects/freeverb.dsp b/examples/SAM/effects/freeverb.dsp index 27c73ffe66..4c983d56c8 100644 --- a/examples/SAM/effects/freeverb.dsp +++ b/examples/SAM/effects/freeverb.dsp @@ -1,5 +1,5 @@ -import("stdfaust.lib"); -import("layout2.dsp"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); +import("layout2.lib"); declare name "freeverb"; declare version "1.0"; diff --git a/examples/SAM/echo/layout2.dsp b/examples/SAM/effects/layout2.lib similarity index 100% rename from examples/SAM/echo/layout2.dsp rename to examples/SAM/effects/layout2.lib diff --git a/examples/SAM/flanger/flanger.dsp b/examples/SAM/flanger/flanger.dsp index ff36e648d5..245dd1b332 100644 --- a/examples/SAM/flanger/flanger.dsp +++ b/examples/SAM/flanger/flanger.dsp @@ -1,7 +1,7 @@ // Created from flange.dsp 2015/06/21 -import("stdfaust.lib"); -import("layout2.dsp"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); +import("layout2.lib"); flanger_mono(dmax,curdel,depth,fb,invert,lfoshape) = _ <: _, (-:de.fdelay(dmax,curdel)) ~ *(fb) : _, diff --git a/examples/SAM/flanger/flangerForBrowser.dsp b/examples/SAM/flanger/flangerForBrowser.dsp index 9bc0d35c30..483a7f0153 100644 --- a/examples/SAM/flanger/flangerForBrowser.dsp +++ b/examples/SAM/flanger/flangerForBrowser.dsp @@ -1,6 +1,6 @@ // Created from flange.dsp 2015/06/21 -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); flanger_mono(dmax,curdel,depth,fb,invert,lfoshape) = _ <: _, (-:de.fdelay(dmax,curdel)) ~ *(fb) : _, diff --git a/examples/SAM/effects/layout2.dsp b/examples/SAM/flanger/layout2.lib similarity index 100% rename from examples/SAM/effects/layout2.dsp rename to examples/SAM/flanger/layout2.lib diff --git a/examples/SAM/freeverb/freeverb.dsp b/examples/SAM/freeverb/freeverb.dsp index 3c620019c6..697d37e996 100644 --- a/examples/SAM/freeverb/freeverb.dsp +++ b/examples/SAM/freeverb/freeverb.dsp @@ -1,5 +1,5 @@ -import("stdfaust.lib"); -import("layout2.dsp"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); +import("layout2.lib"); declare name "freeverb"; declare version "1.0"; diff --git a/examples/SAM/freeverb/freeverbForBrowser.dsp b/examples/SAM/freeverb/freeverbForBrowser.dsp index 62ae71f492..b70664729f 100644 --- a/examples/SAM/freeverb/freeverbForBrowser.dsp +++ b/examples/SAM/freeverb/freeverbForBrowser.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); declare name "freeverb"; declare version "1.0"; diff --git a/examples/SAM/flanger/layout2.dsp b/examples/SAM/freeverb/layout2.lib similarity index 100% rename from examples/SAM/flanger/layout2.dsp rename to examples/SAM/freeverb/layout2.lib diff --git a/examples/SAM/sawtooth_synth/sawtooth_synth.dsp b/examples/SAM/sawtooth_synth/sawtooth_synth.dsp index a6297b8064..37ff0895c5 100644 --- a/examples/SAM/sawtooth_synth/sawtooth_synth.dsp +++ b/examples/SAM/sawtooth_synth/sawtooth_synth.dsp @@ -1,5 +1,5 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); normMIDI(mv) = mv/127.0; diff --git a/examples/SAM/sine_synth/sine_synth.dsp b/examples/SAM/sine_synth/sine_synth.dsp index 76fe92c908..2a6af8ef29 100644 --- a/examples/SAM/sine_synth/sine_synth.dsp +++ b/examples/SAM/sine_synth/sine_synth.dsp @@ -1,5 +1,5 @@ // tosc.dsp - test simple oscillator + MIDI bindings -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = g * a * os.oscrs(f*b) <: _,_; a = hslider("gain [midi:ctrl 7]",1,0,1,0.001); f = hslider("freq",392.0,200.0,450.0,0.01); diff --git a/examples/SAM/freeverb/layout2.dsp b/examples/SAM/virtualAnalog/layout2.lib similarity index 100% rename from examples/SAM/freeverb/layout2.dsp rename to examples/SAM/virtualAnalog/layout2.lib diff --git a/examples/SAM/virtualAnalog/virtualAnalog.dsp b/examples/SAM/virtualAnalog/virtualAnalog.dsp index c1e584fd08..61b214a891 100644 --- a/examples/SAM/virtualAnalog/virtualAnalog.dsp +++ b/examples/SAM/virtualAnalog/virtualAnalog.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); // These are now in a separate file ./effects.dsp // echo = echog(component("echo.dsp")); // ./echo.dsp @@ -92,7 +92,7 @@ ptn(i) = select2(lfoMode(i), // Soon to appear in oscillators.lib: lf_pulsetrain(freq,duty) = 2.0*os.lf_pulsetrainpos(freq,duty) - 1.0; -import("layout2.dsp"); // follows the Mini Moog front panel: ./layout2.dsp +import("layout2.lib"); // follows the Mini Moog front panel: ./layout2.dsp filters = ba.bypass1(bp,vcf); // BYPASS WILL GO AWAY (I think you just open it up all the way to bypass): bp = 0; // VCF is always on diff --git a/examples/SAM/virtualAnalog/virtualAnalogForBrowser.dsp b/examples/SAM/virtualAnalog/virtualAnalogForBrowser.dsp index 167a54d787..30358a2705 100644 --- a/examples/SAM/virtualAnalog/virtualAnalogForBrowser.dsp +++ b/examples/SAM/virtualAnalog/virtualAnalogForBrowser.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); // These are now in separate upstairs directories: // echo = echog(component("echo.dsp")); // ../echo/echo.dsp diff --git a/examples/SAM/virtualAnalog/virtualAnalogWithEffectsForBrowser.dsp b/examples/SAM/virtualAnalog/virtualAnalogWithEffectsForBrowser.dsp index 0afdf2b645..c45feffa8a 100644 --- a/examples/SAM/virtualAnalog/virtualAnalogWithEffectsForBrowser.dsp +++ b/examples/SAM/virtualAnalog/virtualAnalogWithEffectsForBrowser.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); // These are now in a separate file ./effects.dsp // echo = echog(component("echo.dsp")); // ./echo.dsp diff --git a/examples/SAM/volume/volume.dsp b/examples/SAM/volume/volume.dsp index 90e45b9d36..0a34ad64ec 100644 --- a/examples/SAM/volume/volume.dsp +++ b/examples/SAM/volume/volume.dsp @@ -2,7 +2,7 @@ // Volume control in dB with MIDI control (CC-1, modWheel) //--------------------------------------------------------- -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); gain = vslider("Volume[midi:ctrl 2] [tooltip CC-1]", 0, -70, +4, 0.1) : ba.db2linear : si.smoo; diff --git a/examples/ambisonics/fourSourcesToOcto.dsp b/examples/ambisonics/fourSourcesToOcto.dsp index be29321cb3..a557add829 100644 --- a/examples/ambisonics/fourSourcesToOcto.dsp +++ b/examples/ambisonics/fourSourcesToOcto.dsp @@ -4,7 +4,7 @@ declare author "CICM"; declare license "BSD"; declare copyright "(c)CICM 2013"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); r1 = hslider("Radius1", 1.0, 0, 5, 0.001) : si.smooth(ba.tau2pole(0.02)); a1 = hslider("Angle1", 0, ma.PI*(-2), ma.PI*2, 0.001) : si.smooth(ba.tau2pole(0.02)); diff --git a/examples/ambisonics/oneSourceToStereo.dsp b/examples/ambisonics/oneSourceToStereo.dsp index 0b8d1ba9a3..832365784d 100644 --- a/examples/ambisonics/oneSourceToStereo.dsp +++ b/examples/ambisonics/oneSourceToStereo.dsp @@ -4,7 +4,7 @@ declare author "CICM"; declare license "BSD"; declare copyright "(c)CICM 2013"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); r1 = hslider("Radius", 1.0, 0, 5, 0.001) : si.smooth(ba.tau2pole(0.02)); a1 = hslider("Angle", 0, ma.PI*(-2), ma.PI*2, 0.001) : si.smooth(ba.tau2pole(0.02)); diff --git a/examples/analysis/FFT.dsp b/examples/analysis/FFT.dsp index 3589b4c87b..d609b4a388 100644 --- a/examples/analysis/FFT.dsp +++ b/examples/analysis/FFT.dsp @@ -4,7 +4,7 @@ declare name "FFT"; // Faust Fourier Transform :-) declare author "JOS"; declare license "STK-4.3"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); N=32; // FFT size (power of 2) // Number of frequency bins (including dc and SR/2) is N/2+1 diff --git a/examples/analysis/dbmeter.dsp b/examples/analysis/dbmeter.dsp index 50ed12ab65..d952414a3f 100644 --- a/examples/analysis/dbmeter.dsp +++ b/examples/analysis/dbmeter.dsp @@ -8,7 +8,7 @@ declare copyright "(c)GRAME 2006"; // A dB Vumeter //------------------------------------------------- -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = hgroup("8 channels dB meter", par(i,8, vgroup("%i", vmeter(i) : null))) with { diff --git a/examples/analysis/spectralLevel.dsp b/examples/analysis/spectralLevel.dsp index 3928d867d0..9f3aaade99 100644 --- a/examples/analysis/spectralLevel.dsp +++ b/examples/analysis/spectralLevel.dsp @@ -3,6 +3,6 @@ declare version "0.0"; declare author "JOS, revised by RM"; declare description "Demonstrates mth_octave_spectral_level in a standalone GUI."; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.spectral_level_demo; diff --git a/examples/analysis/spectralTiltLab.dsp b/examples/analysis/spectralTiltLab.dsp index 5c9f3646c6..7555f8fa3a 100644 --- a/examples/analysis/spectralTiltLab.dsp +++ b/examples/analysis/spectralTiltLab.dsp @@ -2,7 +2,7 @@ declare name "spectralTiltLab"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); N = 10; // Number of pole-zero pairs to use diff --git a/examples/analysis/vumeter.dsp b/examples/analysis/vumeter.dsp index 9e1b56061b..a86718bf71 100644 --- a/examples/analysis/vumeter.dsp +++ b/examples/analysis/vumeter.dsp @@ -8,7 +8,7 @@ declare copyright "(c)GRAME 2006"; // Simple vumeter //------------------------------------------------- -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = hmeter(0), hmeter(1) with { diff --git a/examples/autodiff/noise.dsp b/examples/autodiff/noise.dsp index a5727d848e..fe89bdf27b 100644 --- a/examples/autodiff/noise.dsp +++ b/examples/autodiff/noise.dsp @@ -1,2 +1,2 @@ - import("stdfaust.lib"); + import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = no.noise; diff --git a/examples/autodiff/noop.dsp b/examples/autodiff/noop.dsp index 69fc449256..d4f51d6e6f 100644 --- a/examples/autodiff/noop.dsp +++ b/examples/autodiff/noop.dsp @@ -1,2 +1,2 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = _; diff --git a/examples/bela/AdditiveSynth.dsp b/examples/bela/AdditiveSynth.dsp index 48ab93ecc6..45b2deb09e 100644 --- a/examples/bela/AdditiveSynth.dsp +++ b/examples/bela/AdditiveSynth.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); /////////////////////////////////////////////////////////////////////////////////////////////////// // diff --git a/examples/bela/AdditiveSynth_Analog.dsp b/examples/bela/AdditiveSynth_Analog.dsp index b55a4ea48e..54f3acd70c 100644 --- a/examples/bela/AdditiveSynth_Analog.dsp +++ b/examples/bela/AdditiveSynth_Analog.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); /////////////////////////////////////////////////////////////////////////////////////////////////// // diff --git a/examples/bela/FMSynth2.dsp b/examples/bela/FMSynth2.dsp index 4f4df0b8b8..b8dfda26c2 100644 --- a/examples/bela/FMSynth2.dsp +++ b/examples/bela/FMSynth2.dsp @@ -1,4 +1,4 @@ -import("all.lib"); +import("pkg:faust/faust/all.lib@1.0.0"); /////////////////////////////////////////////////////////////////////////////////////////////////// // diff --git a/examples/bela/FMSynth2_Analog.dsp b/examples/bela/FMSynth2_Analog.dsp index 279fb6da96..d95f1d6b4f 100644 --- a/examples/bela/FMSynth2_Analog.dsp +++ b/examples/bela/FMSynth2_Analog.dsp @@ -1,4 +1,4 @@ -import("all.lib"); +import("pkg:faust/faust/all.lib@1.0.0"); /////////////////////////////////////////////////////////////////////////////////////////////////// // diff --git a/examples/bela/FMSynth2_FX.dsp b/examples/bela/FMSynth2_FX.dsp index 2bed1dd23d..1efbae40bc 100644 --- a/examples/bela/FMSynth2_FX.dsp +++ b/examples/bela/FMSynth2_FX.dsp @@ -1,4 +1,4 @@ -import("all.lib"); +import("pkg:faust/faust/all.lib@1.0.0"); /////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/examples/bela/FMSynth2_FX_Analog.dsp b/examples/bela/FMSynth2_FX_Analog.dsp index 77257e0270..4c8223ab05 100644 --- a/examples/bela/FMSynth2_FX_Analog.dsp +++ b/examples/bela/FMSynth2_FX_Analog.dsp @@ -1,4 +1,4 @@ -import("all.lib"); +import("pkg:faust/faust/all.lib@1.0.0"); /////////////////////////////////////////////////////////////////////////////////////////////////// // diff --git a/examples/bela/FXChaine2.dsp b/examples/bela/FXChaine2.dsp index f5b010e537..8310f67703 100644 --- a/examples/bela/FXChaine2.dsp +++ b/examples/bela/FXChaine2.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // diff --git a/examples/bela/GrainGenerator.dsp b/examples/bela/GrainGenerator.dsp index 78e9f793ab..84eeafa793 100644 --- a/examples/bela/GrainGenerator.dsp +++ b/examples/bela/GrainGenerator.dsp @@ -15,7 +15,7 @@ // /////////////////////////////////////////////////////////////////////////////////////////////////// -import("all.lib"); +import("pkg:faust/faust/all.lib@1.0.0"); // FOR 4 grains - MONO diff --git a/examples/bela/WaveSynth.dsp b/examples/bela/WaveSynth.dsp index 7f1595880c..c7967cf683 100644 --- a/examples/bela/WaveSynth.dsp +++ b/examples/bela/WaveSynth.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); /////////////////////////////////////////////////////////////////////////////////////////////////// // diff --git a/examples/bela/WaveSynth_Analog.dsp b/examples/bela/WaveSynth_Analog.dsp index 26fce37123..f30ec1737c 100644 --- a/examples/bela/WaveSynth_Analog.dsp +++ b/examples/bela/WaveSynth_Analog.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); /////////////////////////////////////////////////////////////////////////////////////////////////// // diff --git a/examples/bela/WaveSynth_FX.dsp b/examples/bela/WaveSynth_FX.dsp index 798663e317..804c641fc7 100644 --- a/examples/bela/WaveSynth_FX.dsp +++ b/examples/bela/WaveSynth_FX.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); /////////////////////////////////////////////////////////////////////////////////////////////////// // diff --git a/examples/bela/WaveSynth_FX_Analog.dsp b/examples/bela/WaveSynth_FX_Analog.dsp index e456262579..36784cda4d 100644 --- a/examples/bela/WaveSynth_FX_Analog.dsp +++ b/examples/bela/WaveSynth_FX_Analog.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); /////////////////////////////////////////////////////////////////////////////////////////////////// // diff --git a/examples/bela/crossDelay2.dsp b/examples/bela/crossDelay2.dsp index 46fa210766..07673530c1 100644 --- a/examples/bela/crossDelay2.dsp +++ b/examples/bela/crossDelay2.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); /////////////////////////////////////////////////////////////////////////////////////////////////// // diff --git a/examples/bela/granulator.dsp b/examples/bela/granulator.dsp index 329239b8f0..106adbf38a 100644 --- a/examples/bela/granulator.dsp +++ b/examples/bela/granulator.dsp @@ -26,7 +26,7 @@ process = vgroup("Granulator", environment { - Head = Irregular occurrences */ - import("stdfaust.lib"); + import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = hgroup("Granulator", *(excitation : ampf)); diff --git a/examples/bela/repeater.dsp b/examples/bela/repeater.dsp index dc04c25b20..3e152c4b9f 100644 --- a/examples/bela/repeater.dsp +++ b/examples/bela/repeater.dsp @@ -10,7 +10,7 @@ // /////////////////////////////////////////////////////////////////////////////////////////////////// -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = _, _ , (pathClock : compteurUpReset: rampePlayer, _) : routageIO : rec_play_table , rec_play_table; diff --git a/examples/bela/simpleFX.dsp b/examples/bela/simpleFX.dsp index efa502fb1b..9f1149dd7e 100644 --- a/examples/bela/simpleFX.dsp +++ b/examples/bela/simpleFX.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); // /////////////////////////////////////////////////////////////////////////////////////////////////// // diff --git a/examples/bela/simpleFX_Analog.dsp b/examples/bela/simpleFX_Analog.dsp index 4662a128d9..ca1ff67f31 100644 --- a/examples/bela/simpleFX_Analog.dsp +++ b/examples/bela/simpleFX_Analog.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); // /////////////////////////////////////////////////////////////////////////////////////////////////// // diff --git a/examples/bela/simpleSynth.dsp b/examples/bela/simpleSynth.dsp index 5d52d2c239..530d06bf12 100644 --- a/examples/bela/simpleSynth.dsp +++ b/examples/bela/simpleSynth.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); /////////////////////////////////////////////////////////////////////////////////////////////////// // diff --git a/examples/bela/simpleSynth_Analog.dsp b/examples/bela/simpleSynth_Analog.dsp index 36dd9c3445..dd72eaaa10 100644 --- a/examples/bela/simpleSynth_Analog.dsp +++ b/examples/bela/simpleSynth_Analog.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); /////////////////////////////////////////////////////////////////////////////////////////////////// // diff --git a/examples/bela/simpleSynth_FX.dsp b/examples/bela/simpleSynth_FX.dsp index f22c3c8ead..d898b17882 100644 --- a/examples/bela/simpleSynth_FX.dsp +++ b/examples/bela/simpleSynth_FX.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); /////////////////////////////////////////////////////////////////////////////////////////////////// // diff --git a/examples/bela/simpleSynth_FX_Analog.dsp b/examples/bela/simpleSynth_FX_Analog.dsp index 8648421cab..c2c42c7ab7 100644 --- a/examples/bela/simpleSynth_FX_Analog.dsp +++ b/examples/bela/simpleSynth_FX_Analog.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); /////////////////////////////////////////////////////////////////////////////////////////////////// // diff --git a/examples/bela/trill_simple_monophonic_keyboard.dsp b/examples/bela/trill_simple_monophonic_keyboard.dsp index ca8122621c..33ce98435d 100644 --- a/examples/bela/trill_simple_monophonic_keyboard.dsp +++ b/examples/bela/trill_simple_monophonic_keyboard.dsp @@ -12,7 +12,7 @@ // - 1 craft sensor for the 1 octave keyboard and some control touch // - 1 square sensor for the control of the 2 Filter parameters cut off frequency & Q // -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); // Sensor Configuration ////////////////////////////////////////////////// declare trill_mappings "{ 'SQUARE' : {'0' : 40 } ; 'CRAFT' : {'0' : 48} }"; //i2c address for each trill sensor declare trill_settings "{ 'CRAFT_0' : { 'prescaler' : 4 ; 'threshold' : 0.015 }}"; //sensibility settings for the crafts sensors diff --git a/examples/bela/trill_simple_polyphonic_keyboard.dsp b/examples/bela/trill_simple_polyphonic_keyboard.dsp index 01684d207f..ac8d15e98f 100644 --- a/examples/bela/trill_simple_polyphonic_keyboard.dsp +++ b/examples/bela/trill_simple_polyphonic_keyboard.dsp @@ -12,7 +12,7 @@ // - 1 craft sensor for the 1 octave keyboard and some control touch // - 1 square sensor for the control of the 2 Filter parameters cut off frequency & Q // -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); // Sensor Configuration ////////////////////////////////////////////////// declare trill_mappings "{ 'SQUARE' : {'0' : 40 } ; 'CRAFT' : {'0' : 48} }"; //i2c address for each trill sensor declare trill_settings "{ 'CRAFT_0' : { 'prescaler' : 4 ; 'threshold' : 0.015 }}"; //sensibility settings for the crafts sensors diff --git a/examples/delayEcho/echo.dsp b/examples/delayEcho/echo.dsp index 760b458de3..0c31718e36 100644 --- a/examples/delayEcho/echo.dsp +++ b/examples/delayEcho/echo.dsp @@ -10,6 +10,6 @@ declare copyright "(c)GRAME 2006"; // A Simple Echo //----------------------------------------------- -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = vgroup("echo-simple", ef.echo1s); diff --git a/examples/delayEcho/quadEcho.dsp b/examples/delayEcho/quadEcho.dsp index bdb5d3fd86..0d6a72e33e 100644 --- a/examples/delayEcho/quadEcho.dsp +++ b/examples/delayEcho/quadEcho.dsp @@ -11,7 +11,7 @@ declare copyright "(c)GRAME 2007"; // A 1 second quadriphonic Echo //----------------------------------------------- -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = vgroup("stereo echo", multi(ef.echo1s, 4)) with { diff --git a/examples/delayEcho/smoothDelay.dsp b/examples/delayEcho/smoothDelay.dsp index 62c74e0165..4adcaad873 100644 --- a/examples/delayEcho/smoothDelay.dsp +++ b/examples/delayEcho/smoothDelay.dsp @@ -12,7 +12,7 @@ declare license "STK-4.3"; // click and doesn't transpose when the delay time is changed //------------------------------------------------------------- -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = par(i, 2, voice) with { diff --git a/examples/delayEcho/stereoEcho.dsp b/examples/delayEcho/stereoEcho.dsp index d57d7e8191..f3630d2b4b 100644 --- a/examples/delayEcho/stereoEcho.dsp +++ b/examples/delayEcho/stereoEcho.dsp @@ -11,6 +11,6 @@ declare copyright "(c)GRAME 2007"; // A 1 second Stereo Echo //----------------------------------------------- -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = vgroup("stereo echo", (ef.echo1s, ef.echo1s)); diff --git a/examples/delayEcho/tapiir.dsp b/examples/delayEcho/tapiir.dsp index 24852d0e14..2942aa0d78 100644 --- a/examples/delayEcho/tapiir.dsp +++ b/examples/delayEcho/tapiir.dsp @@ -11,7 +11,7 @@ declare copyright "(c)GRAME 2006"; // //====================================================== -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); dsize = 524288; diff --git a/examples/dynamic/compressor.dsp b/examples/dynamic/compressor.dsp index 545eca27c0..a81a30dcd1 100644 --- a/examples/dynamic/compressor.dsp +++ b/examples/dynamic/compressor.dsp @@ -3,6 +3,6 @@ declare version "0.0"; declare author "JOS, revised by RM"; declare description "Compressor demo application"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.compressor_demo; diff --git a/examples/dynamic/distortion.dsp b/examples/dynamic/distortion.dsp index 24852baf74..9e9540fc34 100644 --- a/examples/dynamic/distortion.dsp +++ b/examples/dynamic/distortion.dsp @@ -3,6 +3,6 @@ declare version "0.0"; declare author "JOS, revised by RM"; declare description "Distortion demo application."; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.cubicnl_demo; diff --git a/examples/dynamic/gateCompressor.dsp b/examples/dynamic/gateCompressor.dsp index c776747b67..e00d1cf81d 100644 --- a/examples/dynamic/gateCompressor.dsp +++ b/examples/dynamic/gateCompressor.dsp @@ -1,6 +1,6 @@ declare name "gateCompressor"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = vgroup("[1]", dm.sawtooth_demo) <: diff --git a/examples/dynamic/noiseGate.dsp b/examples/dynamic/noiseGate.dsp index 8d76d5ac41..33b4bbe9d6 100644 --- a/examples/dynamic/noiseGate.dsp +++ b/examples/dynamic/noiseGate.dsp @@ -3,6 +3,6 @@ declare version "0.0"; declare author "JOS, revised by RM"; declare description "Gate demo application."; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.gate_demo; diff --git a/examples/dynamic/volume.dsp b/examples/dynamic/volume.dsp index 74de992f80..228e2a303c 100644 --- a/examples/dynamic/volume.dsp +++ b/examples/dynamic/volume.dsp @@ -8,7 +8,7 @@ declare copyright "(c)GRAME 2006"; // Volume control in dB //----------------------------------------------- -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); gain = vslider("[1]", 0, -70, +4, 0.1) : ba.db2linear : si.smoo; diff --git a/examples/filtering/APF.dsp b/examples/filtering/APF.dsp index 8228d33345..0c07f32b2b 100644 --- a/examples/filtering/APF.dsp +++ b/examples/filtering/APF.dsp @@ -3,7 +3,7 @@ declare name "APF"; -import("maxmsp.lib"); +import("pkg:faust/faust/maxmsp.lib@1.1.0"); G = hslider("Gain [unit:dB]", 0, -10, 10, 0.1); F = hslider("Freq", 1000, 100, 10000, 1); diff --git a/examples/filtering/BPF.dsp b/examples/filtering/BPF.dsp index 7d817e2971..9a428d9c1b 100644 --- a/examples/filtering/BPF.dsp +++ b/examples/filtering/BPF.dsp @@ -3,7 +3,7 @@ declare name "BPF"; -import("maxmsp.lib"); +import("pkg:faust/faust/maxmsp.lib@1.1.0"); G = hslider("Gain [unit:dB]", 0, -10, 10, 0.1); F = hslider("Freq", 1000, 100, 10000, 1); diff --git a/examples/filtering/DNN.dsp b/examples/filtering/DNN.dsp index cd3c4b9bb0..b0428eba3e 100644 --- a/examples/filtering/DNN.dsp +++ b/examples/filtering/DNN.dsp @@ -4,7 +4,7 @@ declare name "DNN"; declare author "JOS"; declare license "STK-4.3"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); layerSizes = (8,5,8); // autoencoder with 8 in & out, 5-state hidden layer w(m,n,k) = m*100+n*10+k; // placeholder weights: m=layer, n=fromNode, k=destNode diff --git a/examples/filtering/HPF.dsp b/examples/filtering/HPF.dsp index df04a35de4..cec2350557 100644 --- a/examples/filtering/HPF.dsp +++ b/examples/filtering/HPF.dsp @@ -3,7 +3,7 @@ declare name "HPF"; -import("maxmsp.lib"); +import("pkg:faust/faust/maxmsp.lib@1.1.0"); G = hslider("Gain [unit:dB]", 0, -10, 10, 0.1); F = hslider("Freq", 1000, 100, 10000, 1); diff --git a/examples/filtering/LPF.dsp b/examples/filtering/LPF.dsp index e1351be3c0..8391bee9c7 100644 --- a/examples/filtering/LPF.dsp +++ b/examples/filtering/LPF.dsp @@ -3,7 +3,7 @@ declare name "LPF"; -import("maxmsp.lib"); +import("pkg:faust/faust/maxmsp.lib@1.1.0"); G = hslider("Gain [unit:dB]", 0, -10, 10, 0.1); F = hslider("Freq", 1000, 100, 10000, 1); diff --git a/examples/filtering/bandFilter.dsp b/examples/filtering/bandFilter.dsp index 47f9efc5bf..fea67ff0fd 100644 --- a/examples/filtering/bandFilter.dsp +++ b/examples/filtering/bandFilter.dsp @@ -7,7 +7,7 @@ declare author "Grame"; declare license "BSD"; declare copyright "(c)GRAME 2006"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); //---------------------second order filter-------------------------- // filter(Q,F,G) diff --git a/examples/filtering/cryBaby.dsp b/examples/filtering/cryBaby.dsp index 1644973425..4ca91424eb 100644 --- a/examples/filtering/cryBaby.dsp +++ b/examples/filtering/cryBaby.dsp @@ -1,4 +1,4 @@ declare name "cryBaby"; declare description "Application demonstrating the CryBaby wah pedal emulation"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.crybaby_demo; diff --git a/examples/filtering/diodeLadder.dsp b/examples/filtering/diodeLadder.dsp index fe27d0484d..16b645e1a4 100644 --- a/examples/filtering/diodeLadder.dsp +++ b/examples/filtering/diodeLadder.dsp @@ -2,7 +2,7 @@ declare name "diodeLadder"; declare description "Demonstration of diodeLadder"; declare author "Eric Tarr"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); Q = hslider("Q",1,0.7072,25,0.01); normFreq = hslider("freq",0.1,0,1,0.001):si.smoo; diff --git a/examples/filtering/filterBank.dsp b/examples/filtering/filterBank.dsp index 20d656608d..147d1f866d 100644 --- a/examples/filtering/filterBank.dsp +++ b/examples/filtering/filterBank.dsp @@ -1,6 +1,6 @@ declare name "filterBank"; declare description "Graphic Equalizer consisting of a filter-bank driving a bank of faders"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.filterbank_demo; diff --git a/examples/filtering/graphicEqLab.dsp b/examples/filtering/graphicEqLab.dsp index fd6e4f6b6c..f7cb597ec2 100644 --- a/examples/filtering/graphicEqLab.dsp +++ b/examples/filtering/graphicEqLab.dsp @@ -1,7 +1,7 @@ declare name "graphicEqLab"; declare description "Signal generators through a filter bank with spectrum analysis display"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = vgroup("[1]",dm.sawtooth_demo) : diff --git a/examples/filtering/highShelf.dsp b/examples/filtering/highShelf.dsp index 332bec6b4a..d2310ace0e 100644 --- a/examples/filtering/highShelf.dsp +++ b/examples/filtering/highShelf.dsp @@ -3,7 +3,7 @@ declare name "highShelf"; -import("maxmsp.lib"); +import("pkg:faust/faust/maxmsp.lib@1.1.0"); G = hslider("Gain [unit:dB]", 0, -10, 10, 0.1); F = hslider("Freq", 1000, 100, 10000, 1); diff --git a/examples/filtering/korg35HPF.dsp b/examples/filtering/korg35HPF.dsp index 28f9723178..5cb5047ace 100644 --- a/examples/filtering/korg35HPF.dsp +++ b/examples/filtering/korg35HPF.dsp @@ -2,7 +2,7 @@ declare name "korg35HPF"; declare description "Demonstration of the Korg 35 HPF"; declare author "Eric Tarr"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); Q = hslider("Q",1,0.5,10,0.01); normFreq = hslider("freq",0.5,0,1,0.001):si.smoo; diff --git a/examples/filtering/korg35LPF.dsp b/examples/filtering/korg35LPF.dsp index 827965f738..49259ec53a 100644 --- a/examples/filtering/korg35LPF.dsp +++ b/examples/filtering/korg35LPF.dsp @@ -2,7 +2,7 @@ declare name "korg35LPF"; declare description "Demonstration of the Korg 35 LPF"; declare author "Eric Tarr"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); Q = hslider("Q",1,0.5,10,0.01); normFreq = hslider("freq",0.5,0,1,0.001):si.smoo; diff --git a/examples/filtering/lfBoost.dsp b/examples/filtering/lfBoost.dsp index 0d16af56ed..7dcae8b12d 100644 --- a/examples/filtering/lfBoost.dsp +++ b/examples/filtering/lfBoost.dsp @@ -14,7 +14,7 @@ declare copyright "(c)GRAME 2006"; // page 53 : second order shelving filter design //------------------------------------------------------------------ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); //----------------------low frequency boost filter ------------------------------- // lfboost(F,G) diff --git a/examples/filtering/lowBoost.dsp b/examples/filtering/lowBoost.dsp index cdf70b00eb..d787f0e799 100644 --- a/examples/filtering/lowBoost.dsp +++ b/examples/filtering/lowBoost.dsp @@ -14,7 +14,7 @@ declare copyright "(c)GRAME 2006"; // page 53 : second order shelving filter design //------------------------------------------------------------------ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); //------------------- low-frequency shelving boost (table 2.3) -------------------- diff --git a/examples/filtering/lowCut.dsp b/examples/filtering/lowCut.dsp index 27e59c87dc..90b7d95150 100644 --- a/examples/filtering/lowCut.dsp +++ b/examples/filtering/lowCut.dsp @@ -14,7 +14,7 @@ declare copyright "(c)GRAME 2006"; // page 53 : second order shelving filter design //------------------------------------------------------------------ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); //------------------- low-frequency shelving cut (table 2.3) -------------------- diff --git a/examples/filtering/lowShelf.dsp b/examples/filtering/lowShelf.dsp index 3b4d0ec12a..45854e6616 100644 --- a/examples/filtering/lowShelf.dsp +++ b/examples/filtering/lowShelf.dsp @@ -3,7 +3,7 @@ declare name "lowShelf"; -import("maxmsp.lib"); +import("pkg:faust/faust/maxmsp.lib@1.1.0"); G = hslider("Gain [unit:dB]", 0, -10, 10, 0.1); F = hslider("Freq", 1000, 100, 10000, 1); diff --git a/examples/filtering/moogHalfLadder.dsp b/examples/filtering/moogHalfLadder.dsp index 02a063e893..bb4018fdfc 100644 --- a/examples/filtering/moogHalfLadder.dsp +++ b/examples/filtering/moogHalfLadder.dsp @@ -2,7 +2,7 @@ declare name "moogHalfLadder"; declare description "Demonstration of moogHalfLadder"; declare author "Eric Tarr"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); Q = hslider("Q",1,0.7072,25,0.01); normFreq = hslider("freq",0.1,0,1,0.001):si.smoo; diff --git a/examples/filtering/moogLadder.dsp b/examples/filtering/moogLadder.dsp index dd0beebcb3..512914af38 100644 --- a/examples/filtering/moogLadder.dsp +++ b/examples/filtering/moogLadder.dsp @@ -2,7 +2,7 @@ declare name "moogLadder"; declare description "Demonstration of moogLadder"; declare author "Eric Tarr"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); Q = hslider("Q",1,0.7072,25,0.01); normFreq = hslider("freq",0.1,0,1,0.001):si.smoo; diff --git a/examples/filtering/moogVCF.dsp b/examples/filtering/moogVCF.dsp index 45f256ec7b..8e8c348841 100644 --- a/examples/filtering/moogVCF.dsp +++ b/examples/filtering/moogVCF.dsp @@ -1,6 +1,6 @@ declare name "moogVCF"; declare description "Exercise and compare three Moog VCF implementations"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.moog_vcf_demo; diff --git a/examples/filtering/notch.dsp b/examples/filtering/notch.dsp index dcab9ecd3a..947e231d9e 100644 --- a/examples/filtering/notch.dsp +++ b/examples/filtering/notch.dsp @@ -3,7 +3,7 @@ declare name "notch"; -import("maxmsp.lib"); +import("pkg:faust/faust/maxmsp.lib@1.1.0"); G = hslider("Gain [unit:dB]", 0, -10, 10, 0.1); F = hslider("Freq", 1000, 100, 10000, 1); diff --git a/examples/filtering/oberheim.dsp b/examples/filtering/oberheim.dsp index 46bf360538..7ea4be7be4 100644 --- a/examples/filtering/oberheim.dsp +++ b/examples/filtering/oberheim.dsp @@ -2,7 +2,7 @@ declare name "oberheimBSF"; declare description "Demonstration of the Oberheim generic multi-outputs Filter"; declare author "Eric Tarr, GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); Q = hslider("Q",1,0.5,10,0.01); normFreq = hslider("freq",0.5,0,1,0.001):si.smoo; diff --git a/examples/filtering/oberheimBPF.dsp b/examples/filtering/oberheimBPF.dsp index f65562a200..bb2e9f3d68 100644 --- a/examples/filtering/oberheimBPF.dsp +++ b/examples/filtering/oberheimBPF.dsp @@ -2,7 +2,7 @@ declare name "oberheimBPF"; declare description "Demonstration of the Oberheim Band-Pass Filter"; declare author "Eric Tarr"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); Q = hslider("Q",1,0.5,10,0.01); normFreq = hslider("freq",0.5,0,1,0.001):si.smoo; diff --git a/examples/filtering/oberheimBSF.dsp b/examples/filtering/oberheimBSF.dsp index c3d025c4ef..0c6d6f9e88 100644 --- a/examples/filtering/oberheimBSF.dsp +++ b/examples/filtering/oberheimBSF.dsp @@ -2,7 +2,7 @@ declare name "oberheimBSF"; declare description "Demonstration of the Oberheim Band-Stop Filter"; declare author "Eric Tarr"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); Q = hslider("Q",1,0.5,10,0.01); normFreq = hslider("freq",0.5,0,1,0.001):si.smoo; diff --git a/examples/filtering/oberheimHPF.dsp b/examples/filtering/oberheimHPF.dsp index f1e860bce9..bc6c648ba3 100644 --- a/examples/filtering/oberheimHPF.dsp +++ b/examples/filtering/oberheimHPF.dsp @@ -2,7 +2,7 @@ declare name "oberheimHPF"; declare description "Demonstration of the Oberheim High-Pass Filter"; declare author "Eric Tarr"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); Q = hslider("Q",1,0.5,10,0.01); normFreq = hslider("freq",0.5,0,1,0.001):si.smoo; diff --git a/examples/filtering/oberheimLPF.dsp b/examples/filtering/oberheimLPF.dsp index 686ad631a2..d18f71dcc5 100644 --- a/examples/filtering/oberheimLPF.dsp +++ b/examples/filtering/oberheimLPF.dsp @@ -2,7 +2,7 @@ declare name "oberheimLPF"; declare description "Demonstration of the Oberheim Low-Pass Filter"; declare author "Eric Tarr"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); Q = hslider("Q",1,0.5,10,0.01); normFreq = hslider("freq",0.5,0,1,0.001):si.smoo; diff --git a/examples/filtering/parametricEqLab.dsp b/examples/filtering/parametricEqLab.dsp index 30a86460da..0fb140dc5b 100644 --- a/examples/filtering/parametricEqLab.dsp +++ b/examples/filtering/parametricEqLab.dsp @@ -1,7 +1,7 @@ declare name "parametricEqLab"; declare description "Demonstrate the Parametric Equalizer sections on test signals with spectrum analysis display"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = vgroup("[1]", dm.sawtooth_demo) : diff --git a/examples/filtering/parametricEqualizer.dsp b/examples/filtering/parametricEqualizer.dsp index a9ceacd417..869886e232 100644 --- a/examples/filtering/parametricEqualizer.dsp +++ b/examples/filtering/parametricEqualizer.dsp @@ -1,6 +1,6 @@ declare name "parametricEqualizer"; declare description "Exercise and compare Parametric Equalizer sections on test signals"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.parametric_eq_demo; diff --git a/examples/filtering/peakNotch.dsp b/examples/filtering/peakNotch.dsp index 671410132b..32e8e982dc 100644 --- a/examples/filtering/peakNotch.dsp +++ b/examples/filtering/peakNotch.dsp @@ -3,7 +3,7 @@ declare name "peakNotch"; -import("maxmsp.lib"); +import("pkg:faust/faust/maxmsp.lib@1.1.0"); G = hslider("Gain [unit: lin]", 1, 0, 8, 0.01); F = hslider("Freq", 1000, 100, 10000, 1); diff --git a/examples/filtering/peakingEQ.dsp b/examples/filtering/peakingEQ.dsp index cf234cf650..b9ff9f55d6 100644 --- a/examples/filtering/peakingEQ.dsp +++ b/examples/filtering/peakingEQ.dsp @@ -3,7 +3,7 @@ declare name "peakingEQ"; -import("maxmsp.lib"); +import("pkg:faust/faust/maxmsp.lib@1.1.0"); G = hslider("Gain [unit:dB]", 0, -10, 10, 0.1); F = hslider("Freq", 1000, 100, 10000, 1); diff --git a/examples/filtering/sallenKey2ndOrder.dsp b/examples/filtering/sallenKey2ndOrder.dsp index 92825dbb8c..710d8750d9 100644 --- a/examples/filtering/sallenKey2ndOrder.dsp +++ b/examples/filtering/sallenKey2ndOrder.dsp @@ -2,7 +2,7 @@ declare name "sallenKey2ndOrderBPF"; declare description "Demonstration of the Sallen-Key Second Order generic multi-ourputs Filter"; declare author "Eric Tarr, GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); Q = hslider("Q",1,0.5,10,0.01); normFreq = hslider("freq",0.5,0,1,0.001):si.smoo; diff --git a/examples/filtering/sallenKey2ndOrderBPF.dsp b/examples/filtering/sallenKey2ndOrderBPF.dsp index b05001f2ce..f657680e3b 100644 --- a/examples/filtering/sallenKey2ndOrderBPF.dsp +++ b/examples/filtering/sallenKey2ndOrderBPF.dsp @@ -2,7 +2,7 @@ declare name "sallenKey2ndOrderBPF"; declare description "Demonstration of the Sallen-Key Second Order Band-Pass Filter"; declare author "Eric Tarr"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); Q = hslider("Q",1,0.5,10,0.01); normFreq = hslider("freq",0.5,0,1,0.001):si.smoo; diff --git a/examples/filtering/sallenKey2ndOrderHPF.dsp b/examples/filtering/sallenKey2ndOrderHPF.dsp index a9b98536e8..020ecbb401 100644 --- a/examples/filtering/sallenKey2ndOrderHPF.dsp +++ b/examples/filtering/sallenKey2ndOrderHPF.dsp @@ -2,7 +2,7 @@ declare name "sallenKey2ndOrderHPF"; declare description "Demonstration of the Sallen-Key Second Order Low-Pass Filter"; declare author "Eric Tarr"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); Q = hslider("Q",1,0.5,10,0.01); normFreq = hslider("freq",0.5,0,1,0.001):si.smoo; diff --git a/examples/filtering/sallenKey2ndOrderLPF.dsp b/examples/filtering/sallenKey2ndOrderLPF.dsp index 83d10328f2..c0c1f6d660 100644 --- a/examples/filtering/sallenKey2ndOrderLPF.dsp +++ b/examples/filtering/sallenKey2ndOrderLPF.dsp @@ -2,7 +2,7 @@ declare name "sallenKey2ndOrderLPF"; declare description "Demonstration of the Sallen-Key Second Order Low-Pass Filter"; declare author "Eric Tarr"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); Q = hslider("Q",1,0.5,10,0.01); normFreq = hslider("freq",0.5,0,1,0.001):si.smoo; diff --git a/examples/filtering/sallenKeyOnePole.dsp b/examples/filtering/sallenKeyOnePole.dsp index 11dba8ab15..e4b40e81f1 100644 --- a/examples/filtering/sallenKeyOnePole.dsp +++ b/examples/filtering/sallenKeyOnePole.dsp @@ -2,7 +2,7 @@ declare name "sallenKeyOnePoleLPF"; declare description "Demonstration of the Sallen-Key One Pole generic multi-ouputs Filter"; declare author "Eric Tarr, GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); normFreq = hslider("freq",0.5,0,1,0.001):si.smoo; switch = checkbox("Saw/Noise"); diff --git a/examples/filtering/sallenKeyOnePoleHPF.dsp b/examples/filtering/sallenKeyOnePoleHPF.dsp index f5852afc88..d4cbccd265 100644 --- a/examples/filtering/sallenKeyOnePoleHPF.dsp +++ b/examples/filtering/sallenKeyOnePoleHPF.dsp @@ -2,7 +2,7 @@ declare name "sallenKeyOnePoleHPF"; declare description "Demonstration of the Sallen-Key One Pole High-Pass Filter"; declare author "Eric Tarr"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); normFreq = hslider("freq",0.5,0,1,0.001):si.smoo; switch = checkbox("Saw/Noise"); diff --git a/examples/filtering/sallenKeyOnePoleLPF.dsp b/examples/filtering/sallenKeyOnePoleLPF.dsp index 9426d71edf..e196053d8a 100644 --- a/examples/filtering/sallenKeyOnePoleLPF.dsp +++ b/examples/filtering/sallenKeyOnePoleLPF.dsp @@ -2,7 +2,7 @@ declare name "sallenKeyOnePoleLPF"; declare description "Demonstration of the Sallen-Key One Pole Low-Pass Filter"; declare author "Eric Tarr"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); normFreq = hslider("freq",0.5,0,1,0.001):si.smoo; switch = checkbox("Saw/Noise"); diff --git a/examples/filtering/spectralTilt.dsp b/examples/filtering/spectralTilt.dsp index 397c85adf3..ffbe812499 100644 --- a/examples/filtering/spectralTilt.dsp +++ b/examples/filtering/spectralTilt.dsp @@ -1,7 +1,7 @@ declare name "spectralTilt"; declare description "Demonstrate the Spectral Tilt effect on test signals"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); O = 2; // filter order diff --git a/examples/filtering/vcfWahLab.dsp b/examples/filtering/vcfWahLab.dsp index 7209df30a2..28f24db1d4 100644 --- a/examples/filtering/vcfWahLab.dsp +++ b/examples/filtering/vcfWahLab.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); declare description "Demonstrate competing variable-lowpass-filter effects on test signals with spectrum analysis display"; declare name "vcfWahLab"; diff --git a/examples/filtering/vocoder.dsp b/examples/filtering/vocoder.dsp index 3cc8ca4e46..925438ce5b 100644 --- a/examples/filtering/vocoder.dsp +++ b/examples/filtering/vocoder.dsp @@ -3,6 +3,6 @@ declare version "0.0"; declare author "RM"; declare description "Use example of the vocoder function where an impulse train is used as excitation."; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.vocoder_demo; diff --git a/examples/filtering/wahPedal.dsp b/examples/filtering/wahPedal.dsp index 802fbe68c3..f893947087 100644 --- a/examples/filtering/wahPedal.dsp +++ b/examples/filtering/wahPedal.dsp @@ -1,6 +1,6 @@ declare name "wahPedal"; declare description "Demonstrate the Fourth-Order Wah pedal (similar to the Moog VCF)"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.wah4_demo; diff --git a/examples/gameaudio/bubble.dsp b/examples/gameaudio/bubble.dsp index e487f7c7d2..dd37c0a7be 100644 --- a/examples/gameaudio/bubble.dsp +++ b/examples/gameaudio/bubble.dsp @@ -3,7 +3,7 @@ declare description "Production of a water drop bubble sound."; declare license "MIT"; declare copyright "(c) 2017: Yann Orlarey, GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); //---------------------------`bubble`-------------------------- // bubble(f0, trig) : produces a water drop bubble sound diff --git a/examples/gameaudio/complex_rain.dsp b/examples/gameaudio/complex_rain.dsp index e7d7132fb1..a0a0f15d1d 100644 --- a/examples/gameaudio/complex_rain.dsp +++ b/examples/gameaudio/complex_rain.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); //------------------------`rain_on_window`-------------------- // rain_on_window : produces a sound of raindrops on a glass diff --git a/examples/gameaudio/door.dsp b/examples/gameaudio/door.dsp index b86d1e5552..e06fd8e49c 100644 --- a/examples/gameaudio/door.dsp +++ b/examples/gameaudio/door.dsp @@ -23,7 +23,7 @@ // //------------------------------------------------------------ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); stickslip(force) = metro : timer : *(1000) : min(100) : /(100) : sqrt <: (+(0.1) : sqrt), (vline) : (*) diff --git a/examples/gameaudio/fire.dsp b/examples/gameaudio/fire.dsp index a45944235f..8be5aac0ab 100644 --- a/examples/gameaudio/fire.dsp +++ b/examples/gameaudio/fire.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); //----------------------------`fire`--------------------------- // fire(is_wet) : produces burning fire sound diff --git a/examples/gameaudio/insects.dsp b/examples/gameaudio/insects.dsp index d9c407f2a1..f102d4b3ee 100644 --- a/examples/gameaudio/insects.dsp +++ b/examples/gameaudio/insects.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); //---------------------------`cricket`------------------------- // cricket(f1, f2, trig) : produces a cricket chirp, diff --git a/examples/gameaudio/rain.dsp b/examples/gameaudio/rain.dsp index 09d12d0e13..f65730892a 100644 --- a/examples/gameaudio/rain.dsp +++ b/examples/gameaudio/rain.dsp @@ -14,7 +14,7 @@ // //---------------------------------------------------------- -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); rain(density,level) = no.multinoise(2) : par(i, 2, drop) : par(i, 2, *(level)) with { diff --git a/examples/gameaudio/thunder.dsp b/examples/gameaudio/thunder.dsp index 4c80da0756..8911b28b2d 100644 --- a/examples/gameaudio/thunder.dsp +++ b/examples/gameaudio/thunder.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); //---------------------------`thunder`------------------------ // thunder(trig) : produces a rumbling thunder, diff --git a/examples/gameaudio/wind.dsp b/examples/gameaudio/wind.dsp index a7d3da2f64..55d615a341 100644 --- a/examples/gameaudio/wind.dsp +++ b/examples/gameaudio/wind.dsp @@ -13,7 +13,7 @@ // //---------------------------------------------------------- -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); wind(force) = no.multinoise(2) : par(i, 2, ve.moog_vcf_2bn(force,freq)) : par(i, 2, *(force)) with { diff --git a/examples/gameaudio/windchimes.dsp b/examples/gameaudio/windchimes.dsp index 54ea5b6a42..589fa64c28 100644 --- a/examples/gameaudio/windchimes.dsp +++ b/examples/gameaudio/windchimes.dsp @@ -1,4 +1,4 @@ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); //-------------------------`windchimes`----------------------- // windchimes(wind) : simulates five windchimes in the wind diff --git a/examples/generator/churchOrgan.dsp b/examples/generator/churchOrgan.dsp index 66cfc6329f..296ef46bc3 100644 --- a/examples/generator/churchOrgan.dsp +++ b/examples/generator/churchOrgan.dsp @@ -1,7 +1,7 @@ declare name "churchOrgan"; declare author "Remi Chapelle"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); // GUI f = hslider("[00]freq[unit:Hz]",440,50,1000,0.1); diff --git a/examples/generator/filterOsc.dsp b/examples/generator/filterOsc.dsp index 5169367f4a..abe804cdaf 100644 --- a/examples/generator/filterOsc.dsp +++ b/examples/generator/filterOsc.dsp @@ -3,6 +3,6 @@ declare version "0.0"; declare author "JOS, revised by RM"; declare description "Simple application demoing filter based oscillators."; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.oscrs_demo; diff --git a/examples/generator/osc.dsp b/examples/generator/osc.dsp index 4ac20c2896..2c0df48d1c 100644 --- a/examples/generator/osc.dsp +++ b/examples/generator/osc.dsp @@ -8,7 +8,7 @@ declare copyright "(c)GRAME 2009"; // Sinusoidal Oscillator //----------------------------------------------- -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); vol = hslider("volume [unit:dB]", 0, -96, 0, 0.1) : ba.db2linear : si.smoo; freq = hslider("freq [unit:Hz]", 1000, 20, 24000, 1); diff --git a/examples/generator/osci.dsp b/examples/generator/osci.dsp index 19bc350769..4cec811568 100644 --- a/examples/generator/osci.dsp +++ b/examples/generator/osci.dsp @@ -9,7 +9,7 @@ declare copyright "(c)GRAME 2009"; // (with linear interpolation) //----------------------------------------------- -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); vol = hslider("volume [unit:dB]", 0, -96, 0, 0.1) : ba.db2linear : si.smoo ; freq = hslider("freq [unit:Hz]", 1000, 20, 24000, 1); diff --git a/examples/generator/sawtoothLab.dsp b/examples/generator/sawtoothLab.dsp index 8cf5ca8667..0b86c547d1 100644 --- a/examples/generator/sawtoothLab.dsp +++ b/examples/generator/sawtoothLab.dsp @@ -3,6 +3,6 @@ declare version "0.0"; declare author "JOS, revised by RM"; declare description "An application demonstrating the different sawtooth oscillators of Faust."; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.sawtooth_demo; diff --git a/examples/generator/virtualAnalog.dsp b/examples/generator/virtualAnalog.dsp index b45eb3a067..6fe5c9d6d4 100644 --- a/examples/generator/virtualAnalog.dsp +++ b/examples/generator/virtualAnalog.dsp @@ -3,6 +3,6 @@ declare version "0.0"; declare author "JOS, revised by RM"; declare description "Virtual analog oscillator demo application."; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.virtual_analog_oscillator_demo; diff --git a/examples/generator/virtualAnalogLab.dsp b/examples/generator/virtualAnalogLab.dsp index 0fabf73be0..93b5446dd0 100644 --- a/examples/generator/virtualAnalogLab.dsp +++ b/examples/generator/virtualAnalogLab.dsp @@ -1,6 +1,6 @@ declare name "virtualAnalogLab"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = vgroup("[1]", dm.virtual_analog_oscillator_demo) : diff --git a/examples/misc/autopan.dsp b/examples/misc/autopan.dsp index 23d1b328f4..48a30c25c8 100644 --- a/examples/misc/autopan.dsp +++ b/examples/misc/autopan.dsp @@ -26,7 +26,7 @@ // * `shape`: turning `shape` up pushes the waveforms to their // upper and lower limits, "hardening" their shape //------------------------------------------------------------ -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); autopan(amount, rate, phase, shape) = _*gainLeft, _*gainRight with { diff --git a/examples/misc/capture.dsp b/examples/misc/capture.dsp index 949c20d899..8f63280ead 100644 --- a/examples/misc/capture.dsp +++ b/examples/misc/capture.dsp @@ -9,7 +9,7 @@ declare copyright "(c)GRAME 2006"; // playback the recorded sound in loop //------------------------------------------------- -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); B = button("Capture"); // Capture sound while pressed I = int(B); // convert button signal from float to integer diff --git a/examples/misc/drumkit.dsp b/examples/misc/drumkit.dsp index 08fba7c4c7..5db4ebaf33 100644 --- a/examples/misc/drumkit.dsp +++ b/examples/misc/drumkit.dsp @@ -4,7 +4,7 @@ // drum machine //------------------------------------------------- -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); drumkit(gate, ks, ss, hs) = k_seq, s_seq, h_seq :> /(3) with { diff --git a/examples/misc/guitarix.dsp b/examples/misc/guitarix.dsp index d515987522..fd114a7287 100644 --- a/examples/misc/guitarix.dsp +++ b/examples/misc/guitarix.dsp @@ -29,11 +29,11 @@ declare author "Guitarix project (http://guitarix.sourceforge.net/)"; declare copyright "Guitarix project"; declare license "LGPL"; -ba = library("basics.lib"); -si = library("signals.lib"); +ba = library("pkg:faust/faust/basics.lib@1.19.1"); +si = library("pkg:faust/faust/signals.lib@1.6.0"); -import("tubes.lib"); -import("tonestacks.lib"); +import("pkg:faust/faust/tubes.lib@1.0.0"); +import("pkg:faust/faust/tonestacks.lib@1.28.0"); process = preamp; diff --git a/examples/misc/matrix.dsp b/examples/misc/matrix.dsp index bb137ac676..23be2619bc 100644 --- a/examples/misc/matrix.dsp +++ b/examples/misc/matrix.dsp @@ -8,7 +8,7 @@ declare copyright "(c)GRAME 2006"; // Audio Matrix : N inputs x M outputs //----------------------------------------------- -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); Fader(in) = ba.db2linear(vslider("Input %in", -10, -96, 4, 0.1)); Mixer(N,out) = hgroup("Output %out", par(in, N, *(Fader(in)) ) :> _ ); diff --git a/examples/misc/mixer.dsp b/examples/misc/mixer.dsp index 6495d7740b..cc620ff77c 100644 --- a/examples/misc/mixer.dsp +++ b/examples/misc/mixer.dsp @@ -4,7 +4,7 @@ declare author "Grame"; declare license "BSD"; declare copyright "(c)GRAME 2006-2020"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); //------------------------------------------------- // Simple 8x2 mixer diff --git a/examples/misc/statespace.dsp b/examples/misc/statespace.dsp index 34b191c726..42935d1f88 100644 --- a/examples/misc/statespace.dsp +++ b/examples/misc/statespace.dsp @@ -8,7 +8,7 @@ declare copyright "(c) Julius O. Smith III, 2020"; // General Linear State-Space Model Example //----------------------------------------------- -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); p = 2; // number of inputs q = 3; // number of outputs diff --git a/examples/misc/tester.dsp b/examples/misc/tester.dsp index 093baf2d82..892bd3aa25 100644 --- a/examples/misc/tester.dsp +++ b/examples/misc/tester.dsp @@ -10,7 +10,7 @@ declare copyright "(c)GRAME 2006"; // of 8 loudspeakers //----------------------------------------------- -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); // TODO: this should be rewritten with the pink noise function of noises.lib pink = f : (+ ~ g) with { diff --git a/examples/misc/tester2.dsp b/examples/misc/tester2.dsp index bb177d9057..3188dc98f2 100644 --- a/examples/misc/tester2.dsp +++ b/examples/misc/tester2.dsp @@ -9,7 +9,7 @@ declare copyright "(c)GRAME 2014"; // noise, pink) on a stereo channel //----------------------------------------------- -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); pink = f : (+ ~ g) with { f(x) = 0.04957526213389*x - 0.06305581334498*x' + 0.01483220320740*x''; diff --git a/examples/phasing/flanger.dsp b/examples/phasing/flanger.dsp index a8019468e3..345b082feb 100644 --- a/examples/phasing/flanger.dsp +++ b/examples/phasing/flanger.dsp @@ -3,6 +3,6 @@ declare version "0.0"; declare author "JOS, revised by RM"; declare description "Flanger effect application."; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.flanger_demo; diff --git a/examples/phasing/phaser.dsp b/examples/phasing/phaser.dsp index 12121cffc5..40af945d29 100644 --- a/examples/phasing/phaser.dsp +++ b/examples/phasing/phaser.dsp @@ -3,6 +3,6 @@ declare version "0.0"; declare author "JOS, revised by RM"; declare description "Phaser demo application."; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.phaser2_demo; diff --git a/examples/phasing/phaserFlangerLab.dsp b/examples/phasing/phaserFlangerLab.dsp index 8eec8ac4e2..e90cd8f76b 100644 --- a/examples/phasing/phaserFlangerLab.dsp +++ b/examples/phasing/phaserFlangerLab.dsp @@ -1,6 +1,6 @@ declare name "phaserFlangerLab"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); fx_stack = vgroup("[1]", dm.sawtooth_demo) <: diff --git a/examples/physicalModeling/brass.dsp b/examples/physicalModeling/brass.dsp index db73aa8d1d..a238d1fb73 100644 --- a/examples/physicalModeling/brass.dsp +++ b/examples/physicalModeling/brass.dsp @@ -3,6 +3,6 @@ declare description "Simple brass instrument physical model with physical parame declare license "MIT"; declare copyright "(c)Romain Michon, CCRMA (Stanford University), GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.brass_ui <: _,_; diff --git a/examples/physicalModeling/brassMIDI.dsp b/examples/physicalModeling/brassMIDI.dsp index b550b9ab6a..c5a819a960 100644 --- a/examples/physicalModeling/brassMIDI.dsp +++ b/examples/physicalModeling/brassMIDI.dsp @@ -3,6 +3,6 @@ declare description "Simple MIDI-controllable brass instrument physical model wi declare license "MIT"; declare copyright "(c)Romain Michon, CCRMA (Stanford University), GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.brass_ui_MIDI <: _,_; diff --git a/examples/physicalModeling/churchBell.dsp b/examples/physicalModeling/churchBell.dsp index 6bdaece56b..cbd64c5c59 100644 --- a/examples/physicalModeling/churchBell.dsp +++ b/examples/physicalModeling/churchBell.dsp @@ -3,6 +3,6 @@ declare description "Generic church bell physical model."; declare license "MIT"; declare copyright "(c)Romain Michon, CCRMA (Stanford University), GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.churchBell_ui <: _,_; diff --git a/examples/physicalModeling/clarinet.dsp b/examples/physicalModeling/clarinet.dsp index dc4588fcce..5d3da938dc 100644 --- a/examples/physicalModeling/clarinet.dsp +++ b/examples/physicalModeling/clarinet.dsp @@ -3,6 +3,6 @@ declare description "Simple clarinet physical model with physical parameters."; declare license "MIT"; declare copyright "(c)Romain Michon, CCRMA (Stanford University), GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.clarinet_ui <: _,_; diff --git a/examples/physicalModeling/clarinetMIDI.dsp b/examples/physicalModeling/clarinetMIDI.dsp index a090509905..9f6858cd84 100644 --- a/examples/physicalModeling/clarinetMIDI.dsp +++ b/examples/physicalModeling/clarinetMIDI.dsp @@ -3,6 +3,6 @@ declare description "Simple MIDI-controllable clarinet physical model with physi declare license "MIT"; declare copyright "(c)Romain Michon, CCRMA (Stanford University), GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.clarinet_ui_MIDI <: _,_; diff --git a/examples/physicalModeling/djembeMIDI.dsp b/examples/physicalModeling/djembeMIDI.dsp index 2205c7fb14..81a1b634f3 100644 --- a/examples/physicalModeling/djembeMIDI.dsp +++ b/examples/physicalModeling/djembeMIDI.dsp @@ -3,6 +3,6 @@ declare description "Simple MIDI-controllable djembe physical model."; declare license "MIT"; declare copyright "(c)Romain Michon, CCRMA (Stanford University), GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.djembe_ui_MIDI <: _,_; diff --git a/examples/physicalModeling/elecGuitarMIDI.dsp b/examples/physicalModeling/elecGuitarMIDI.dsp index 7231a0c59f..c840182f90 100644 --- a/examples/physicalModeling/elecGuitarMIDI.dsp +++ b/examples/physicalModeling/elecGuitarMIDI.dsp @@ -3,7 +3,7 @@ declare description "Simple electric guitar model without effect chain."; declare license "MIT"; declare copyright "(c)Romain Michon, CCRMA (Stanford University), GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); // TODO: We could potentially add an audio effect chain here diff --git a/examples/physicalModeling/englishBell.dsp b/examples/physicalModeling/englishBell.dsp index 63b4eb64f8..598483160d 100644 --- a/examples/physicalModeling/englishBell.dsp +++ b/examples/physicalModeling/englishBell.dsp @@ -3,6 +3,6 @@ declare description "English church bell physical model."; declare license "MIT"; declare copyright "(c)Romain Michon, CCRMA (Stanford University), GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.englishBell_ui <: _,_; diff --git a/examples/physicalModeling/flute.dsp b/examples/physicalModeling/flute.dsp index 9fa8bcd414..e4e8a80ed2 100644 --- a/examples/physicalModeling/flute.dsp +++ b/examples/physicalModeling/flute.dsp @@ -3,6 +3,6 @@ declare description "Simple flute physical model with physical parameters."; declare license "MIT"; declare copyright "(c)Romain Michon, CCRMA (Stanford University), GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.flute_ui <: _,_; diff --git a/examples/physicalModeling/fluteMIDI.dsp b/examples/physicalModeling/fluteMIDI.dsp index 18fa066937..104a7ed959 100644 --- a/examples/physicalModeling/fluteMIDI.dsp +++ b/examples/physicalModeling/fluteMIDI.dsp @@ -3,6 +3,6 @@ declare description "Simple MIDI-controllable flute physical model with physical declare license "MIT"; declare copyright "(c)Romain Michon, CCRMA (Stanford University), GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.flute_ui_MIDI <: _,_; diff --git a/examples/physicalModeling/frenchBell.dsp b/examples/physicalModeling/frenchBell.dsp index 52bb8df23c..fee9451301 100644 --- a/examples/physicalModeling/frenchBell.dsp +++ b/examples/physicalModeling/frenchBell.dsp @@ -3,6 +3,6 @@ declare description "French church bell physical model."; declare license "MIT"; declare copyright "(c)Romain Michon, CCRMA (Stanford University), GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.frenchBell_ui <: _,_; diff --git a/examples/physicalModeling/germanBell.dsp b/examples/physicalModeling/germanBell.dsp index b6376532a7..d31dacb535 100644 --- a/examples/physicalModeling/germanBell.dsp +++ b/examples/physicalModeling/germanBell.dsp @@ -3,6 +3,6 @@ declare description "German church bell physical model."; declare license "MIT"; declare copyright "(c)Romain Michon, CCRMA (Stanford University), GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.germanBell_ui <: _,_; diff --git a/examples/physicalModeling/guitarMIDI.dsp b/examples/physicalModeling/guitarMIDI.dsp index d374d6b9d1..53f05fb0e7 100644 --- a/examples/physicalModeling/guitarMIDI.dsp +++ b/examples/physicalModeling/guitarMIDI.dsp @@ -3,6 +3,6 @@ declare description "Simple acoustic guitar model with steel strings."; declare license "MIT"; declare copyright "(c)Romain Michon, CCRMA (Stanford University), GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.guitar_ui_MIDI <: _,_; diff --git a/examples/physicalModeling/karplus.dsp b/examples/physicalModeling/karplus.dsp index 2c5421c895..d2e5122d7e 100644 --- a/examples/physicalModeling/karplus.dsp +++ b/examples/physicalModeling/karplus.dsp @@ -3,6 +3,6 @@ declare description "Simple call of the Karplus-Strong model for the Faust physi declare license "MIT"; declare copyright "(c)Romain Michon, CCRMA (Stanford University), GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.ks_ui_MIDI <: _,_; diff --git a/examples/physicalModeling/marimbaMIDI.dsp b/examples/physicalModeling/marimbaMIDI.dsp index 1ebabd07d5..12d724d3fa 100644 --- a/examples/physicalModeling/marimbaMIDI.dsp +++ b/examples/physicalModeling/marimbaMIDI.dsp @@ -5,6 +5,6 @@ declare description "Simple MIDI-controllable marimba physical model."; declare license "MIT"; declare copyright "(c)Romain Michon, CCRMA (Stanford University), GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.marimba_ui_MIDI <: _,_; diff --git a/examples/physicalModeling/modularInterpInstrMIDI.dsp b/examples/physicalModeling/modularInterpInstrMIDI.dsp index ecc3f38ac7..158f29fc5b 100644 --- a/examples/physicalModeling/modularInterpInstrMIDI.dsp +++ b/examples/physicalModeling/modularInterpInstrMIDI.dsp @@ -3,6 +3,6 @@ declare description "String instrument with a modular body"; declare license "MIT"; declare copyright "(c)Romain Michon & John Granzow, CCRMA (Stanford University), GRAME, University of Michigan"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.modularInterpInstr_ui_MIDI <: _,_; diff --git a/examples/physicalModeling/nylonGuitarMIDI.dsp b/examples/physicalModeling/nylonGuitarMIDI.dsp index d1e4317337..db08a28e41 100644 --- a/examples/physicalModeling/nylonGuitarMIDI.dsp +++ b/examples/physicalModeling/nylonGuitarMIDI.dsp @@ -3,6 +3,6 @@ declare description "Simple acoustic guitar model with nylon strings."; declare license "MIT"; declare copyright "(c)Romain Michon, CCRMA (Stanford University), GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.nylonGuitar_ui_MIDI <: _,_; diff --git a/examples/physicalModeling/russianBell.dsp b/examples/physicalModeling/russianBell.dsp index db3e3a9157..bbf91d43d5 100644 --- a/examples/physicalModeling/russianBell.dsp +++ b/examples/physicalModeling/russianBell.dsp @@ -3,6 +3,6 @@ declare description "Russian church bell physical model."; declare license "MIT"; declare copyright "(c)Romain Michon, CCRMA (Stanford University), GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.russianBell_ui <: _,_; diff --git a/examples/physicalModeling/standardBell.dsp b/examples/physicalModeling/standardBell.dsp index f8adaf773b..e808c50896 100644 --- a/examples/physicalModeling/standardBell.dsp +++ b/examples/physicalModeling/standardBell.dsp @@ -3,6 +3,6 @@ declare description "Standard church bell physical model."; declare license "MIT"; declare copyright "(c)Romain Michon, CCRMA (Stanford University), GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.standardBell_ui <: _,_; diff --git a/examples/physicalModeling/violin.dsp b/examples/physicalModeling/violin.dsp index 2a62fcb137..8a3863c767 100644 --- a/examples/physicalModeling/violin.dsp +++ b/examples/physicalModeling/violin.dsp @@ -3,6 +3,6 @@ declare description "Simple violin physical model controlled with continuous par declare license "MIT"; declare copyright "(c)Romain Michon, CCRMA (Stanford University), GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.violin_ui <: _,_; diff --git a/examples/physicalModeling/violinMIDI.dsp b/examples/physicalModeling/violinMIDI.dsp index f432ab86ce..2581971cb5 100644 --- a/examples/physicalModeling/violinMIDI.dsp +++ b/examples/physicalModeling/violinMIDI.dsp @@ -3,6 +3,6 @@ declare description "Simple MIDI-controllable violin physical model."; declare license "MIT"; declare copyright "(c)Romain Michon, CCRMA (Stanford University), GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.violin_ui_MIDI <: _,_; diff --git a/examples/physicalModeling/vocalBP.dsp b/examples/physicalModeling/vocalBP.dsp index d2db5f28ca..af694f9302 100644 --- a/examples/physicalModeling/vocalBP.dsp +++ b/examples/physicalModeling/vocalBP.dsp @@ -3,6 +3,6 @@ declare description "Simple source-filter vocal synthesizer."; declare license "MIT"; declare copyright "(c)Romain Michon, CCRMA (Stanford University), GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.SFFormantModelBP_ui <: _,_; diff --git a/examples/physicalModeling/vocalBPMIDI.dsp b/examples/physicalModeling/vocalBPMIDI.dsp index 11eb0a8363..bcfcf10742 100644 --- a/examples/physicalModeling/vocalBPMIDI.dsp +++ b/examples/physicalModeling/vocalBPMIDI.dsp @@ -3,6 +3,6 @@ declare description "Simple MIDI-controllable source-filter vocal synthesizer."; declare license "MIT"; declare copyright "(c)Romain Michon, CCRMA (Stanford University), GRAME"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.SFFormantModelBP_ui_MIDI <: _,_; diff --git a/examples/physicalModeling/vocalFOF.dsp b/examples/physicalModeling/vocalFOF.dsp index c832a0c9d7..864b40a062 100644 --- a/examples/physicalModeling/vocalFOF.dsp +++ b/examples/physicalModeling/vocalFOF.dsp @@ -3,6 +3,6 @@ declare description "FOF vocal synthesizer."; declare license "MIT"; declare copyright "(c)Mike Olsen, CCRMA (Stanford University)"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.SFFormantModelFofSmooth_ui <: _,_; diff --git a/examples/physicalModeling/vocalFOFMIDI.dsp b/examples/physicalModeling/vocalFOFMIDI.dsp index 799f80b56f..a4c0b6f0be 100644 --- a/examples/physicalModeling/vocalFOFMIDI.dsp +++ b/examples/physicalModeling/vocalFOFMIDI.dsp @@ -3,6 +3,6 @@ declare description "MIDI-controllable FOF vocal synthesizer."; declare license "MIT"; declare copyright "(c)Mike Olsen, CCRMA (Stanford University)"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = pm.SFFormantModelFofSmooth_ui_MIDI <: _,_; diff --git a/examples/pitchShifting/pitchShifter.dsp b/examples/pitchShifting/pitchShifter.dsp index 3c3f105b81..cc9054ac37 100644 --- a/examples/pitchShifting/pitchShifter.dsp +++ b/examples/pitchShifting/pitchShifter.dsp @@ -8,7 +8,7 @@ declare copyright "(c)GRAME 2006"; // Very simple real time pitch shifter //-------------------------------------- -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); pitchshifter = vgroup("Pitch Shifter", ef.transpose( hslider("window (samples)", 1000, 50, 10000, 1), diff --git a/examples/psychoacoustic/harmonicExciter.dsp b/examples/psychoacoustic/harmonicExciter.dsp index 54303ee922..00e29a417f 100644 --- a/examples/psychoacoustic/harmonicExciter.dsp +++ b/examples/psychoacoustic/harmonicExciter.dsp @@ -5,6 +5,6 @@ declare exciter_version "1.0"; declare exciter_license "MIT License (MIT)"; declare description "Psychoacoustic harmonic exciter, with GUI"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.exciter; diff --git a/examples/quantizing/quantizedChords.dsp b/examples/quantizing/quantizedChords.dsp index bd0cea8991..63735a52cf 100644 --- a/examples/quantizing/quantizedChords.dsp +++ b/examples/quantizing/quantizedChords.dsp @@ -27,7 +27,7 @@ declare description "Generate chords using the quantizer functions"; declare author "CesarChaussinand"; declare license "MIT"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); Nb = 3; diff --git a/examples/reverb/dattorro.dsp b/examples/reverb/dattorro.dsp index cddabe86b0..3d9c298f07 100644 --- a/examples/reverb/dattorro.dsp +++ b/examples/reverb/dattorro.dsp @@ -3,6 +3,6 @@ declare version "0.1"; declare author "Jakob Zerbian"; declare description "Dattorro demo application."; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.dattorro_rev_demo; diff --git a/examples/reverb/fdnRev.dsp b/examples/reverb/fdnRev.dsp index 13d9a268f5..508b3c513a 100644 --- a/examples/reverb/fdnRev.dsp +++ b/examples/reverb/fdnRev.dsp @@ -3,6 +3,6 @@ declare version "0.0"; declare author "JOS, Revised by RM"; declare description "A feedback delay network reverb."; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.fdnrev0_demo(16,5,3); diff --git a/examples/reverb/freeverb.dsp b/examples/reverb/freeverb.dsp index 61494404e9..d279bab239 100644 --- a/examples/reverb/freeverb.dsp +++ b/examples/reverb/freeverb.dsp @@ -3,6 +3,6 @@ declare version "0.0"; declare author "RM"; declare description "Freeverb demo application."; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.freeverb_demo; diff --git a/examples/reverb/greyhole.dsp b/examples/reverb/greyhole.dsp index d6e943a1ce..d62b8a3419 100644 --- a/examples/reverb/greyhole.dsp +++ b/examples/reverb/greyhole.dsp @@ -3,6 +3,6 @@ declare version "0.1"; declare author "GRAME"; declare description "Greyhole demo application."; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.greyhole_demo; diff --git a/examples/reverb/jprev.dsp b/examples/reverb/jprev.dsp index 334254123e..7f9ad10096 100644 --- a/examples/reverb/jprev.dsp +++ b/examples/reverb/jprev.dsp @@ -3,6 +3,6 @@ declare version "0.1"; declare author "GRAME"; declare description "Jprev demo application."; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.jprev_demo; diff --git a/examples/reverb/reverbDesigner.dsp b/examples/reverb/reverbDesigner.dsp index 89d44c45cf..c974352ca1 100644 --- a/examples/reverb/reverbDesigner.dsp +++ b/examples/reverb/reverbDesigner.dsp @@ -3,7 +3,7 @@ declare version "0.1"; declare author "JOS"; declare description "Workbench for building a custom Feedback Delay Network (FDN) Reverebator"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); N = 16; // Feedback Delay Network (FDN) order (power of 2, 2 to 16) NB = 5; // Number of T60-controlled frequency-bands (3 or more) diff --git a/examples/reverb/reverbTester.dsp b/examples/reverb/reverbTester.dsp index 70a1adf0f6..76e580273b 100644 --- a/examples/reverb/reverbTester.dsp +++ b/examples/reverb/reverbTester.dsp @@ -3,6 +3,6 @@ declare version "0.0"; declare author "RM"; declare description "Handy test inputs for reverberator demos below."; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.stereo_reverb_tester; diff --git a/examples/reverb/vital_rev.dsp b/examples/reverb/vital_rev.dsp index 4237059766..d19d6c24e7 100644 --- a/examples/reverb/vital_rev.dsp +++ b/examples/reverb/vital_rev.dsp @@ -3,6 +3,6 @@ declare version "0.1"; declare author "David Braun"; declare description "Vital demo application."; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.vital_rev_demo; diff --git a/examples/reverb/zitaRev.dsp b/examples/reverb/zitaRev.dsp index c9fb3b5f97..5a004f020d 100644 --- a/examples/reverb/zitaRev.dsp +++ b/examples/reverb/zitaRev.dsp @@ -3,6 +3,6 @@ declare version "0.0"; declare author "JOS, Revised by RM"; declare description "Example GUI for `zita_rev1_stereo` (mostly following the Linux `zita-rev1` GUI)."; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.zita_rev1; diff --git a/examples/reverb/zitaRevFDN.dsp b/examples/reverb/zitaRevFDN.dsp index c51ddc9fb1..b70d4d33cc 100644 --- a/examples/reverb/zitaRevFDN.dsp +++ b/examples/reverb/zitaRevFDN.dsp @@ -3,6 +3,6 @@ declare version "0.0"; declare author "JOS, Revised by RM"; declare description "Reverb demo application based on `zita_rev_fdn`."; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); process = dm.zita_rev_fdn_demo; diff --git a/examples/smartKeyboard/acGuitar.dsp b/examples/smartKeyboard/acGuitar.dsp index 09657c1a2a..d186d86da7 100644 --- a/examples/smartKeyboard/acGuitar.dsp +++ b/examples/smartKeyboard/acGuitar.dsp @@ -61,7 +61,7 @@ declare interface "SmartKeyboard{ 'Keyboard 6 - Key 5 - Label':'S5' }"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); // SMARTKEYBOARD PARAMS kbfreq(0) = hslider("kb0freq",164.8,20,10000,0.01); diff --git a/examples/smartKeyboard/bells.dsp b/examples/smartKeyboard/bells.dsp index c3cc877b2e..b11f000046 100644 --- a/examples/smartKeyboard/bells.dsp +++ b/examples/smartKeyboard/bells.dsp @@ -47,7 +47,7 @@ declare interface "SmartKeyboard{ 'Keyboard 1 - Key 1 - Label':'Russian Bell' }"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); // SMARTKEYBOARD PARAMS kb0k0status = hslider("kb0k0status",0,0,1,1) : min(1) : int; diff --git a/examples/smartKeyboard/bowed.dsp b/examples/smartKeyboard/bowed.dsp index b567f41bab..218202f0c5 100644 --- a/examples/smartKeyboard/bowed.dsp +++ b/examples/smartKeyboard/bowed.dsp @@ -58,7 +58,7 @@ declare interface "SmartKeyboard{ 'Keyboard 4 - Key 0 - Label':'Bow' }"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); // parameters f = hslider("freq",400,50,2000,0.01); diff --git a/examples/smartKeyboard/brass.dsp b/examples/smartKeyboard/brass.dsp index d4ed673ce6..0024b0243a 100644 --- a/examples/smartKeyboard/brass.dsp +++ b/examples/smartKeyboard/brass.dsp @@ -44,7 +44,7 @@ declare interface "SmartKeyboard{ 'Keyboard 1 - Key 2 - Label':'P3' }"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); // SMARTKEYBOARD PARAMS kb0k0x = hslider("kb0k0x",0,0,1,1); diff --git a/examples/smartKeyboard/clarinet.dsp b/examples/smartKeyboard/clarinet.dsp index 84122f5c72..b7d8cce795 100644 --- a/examples/smartKeyboard/clarinet.dsp +++ b/examples/smartKeyboard/clarinet.dsp @@ -43,7 +43,7 @@ declare interface "SmartKeyboard{ 'Keyboard 1 - Key 4 - Label':'O-' }"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); // SMARTKEYBOARD PARAMS kb0k0status = hslider("kb0k0status",0,0,1,1) : min(1) : int; diff --git a/examples/smartKeyboard/crazyGuiro.dsp b/examples/smartKeyboard/crazyGuiro.dsp index 33492dc6ef..e9813bc2b6 100644 --- a/examples/smartKeyboard/crazyGuiro.dsp +++ b/examples/smartKeyboard/crazyGuiro.dsp @@ -30,7 +30,7 @@ // MIT Licence: https://opensource.org/licenses/MIT //######################################################################################## -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); //========================= Smart Keyboard Configuration ================================= diff --git a/examples/smartKeyboard/drums.dsp b/examples/smartKeyboard/drums.dsp index 441c95713d..8f4efade33 100644 --- a/examples/smartKeyboard/drums.dsp +++ b/examples/smartKeyboard/drums.dsp @@ -48,7 +48,7 @@ declare interface "SmartKeyboard{ 'Keyboard 1 - Key 0 - Label':'Low' }"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); // standard parameters gate = button("gate"); diff --git a/examples/smartKeyboard/dubDub.dsp b/examples/smartKeyboard/dubDub.dsp index 5744a90790..ad5c713ac8 100644 --- a/examples/smartKeyboard/dubDub.dsp +++ b/examples/smartKeyboard/dubDub.dsp @@ -28,7 +28,7 @@ declare name "dubDub"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); //========================= Smart Keyboard Configuration ================================= // (1 keyboards with 1 key configured as a pad. diff --git a/examples/smartKeyboard/elecGuitar.dsp b/examples/smartKeyboard/elecGuitar.dsp index 27e9b3aee7..9bc2d1eb9b 100644 --- a/examples/smartKeyboard/elecGuitar.dsp +++ b/examples/smartKeyboard/elecGuitar.dsp @@ -47,7 +47,7 @@ declare interface "SmartKeyboard{ 'Rounding Mode':'2' }"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); // standard parameters f = hslider("freq",300,50,2000,0.01); diff --git a/examples/smartKeyboard/fm.dsp b/examples/smartKeyboard/fm.dsp index a5629b555f..073fd743bd 100644 --- a/examples/smartKeyboard/fm.dsp +++ b/examples/smartKeyboard/fm.dsp @@ -27,7 +27,7 @@ declare name "fm"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); //========================= Smart Keyboard Configuration ================================= // (1 keyboards with 1 key configured as a pad. diff --git a/examples/smartKeyboard/frog.dsp b/examples/smartKeyboard/frog.dsp index cf3c707771..111a069f8a 100644 --- a/examples/smartKeyboard/frog.dsp +++ b/examples/smartKeyboard/frog.dsp @@ -28,7 +28,7 @@ declare name "frog"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); //========================= Smart Keyboard Configuration ================================= // (1 keyboards with 1 key configured as a pad. diff --git a/examples/smartKeyboard/harp.dsp b/examples/smartKeyboard/harp.dsp index bd4bd25135..d5004f7366 100644 --- a/examples/smartKeyboard/harp.dsp +++ b/examples/smartKeyboard/harp.dsp @@ -28,7 +28,7 @@ declare name "harp"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); //========================= Smart Keyboard Configuration ================================= // (8 keyboards with 16 keys configured as a pitch matrix. diff --git a/examples/smartKeyboard/midiOnly.dsp b/examples/smartKeyboard/midiOnly.dsp index 53f478fc5e..98fcf81d6d 100644 --- a/examples/smartKeyboard/midiOnly.dsp +++ b/examples/smartKeyboard/midiOnly.dsp @@ -40,7 +40,7 @@ declare interface "SmartKeyboard{ 'Keyboard 0 - Key 1 - Label':'Mod Freq' }"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); f = hslider("freq",300,50,2000,0.01); bend = ba.semi2ratio(hslider("bend[midi:pitchwheel]",0,-2,2,0.001)) : si.polySmooth(gate,0.999,1); diff --git a/examples/smartKeyboard/multiSynth.dsp b/examples/smartKeyboard/multiSynth.dsp index 36a65254b2..33d6d8bca4 100644 --- a/examples/smartKeyboard/multiSynth.dsp +++ b/examples/smartKeyboard/multiSynth.dsp @@ -44,7 +44,7 @@ declare interface "SmartKeyboard{ 'Keyboard 3 - Send Y':'1' }"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); // standard parameters f = hslider("freq",300,50,2000,0.01); diff --git a/examples/smartKeyboard/toy.dsp b/examples/smartKeyboard/toy.dsp index 16838ba3e9..8cb87d6645 100644 --- a/examples/smartKeyboard/toy.dsp +++ b/examples/smartKeyboard/toy.dsp @@ -50,7 +50,7 @@ declare interface "SmartKeyboard{ 'Keyboard 0 - Send Numbered Y':'1' }"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); // parameters x0 = hslider("x0",0.5,0,1,0.01) : si.smoo; diff --git a/examples/smartKeyboard/trumpet.dsp b/examples/smartKeyboard/trumpet.dsp index 2662d0ad66..31f4ae183a 100644 --- a/examples/smartKeyboard/trumpet.dsp +++ b/examples/smartKeyboard/trumpet.dsp @@ -18,7 +18,7 @@ // MIT Licence: https://opensource.org/licenses/MIT //######################################################################################## -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); declare interface "SmartKeyboard{ 'Number of Keyboards':'5', diff --git a/examples/smartKeyboard/turenas.dsp b/examples/smartKeyboard/turenas.dsp index 864795eed3..63834ede22 100644 --- a/examples/smartKeyboard/turenas.dsp +++ b/examples/smartKeyboard/turenas.dsp @@ -29,7 +29,7 @@ declare name "turenas"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); //========================= Smart Keyboard Configuration ================================= // (10 keyboards with 18 keys each configured as a pitch matrix. diff --git a/examples/smartKeyboard/violin.dsp b/examples/smartKeyboard/violin.dsp index be45ced1b0..da275adb7d 100644 --- a/examples/smartKeyboard/violin.dsp +++ b/examples/smartKeyboard/violin.dsp @@ -54,7 +54,7 @@ declare interface "SmartKeyboard{ 'Keyboard 4 - Static Mode':'1' }"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); // SMARTKEYBOARD PARAMS kbfreq(0) = hslider("kb0freq",220,20,10000,0.01); diff --git a/examples/smartKeyboard/violin2.dsp b/examples/smartKeyboard/violin2.dsp index 41190f0c0e..20a8466d6c 100644 --- a/examples/smartKeyboard/violin2.dsp +++ b/examples/smartKeyboard/violin2.dsp @@ -49,7 +49,7 @@ declare interface "SmartKeyboard{ 'Keyboard 3 - Send Y':'1' }"; -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); // SMARTKEYBOARD PARAMS kbfreq(0) = hslider("kb0freq",220,20,10000,0.01); diff --git a/examples/smartKeyboard/vocal.dsp b/examples/smartKeyboard/vocal.dsp index fc35016466..c8daa855b3 100644 --- a/examples/smartKeyboard/vocal.dsp +++ b/examples/smartKeyboard/vocal.dsp @@ -18,7 +18,7 @@ // MIT Licence: https://opensource.org/licenses/MIT //######################################################################################## -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); declare interface "SmartKeyboard{ 'Number of Keyboards':'1', diff --git a/examples/spat/spat.dsp b/examples/spat/spat.dsp index 111e5e3bd2..60283d9162 100644 --- a/examples/spat/spat.dsp +++ b/examples/spat/spat.dsp @@ -11,7 +11,7 @@ declare copyright "(c)GRAME 2006"; // //========================================================== -import("stdfaust.lib"); +import("pkg:faust/faust/stdfaust.lib@1.0.0"); //------------------------------------------------------ // EXEMPLE : une entree mono spatialisee sur 8 sorties diff --git a/libraries b/libraries index c27997b478..a28badb72e 160000 --- a/libraries +++ b/libraries @@ -1 +1 @@ -Subproject commit c27997b47829ccad5e84d0d4b77095fcfc34c186 +Subproject commit a28badb72ec8d6c92e61a75157233c3ae523d9a3 diff --git a/test.py b/test.py new file mode 100644 index 0000000000..1bf9c04855 --- /dev/null +++ b/test.py @@ -0,0 +1,36 @@ +import os +import subprocess +from colorama import init, Fore, Style +import sys + +# Initialize colorama +init(autoreset=True) + +def compile_faust_file(file_path): + try: + # Replace 'faust' with the full path if it's not in your PATH + result = subprocess.run(['faust', file_path], check=True, capture_output=True) + return True, result.stdout.decode() + except subprocess.CalledProcessError as e: + return False, e.stderr.decode() + +def search_and_compile_dsp_files(root_dir): + for dirpath, _, filenames in os.walk(root_dir): + for filename in filenames: + if filename.endswith('.dsp'): + file_path = os.path.join(dirpath, filename) + success, _ = compile_faust_file(file_path) + if success: + print(f"{Fore.GREEN}Passed: {file_path}") + else: + print(f"{Fore.RED}Failed: {file_path}") + +# Set the root directory to search from + +dir = "examples" + + +if(sys.argv.__len__() > 1): + dir = sys.argv[1] + +search_and_compile_dsp_files(dir)