本文整理汇总了Python中FMOD.getSound方法的典型用法代码示例。如果您正苦于以下问题:Python FMOD.getSound方法的具体用法?Python FMOD.getSound怎么用?Python FMOD.getSound使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FMOD
的用法示例。
在下文中一共展示了FMOD.getSound方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __loadConfig
# 需要导入模块: import FMOD [as 别名]
# 或者: from FMOD import getSound [as 别名]
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
示例2: _playGUI
# 需要导入模块: import FMOD [as 别名]
# 或者: from FMOD import getSound [as 别名]
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)
示例3: __getArenaSoundEvent
# 需要导入模块: import FMOD [as 别名]
# 或者: from FMOD import getSound [as 别名]
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
示例4: _speak
# 需要导入模块: import FMOD [as 别名]
# 或者: from FMOD import getSound [as 别名]
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
示例5: getSound2D
# 需要导入模块: import FMOD [as 别名]
# 或者: from FMOD import getSound [as 别名]
def getSound2D(self, event):
if FMOD.enabled:
return FMOD.getSound(self.checkAndReplace(event))
示例6: FMODgetSound
# 需要导入模块: import FMOD [as 别名]
# 或者: from FMOD import getSound [as 别名]
def FMODgetSound(self, event):
return FMOD.getSound(self.checkAndReplace(event))
示例7: __init__
# 需要导入模块: import FMOD [as 别名]
# 或者: from FMOD import getSound [as 别名]
def __init__(self, soundPath):
self.__sndTick = FMOD.getSound(soundPath)
self.__isPlaying = True
self.stop()