From cd62e6af4d8f4dda887f1aac15abb13128a7f447 Mon Sep 17 00:00:00 2001 From: Oli Date: Sat, 20 Oct 2007 17:25:17 +0000 Subject: removed csound table's load from startup --- (limited to 'common') diff --git a/common/Util/Block.py b/common/Util/Block.py index 45f942a..e6a7bf4 100644 --- a/common/Util/Block.py +++ b/common/Util/Block.py @@ -14,7 +14,7 @@ from common.Util.NoteDB import PARAMETER # All the graphics resources are loaded in Desktop and referenced here as necessary #::: -class Block(): +class Block: WIDTH = 100 HEIGHT = 100 diff --git a/common/Util/CSoundClient.py b/common/Util/CSoundClient.py index c2ca4ff..b3729d8 100644 --- a/common/Util/CSoundClient.py +++ b/common/Util/CSoundClient.py @@ -14,6 +14,7 @@ from common.Util.Clooper.aclient import * from common.Util import NoteDB import common.Util.InstrumentDB as InstrumentDB +loadedInstruments = [] _note_template = array.array('f', [0] * 19 ) def _new_note_array(): @@ -98,6 +99,22 @@ class _CSoundClientPlugin: instrumentId = Config.INSTRUMENT_TABLE_OFFSET + self.instrumentDB.instNamed[ instrumentSoundFile ].instrumentId sc_inputMessage( Config.CSOUND_LOAD_INSTRUMENT % (instrumentId, fileName) ) + def load_instrument(self, inst): + if not inst in loadedInstruments: + fileName = Config.SOUNDS_DIR + "/" + inst + instrumentId = Config.INSTRUMENT_TABLE_OFFSET + self.instrumentDB.instNamed[ inst ].instrumentId + sc_inputMessage( Config.CSOUND_LOAD_INSTRUMENT % (instrumentId, fileName) ) + loadedInstruments.append(inst) + + def load_drumkit(self, kit): + if not kit in loadedInstruments: + for i in self.instrumentDB.instNamed[kit].kit.values(): + fileName = Config.SOUNDS_DIR + "/" + i + instrumentId = Config.INSTRUMENT_TABLE_OFFSET + self.instrumentDB.instNamed[ i ].instrumentId + sc_inputMessage( Config.CSOUND_LOAD_INSTRUMENT % (instrumentId, fileName) ) + loadedInstruments.append(i) + loadedInstruments.append(kit) + def connect( self, init = True ): def reconnect(): if sc_start(self.periods_per_buffer) : @@ -355,6 +372,6 @@ def new_csound_client(): _Client = _CSoundClientPlugin() _Client.connect(True) _Client.setMasterVolume(100.0) - _Client.load_instruments() + #_Client.load_instruments() time.sleep(0.2) return _Client diff --git a/common/Util/ControlStream.py b/common/Util/ControlStream.py index 4eeabc1..ae62c61 100644 --- a/common/Util/ControlStream.py +++ b/common/Util/ControlStream.py @@ -17,7 +17,7 @@ class TamTamOStream: self.file = file def note_add(self, note): - l = ['note_add', note.id, note.page, note.track, + l = ['note_add', note.id, note.page, note.track, note.cs.onset, note.cs.pitch, note.cs.amplitude, @@ -120,7 +120,7 @@ class TamTamTable: nid = int(argv[0]) page = self.pid[int(argv[1])] track = int(argv[2]) - cs = CSoundNote( + cs = CSoundNote( int(argv[3]), int(argv[4]), float(argv[5]), @@ -149,7 +149,7 @@ class TamTamTable: insts = "" for str in argv[3:]: insts += str - print pid, insts + #print pid, insts instruments = eval( insts ) if len( self.noteDB.tune ): after = self.noteDB.tune[-1] @@ -189,11 +189,11 @@ class TamTamTable: self.jam.updateLoopImage( data["id"] ) if child: - block = blockClass( self.jam.getDesktop(), data ) - self.lastBlock.addChild( block ) + block = blockClass( self.jam.getDesktop(), data ) + self.lastBlock.addChild( block ) else: block = self.jam.getDesktop().addBlock( blockClass, data, ( x, y ) ) - + block.setPlaced( True ) if blockClass == Block.Instrument and active: @@ -206,7 +206,7 @@ class TamTamTable: #try: if os.path.isfile( filename ): os.remove( filename ) - + file = open( filename, "w" ) for line in self.file: if line == "desktop_store END\n": @@ -229,4 +229,3 @@ class TamTamTable: def quit(self, argv): print 'quitting...' sys.exit(0) - -- cgit v0.9.1