def Run(self, ms=None): self.active = False self.manager = audio2.GetManager() aPath = blue.paths.ResolvePath(u'res:/Audio') io = audio2.AudLowLevelIO( aPath, LANGUAGE_ID_TO_BANK.get(session.languageID, u'')) initConf = audio2.AudConfig() initConf.lowLevelIO = io initConf.numRefillsInVoice = 8 initConf.asyncFileOpen = True self.manager.config = initConf self.banksLoaded = False enabled = self.AppGetSetting('audioEnabled', 1) self.uiPlayer = self.jukeboxPlayer = None self.busChannels = {} for i in xrange(8): self.busChannels[i] = None self.audioEmitterComponentsByScene = collections.defaultdict(dict) self.audioEmitterPositionsByComponent = {} self.audioEmitterComponentGroupsByScene = collections.defaultdict( lambda: collections.defaultdict(list)) trinity.SetDirectSoundPtr(audio2.GetDirectSoundPtr()) self.AppRun() if enabled: self.Activate() self.obstructionPollThreadWR = None
def InitializeAudioManager(languageID): manager = audio2.GetManager() io = audio2.AudLowLevelIO(u'res:/Audio/', LANGUAGE_ID_TO_BANK.get(languageID, u'')) initConf = audio2.AudConfig() initConf.lowLevelIO = io initConf.numRefillsInVoice = 8 initConf.asyncFileOpen = True manager.config = initConf return manager
def init(): aPath = blue.paths.ResolvePath(u'res:/Audio') print 'aPath:', aPath io = audio2.AudLowLevelIO(aPath, u'') initConf = audio2.AudConfig() initConf.lowLevelIO = io initConf.numRefillsInVoice = 8 initConf.asyncFileOpen = True manager.config = initConf manager.SetEnabled(True)