Updated lick to use new @import semantics & inquiry into adding lick to package manager#55
Updated lick to use new @import semantics & inquiry into adding lick to package manager#55nshaheed wants to merge 5 commits intoheuermh:masterfrom
Conversation
|
Awesome! Thank you, @nshaheed! It may take me a little while to go over this and absorb the new reality 😉 |
|
haha take your time, let me know if you have any questions! |
|
|
||
| */ | ||
|
|
||
| @import "../lick/effect/AdsrTremolo" |
There was a problem hiding this comment.
If LiCK were a package, would these still need to be relative? or just
@import "lick"
There was a problem hiding this comment.
So, import has special semantics for @import with packages. A package is just a directory in a pre-determined packages dir. For example, on mac and linux it would be ~/.chuck/packages/LiCK/.
If you are importing a file that's at the top-level of your package dir you can do this:
@import "lick"
And chuck will automatically find the lick.ck file in the LiCK/ directory.
However, if you want to import a file that in a subdirectory of a package, for example one of the ladspa files, you actually need to specificy the package directory in the import filepath:
@import "LiCK/lick/ladspa/caps/Amp"
The relative imports here are relative to the file that calls @import. This means that these imports will work both if LiCK is installed as a package or if someone downloads it from github directly and puts it in their project.
| class ClosedHat extends Sample | ||
| { | ||
| { | ||
| "samples/AkaiMpc60/ClosedHat.wav" => buf.read; | ||
| me.dir() + "../../samples/AkaiMpc60/ClosedHat.wav" => buf.read; |
There was a problem hiding this comment.
Can samples be part of a package? If not, am not sure how this relative directory lookup would work outside of this source tree
There was a problem hiding this comment.
Yes! Any arbitrary files can be included in the package. The package version of this would just preserve the directory structure of the repo. How are these samplers typically used? Do people mostly copy and pasted the needed parts of LiCK?
|
There has never been a "release" of LiCK, so I think I will plan to make a version 1.0 release on git |
|
That makes sense! Packages expect a versioning format with three numbers: |
|
Any questions or anything I can help with wrt this pull request? :) |
|
+1 to this, would love to (more easily) import just what i need from lick |
Hi Michael!
I'm with the chuck dev team. As of 1.5.4.0 chuck now has the
@importsyntax, which works like most other language's import system where it adds the imported file to the type system at compile time, which means thatMachine.addis not longer necessary for adding files to the VM!This behemoth of a PR moves lick over to exclusively using
@import, and additionally I added alick.ckfile which imports all the different classes (except for the ones with optional dependencies). So you could do something like this:instead of having a score file that has to
Machine.add("import.ck")and every other dependent file.Of course, this is a breaking change to lick and would require people to both be on a chuck version > 1.5.4.0 and change their existing code to use lick after this. Please let me know wheter this is something you'd like to have in lick or not!
Additionally, as of 1.5.5.0, chuck now has a package manager! We'd love to include lick in our package repository and make it as easy as possible to install. I can help with defining a package a creating a release if you would like it to be included.