/* Julianne Grasso ORTGEIST SOUND TRIGGERS 12/06/2012 */ //Nature is Offended SndBuf thunder1; "thunder1.wav" => thunder1.read; SndBuf thunder2; "thunder2.wav" => thunder2.read; SndBuf thunder3; "thunder3.wav" => thunder3.read; //Furniture is Offended SndBuf dishes1; "dishes1.wav" => dishes1.read; SndBuf dishes2; "dishes2.wav" => dishes2.read; SndBuf dishes3; "dishes3.wav" => dishes3.read; //keyboard input via terminal KBHit kb; while (true) { //wait on event kb => now; while (kb.more()) { //get key kb.getchar() => int key; //print int value <<< "ascii:", key >>>; if (key == 105) { spork ~triggers(thunder1); } if (key == 111) { spork ~triggers(thunder2); } if (key == 112) { spork ~triggers(thunder3); } if (key == 98) { spork ~triggers(dishes1); } if (key == 110) { spork ~triggers(dishes2); } if (key == 109) { spork ~triggers(dishes3); } } } fun void triggers(SndBuf trigger){ trigger => dac; trigger.pos(0); trigger.length() => now; trigger =< dac; }