diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.cpp b/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.cpp index 0fdaf4937f..a10fa21c6a 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.cpp @@ -356,6 +356,11 @@ std::vector pyAudioControl::GetPlaybackDevices() const return plgAudioSys::GetPlaybackDevices(); } +ST::string pyAudioControl::GetFriendlyDeviceName(const ST::string& deviceName) const +{ + return plgAudioSys::GetFriendlyDeviceName(deviceName); +} + void pyAudioControl::SetCaptureDevice(const ST::string& device) { plgAudioSys::SetCaptureDevice(device); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.h b/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.h index 0b9d9e05b9..45a862371c 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.h @@ -111,6 +111,8 @@ class pyAudioControl std::vector GetPlaybackDevices() const; + ST::string GetFriendlyDeviceName(const ST::string& deviceName) const; + //------------------------ diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAudioControlGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyAudioControlGlue.cpp index 0de3f9534b..c8c2dc63fc 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAudioControlGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyAudioControlGlue.cpp @@ -377,6 +377,16 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptAudioControl, getPlaybackDevices) return tup; } +PYTHON_METHOD_DEFINITION(ptAudioControl, getFriendlyDeviceName, args) +{ + PyObject* devicename; + if (!PyArg_ParseTuple(args, "O", &devicename) || !PyString_CheckEx(devicename)) { + PyErr_SetString(PyExc_TypeError, "getFriendlyDeviceName expects a string"); + PYTHON_RETURN_ERROR; + } + return PyUnicode_FromSTString(self->fThis->GetFriendlyDeviceName(PyString_AsStringEx(devicename))); +} + PYTHON_METHOD_DEFINITION(ptAudioControl, setCaptureDevice, args) { PyObject* devicename; @@ -436,6 +446,7 @@ PYTHON_START_METHODS_TABLE(ptAudioControl) PYTHON_METHOD(ptAudioControl, setPlaybackDevice, "Params: devicename,restart\nSets audio system output device by name, and optionally restarts it"), PYTHON_METHOD(ptAudioControl, getPlaybackDevice, "Gets the name for the device being used by the audio system"), PYTHON_METHOD_NOARGS(ptAudioControl, getPlaybackDevices, "Gets the names of all available audio playback devices"), + PYTHON_METHOD(ptAudioControl, getFriendlyDeviceName, "Params: devicename\nReturns the provided device name without any OpenAL prefixes applied"), PYTHON_METHOD_NOARGS(ptAudioControl, canSetMicLevel, "Can the microphone level be set? Returns 1 if true otherwise returns 0."), PYTHON_METHOD(ptAudioControl, setMicLevel, "Params: level\nSets the microphone recording level (0.0 to 1.0)."),