robbielyman / seamstress

seamstress is an art engine
GNU General Public License v3.0
129 stars 12 forks source link

clock.transport.start() called with clock source changes #72

Closed dndrks closed 1 year ago

dndrks commented 1 year ago

hiii! happy friday!!

i've been going through some MIDI clock + transport examples for the seamstress + grid study and ran into a few behaviors that felt potentially useful to raise. to try and keep stuff clean, i'll log separate tickets for each issue! lmk if i can help with any further info or testing!!

test script, running 0.24.5:

function clock.transport.start()
  print("started", clock.get_beats())
  test_clock = clock.run(
    function()
      while true do
        clock.sync(1/4)
        print('step', clock.get_beats())
      end
    end
  )
end

function clock.transport.stop()
  print("stopped")
  clock.cancel(test_clock)
  test_clock = nil -- clean up the variable
end

steps to repro:

expected results: changing clock source won't execute transport callbacks (if it helps, this is true for norns)

experienced results: changing clock source to MIDI via the parameters window executes the 'transport start' callback, which fires off the coroutine before any actual MIDI transport messages are sent. actually starting the MIDI transport then causes two clocks to exist.