本文整理汇总了Python中FMOD类的典型用法代码示例。如果您正苦于以下问题:Python FMOD类的具体用法?Python FMOD怎么用?Python FMOD使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FMOD类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: stopAmbient
def stopAmbient(self):
ambientEvent = self.__musicEvents[MusicController._AMBIENT_EVENT]
if ambientEvent is not None:
ambientEvent.destroy()
if FMOD.enabled:
FMOD.enableLightSound(0)
return
示例2: setMasterVolume
def setMasterVolume(self, volume):
self.__masterVolume = volume
self.__muffledVolume = self.__masterVolume * self.getVolume('masterFadeVivox')
FMOD.setMasterVolume(self.__muffledVolume if self.__muffled else self.__masterVolume)
self.savePreferences()
self.onMusicVolumeChanged('music', self.__masterVolume, self.getVolume('music'))
self.onMusicVolumeChanged('ambient', self.__masterVolume, self.getVolume('ambient'))
示例3: __setMode
def __setMode(self, modeName):
if modeName not in self.__modes:
LOG_DEBUG('Sound mode %s does not exist' % modeName)
return False
if self.__currentMode == modeName:
return True
self.__modes[self.__currentMode].unloadBanksManually()
self.__currentMode = modeName
modeDesc = self.__modes[modeName]
if FMOD.enabled:
languageSet = FMOD.setLanguage(modeDesc.voiceLanguage, self.modifiedSoundGroups)
if not languageSet:
LOG_DEBUG('Internal FMOD error in FMOD::setLanguage')
return False
if not self.__modes[self.__currentMode].loadBanksManually():
LOG_DEBUG('Error while manual banks loading')
return False
if FMOD.enabled:
loadedSoundBanks = FMOD.getSoundBanks()
for bankName, bankPath in modeDesc.banksToBeLoaded:
found = False
for loadedBank in loadedSoundBanks:
if bankName == loadedBank:
found = True
break
if not found:
LOG_DEBUG('Bank %s was not loaded while loading %s sound mode' % (bankName, modeName))
return False
return True
示例4: __destroyDestructible
def __destroyDestructible(self, chunkID, dmgType, destData, isNeedAnimation, explosionInfo=None):
if self.forceNoAnimation:
isNeedAnimation = False
if dmgType == DESTR_TYPE_FALLING_ATOM:
destrIndex, fallDirYaw, fallSpeed = decodeFallenColumn(destData)
pitchConstr, collisionFlags = BigWorld.wg_getDestructibleFallPitchConstr(
self.__spaceID, chunkID, destrIndex, fallDirYaw
)
if pitchConstr is None:
pitchConstr = math.pi / 2.0
self.__dropDestructible(
chunkID, destrIndex, fallDirYaw, pitchConstr, fallSpeed, isNeedAnimation, collisionFlags
)
if dmgType == DESTR_TYPE_TREE:
destrIndex, fallDirYaw, pitchConstr, fallSpeed = decodeFallenTree(destData)
_, collisionFlags = BigWorld.wg_getDestructibleFallPitchConstr(
self.__spaceID, chunkID, destrIndex, fallDirYaw
)
self.__dropDestructible(
chunkID, destrIndex, fallDirYaw, pitchConstr, fallSpeed, isNeedAnimation, collisionFlags
)
if FMOD.enabled:
FMOD.lightSoundRemove(self.__spaceID, chunkID, destrIndex)
elif dmgType == DESTR_TYPE_FRAGILE:
destrIndex, isShotDamage = decodeFragile(destData)
self.__destroyFragile(chunkID, destrIndex, isNeedAnimation, isShotDamage, explosionInfo)
if FMOD.enabled:
FMOD.lightSoundRemove(self.__spaceID, chunkID, destrIndex)
elif dmgType == DESTR_TYPE_STRUCTURE:
destrIndex, matKind, isShotDamage = decodeDestructibleModule(destData)
self.__destroyModule(chunkID, destrIndex, matKind, isNeedAnimation, isShotDamage, explosionInfo)
示例5: applyPreferences
def applyPreferences(self):
if not self.__isWindowVisible:
FMOD.setMasterVolume(0)
return
self.setMasterVolume(self.__masterVolume)
for categoryName in self.__volumeByCategory.keys():
self.setVolume(categoryName, self.__volumeByCategory[categoryName], updatePrefs=False)
示例6: applyPreferences
def applyPreferences(self):
if not self.__isWindowVisible:
if FMOD.enabled:
FMOD.setMasterVolume(0)
return
self.setMasterVolume(self.__masterVolume)
for categoryName in self.__volumeByCategory.keys():
newVolume = self.__volumeByCategory[categoryName]
if self.__muffledByReplay and categoryName in ('vehicles', 'effects', 'ambient'):
newVolume = 0.0
self.setVolume(categoryName, newVolume, updatePrefs=False)
示例7: changePlayMode
def changePlayMode(self, mode):
FMOD.setEventsParam('viewPlayMode', mode)
if self.__handleInside == None:
self.__handleInside = FMOD.DSPgetHandleByNameAndCategory('FMOD Lowpass Simple', 'inside')
if self.__handleOutside == None:
self.__handleOutside = FMOD.DSPgetHandleByNameAndCategory('FMOD Lowpass Simple', 'outside')
if self.__ceilLess == True:
FMOD.DSPsetParamEx(self.__handleInside, 0, DSP_LOWPASS_HI, DSP_SEEKSPEED)
FMOD.DSPsetParamEx(self.__handleOutside, 0, DSP_LOWPASS_HI, DSP_SEEKSPEED)
elif mode == 1:
FMOD.DSPsetParamEx(self.__handleInside, 0, DSP_LOWPASS_HI, DSP_SEEKSPEED)
FMOD.DSPsetParamEx(self.__handleOutside, 0, DSP_LOWPASS_LOW, -DSP_SEEKSPEED)
else:
FMOD.DSPsetParamEx(self.__handleInside, 0, DSP_LOWPASS_LOW, -DSP_SEEKSPEED)
FMOD.DSPsetParamEx(self.__handleOutside, 0, DSP_LOWPASS_HI, DSP_SEEKSPEED)
示例8: __init__
def __init__(self, soundName, autoPlay = False, useDummy = True):
self.__fmodSound = FMOD.playSound(soundName)
if not self.__fmodSound and useDummy:
self.__fmodSound = DummySound()
if not autoPlay:
self.__fmodSound.stop()
return
示例9: __loadConfig
def __loadConfig(self):
eventNames = {}
xmlPath = 'gui/music_events.xml'
section = ResMgr.openSection(xmlPath)
if section is None:
_xml.raiseWrongXml(None, xmlPath, 'can not open or read')
for i in section.items():
s = i[1]
if i[0] == 'music':
eventNames[MUSIC_EVENT_LOGIN] = s.readString('login')
eventNames[MUSIC_EVENT_LOBBY] = (s.readString('lobby'), s.readString('lobby_premium'))
eventNames[MUSIC_EVENT_COMBAT_VICTORY] = s.readString('combat_victory')
eventNames[MUSIC_EVENT_COMBAT_LOSE] = s.readString('combat_lose')
eventNames[MUSIC_EVENT_COMBAT_DRAW] = s.readString('combat_draw')
elif i[0] == 'ambient':
eventNames[AMBIENT_EVENT_LOBBY] = (s.readString('lobby'), s.readString('lobby_premium'))
eventNames[AMBIENT_EVENT_SHOP] = (s.readString('shop'), s.readString('shop_premium'))
eventNames[AMBIENT_EVENT_STATISTICS] = (s.readString('rating'), s.readString('rating_premium'))
fallbackEventNames = eventNames.copy()
for eventId, overriddenNames in self.__overriddenEvents.iteritems():
eventNames[eventId] = overriddenNames
soundsByName = {}
for eventId, names in eventNames.items():
lstEvents = []
if not isinstance(names, tuple):
names = (names,)
fallbackNames = fallbackEventNames[eventId]
if not isinstance(fallbackNames, tuple):
fallbackNames = (fallbackNames,)
for i in xrange(len(names)):
eventName = names[i]
fallbackEventName = fallbackNames[i]
sound = soundsByName.get(eventName)
if sound is None:
sound = FMOD.getSound(eventName) if eventName != '' else None
if sound is None:
sound = FMOD.getSound(fallbackEventName) if fallbackEventName != '' else None
soundsByName[eventName] = sound
lstEvents.append(sound)
if sound is not None:
sound.stop()
self.__soundEvents[eventId] = lstEvents
return
示例10: loadBanksManually
def loadBanksManually(self):
for (bankName, bankPath,) in self.banksToBeLoaded:
if bankPath != '':
loadSuccessfully = FMOD.loadSoundBankIntoMemoryFromPath(bankPath)
if not loadSuccessfully:
return False
return True
示例11: setMode
def setMode(self, modeName):
languageSet = False
try:
languageSet = self._SoundModes__setMode(modeName)
except:
LOG_CURRENT_EXCEPTION()
if not languageSet:
defaultFmodLanguage = ''
if SoundModes.DEFAULT_MODE_NAME in self._SoundModes__modes:
defaultFmodLanguage = self._SoundModes__modes[SoundModes.DEFAULT_MODE_NAME].fmodLanguage
try:
FMOD.setLanguage(defaultFmodLanguage, self.modifiedSoundGroups)
self._SoundModes__modes[SoundModes.DEFAULT_MODE_NAME].loadBanksManually()
except:
LOG_CURRENT_EXCEPTION()
self._SoundModes__currentMode = SoundModes.DEFAULT_MODE_NAME
return languageSet
示例12: stop
def stop(self):
self.__isStarted = False
FMOD.setEventsParam('viewPlayMode', 0)
self.__removeBattleCtrlListeners()
for control in self.__ctrls.itervalues():
control.destroy()
replayCtrl = BattleReplay.g_replayCtrl
if replayCtrl.isRecording:
replayCtrl.setPlayerVehicleID(0)
self.onCameraChanged = None
self.__targeting.enable(False)
self.__killerVehicleID = None
g_guiResetters.remove(self.__onRecreateDevice)
BigWorld.player().arena.onPeriodChange -= self.__onArenaStarted
from account_helpers.settings_core.SettingsCore import g_settingsCore
g_settingsCore.onSettingsChanged -= self.__onSettingsChanged
CallbackDelayer.destroy(self)
示例13: _playGUI
def _playGUI(self, event):
if self.__ignoreNext:
self.__ignoreNext = False
return
if event is context.SOUND_EVENT.NEXT_CHAPTER:
self.__ignoreNext = True
sndID = self.__guiSounds[event]
sound = FMOD.getSound(sndID)
if sound:
sound.play()
else:
LOG_ERROR("Sound not found", sndID)
示例14: __getArenaSoundEvent
def __getArenaSoundEvent(self, eventId):
player = BigWorld.player()
soundEvent = None
soundEventName = None
if not isPlayerAvatar():
return
elif player.arena is None:
return
else:
arenaType = player.arena.arenaType
if eventId == MUSIC_EVENT_COMBAT:
soundEventName = arenaType.music
elif eventId == MUSIC_EVENT_COMBAT_LOADING:
soundEventName = arenaType.loadingMusic
elif eventId == AMBIENT_EVENT_COMBAT:
soundEventName = arenaType.ambientSound
if soundEventName is not None:
soundEvent = FMOD.getSound(soundEventName)
if soundEvent is not None:
soundEvent.stop()
return soundEvent
示例15: _speak
def _speak(self, sndID):
if sndID in self.__prevSpeaks:
LOG_DEBUG("Speaking played, ignore", sndID)
return
elif sndID is None:
LOG_WARNING("Sound ID for speaking is not defined")
return
elif self.__speakSnd is not None:
self.__nextSndID = sndID
return
else:
sound = FMOD.getSound(sndID)
if not sound:
LOG_ERROR("Sound not found", sndID)
return
self.__nextSndID = None
self.__speakSnd = sound
self.__prevSpeaks.add(sndID)
sound.setCallback("EVENTFINISHED", self.__onSpeakingStop)
sound.play()
return