Title: Using Grooves Aliases Post by: sciurius on September 11, 2019, 12:38:49 PM Me again with my stupid and unexpected problems >:D.
Groove MellowJazz 1 C This works. DefAlias MellowJazz Foo Groove Foo 1 C This complains that MellowJazz is not a defined groove: DefAlias: Groove MellowJazz has not been defined. Groove MellowJazz DefAlias MellowJazz Foo Groove Foo 1 C Still not defined? Groove MellowJazz print $_GrooveList DefAlias MellowJazz Foo This prints: MELLOWJAZZ MELLOWJAZZEND MELLOWJAZZFILL MELLOWJAZZINTRO MELLOWJAZZPLUS MELLOWJAZZSUS MELLOWJAZZSUSPLUS Error: <Line 3> <File:groove2.mma> DefAlias: Groove MellowJazz has not been defined. Well it turns out that the grooveAlias method in grooves.py has its arguments swapped... So either the documentation should be changed to "DefAlias AliasName ExistingGrooveName", or the roles of variables g and a in lines 156/157 of grooves.py must be swapped. Both solutions have pros and cons. Final question: Shouldn't DefAlias auto-load grooves? Title: Re: Using Grooves Aliases Post by: bvdp on September 11, 2019, 04:10:26 PM Got me :)
I just spent a bunch of time with the load groove code and have added the option to load from a specific directory. So, you can now do "groove casio:80sPopIntro" instead of the more verbose "groove casio/80spop:80sPopIntro". But, I didn't look a the alias code. If memory serves, the idea behind the alias stuff is really just to create an alternate name for an existing groove. The advantage being that it's also a copy. That is because you now have 2 references to the groove info. Well, that's the way it's supposed to work. I will check that again!! Certainly the docs here need work! I'd rather fix the docs than the code ... less chance of breaking things. I'd not thought about autoloading grooves at this point. It would be easy enough to fork off, search and load, and then define. Guess I have to ask why and what are the downfalls? One "problem" I see is that if loading the groove involves reading a file (esp. from another directory) you could inadvertently clobber existing groove info which may not be desired. To be honest, it's a feature I've never used. Could be that it's not that useful and should be dumped??? Title: Re: Using Grooves Aliases Post by: sciurius on September 11, 2019, 04:29:33 PM I turned some custom plucking grooves in song files into general usable library grooves and ran cross the uglyness of having to say
Groove MyCustomPluckingPattern4E ... Groove MyCustomPluckingPattern4A ... and so on. So I wanted to use aliases: DefAlias MyCustomPluckingPattern4E GE DefAlias MyCustomPluckingPattern4A GA .... to obtain neater code, and the ability to change to a different plucking pattern by just changing the aliases instead of all the groove settings in the music. So I find the aliases feature very useful. And there's nothing wrong with the current code... You just need to swap the two arguments. Everything else seems to work fine. Autoloading would be fine, but I have no problems to insert an explicit 'use' before defining the aliases. Title: Re: Using Grooves Aliases Post by: bvdp on September 11, 2019, 05:05:19 PM So, just a doc fix. Easy! Consider it done.
Title: Re: Using Grooves Aliases Post by: sciurius on September 11, 2019, 05:15:57 PM Eh, I'd rather prefer the code fix... I find 'DefAlias groove alias' more intuitive than the other way around. And the code also mentions this in the error message.
*** grooves.py~ 2019-08-04 20:28:14.000000000 +0200 --- grooves.py 2019-09-11 14:36:26.555921789 +0200 *************** *** 153,160 **** if len(ln) != 2: error("DefAlias needs exactly 2 args: GrooveName AliasName.") ! a = ln[0].upper() ! g = ln[1].upper() if not g in glist: error("DefAlias: Groove %s has not been defined." % ln[0]) --- 153,160 ---- if len(ln) != 2: error("DefAlias needs exactly 2 args: GrooveName AliasName.") ! g = ln[0].upper() ! a = ln[1].upper() if not g in glist: error("DefAlias: Groove %s has not been defined." % ln[0]) |