-
Notifications
You must be signed in to change notification settings - Fork 151
feat: add clock.link.get_number_of_peers()
#1825
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
Conversation
this commit adds `number_of_peers` to `clock_link_shared_data_t` and keeps this data in sync with the Link session. in the header, a new function to return this number of peers is added. this commit does not yet expose this functionality to Lua.
this commit adds (provided `HAVE_ABLETON_LINK` is true) a new Lua function which will return the number of peers connected via Ableton Link. When Link functionality is disabled, this function returns 0. this commit does not add any UI changes.
thanks for the contribution! i recall there's no need to pass returned number of peers through protected could you update the PR accordingly? thx! |
yes, i’d be happy to make that change, but unfortunately i need more guidance: since the in case this is useful information, given that the function is marked as realtime safe in the header by Ableton, it sounds like it’s not a problem to call very frequently. |
yeah, link object itself could be moved out of the thread, for instance declared as the wrapper in |
rather than managing the number of link peers automatically, the Lua instance will now query the Link library directly.
i made the change! it might now not be the case that the number of peers is zero when norns has Link disabled—i'm not likely to test what the behavior is for several days, but it would be a pretty easy check for anyone able to both build norns and connect to it via Link. |
the number of peers should be displayed only when clock source is set to |
good point. well ok, i think this is ready for review :) |
|
just got a chance to sync up with my norns; everything seems a-ok! here's a little test script to demonstrate: function init()
clock.run(function()
while true do
clock.sleep(1)
redraw()
end
end)
end
function redraw()
screen.font_size(15)
screen.move(1,50)
screen.clear()
if params:get("clock_source") ~= 3 then
screen.text("source != link")
else
screen.text("peers: " .. _norns.clock_link_get_number_of_peers())
end
screen.update()
end to verify, make sure your norns is on the same network as another link-enabled device, set the |
Generally the
|
i’m well aware of the distinction between the now, i’m happy to increase the scope, since reading between the lines of your comment it sounds to me like you want me to. i think it would be helpful for me if you could communicate similar asks more directly in the future. |
yeah, it's a tiny change that improves the usability of the feature, so why not :) thanks for adding it! |
clock.link.get_number_of_peers()
this PR adds
_norns.clock_link_get_number_of_peers()
a new Lua function which will return the number of peers connected to this Norns over Ableton Link.related discussion on Lines:
this PR does not make a user-facing change to display the number of peers anywhere on norns, but it enables that change to be made solely in Lua. i'd happily help brainstorm or contribute that Lua change as well, if there's interest.