Closed dndrks closed 1 year ago
oh, yeah, i stumbled upon that. i thought it might have been a conscious decision (non-blocking midi device registration?).
i just bind midi devices post-init
w/ the midi.add
callback and do something very unholy for params containing a list of midi devices: resetting the param definition after each new device is found/removed.
it is kinda cool as devices can be hot-pluggued & unpluggued without having to register them anywhere beforehand. but it's true that for when having a param to hold the list of devices it's trickier to handle API-wise.
Thanks for the very clear issue report!
I think the issue is this line of midi.zig
which tells the MIDI discovery thread to wait one second before starting up. https://github.com/ryleelyman/seamstress/blob/b974b80a5ab68b220510573d92f78531133c505a/src/midi.zig#L171
Should be an easy fix; gives me a chance to clean up this file a little too. Thanks!
hihi! hope all's well :) i ran into something unexpected when working on extending the PMAP system to include MIDI echo (for devices like the MIDI Fighter Twister), which seems useful to raise!
test case
i'd like to capture the names of all the connected MIDI output devices in an option-style parameter, so i connect a few MIDI devices to my computer and run this script:
expected results
at script load, my
midi_target
parameter will initialize with a list of all the currently-connected MIDI output devices. this is also the result from running the script on norns.actual results
the script initializes fine, but my connected MIDI output devices don't populate in the list -- everything past
1: seamstress_out
shows up asx: none
.to work around this, i can force a refresh after a 1 second delay:
^ this does collect all connected devices into the parameter options as expected. also, in case it helps to have confirmed, i get the same results with
midi.vinports
.extra diggin'
idk if this is helpful, but along the debug trail i popped a few
print
s to try and understand the timing of everything.i added this to
core/midi.lua
(when the connected state is updated):and added these lines to bookend the
init
in my test script:which returns the following on script load:
if that first instance of
output device 1 connected
were to snag all the connected output devices, the timing would work out great for the example script, but it looks like there are a few additional calls tomidi.update_connected_state()
before the additional devices are discovered and logged, which comes after the script has already initialized?hope this helps, please lmk if there's anything i can do to assist!!