From 9583b21dae8041c6544fb37de00ca42b034ebc98 Mon Sep 17 00:00:00 2001 From: Oli Date: Fri, 26 Oct 2007 05:50:30 +0000 Subject: miniT tabs cleanup, loop settings moved to Jam --- (limited to 'common') diff --git a/common/Config.py b/common/Config.py index 2aae053..8efc36c 100644 --- a/common/Config.py +++ b/common/Config.py @@ -37,12 +37,14 @@ if SugarMode == True: TUNE_DIR=env.get_profile_path() + '/tamtam/tunes' SYNTH_DIR=env.get_profile_path() + '/tamtam/synthlab' SNDS_DIR=env.get_profile_path() + '/tamtam/snds' + SNDS_INFO_DIR=env.get_profile_path() + '/tamtam/snds_info' SCRATCH_DIR = PREF_DIR + "/.scratch/" else: PREF_DIR = os.getenv('HOME') + '/.tamtam' TUNE_DIR= os.getenv('HOME') + '/.tamtam/tunes' SYNTH_DIR= os.getenv('HOME') + '/.tamtam/synthlab' SNDS_DIR= os.getenv('HOME') + '/.tamtam/snds' + SNDS_INFO_DIR = os.getenv('HOME') + '/.tamtam/snds_info' SCRATCH_DIR = PREF_DIR + "/.scratch/" #PLUGIN diff --git a/common/Resources/tamtamorc.csd b/common/Resources/tamtamorc.csd index 37129fb..3eb3db4 100644 --- a/common/Resources/tamtamorc.csd +++ b/common/Resources/tamtamorc.csd @@ -509,8 +509,6 @@ aRight eqfil aRight, 4000, 1000, 0.125 aLeft butterhp aLeft, 150 aRight butterhp aRight, 150 -aLeft butterhp aLeft, 150 -aRight butterhp aRight, 150 aOutLeft dcblock (arev + aLeft) * koutGain * gkduck aOutRight dcblock (arev + aRight) * koutGain * gkduck @@ -749,6 +747,7 @@ instr 5022 kstart chnget "lstart" kend chnget "lend" kdur chnget "ldur" +kvol chnget "lvol" idurfadein init 0.005 idurfadeout init 0.095 @@ -790,12 +789,12 @@ kvibrato oscil .006, ivibRand, 1 a1 flooper2 0.5, 1+kvibrato, kstart, kend, kdur, 4999, 0, 0, 0, iskip -a1 = a1*kenv +a1 = a1*kenv*kvol gaoutL = a1*0.5+gaoutL gaoutR = a1*0.5+gaoutR -gainrev = a1*0.1+gainrev +gainrev = a1*0.05+gainrev tieskip: endin @@ -805,18 +804,20 @@ Loop points editor, simple player *************************/ instr 5023 +kvol chnget "lvol" + p3 = nsamp(4999) * giScale a1 loscil 0.5, 1, 4999, 1 kenv adsr 0.005, 0.05, .8, 0.1 -a1 = a1*kenv +a1 = a1*kenv*kvol gaoutL = a1*0.5+gaoutL gaoutR = a1*0.5+gaoutR -gainrev = a1*0.1+gainrev +gainrev = a1*0.05+gainrev endin diff --git a/common/Util/CSoundClient.py b/common/Util/CSoundClient.py index b3729d8..b8919eb 100644 --- a/common/Util/CSoundClient.py +++ b/common/Util/CSoundClient.py @@ -101,7 +101,10 @@ class _CSoundClientPlugin: def load_instrument(self, inst): if not inst in loadedInstruments: - fileName = Config.SOUNDS_DIR + "/" + inst + if inst[0:3] == 'mic' or inst[0:3] == 'lab' or self.instrumentDB.instNamed[inst].category == 'mysounds': + fileName = Config.SNDS_DIR + '/' + inst + else: + 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) diff --git a/common/Util/InstrumentDB.py b/common/Util/InstrumentDB.py index fd276ae..82c0e56 100644 --- a/common/Util/InstrumentDB.py +++ b/common/Util/InstrumentDB.py @@ -30,17 +30,17 @@ class Instrument: magic = f.readline()[:-1] if (magic != 'TamTam idf v1'): raise 'given file has wrong header' - self.name = f.readline() - self.csoundInstrumentId = f.readline() - self.register = f.readline() - self.loopStart = float( f.readline()) - self.loopEnd = float( f.readline()) - self.crossDur = float( f.readline()) - self.ampScale = float( f.readline()) + self.name = f.readline()[:-1] + self.csoundInstrumentId = float(f.readline()[:-1]) + self.register = f.readline()[:-1] + self.loopStart = float( f.readline()[:-1]) + self.loopEnd = float( f.readline()[:-1]) + self.crossDur = float( f.readline()[:-1]) + self.ampScale = float( f.readline()[:-1]) self.kit = None - self.wav = f.readline() - self.img = f.readline() - self.category = f.readline().split() + self.wav = f.readline()[:-1] + self.img = f.readline()[:-1] + self.category = f.readline() f.close() class InstrumentDB: @@ -68,16 +68,19 @@ class InstrumentDB: # add an instrument to the DB by reading from an instrument definition file def addInstrument( self, path ): + from common.Util.CSoundClient import new_csound_client + csnd = new_csound_client() i = Instrument(len(self.inst)) self.inst += [ i ] i.loadFromPath( path ) self.instNamed[ i.name ] = i - self.instId[self.instNamed[i].instrumentId] = i + self.instId[i.instrumentId] = i #print 'labelSet... ', self.labelSet self.labelSet['All'].add(i) if not self.labelSet.has_key(category): self.labelSet[category] = set([]) self.labelSet[category].add( i ) + csnd.load_instrument(i.name) # try to load each file in a given folder as an instrument def. file def scanInstrumentDir( self, path ): diff --git a/common/Util/Instruments.py b/common/Util/Instruments.py index 17a0594..004fcca 100644 --- a/common/Util/Instruments.py +++ b/common/Util/Instruments.py @@ -1,3 +1,4 @@ +import os import common.Config as Config import common.Util.InstrumentDB as InstrumentDB @@ -175,10 +176,9 @@ _addInstrument( "plane", INST_SIMP, MID, 'concret', 0, 0, 0, 0.7 ) _addInstrument( "slap", INST_SIMP, MID, 'concret', 0, 0, 0, 0.7 ) try: - ifile = open(PREF_DIR + '/sounds_settings', 'r') - for line in ifile.readlines(): - list = line.split() - _addInstrument(list[0], int(list[1]), int(list[2]), list[3], list[4], float(list[5]), float(list[6]), float(list[7]), float(list[8])) + files = os.listdir(Config.SNDS_INFO_DIR) + for file in files: + instrumentDB.addInstrument(Config.SNDS_INFO_DIR + '/' + file) except: pass -- cgit v0.9.1