Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update metro syntax to match norns update #23

Closed
tehn opened this issue Dec 22, 2018 · 4 comments
Closed

update metro syntax to match norns update #23

tehn opened this issue Dec 22, 2018 · 4 comments
Assignees
Labels
design Issue needs design consideration
Milestone

Comments

@tehn
Copy link
Member

tehn commented Dec 22, 2018

see monome/norns#572

@trentgill trentgill added this to the 1 milestone Dec 23, 2018
@tehn tehn self-assigned this Dec 23, 2018
@trentgill trentgill modified the milestone: 1 Dec 24, 2018
@trentgill
Copy link
Collaborator

trentgill commented Jan 16, 2019

see 0268d01..ab02b8b

  • rename .alloc to .init
  • .init takes either a table or a arg list

i also added a class fn called 'assign_all()' which:

  • allocates all the timers
  • assigns default _crow.tell() events: ^^metro(chan,count)

usage is in the README. in short:

function init()
  metro = Metro.assign_all()
  metro[1]:start(1.0)
  metro[2]:start(2.0, 100)
end

the user can then alias the metros if they desire:
mycounter = metro[1]

i understand it's an extra layer on top of the norns metro system, but it makes it feel way more like the rest of crow to my mind.

please reopen this for discussion if you want!

//
edit: changed name from 'auto_metros()' to 'assign_all()` ce140e9

@tehn
Copy link
Member Author

tehn commented Jan 26, 2019

just a heads up that norns sortof automatically does assign_all as default behavior.

metro[0...32] are available always. but metro.init() provide an "unused" timer, to avoid collisions. on script reset the metros are "cleared" (ie, turned off, marked as unallocated). (there are actually 38 or so metros accessible, but the high numbers are protected for menu use in norns.)

it'd be nice to do something similar, so that people can either use numbered metros or name them.

a big aim for me is syntax consistency between norns and crow. we can of course introduce changes to norns as well if seen fit.

@tehn tehn reopened this Jan 26, 2019
@trentgill
Copy link
Collaborator

trentgill commented Feb 20, 2019

i'm a little vague on "metro[0...32] are available always".

doesn't the user still need to run metro[1] = Metro.init() or something?
the point of assign_all is that the .init() procedure is not needed.

the problem with assign_all is it means the .init() procedure will fail as all of the metros are already assigned. i don't see how both functions can be simultaneously available.

edit: @tehn

@trentgill trentgill added the design Issue needs design consideration label Mar 1, 2019
@tehn
Copy link
Member Author

tehn commented Mar 5, 2019

on norns metro[1] ... metro[32] are allocated at startup. so they are always available to the environment.

named_metro = metro.init(...)

is basically a helper function which keeps track of which metros (1-32) are allocated (there is an internal allocation table).

of course you can still direct-access an already-allocated metro with the subtable... ie, even if named_metro got allocated metro[1] you can still play with metro[1] directly (but this is not really advised).

not necessarily relevant to crow: when norns scripts get cleared, all the metros get turned off and allocation table cleared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Issue needs design consideration
Projects
None yet
Development

No branches or pull requests

2 participants