Skip to content
This repository has been archived by the owner on Sep 11, 2021. It is now read-only.

ControlSpecs are written to the global ControlSpec namespace #125

Open
antonhornquist opened this issue Jun 18, 2018 · 9 comments
Open

ControlSpecs are written to the global ControlSpec namespace #125

antonhornquist opened this issue Jun 18, 2018 · 9 comments
Assignees

Comments

@antonhornquist
Copy link
Collaborator

antonhornquist commented Jun 18, 2018

I suggest to put the script specific controlspecs used in kayan (EDIT: and other scripts) in a script specific table rather than the core ControlSpec table.

Ie. see this line:

cs.AMP = cs.new(0,1,'lin',0,0.5,'')

I've not tested this in practice but am quite sure that line changes the standard ControlSpec.AMP for any script using that default controlspec loaded after kayan.

@antonhornquist
Copy link
Collaborator Author

@jonpauldavies

@jonpauldavies
Copy link
Contributor

Hey buddy. I'm out of action for a few weeks getting a project out of the door. Feel free to tweak how you wish. I just copied these controlspec lines from another one of the default lua scripts. I dont fully understand what they are doing, so if you know better, go for it.

@markwheeler
Copy link
Collaborator

I think awake is doing this also:

cs.AMP = cs.new(0,1,'lin',0,0.5,'')

@antonhornquist
Copy link
Collaborator Author

@markwheeler ah, thanks. the ControlSpec ”globals” or ”class variables” are probably completely undocumented (this is stuff brought over 1:1 from SC). might need to rethink this a bit.

@antonhornquist antonhornquist self-assigned this Jul 5, 2018
@antonhornquist antonhornquist changed the title kayan: ControlSpecs are written to the global ControlSpec namespace ControlSpecs are written to the global ControlSpec namespace Aug 10, 2018
@antonhornquist
Copy link
Collaborator Author

partly related to monome/norns#425

@tehn
Copy link
Member

tehn commented Sep 3, 2018

@pq re: monome/norns#436

does ControlSpec global get restored to its default state with this method?

@pq
Copy link
Collaborator

pq commented Sep 21, 2018

late to the party; sorry!

does ControlSpec global get restored to its default state with this method?

as per our conversation over on monome/norns#559, nope. we'll need to restore it specially (maybe in Script.clear).

@tehn
Copy link
Member

tehn commented Sep 21, 2018

in awake i'm using a local copy of controlspec if that makes sense.

@antonhornquist
Copy link
Collaborator Author

@tehn (you probably already get this, but, to clarify) the underlying problem is it's not a copy but the controlspec table that is used and overwritten (ie. cs.AMP gets 0.5 as default), and since require caches no values are overwritten again so for a script using the cs.AMP after running awake, cs.AMP is 0.5 but for a script running from scratch it would be 0 as defined here: https://github.com/monome/norns/blob/master/lua/controlspec.lua#L137

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants