diff options
author | Oli <olivier.belanger@umontreal.ca> | 2007-07-18 23:04:25 (GMT) |
---|---|---|
committer | Oli <olivier.belanger@umontreal.ca> | 2007-07-18 23:04:25 (GMT) |
commit | b7a6ecf47a6090b5fa4566f9a5e1147d1a099ba3 (patch) | |
tree | 6de79963687f7cfb22e8028a9feb5023664c8f22 /Util | |
parent | 79b3ce7fff88482831a145d7563460389f7de755 (diff) | |
parent | 89f7701457b2222b2d3eaee7ee00285f9f52991a (diff) |
Merge branch 'master' of git+ssh://olipet@dev.laptop.org/git/projects/tamtam
Diffstat (limited to 'Util')
-rw-r--r-- | Util/CSoundClient.py | 3 | ||||
-rw-r--r-- | Util/Clooper/aclient.cpp | 33 | ||||
-rwxr-xr-x | Util/Clooper/aclient.so | bin | 47718 -> 49464 bytes | |||
-rw-r--r-- | Util/Instrument.py | 10 | ||||
-rw-r--r-- | Util/Network.py | 14 |
5 files changed, 54 insertions, 6 deletions
diff --git a/Util/CSoundClient.py b/Util/CSoundClient.py index a018ac8..53a4788 100644 --- a/Util/CSoundClient.py +++ b/Util/CSoundClient.py @@ -41,6 +41,9 @@ class _CSoundClientPlugin: self.connect(False) sc_destroy() + def setChannel(self, name, val): + if self.on: + sc_setChannel(name, val) def setMasterVolume(self, volume): #self.masterVolume = volume diff --git a/Util/Clooper/aclient.cpp b/Util/Clooper/aclient.cpp index 861b590..baa7419 100644 --- a/Util/Clooper/aclient.cpp +++ b/Util/Clooper/aclient.cpp @@ -614,6 +614,26 @@ struct TamTamSound return csound != NULL; } + void setChannel(const char * name, MYFLT vol) + { + if (!csound) { + ll->printf(1, "skipping %s, csound==NULL\n", __FUNCTION__); + return; + } + if (!ThreadID) + { + if (_debug && (VERBOSE > 1)) fprintf(_debug, "skipping %s, ThreadID==NULL\n", __FUNCTION__); + return ; + } + MYFLT *p; + if (!(csoundGetChannelPtr(csound, &p, name, CSOUND_CONTROL_CHANNEL | CSOUND_INPUT_CHANNEL))) + *p = (MYFLT) vol; + else + { + if (_debug && (VERBOSE >0)) fprintf(_debug, "ERROR: failed to set channel: %s\n", name); + } + } + void setMasterVolume(MYFLT vol) { if (!csound) { @@ -825,6 +845,18 @@ DECL(sc_scoreEvent) //(char type, farray param) assert(!"not reached"); return NULL; } +DECL(sc_setChannel) //(float v) +{ + const char * str; + float v; + if (!PyArg_ParseTuple(args, "sf", &str,&v)) + { + return NULL; + } + sc_tt->setChannel(str,v); + Py_INCREF(Py_None); + return Py_None; +} DECL(sc_setMasterVolume) //(float v) { float v; @@ -1020,6 +1052,7 @@ static PyMethodDef SpamMethods[] = { MDECL(sc_start), MDECL(sc_stop), MDECL(sc_scoreEvent), + MDECL(sc_setChannel), MDECL(sc_setMasterVolume), MDECL(sc_setTrackVolume), MDECL(sc_setTrackpadX), diff --git a/Util/Clooper/aclient.so b/Util/Clooper/aclient.so Binary files differindex 5143f9d..b089412 100755 --- a/Util/Clooper/aclient.so +++ b/Util/Clooper/aclient.so diff --git a/Util/Instrument.py b/Util/Instrument.py index 3e4db27..159b736 100644 --- a/Util/Instrument.py +++ b/Util/Instrument.py @@ -19,8 +19,9 @@ class Instrument: def __init__( self, name, csoundInstrumentName, registerName, category, loopStart, loopEnd, crossDur, wav, img ): self.name = name self.instrumentId = len(INST) + self.csoundInstrumentName = csoundInstrumentName self.csoundInstrumentId = CSOUND_INSTRUMENT[csoundInstrumentName] - self.instrumentRegister = self.REGISTER[registerName] + self.register = registerName self.category = category self.loopStart = loopStart self.loopEnd = loopEnd @@ -170,6 +171,13 @@ else: Instrument( "guit2", 'inst_tied', 'mid', 'strings', .33, 1.1583, .02 , None, None) Instrument( "plane", 'inst_simp', 'mid', 'concret', 0, 0, 0 , None, None) Instrument( "slap", 'inst_simp', 'mid', 'concret', 0, 0, 0 , None, None) +INST_byId = {} +for i in INST: + INST_byId[ INST[i].instrumentId] = INST[i] + +KIT_ELEMENT = 24 * [0] +for i in range(0,13): + KIT_ELEMENT += 2 * [i] DRUM = {} drum_load_dynamic = 0 diff --git a/Util/Network.py b/Util/Network.py index a3df280..397110f 100644 --- a/Util/Network.py +++ b/Util/Network.py @@ -48,7 +48,7 @@ message_enum = [ ("PR_LATENCY_QUERY", 4), # test latency ("PR_SYNC_QUERY", 4), # test sync ("PR_TEMPO_QUERY", 0), # test sync -("PR_TEMPO_CHANGE", 4), # test sync +("PR_REQUEST_TEMPO_CHANGE", 4), # request tempo change ("MAX_MSG_ID", 0) ] @@ -80,7 +80,9 @@ class Listener( threading.Thread ): def run(self): while 1: # rely on the owner to kill us when necessary try: + print "Listerner:: select" inputReady, outputReady, exceptReady = select.select( self.inputSockets, self.outputSockets, self.exceptSockets ) + print "Listener:: inputready", inputReady if self.listenerSocket in inputReady: data, s = self.listenerSocket.recvfrom(MAX_SIZE) if data == "REFRESH": @@ -90,8 +92,10 @@ class Listener( threading.Thread ): continue else: break # exit thread + print "Listener:: threads_enter" gtk.gdk.threads_enter() self.owner._processSockets( inputReady, outputReady, exceptReady ) + print "Listener:: threads_leave" gtk.gdk.threads_leave() except socket.error, (value, message): print "Listener:: socket error: " + message @@ -389,12 +393,12 @@ class Network: if size >= 0: if length != size: - print "Network:: message wrong length! Got %d expected %d: %s %s" % (len(data), MSG_SIZE[message], MSG_NAME[message], data) + print "Network:: message wrong length! Got %d expected %d: %s" % (len(data), MSG_SIZE[message], MSG_NAME[message]) return msg = chr(message) + data elif size == -1: if length > 255: - print "Network:: oversized message! Got %d, max size 255: %s %s" % (length, MSG_NAME[message], data) + print "Network:: oversized message! Got %d, max size 255: %s" % (length, MSG_NAME[message]) return msg = chr(message) + chr(length) + data else: # size == -2 @@ -427,12 +431,12 @@ class Network: if size >= 0: if length != size: - print "Network:: message wrong length! Got %d expected %d: %s %s" % (MSG_SIZE[message], len(data), MSG_NAME[message], data) + print "Network:: message wrong length! Got %d expected %d: %s" % (MSG_SIZE[message], len(data), MSG_NAME[message]) return msg = chr(message) + data elif size == -1: if length > 255: - print "Network:: oversized message! Size %d, max size 255: %s %s" % (length, MSG_NAME[message], data) + print "Network:: oversized message! Size %d, max size 255: %s" % (length, MSG_NAME[message]) return msg = chr(message) + chr(length) + data else: # size == -2 |