« Return to Thread: another (post-3.3?) pattern cleanup

Re: another (post-3.3?) pattern cleanup

by James Harkins-2 :: Rate this Message:

Reply to Author | View in Thread

On Apr 21, 2009, at 11:41 PM, James Harkins wrote:

A quick scan through and Ppar is the only other one left (that I can see quickly) that sets \freq to \rest. That seems bad to me. Maybe someone is using a non-default event prototype that doesn't identify rests by a Symbol for frequency?

Thinking further -- there is one advantage to setting a \rest key in the input event, which is that it's minimal change to the input event and downstream patterns that might be using expected values from the input event might not always have to check for a rest.

~asPattern = {
var valueFixes = Pbind(
#[start, bufnum], Pfunc { |ev|
[~segStart.wrapAt(ev[\bufIndex]).wrapAt(ev[\start]),
~buffers.wrapAt(ev[\bufIndex]).tryPerform(\bufnum) ? ~buffers[0].bufnum
]
},
\time, min(Pkey(\delta), Pkey(\time)) / Pfunc { thisThread.clock.tempo },
\instrument, Pif(Pkey(\amp) > 0, Pkey(\instrument), \rest)
);
Pchain(
// here's my rest check
Pif(Pbinop('==', Pkey(\type), \rest), Pfunc { |ev| ev }, valueFixes),
Pn(Plazy({
var meter = /*BP(~cond).currentMeter ?*/ thisThread.clock.beatsPerBar;
Psync(~getGesture.(meter), meter, meter);
}), inf)
)
};

What happened last night is that I put in the Pif rest check to catch the silent event from Psync, but then Pspawner (used in the get gesture function) surprised me with rests whose type is not rest.

With the change last night, the above works, but it also means rest checking is one more thing the user has to be aware of.

Maybe this is better?

(Event.sc):

*silent { arg dur = 1.0, inEvent;
// ^Event.new(8, nil, defaultParentEvent, true).put(\type, \rest).put(\dur, dur)
^inEvent.copy.put(\type, \rest).put(\dur, \dur)
}

... but then, there's one place (Spawner:wait) that doesn't have access to the input event. I don't see an easy fix for that.

Confused... at this point, MixedMessages is making more sense to me :)

hjh


: H. James Harkins
: jamshark70@...
: http://www.dewdrop-world.net
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman

 « Return to Thread: another (post-3.3?) pattern cleanup