better wtce/modcall sound management

This commit is contained in:
Headshotnoby 2021-06-22 13:12:45 -04:00
parent 8b2a93bdf0
commit d58268a244

View File

@ -657,18 +657,8 @@ class gui(QtGui.QWidget):
self.sfx_delay_timer.setSingleShot(True)
self.sfx_delay_timer.timeout.connect(self.play_sfx)
if exists('mod_call.wav'):
self.modcall = audio.loadhandle(0, "mod_call.wav", 0, 0, 0)
else:
self.modcall = None
wtcefile = AOpath+"sounds/general/sfx-testimony2"
guiltyfile = AOpath+"sounds/general/sfx-guilty"
notguiltyfile = AOpath+"sounds/general/sfx-notguilty.opus"
self.wtcesfx = audio.loadhandle(False, wtcefile+".opus" if exists(wtcefile+".opus") else wtcefile+".wav", 0, 0, 0)
self.guiltysfx = audio.loadhandle(False, guiltyfile+".opus" if exists(guiltyfile+".opus") else guiltyfile+".wav", 0, 0, 0)
self.notguiltysfx = audio.loadhandle(False, notguiltyfile, 0, 0, 0)
self.healthbars.connect(self.netmsg_hp)
self.disconnectnow = False
self.swapping = False
@ -2835,6 +2825,9 @@ class TCP_Thread(QtCore.QThread):
elif header == 'ZZ':
if self.parent.modcall:
audio.freehandle(self.parent.modcall)
self.parent.modcall = audio.loadhandle(0, "mod_call.wav", 0, 0, 0)
audio.sethandleattr(self.parent.modcall, BASS_ATTRIB_VOL, self.parent.soundslider.value() / 100.0)
audio.playhandle(self.parent.modcall, False)
if len(network) > 1:
@ -2850,14 +2843,19 @@ class TCP_Thread(QtCore.QThread):
elif header == 'RT':
testimony = network[1]
wtcefile = AOpath+"sounds/general/sfx-testimony2"
audio.freehandle(self.parent.wtcesfx)
if testimony == 'judgeruling':
variant = int(network[2])
if variant == 0:
audio.playhandle(self.parent.notguiltysfx, True)
wtcefile = AOpath+"sounds/general/sfx-notguilty"
elif variant == 1:
audio.playhandle(self.parent.guiltysfx, True)
wtcefile = AOpath+"sounds/general/sfx-guilty"
else:
variant = 0
self.parent.wtcesfx = audio.loadhandle(False, wtcefile+".opus" if exists(wtcefile+".opus") else wtcefile+".wav", 0, 0, 0)
audio.sethandleattr(self.parent.wtcesfx, BASS_ATTRIB_VOL, self.parent.soundslider.value() / 100.0)
audio.playhandle(self.parent.wtcesfx, True)
self.parent.WTCEsignal.emit(testimony, variant)