diff options
author | Robin Gareus <robin@gareus.org> | 2018-03-17 21:13:06 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2018-03-17 21:13:06 +0100 |
commit | 1231a0805aca0070f589fdc3cf7ef002bbfd381d (patch) | |
tree | ebc76c37742d4001914da8963e18292acb517ba6 | |
parent | c2ed125b8ddf3ee684fa742eea6c3db1dc05ecc1 (diff) |
Remove calls to deprecated Lua bitlib
-rw-r--r-- | scripts/_midi_rec_start.lua | 2 | ||||
-rw-r--r-- | scripts/s_group_color.lua | 2 | ||||
-rw-r--r-- | scripts/synth1.lua | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/scripts/_midi_rec_start.lua b/scripts/_midi_rec_start.lua index edd67eb7af..235609b037 100644 --- a/scripts/_midi_rec_start.lua +++ b/scripts/_midi_rec_start.lua @@ -21,7 +21,7 @@ function factory () local mb = midiport:get_midi_buffer (n_samples) -- get the midi-data buffers local events = mb:table () -- copy event list into lua table for _,e in pairs (events) do -- iterate over all events in the midi-buffer - if bit32.band (e:buffer():array()[1], 0xf0) == 0x90 then -- note on + if (e:buffer():array()[1] & 0xf0) == 0x90 then -- note on Session:maybe_enable_record (true) -- global record-enable from rt-context -- maybe-enable may fail if there are no tracks or step-entry is active -- roll transport if record-enable suceeded: diff --git a/scripts/s_group_color.lua b/scripts/s_group_color.lua index 1fd5321ef5..d8c0785ed7 100644 --- a/scripts/s_group_color.lua +++ b/scripts/s_group_color.lua @@ -5,7 +5,7 @@ function factory () return function () local r = math.random (0, 255) local g = math.random (0, 255) local b = math.random (0, 255) - local rgba = bit32.lshift (r, 24) + bit32.lshift (g, 16) + bit32.lshift (b, 8) + 0xff + local rgba = (r << 24) + (g << 16) + (b << 8) + 0xff grp:set_rgba(rgba) end end end diff --git a/scripts/synth1.lua b/scripts/synth1.lua index 2a8288ba52..de68c58e46 100644 --- a/scripts/synth1.lua +++ b/scripts/synth1.lua @@ -73,17 +73,17 @@ function dsp_run (ins, outs, n_samples) local d = b["data"] -- get midi-event -- we ignore the midi channel - if (#d == 3 and bit32.band (d[1], 240) == 144) then -- note on + if (#d == 3 and (d[1] & 240) == 144) then -- note on local n = 1 + d[2]; active_notes[n] = active_notes[n] or {} active_notes[n]["tvel"] = d[3] end - if (#d == 3 and bit32.band (d[1], 240) == 128) then -- note off + if (#d == 3 and (d[1] & 240) == 128) then -- note off local n = 1 + d[2]; active_notes[n] = active_notes[n] or {} active_notes[n]["tvel"] = 0 end - if (#d == 3 and bit32.band (d[1], 240) == 176) then -- CC + if (#d == 3 and (d[1] & 240) == 176) then -- CC if (d[2] == 120 or d[2] == 123) then -- panic active_notes = {} end |