[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] Silly Question Probably....




Hi Clifford

Try this. I think the last y=x is what you're missing.

c = [ ["fast", "slow"], ["loud", "soft"], ["Page 1", "Page 2" ] ];
b = Set.new;

//Run this line each time a pedal is pressed:
x=c.choose;if(b.includes(x), {"banned!".postln}, {("command: " ++ x).postln; b.add(x); b.remove(y)}); y=x;

Hope it works. Another way is using flags.

Martin



Den 03/05/2009 kl. 0.45 skrev Clifford Dunn:

Thanks a lot James! I guess this can work...however, I seem to be
missing an important step in being able to have the selection process
loop after the pedal is pressed until it picks something different
from what's in the ordered set. By setting up an if sequence, I can do
it once:

c = [ ["fast", "slow"], ["loud", "soft"], ["Page 1", "Page 2" ] ];
b = Set.new;
x = c.choose;
b.add(x);
x.choose.postln;
y = c.choose;

if(b.includes(y), {y = c.choose}, {y.choose.postln;});

This runs the risk of picking the same command twice. I can't seem to
find much help with loop or routines.

Thanks again!
Cliff

On Sat, May 2, 2009 at 2:02 PM, James Harkins <jamshark70@xxxxxxxxx> wrote:
How about...
commands = (set of commands);
banned = IdentitySet.new; // or Set.new if you're using strings
When the computer picks a command, it does:
banned.add(command);
When a player hits the pedal, check
banned.includes(command)
If that's false, the command can go through.
hjh
On May 2, 2009, at 2:06 PM, Clifford Dunn wrote:

Ok, so I've been sort of racking my brain for an easy way to do this
(not as good of a programmer as I'd like to pretend to be):
I want to have a series of commands for performers. The commands will
be displayed in a GUI (not a problem so far) in two halves. The first
half will have a command picked by the computer, and the second will
have commands picked by the performers by way of foot pedal
interaction. There are three sets of commands:
speed (fast or slow)
volume (loud or soft)
page number (1 or 2)
So basically, I want the computer to randomly pick one command for the
performers to follow. When this command is selected, I don't want any
foot pedal activity to be able to pick from the same command class
(i.e. if the computer decides to choose "slow" as a command, no one
should be able to hit a pedal to generate "fast" as a command). I'm
sort of lost on how I can go about programming this.

: H. James Harkins
: jamshark70@xxxxxxxxxxxxxxxxx
: http://www.dewdrop-world.net
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:
"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman




--
Clifford Dunn
Flutist/Composer
www.clifforddunnmusic.com
www.myspace.com/clifforddunn

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/ sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/