8888kDemoMovieName = "avi/UruPreview.webm"
8989gPreviewStarted = 0
9090prevAudioDeviceName = None
91+ gAudioDevices = ()
9192
9293# =====================================
9394# Aspect Ratios
@@ -1244,15 +1245,15 @@ def OnGUINotify(self,id,control,event):
12441245 if self .restartAudio :
12451246 audio = ptAudioControl ()
12461247 audioField = ptGUIControlKnob (AudioSettingsDlg .dialog .getControlFromTag (kAudioModeID ))
1247- audModeNum = audio . getNumAudioDevices ( ) - 1
1248+ audModeNum = len ( gAudioDevices ) - 1
12481249 curSelection = round (audioField .getValue () * audModeNum )
12491250 intCurSelection = int (curSelection )
12501251
12511252 #Enable EAX Support
12521253 EAXcheckbox = ptGUIControlCheckBox (AudioSettingsDlg .dialog .getControlFromTag (kAudioModeCBID03 ))
12531254 audio .useEAXAcceleration (EAXcheckbox .isChecked ())
12541255
1255- audio .setDeviceName ( audio . getAudioDeviceName ( intCurSelection ) , 1 )
1256+ audio .setPlaybackDevice ( gAudioDevices [ intCurSelection ] , 1 )
12561257 self .WriteAudioControls ()
12571258
12581259 elif event == kAction or event == kValueChanged :
@@ -1310,23 +1311,20 @@ def OnGUINotify(self,id,control,event):
13101311 self .restartAudio = 1
13111312 audio = ptAudioControl ()
13121313 #~ print "Number of Audio Devices: %d" % (audio.getNumAudioDevices())
1313- audModeNum = audio . getNumAudioDevices () - 1
1314+ audModeNum = len ( gAudioDevices ) - 1
13141315 curSelection = round (control .getValue () * audModeNum )
13151316 intCurSelection = int (curSelection )
13161317 control .setValue (curSelection / audModeNum )
13171318
1318- audioDeviceName = audio .getAudioDeviceName (intCurSelection )
1319-
1319+ audioDeviceName = gAudioDevices [intCurSelection ]
13201320 audioModeCtrlTextBox = ptGUIControlTextBox (AudioSettingsDlg .dialog .getControlFromTag (kAudioModeTextID ))
1321- curText = audioModeCtrlTextBox .getString ()
1322- if curText != audio .getAudioDeviceName (intCurSelection ):
1323- audioModeCtrlTextBox .setString (audioDeviceName )
1321+ audioModeCtrlTextBox .setStringW (audio .getFriendlyDeviceName (audioDeviceName ))
13241322
13251323 if audioDeviceName != prevAudioDeviceName : #Only update the EAX checkbox when the mouse has been let up...
13261324 print "Audio Device Name changed!"
13271325 prevAudioDeviceName = audioDeviceName
13281326 EAXcheckbox = ptGUIControlCheckBox (AudioSettingsDlg .dialog .getControlFromTag (kAudioModeCBID03 ))
1329- if not audio .supportsEAX ( audioDeviceName ):
1327+ if not audio .isEAXSupported ( ):
13301328 print "Disabling EAX checkbox"
13311329 #Disable EAX checkbox
13321330 EAXcheckbox .disable ()
@@ -1670,7 +1668,7 @@ def WriteAudioControls(self):
16701668
16711669 EAXcheckbox = ptGUIControlCheckBox (AudioSettingsDlg .dialog .getControlFromTag (kAudioModeCBID03 ))
16721670
1673- xIniAudio .SetAudioMode ( true , audio .getDeviceName (), EAXcheckbox .isChecked () )
1671+ xIniAudio .SetAudioMode ( true , audio .getPlaybackDevice (), EAXcheckbox .isChecked () )
16741672 #xIniAudio.SetAudioMode( audio.isEnabled(), audio.getDeviceName(), EAXcheckbox.isChecked() )
16751673 #xIniAudio.SetAudioMode( audio.isEnabled(), audio.getDeviceName(), audio.isUsingEAXAcceleration() )
16761674 #xIniAudio.SetMicLevel( audio.getMicLevel() )
@@ -1679,11 +1677,14 @@ def WriteAudioControls(self):
16791677 xIniAudio .WriteIni ()
16801678
16811679 def InitAudioControlsGUI (self ):
1680+ global gAudioDevices
16821681 global prevAudioDeviceName
16831682
16841683 xIniAudio .ReadIni ()
16851684 audio = ptAudioControl ()
16861685
1686+ gAudioDevices = audio .getPlaybackDevices ()
1687+
16871688 audioField = ptGUIControlKnob (AudioSettingsDlg .dialog .getControlFromTag (kAudioNumberOfSoundsSliderTag ))
16881689 audioField .setValue ( audio .getPriorityCutoff () )
16891690
@@ -1714,21 +1715,21 @@ def InitAudioControlsGUI(self):
17141715 respDisableItems .run (self .key , state = "enableEAX" )
17151716
17161717 audioField = ptGUIControlKnob (AudioSettingsDlg .dialog .getControlFromTag (kAudioModeID ))
1717- numAudioDevices = audio . getNumAudioDevices ( ) - 1.0
1718+ numAudioDevices = len ( gAudioDevices ) - 1.0
17181719
17191720 if numAudioDevices > 0 :
1720- for num in range ( audio . getNumAudioDevices () ):
1721- if audio . getAudioDeviceName ( num ) == audio .getDeviceName ():
1722- if not audio .supportsEAX ( audio . getDeviceName () ):
1721+ for num , device in enumerate ( gAudioDevices ):
1722+ if gAudioDevices [ num ] == audio .getPlaybackDevice ():
1723+ if not audio .isEAXSupported ( ):
17231724 EAXcheckbox .disable ()
17241725 respDisableItems .run (self .key , state = "disableEAX" )
17251726 EAXcheckbox .setChecked (false )
17261727 ptGUIControlTextBox (AudioSettingsDlg .dialog .getControlFromTag (kAudioModeEAXTextID )).setForeColor (ptColor (0.839 , 0.785 , 0.695 , 1 ))
17271728
17281729 audioField .setValue (num / numAudioDevices )
17291730 audioModeCtrlTextBox = ptGUIControlTextBox (AudioSettingsDlg .dialog .getControlFromTag (kAudioModeTextID ))
1730- audioDeviceName = prevAudioDeviceName = audio .getAudioDeviceName ( num )
1731- audioModeCtrlTextBox .setString ( audioDeviceName )
1731+ audioDeviceName = prevAudioDeviceName = audio .getPlaybackDevice ( )
1732+ audioModeCtrlTextBox .setStringW ( audio . getFriendlyDeviceName ( device ) )
17321733 else :
17331734 EAXcheckbox .disable ()
17341735 respDisableItems .run (self .key , state = "disableEAX" )
0 commit comments