|
|
|
@ -15,16 +15,16 @@
|
|
|
|
|
masterVol = 1;
|
|
|
|
|
|
|
|
|
|
clockStringFunc = {
|
|
|
|
|
arg beat;
|
|
|
|
|
var measure, measureBeat, leadSpace;
|
|
|
|
|
measure = ((beat / 2) + 1).asInteger.asString;
|
|
|
|
|
measureBeat = ((beat % 2) + 1).asInteger.asString;
|
|
|
|
|
leadSpace = (3 - measure.size).collect({" "}).join;
|
|
|
|
|
leadSpace ++ measure ++ "." ++ measureBeat
|
|
|
|
|
arg measure, beat;
|
|
|
|
|
var measureString, beatString, leadSpace;
|
|
|
|
|
measureString = measure.asInteger.asString;
|
|
|
|
|
beatString = beat.asInteger.asString;
|
|
|
|
|
leadSpace = (3 - measureString.size).collect({" "}).join;
|
|
|
|
|
leadSpace ++ measureString ++ "." ++ beatString
|
|
|
|
|
};
|
|
|
|
|
// [-30, -105, -104].asAscii and [-30, -105, -113].asAscii are unicode inverse bullet and normal bullet, respectively
|
|
|
|
|
metronomeStringFunc = { arg beat; if(beat % 2 == 0, {[-30, -105, -104].asAscii}, {[-30, -105, -113].asAscii}) };
|
|
|
|
|
metronomeColorFunc = { arg beat; if(beat % 2 == 0, {Color.red},{Color.black}) };
|
|
|
|
|
metronomeStringFunc = { arg beat; if(beat == 1, {[-30, -105, -104].asAscii}, {[-30, -105, -113].asAscii}) };
|
|
|
|
|
metronomeColorFunc = { arg beat; if(beat == 1, {Color.red},{Color.black}) };
|
|
|
|
|
|
|
|
|
|
~appStatusFunc = Task({
|
|
|
|
|
loop {
|
|
|
|
@ -39,12 +39,15 @@
|
|
|
|
|
|
|
|
|
|
win = Window("Counterfeiting in Colonial Connecticut", Rect(500, 500, 1100, 500), false).front;
|
|
|
|
|
masterView = {
|
|
|
|
|
var view, masterIndicators, master, generator, transport, ranSeed, startPosText, pauseButton, clock, metronome;
|
|
|
|
|
var view, masterIndicators, master, generator, transport, ranSeed, startPosText,
|
|
|
|
|
prevSectionButton, prevSubsectionButton, playStopButton, nextSubsectionButton, nextSectionButton, clock, metronome;
|
|
|
|
|
|
|
|
|
|
OSCFunc({ arg msg, time;
|
|
|
|
|
{
|
|
|
|
|
var beat = msg[3];
|
|
|
|
|
clock.string = clockStringFunc.value(beat);
|
|
|
|
|
var measure, beat;
|
|
|
|
|
measure = msg[3];
|
|
|
|
|
beat = msg[4];
|
|
|
|
|
clock.string = clockStringFunc.value(measure, beat);
|
|
|
|
|
metronome.stringColor = metronomeColorFunc.value(beat);
|
|
|
|
|
metronome.string = metronomeStringFunc.value(beat);
|
|
|
|
|
}.defer;
|
|
|
|
@ -65,7 +68,31 @@
|
|
|
|
|
[~appStatus = StaticText(view).string_("status: ready"), stretch: 1],
|
|
|
|
|
nil);
|
|
|
|
|
transport = HLayout(
|
|
|
|
|
Button(view).states_([["play", Color.black], ["stop", Color.black, Color.grey]]).action_(
|
|
|
|
|
prevSectionButton = Button(view).states_([["<<", Color.black]]).action_({| pState |
|
|
|
|
|
if((~currentSection - 4) >= 0, {
|
|
|
|
|
if(~isPlaying, {
|
|
|
|
|
~patterns[~currentSection].stop;
|
|
|
|
|
~currentSection = (~currentSection - 4).trunc(4);
|
|
|
|
|
~play.set(\sel, ~currentSection % 2);
|
|
|
|
|
~patterns[~currentSection].play(quant: 0)
|
|
|
|
|
},{
|
|
|
|
|
~currentSection = ~currentSection - 1;
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
prevSubsectionButton = Button(view).states_([["<", Color.black]]).action_({| pState |
|
|
|
|
|
if((~currentSection - 1) >= 0, {
|
|
|
|
|
if(~isPlaying, {
|
|
|
|
|
~patterns[~currentSection].stop;
|
|
|
|
|
~currentSection = (~currentSection - 1);
|
|
|
|
|
~play.set(\sel, ~currentSection % 2);
|
|
|
|
|
~patterns[~currentSection].play(quant: 0)
|
|
|
|
|
},{
|
|
|
|
|
~currentSection = ~currentSection - 1;
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}),
|
|
|
|
|
playStopButton = Button(view).states_([["play", Color.black], ["stop", Color.black, Color.grey]]).action_(
|
|
|
|
|
/*
|
|
|
|
|
{| pState |
|
|
|
|
|
pauseButton.value = 0;
|
|
|
|
@ -74,14 +101,40 @@
|
|
|
|
|
{~play.set(\startPos, startPos, \playRate, 1, \startTrig, 1)})}
|
|
|
|
|
*/
|
|
|
|
|
{| pState |
|
|
|
|
|
pauseButton.value = 0;
|
|
|
|
|
if(pState.value == 0, {~patterns[0].stop;
|
|
|
|
|
clock.string = clockStringFunc.value((startPos * ~totalDur * 5).asInteger)},
|
|
|
|
|
{~currentSection = 0; ~play.set(\sel, ~currentSection % 2); ~patterns[~currentSection].play})}
|
|
|
|
|
if(pState.value == 0, {
|
|
|
|
|
~isPlaying = false;
|
|
|
|
|
~patterns[~currentSection].stop;
|
|
|
|
|
},{
|
|
|
|
|
~isPlaying = true;
|
|
|
|
|
~play.set(\sel, ~currentSection % 2);
|
|
|
|
|
~patterns[~currentSection].play(quant: 0)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
pauseButton = Button(view).states_([["pause", Color.black], ["pause", Color.black, Color.grey]]).action_(
|
|
|
|
|
{| pState |
|
|
|
|
|
if(pState.value == 1, {~play.set(\playRate, 0)},{~play.set(\playRate, 1)})}),
|
|
|
|
|
nextSubsectionButton = Button(view).states_([[">", Color.black]]).action_({| pState |
|
|
|
|
|
if((~currentSection + 1) < ~patterns.size, {
|
|
|
|
|
if(~isPlaying, {
|
|
|
|
|
~patterns[~currentSection].stop;
|
|
|
|
|
~currentSection = (~currentSection + 1);
|
|
|
|
|
~play.set(\sel, ~currentSection % 2);
|
|
|
|
|
~patterns[~currentSection].play(quant: 0)
|
|
|
|
|
},{
|
|
|
|
|
~currentSection = ~currentSection + 1;
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}),
|
|
|
|
|
nextSectionButton = Button(view).states_([[">>", Color.black]]).action_({| pState |
|
|
|
|
|
if((~currentSection + 4) < ~patterns.size, {
|
|
|
|
|
if(~isPlaying, {
|
|
|
|
|
~patterns[~currentSection].stop;
|
|
|
|
|
~currentSection = (~currentSection + 4).trunc(4);
|
|
|
|
|
~play.set(\sel, ~currentSection % 2);
|
|
|
|
|
~patterns[~currentSection].play(quant: 0)
|
|
|
|
|
},{
|
|
|
|
|
~currentSection = ~currentSection - 1;
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}),
|
|
|
|
|
StaticText(view).string_("start time"),
|
|
|
|
|
[Slider(view, Rect(0, 0, 30, 5)).action_(
|
|
|
|
|
{|pos|
|
|
|
|
|