Created
November 12, 2023 09:38
-
-
Save sonocircuit/86be456e4bc82dc1425566bfae02e63d to your computer and use it in GitHub Desktop.
reflection queued_rec test script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --_r = include 'lib/reflection_new' | |
| _r = require 'reflection' | |
| my_pattern = _r.new() | |
| function init() | |
| params:set("clock_reset", 1) | |
| my_pattern.process = process_pat | |
| my_pattern.loop = 1 | |
| my_pattern:set_quantization(1/48) | |
| event_clock = clock.run(fire_events) | |
| clock.run(function() | |
| clock.sync(4) | |
| --my_pattern:set_rec(1, 4, 4) -- unqueued, length 4 beats, start on downbeat | |
| my_pattern:set_rec(2, 4) -- unqueued, length 4 beats | |
| end) | |
| end | |
| function fire_events() | |
| while true do | |
| clock.sync(1) | |
| local e = {st = my_pattern.step, tm = util.round(clock.get_beats(),0.01)} | |
| my_pattern:watch(e) | |
| end | |
| end | |
| function my_pattern.start_callback() | |
| print('playback started', util.round(clock.get_beats(),0.01)) | |
| end | |
| function my_pattern.end_of_rec_callback() | |
| print('recording finished', util.round(clock.get_beats(),0.01)) | |
| print('--- event table ---') | |
| for k, v in pairs(my_pattern.event) do | |
| print(k, v[1].st, util.round(v[1].tm, 0.01)) | |
| end | |
| print('-------------------') | |
| end | |
| function my_pattern.end_of_loop_callback() | |
| print('loop ended', util.round(clock.get_beats(),0.01)) | |
| my_pattern.loop = 0 | |
| end | |
| function my_pattern.end_callback() | |
| print('playback ended', util.round(clock.get_beats(),0.01)) | |
| end | |
| function process_pat(e) | |
| print(e.st, e.tm, util.round(clock.get_beats(),0.01)) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment