Skip to content

Commit

Permalink
fix multiple zone registration
Browse files Browse the repository at this point in the history
  • Loading branch information
ngwese committed Feb 8, 2023
1 parent e5793cf commit 224bd72
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion mod/test/ctl.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
function init()
spn.handlers.control = function(...) print('ctl', ...) end
spn.handlers.touch = function(...) print('touch', ...) end
x = spn.client.zone.new({
name = 'foo',
type = 'xy',
bounds = {0, 0, 3, 3},
ctrl1 = 12,
ctrl2 = 13
})
y = spn.client.zone.new({
name = 'bar',
type = 'xy',
bounds = {0, 3, 3, 2},
ctrl1 = 14,
ctrl2 = 15,
})
notes = spn.client.zone.new({
name = 'baz',
type = 'note_row',
bounds = {3, 0, 27, 1},
start_note = 57,
})
spn.client.start()
spn.client.set_zones({x})
spn.client.set_zones({x, y, notes})
spn.client.set_property('data_rate', 10)
end

Expand Down
2 changes: 1 addition & 1 deletion src/spn_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ static int spn_client_set_zones(lua_State *L) {

lua_Integer num_zones = luaL_len(L, -1);
for (int i = 1; i <= num_zones; i++) {
lua_geti(L, -1, 1);
lua_geti(L, -1, i);
spn_zone_t *z = spn_zone_check(L, -1);
zones.push_back(soundplane::Zone::fromSpec(*(z->spec)));
lua_pop(L, 1);
Expand Down

0 comments on commit 224bd72

Please sign in to comment.