diff --git a/Python/plasma/Plasma.py b/Python/plasma/Plasma.py index f37a3f30..547df56e 100644 --- a/Python/plasma/Plasma.py +++ b/Python/plasma/Plasma.py @@ -1281,46 +1281,22 @@ def enableVoiceChat(self,state): """Enables or disables voice chat.""" pass - def enableVoiceCompression(self,state): - """Enables or disables voice compression.""" - pass - - def enableVoiceNetBroadcast(self,state): - """Enables or disables voice over network broadcast.""" - pass - - def enableVoiceRecording(self,state): - """Enables or disables voice recording.""" - pass - def getAmbienceVolume(self): """Returns the volume (0.0 to 1.0) for the Ambiance.""" pass - def getAudioDeviceName(self,index): - """Gets the name of audio device for the given index""" - pass - - def getDeviceName(self): - """Gets the name for the device being used by the audio system""" + def getFriendlyDeviceName(self): + """Returns the provided device name without any OpenAL prefixes applied.""" pass def getGUIVolume(self): """Returns the volume (0.0 to 1.0) for the GUI dialogs.""" pass - def getHighestMode(self): - """Gets the highest possible audio system mode""" - pass - def getMicLevel(self): """Returns the microphone recording level (0.0 to 1.0).""" pass - def getMode(self): - """Gets the audio system mode""" - pass - def getMusicVolume(self): """Returns the volume (0.0 to 1.0) for the Music.""" pass @@ -1329,8 +1305,12 @@ def getNPCVoiceVolume(self): """Returns the volume (0.0 to 1.0) for the NPC's voice.""" pass - def getNumAudioDevices(self): - """Returns the number of available audio devices.""" + def getPlaybackDevice(self): + """Gets the name for the device being used by the audio system.""" + pass + + def getPlaybackDevices(self): + """Gets the names of all available audio playback devices.""" pass def getPriorityCutoff(self): @@ -1353,10 +1333,6 @@ def isEnabled(self): """Is the audio enabled? Returns 1 if true otherwise returns 0.""" pass - def isHardwareAccelerated(self): - """Is audio hardware acceleration enabled? Returns 1 if true otherwise returns 0.""" - pass - def isMuted(self): """Are all sounds muted? Returns 1 if true otherwise returns 0.""" pass @@ -1365,10 +1341,6 @@ def isUsingEAXAcceleration(self): """Is EAX sound acceleration enabled? Returns 1 if true otherwise returns 0.""" pass - def isVoiceCompressionEnabled(self): - """Is voice compression enabled? Returns 1 if true otherwise returns 0.""" - pass - def isVoiceNetBroadcastEnabled(self): """Is voice over net enabled? Returns 1 if true otherwise returns 0.""" pass @@ -1385,23 +1357,11 @@ def pushToTalk(self,state): """Enables or disables 'push-to-talk'.""" pass - def recordFrame(self,size): - """Sets the voice packet frame size.""" - pass - - def recordSampleRate(self,sampleRate): - """Sets the recording sample rate.""" - pass - def setAmbienceVolume(self,volume): """Sets the Ambience volume (0.0 to 1.0) for the game. This only sets the volume for this game session.""" pass - def setDeviceName(self,devicename,restart): - """Sets the device name for the audio system, and optionally restarts it""" - pass - def setGUIVolume(self,volume): """Sets the GUI dialog volume (0.0 to 1.0) for the game. This only sets the volume for this game session.""" @@ -1415,10 +1375,6 @@ def setMicLevel(self,level): """Sets the microphone recording level (0.0 to 1.0).""" pass - def setMode(self,mode): - """Sets the audio system mode""" - pass - def setMusicVolume(self,volume): """Sets the Music volume (0.0 to 1.0) for the game. This only sets the volume for this game session.""" @@ -1429,6 +1385,10 @@ def setNPCVoiceVolume(self,volume): This only sets the volume for this game session.""" pass + def setPlaybackDevice(self,devicename,restart): + """Sets audio system output device by name, and optionally restarts it""" + pass + def setPriorityCutoff(self,priority): """Sets the sound priority""" pass @@ -1456,10 +1416,6 @@ def squelchLevel(self,level): """Sets the squelch level.""" pass - def supportsEAX(self): - """Returns true or false based on whether or not a the device specified supports EAX""" - pass - def unmuteAll(self): """Unmutes all sounds.""" pass @@ -1468,10 +1424,6 @@ def useEAXAcceleration(self,state): """Enables or disables EAX sound acceleration (requires hardware acceleration).""" pass - def useHardwareAcceleration(self,state): - """Enables or disables audio hardware acceleration.""" - pass - class ptAvatar: """Plasma avatar class""" def __init__(self): diff --git a/Python/xIniAudio.py b/Python/xIniAudio.py index 8c073612..4ec85a61 100644 --- a/Python/xIniAudio.py +++ b/Python/xIniAudio.py @@ -324,9 +324,9 @@ def SetAudioMode(init, device, eax): print device if entryDev: - entryDev.setValue(0, "\"" + device + "\"") + entryDev.setValue(0, "\"" + device.encode("utf-8") + "\"") else: - gIniFile.addEntry("Audio.SetDeviceName \"" + device + "\"") + gIniFile.addEntry("Audio.SetDeviceName \"" + device.encode("utf-8") + "\"") if eax: val = kBeTrue diff --git a/Python/xOptionsMenu.py b/Python/xOptionsMenu.py index e925dc33..232a1b8b 100644 --- a/Python/xOptionsMenu.py +++ b/Python/xOptionsMenu.py @@ -88,6 +88,7 @@ kDemoMovieName = "avi/UruPreview.webm" gPreviewStarted = 0 prevAudioDeviceName = None +gAudioDevices = () # ===================================== # Aspect Ratios @@ -1244,7 +1245,7 @@ def OnGUINotify(self,id,control,event): if self.restartAudio: audio = ptAudioControl() audioField = ptGUIControlKnob(AudioSettingsDlg.dialog.getControlFromTag(kAudioModeID)) - audModeNum = audio.getNumAudioDevices() - 1 + audModeNum = len(gAudioDevices) - 1 curSelection = round(audioField.getValue() * audModeNum) intCurSelection = int(curSelection) @@ -1252,7 +1253,7 @@ def OnGUINotify(self,id,control,event): EAXcheckbox = ptGUIControlCheckBox(AudioSettingsDlg.dialog.getControlFromTag(kAudioModeCBID03)) audio.useEAXAcceleration(EAXcheckbox.isChecked()) - audio.setDeviceName(audio.getAudioDeviceName(intCurSelection), 1) + audio.setPlaybackDevice(gAudioDevices[intCurSelection], 1) self.WriteAudioControls() elif event == kAction or event == kValueChanged: @@ -1310,23 +1311,20 @@ def OnGUINotify(self,id,control,event): self.restartAudio = 1 audio = ptAudioControl() #~ print "Number of Audio Devices: %d" % (audio.getNumAudioDevices()) - audModeNum = audio.getNumAudioDevices() - 1 + audModeNum = len(gAudioDevices) - 1 curSelection = round(control.getValue() * audModeNum) intCurSelection = int(curSelection) control.setValue(curSelection/audModeNum) - audioDeviceName = audio.getAudioDeviceName(intCurSelection) - + audioDeviceName = gAudioDevices[intCurSelection] audioModeCtrlTextBox = ptGUIControlTextBox(AudioSettingsDlg.dialog.getControlFromTag(kAudioModeTextID)) - curText = audioModeCtrlTextBox.getString() - if curText != audio.getAudioDeviceName(intCurSelection): - audioModeCtrlTextBox.setString(audioDeviceName) + audioModeCtrlTextBox.setStringW(audio.getFriendlyDeviceName(audioDeviceName)) if audioDeviceName != prevAudioDeviceName: #Only update the EAX checkbox when the mouse has been let up... print "Audio Device Name changed!" prevAudioDeviceName = audioDeviceName EAXcheckbox = ptGUIControlCheckBox(AudioSettingsDlg.dialog.getControlFromTag(kAudioModeCBID03)) - if not audio.supportsEAX(audioDeviceName): + if not audio.isEAXSupported(): print "Disabling EAX checkbox" #Disable EAX checkbox EAXcheckbox.disable() @@ -1670,7 +1668,7 @@ def WriteAudioControls(self): EAXcheckbox = ptGUIControlCheckBox(AudioSettingsDlg.dialog.getControlFromTag(kAudioModeCBID03)) - xIniAudio.SetAudioMode( true, audio.getDeviceName(), EAXcheckbox.isChecked() ) + xIniAudio.SetAudioMode( true, audio.getPlaybackDevice(), EAXcheckbox.isChecked() ) #xIniAudio.SetAudioMode( audio.isEnabled(), audio.getDeviceName(), EAXcheckbox.isChecked() ) #xIniAudio.SetAudioMode( audio.isEnabled(), audio.getDeviceName(), audio.isUsingEAXAcceleration() ) #xIniAudio.SetMicLevel( audio.getMicLevel() ) @@ -1679,11 +1677,14 @@ def WriteAudioControls(self): xIniAudio.WriteIni() def InitAudioControlsGUI(self): + global gAudioDevices global prevAudioDeviceName xIniAudio.ReadIni() audio = ptAudioControl() + gAudioDevices = audio.getPlaybackDevices() + audioField = ptGUIControlKnob(AudioSettingsDlg.dialog.getControlFromTag(kAudioNumberOfSoundsSliderTag)) audioField.setValue( audio.getPriorityCutoff() ) @@ -1714,12 +1715,12 @@ def InitAudioControlsGUI(self): respDisableItems.run(self.key, state="enableEAX") audioField = ptGUIControlKnob(AudioSettingsDlg.dialog.getControlFromTag(kAudioModeID)) - numAudioDevices = audio.getNumAudioDevices() - 1.0 + numAudioDevices = len(gAudioDevices) - 1.0 if numAudioDevices > 0: - for num in range(audio.getNumAudioDevices()): - if audio.getAudioDeviceName(num) == audio.getDeviceName(): - if not audio.supportsEAX(audio.getDeviceName()): + for num, device in enumerate(gAudioDevices): + if gAudioDevices[num] == audio.getPlaybackDevice(): + if not audio.isEAXSupported(): EAXcheckbox.disable() respDisableItems.run(self.key, state="disableEAX") EAXcheckbox.setChecked(false) @@ -1727,8 +1728,8 @@ def InitAudioControlsGUI(self): audioField.setValue(num/numAudioDevices) audioModeCtrlTextBox = ptGUIControlTextBox(AudioSettingsDlg.dialog.getControlFromTag(kAudioModeTextID)) - audioDeviceName = prevAudioDeviceName = audio.getAudioDeviceName(num) - audioModeCtrlTextBox.setString(audioDeviceName) + audioDeviceName = prevAudioDeviceName = audio.getPlaybackDevice() + audioModeCtrlTextBox.setStringW(audio.getFriendlyDeviceName(device)) else: EAXcheckbox.disable() respDisableItems.run(self.key, state="disableEAX")