Skip to content

Conversation

@nshaheed
Copy link
Contributor

Hi Michael!

I'm with the chuck dev team. As of 1.5.4.0 chuck now has the @import syntax, which works like most other language's import system where it adds the imported file to the type system at compile time, which means that Machine.add is 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 a lick.ck file which imports all the different classes (except for the ones with optional dependencies). So you could do something like this:

@import "lick"

// start doing things!
AnalogDelay delay;

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.

@heuermh
Copy link
Owner

heuermh commented Mar 20, 2025

Awesome! Thank you, @nshaheed!

It may take me a little while to go over this and absorb the new reality 😉

@nshaheed
Copy link
Contributor Author

haha take your time, let me know if you have any questions!

*/

@import "../lick/effect/AdsrTremolo"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If LiCK were a package, would these still need to be relative? or just

@import "lick"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can samples be part of a package? If not, am not sure how this relative directory lookup would work outside of this source tree

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@heuermh
Copy link
Owner

heuermh commented Mar 20, 2025

There has never been a "release" of LiCK, so I think I will plan to make a version 1.0 release on git master and then merge this one after that as work towards a version 2.0.

@nshaheed
Copy link
Contributor Author

That makes sense! Packages expect a versioning format with three numbers: 1.0.0 and 2.0.0 so consistency's sake it might make sense to have the first version as 1.0.0

@nshaheed
Copy link
Contributor Author

Any questions or anything I can help with wrt this pull request? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants