Commit 04e73bc6 authored by Hanspeter Portner's avatar Hanspeter Portner

templates: add Time Responder template.

parent e50b8fb2
......@@ -257,6 +257,7 @@ moony:bank-state_state-responder
rdfs:label "State responder" ;
rdfs:seeAlso <presets.ttl> .
# Tutorials
moony:bank-tutorial_part-1
a pset:Preset ;
lv2:appliesTo moony:a1xa1 ;
......@@ -285,9 +286,17 @@ moony:bank-tutorial_part-4
rdfs:label "Tutorial 4: MIDI Arpeggiator" ;
rdfs:seeAlso <presets.ttl> .
# Templates
moony:bank-template_part-1
a pset:Preset ;
lv2:appliesTo moony:a1xa1 ;
pset:bank moony:bank-template;
rdfs:label "Template 1: MIDI Responder" ;
rdfs:seeAlso <presets.ttl> .
moony:bank-template_part-2
a pset:Preset ;
lv2:appliesTo moony:a1xa1 ;
pset:bank moony:bank-template;
rdfs:label "Template 2: Time Responder" ;
rdfs:seeAlso <presets.ttl> .
......@@ -669,7 +669,7 @@ moony:bank-template_part-1
local block = false -- route unmatched messages as-is
-- define a MIDIResponder object configured to pass-through unmatched messages
-- define a MIDIResponder object
local midiR = MIDIResponder({
-- callbacks featuring a channel parameter
[MIDI.NoteOn] = function(self, frames, forge, chan, note, vel)
......@@ -736,3 +736,50 @@ function run(n, seq, forge, control, notify)
end
end"""
] .
moony:bank-template_part-2
a pset:Preset ;
doap:license lic:Artistic-2.0 ;
state:state [
moony:code """-- Template 2: Time Responder
-- define a TimeResponder object
local timeR = TimeResponder({
[Time.speed] = function(self, frames, forge, speed)
--TODO
end,
[Time.bar] = function(self, frames, forge, bar)
--TODO
end,
[Time.barBeat] = function(self, frames, forge, barBeat)
--TODO
end,
[Time.beatUnit] = function(self, frames, forge, beatUnit)
--TODO
end,
[Time.beatsPerBar] = function(self, frames, forge, beatsPerBar)
--TODO
end,
[Time.beatsPerMinute] = function(self, frames, forge, beatsPerMinute)
--TODO
end,
[Time.framesPerSecond] = function(self, frames, forge, framesPerSecond)
--TODO
end,
[Time.frame] = function(self, frames, forge, frame)
--TODO
end
})
function run(n, seq, forge, control, notify)
local from = 0 -- initial frame offset
for to, atom in seq:foreach() do -- iterate over incoming events
timeR(from, to, forge, atom) -- call responder for event
from = to -- update to new frame offset
end
timeR(from, n, forge) -- call responder for remaining frames
end"""
] .
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment