monome / norns

norns is many sound instruments.
http://monome.org
GNU General Public License v3.0
614 stars 144 forks source link

norns monitor level resets to maximum every time a script is loaded. #1270

Open terribleben opened 3 years ago

terribleben commented 3 years ago

norns version: 201202

I have a script where one of my params affects the system monitor:

  params:add_control("monitor", "monitor", controlspec.new(0, 1, 'lin', 0, 0, ''))
  params:set_action("monitor", function(x)
    audio.level_monitor(x)
    -- there could be some other stuff here, issue happens regardless
  end)

expected: If I load this script, crank the monitor level down to zero, then load a new script (or reload this one), the monitor should stay at zero, or whatever I set it to.

observed: When I load the next script, the monitor level resets to maximum. (That is to say, I can suddenly hear the monitor coming through the norns output at maximum.) It doesn't matter which script; I could also reload the same script. The same issue seems to affect other system state such as the monitor mode.

I hadn't updated my norns in awhile, but in a previous version of norns (~May 2019), the expected behavior happened.

Should I be writing my script differently? Or if this is a bug in norns, I would be happy to submit a patch if someone knows where I can get started.

catfact commented 3 years ago

it sounds like a regression, there have been some changes to the way system and script state is saved and restored, but unfortunately i'm not the author of the changes and not best suited to tracing their history and consequences. (i'd start by looking at state.lua and script.lua)

tehn commented 3 years ago

indeed, this was a regression by design (quite a long time ago), as the "mix" parameter set was merged into the main global parameter set, so that the parameters could be unified under one menu (instead of a weird additional system/audio menu) and also share the same midi routing/etc.

but this point has been brought up before and i've sketched various solutions.

fastest: make the default monitor mix 0 instead of 1.

more complete: have system settings for "default mix levels" that get saved in system.state --- and also there'd need to be a secondary state storage for these mix values if they're not to waver in between script loads

additionally/side thought: implement a "don't save" flag on for parameters (we did this on aleph)