// title: just a start with Livid BASE // author: moncrey // description: // getting livid base communicating. // code: LividBASE{ classvar <>defKeys,<>defMap,<>base,<>baseOut,<>baseIn; *init{ arg settings; this.defKeys = [\slider1,\btn1,\scene1,\scene1LEDs,\pad1]; this.defMap = Dictionary[ \slider1 ->1, \btn1-> 10, \scene1 -> 18, \scene1LEDs -> #[18,26], \pad1 ->36 ]; settings.do{|a| if(a != nil && a.size==2, {this.defMap.put(a[0],a[1])} ) }; this.initMIDI; } *initMIDI{ var baseFound=false; if(MIDIClient.initialized==false,{MIDIClient.init}); MIDIClient.sources.do{|a,b| if( baseFound==false && a.device == "Base" && a.name == "Controls", { baseFound=true; this.base = b; this.baseIn=MIDIIn(b); this.baseOut = MIDIOut.newByName("Base","Controls"); } ) }; if(this.base == nil, {Post << "BASE not found! base=="<< this.base << Char.nl}, { // generic midi func MIDIFunc.noteOn({arg val,num,chan,src; val.postln;"ooo".postln;}); MIDIFunc.noteOff({arg val,num,chan,src; val.postln;}); // MIDIFunc({}, // give a confirmation light show //this.mapToNotes this.hiBASE; } ); } /* "BASE FOUND!" LED sequence */ *hiBASE{ var seq=Pbind( \type, \midi, \chan, 16, \midiout, this.baseOut, \midinote,Pseq(this.defMap.at(\pad1)+(0..31)), \dur,0.007//Pbrown(0.1,0.6,length:32) ).play; } }