/*---------------------------------------------------------------------------- iNc (In C) composed by Terry Riley ChucK realization by Rob Hamilton - http://ccrma.stanford.edu/~rob - code liberally borrowed from existing ChucK pieces and tutorials This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 U.S.A. -----------------------------------------------------------------------------*/ MAUI_View v; v.size( 305, 80 ); v.name( "in C: sync server" ); MAUI_Slider tempo_slider; tempo_slider.size( 300, 80 ); tempo_slider.position( 0, 0 ); tempo_slider.name( "Tempo" ); tempo_slider.range( 60, 400 ); tempo_slider.value( 120 ); tempo_slider.displayFormat( tempo_slider.integerFormat ); v.addElement( tempo_slider ); v.display(); // default tempo 240 => int tempo; //number of client targets 20 => int targets; // default `value of 8th 500::ms => dur T; 500 => int Tval; int bpm; 20 => int bpmOffset; // port 6449 => int port; string slorkstations[20]; "poutine.local" => slorkstations[0]; "pupuplatter.local" => slorkstations[1]; "padthai.local" => slorkstations[2]; "snickers.local" => slorkstations[3]; "shabushabu.local" => slorkstations[4]; "dolsotbibimbop.local" => slorkstations[5]; "aguachile.local" => slorkstations[6]; "turducken.local" => slorkstations[7]; "xiaolongbao.local" => slorkstations[8]; "froyo.local" => slorkstations[9]; "tikkamasala.local" => slorkstations[10]; "peanutbutter.local" => slorkstations[11]; "quesadilla.local" => slorkstations[12]; "transfat.local" => slorkstations[13]; "oatmealraisin.local" => slorkstations[14]; "seventeen.local" => slorkstations[15]; "doubledouble.local" => slorkstations[16]; "tofurkey.local" => slorkstations[17]; "heartstop.local" => slorkstations[18]; "blt.local" => slorkstations[19]; fun void setTempo(int val) { // val => Tval; (60000/(val+bpmOffset))::ms => T; <<< "setTempo:T: ", T >>>; } fun string getSlorkNames(int num) { return slorkstations[num]; } // send objects OscSend xmit[targets]; for(0=>int i; i int width; 4 => int height; int x; int y; int z; function void controlTempo() { while( true ) { tempo_slider => now; (60000/(tempo_slider.value()))::ms => T; (60000/(tempo_slider.value())) $ int => Tval; tempo_slider.value() $ int => bpm; } } fun void dumbasssynccrapfunctionmofo() { // value of 8th 4096::samp => dur Te; // port 6449 => int port; // infinite time loop while( true ) { for( 0 => z; z < targets; z++ ) { // start the message... xmit[z].startMsg( "/slork/dumbass/poop", "i i f" ); // a message is kicked as soon as it is complete 1 => xmit[z].addInt; 2 => xmit[z].addInt; 3.0 => xmit[z].addFloat; // advance time } Te => now; } } fun void syncherIhardlyevenknowher() { while( true ) { // infinite time loop for( 0 => y; y < height; y++ ) for( 0 => x; x < width; x++ ) { for( 0 => z; z < targets; z++ ) { // start the message... xmit[z].startMsg( "/slork/synch/clock", "i i" ); // a message is kicked as soon as it is complete bpm => xmit[z].addInt; Tval => xmit[z].addInt; } T => now; } } } spork ~ dumbasssynccrapfunctionmofo(); // piece of f*ck!n@ crap wireless hub spork ~ controlTempo(); // FOR MAUI INTERFACE: Comment out for MIDI spork ~ syncherIhardlyevenknowher(); 1::day => now;