sound: more channels for sound effects + simplify effects list
This commit is contained in:
parent
703a458160
commit
683af1ca34
38
gameview.py
38
gameview.py
@ -1033,7 +1033,13 @@ class Chatbox(QtGui.QLabel):
|
||||
|
||||
class GUI(QtGui.QWidget):
|
||||
gamewindow = None
|
||||
sound = None
|
||||
# In theory 3 sounds may play at the same time: character, evidence sweep,
|
||||
# effect
|
||||
soundChannels = 3
|
||||
soundChannel = 0
|
||||
sound = []
|
||||
for i in range(soundChannels):
|
||||
sound.append(None)
|
||||
music = None
|
||||
nextCharacterIsNotSpecial = False
|
||||
messageIsCentered = False
|
||||
@ -2250,7 +2256,8 @@ class GUI(QtGui.QWidget):
|
||||
audio.playHandle(self.music, False)
|
||||
|
||||
def changeSoundVolume(self, value):
|
||||
if self.sound:
|
||||
for s in self.sound:
|
||||
if s:
|
||||
audio.setHandleAttr(self.sound, BASS_ATTRIB_VOL, value / 100.0)
|
||||
audio.setHandleAttr(self.sndRealization, BASS_ATTRIB_VOL, value / 100.0)
|
||||
audio.setHandleAttr(self.wtceSfx, BASS_ATTRIB_VOL, value / 100.0)
|
||||
@ -3153,7 +3160,8 @@ class GUI(QtGui.QWidget):
|
||||
msg += emote[2] + "#" #anim
|
||||
msg += text + "#"
|
||||
msg += self.charSide + "#"
|
||||
msg += (ini.get_effect_sound(self.boxEffects.currentText(), self.charName) if self.boxEffects.currentIndex() > 0 else emote[4])+"#" #sfx
|
||||
#msg += (ini.get_effect_sound(self.boxEffects.currentText(), self.charName) if self.boxEffects.currentIndex() > 0 else emote[4]) + "#" #sfx
|
||||
msg += emote[4] + "#"
|
||||
msg += str(modifier) + "#" #emote modifier
|
||||
msg += str(self.myChar) + "#" #character ID
|
||||
msg += emote[5] + "#" #sfx delay
|
||||
@ -4259,18 +4267,24 @@ class GUI(QtGui.QWidget):
|
||||
self.playSound(sfxName)
|
||||
|
||||
def playSound(self, sfx):
|
||||
if self.sound:
|
||||
if audio.handleIsActive(self.sound):
|
||||
audio.stopHandle(self.sound)
|
||||
audio.freeHandle(self.sound)
|
||||
self.soundChannel = (self.soundChannel + 1) % self.soundChannels
|
||||
|
||||
path = testPath(AOpath + 'sounds/general/' + sfx, AOpath + 'sounds/general/' + sfx + '.wav', AOpath + 'sounds/general/' + sfx + '.opus')
|
||||
if self.sound[self.soundChannel]:
|
||||
if audio.handleIsActive(self.sound[self.soundChannel]):
|
||||
audio.stopHandle(self.sound[self.soundChannel])
|
||||
audio.freeHandle(self.sound[self.soundChannel])
|
||||
|
||||
path = testPath(
|
||||
AOpath + 'sounds/general/' + sfx,
|
||||
AOpath + 'sounds/general/' + sfx + '.wav',
|
||||
AOpath + 'sounds/general/' + sfx + '.opus'
|
||||
)
|
||||
|
||||
if path:
|
||||
self.sound = audio.loadHandle(False, path, 0, 0, 0)
|
||||
audio.setHandleAttr(self.sound, BASS_ATTRIB_VOL, self.sliSoundVolume.value() / 100.0)
|
||||
if self.sound:
|
||||
audio.playHandle(self.sound, True)
|
||||
self.sound[self.soundChannel] = audio.loadHandle(False, path, 0, 0, 0)
|
||||
audio.setHandleAttr(self.sound[self.soundChannel], BASS_ATTRIB_VOL, self.sliSoundVolume.value() / 100.0)
|
||||
if self.sound[self.soundChannel]:
|
||||
audio.playHandle(self.sound[self.soundChannel], True)
|
||||
|
||||
def playMusic(self, mus):
|
||||
self.stopMusic()
|
||||
|
||||
14
ini.py
14
ini.py
@ -138,15 +138,15 @@ def get_effect_sound(fx_name, char):
|
||||
def get_effects(char):
|
||||
p_effect = read_ini("base/characters/"+char+"/char.ini", "options", "effects", "default/effects")
|
||||
p_path = "base/misc/"+p_effect+"/effects.ini"
|
||||
default_path = "AO2XPbase/themes/default/effects/effects.ini"
|
||||
# default_path = "AO2XPbase/themes/default/effects/effects.ini"
|
||||
|
||||
effects = []
|
||||
# effects = []
|
||||
|
||||
if exists(default_path):
|
||||
with open(default_path, 'r') as file:
|
||||
for line in file:
|
||||
effects.append(line.split("=")[0].strip())
|
||||
else:
|
||||
# if exists(default_path):
|
||||
# with open(default_path, 'r') as file:
|
||||
# for line in file:
|
||||
# effects.append(line.split("=")[0].strip())
|
||||
# else:
|
||||
effects = ["realization", "hearts", "reaction", "impact"]
|
||||
|
||||
if not exists(p_path): return effects
|
||||
|
||||
Loading…
Reference in New Issue
Block a user