예제 #1
0
    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
예제 #2
0
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
예제 #3
0
def GetSharedAudioEmitter(eventName):
    """
        Gets an emitter for a given event name if it exists. If emitter does not exist a new
        emitter will be created by the audio2.AudManager.
    :param eventName:
    :return:
    """
    audMan = audio2.GetManager()
    if eventName.startswith('wise:/'):
        eventName = eventName[6:]
    emitter = audMan.GetEmitterForEventName(eventName)
    return emitter
예제 #4
0
def main():
    app = TrinityApp.instance()
    manager = audio2.GetManager()
    uiplayer = audio2.GetUIPlayer()

    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)

    init()

    def loadbanks():
        manager.LoadBank(u'Init.bnk')
        manager.LoadBank(u'Interface.bnk')

    loadbanks()

    def maxVolume():
        audio2.SetGlobalRTPC(u'volume_master', 1.0)
        audio2.SetGlobalRTPC(u'volume_ui', 1.0)

    maxVolume()

    def onevent(*_):
        print 'SENDING'
        uiplayer.SendEvent(u'msg_CCPrevious_play')
        print 'SENT'

    app.mouse_moved.Connect(onevent)
    app.exec_()
예제 #5
0
def GetSharedAudioEmitter(eventName):
    audMan = audio2.GetManager()
    if eventName.startswith('wise:/'):
        eventName = eventName[6:]
    emitter = audMan.GetEmitterForEventName(eventName)
    return emitter