Add framework for implementing Linux AudioManager
Source outputs must all be moved to new default source. Reference topic https://askubuntu.com/a/72076 * Adds microphone controls on Linux via PulseAudio (PA) for several points in https://github.com/OpenVR-Advanced-Settings/OpenVR-AdvancedSettings/issues/43. It can not be overstated how unsuited the public AudioManager API is for using the PA API. It can also not be overstated how undocumented and horrible the PA API is. The PA way of doing audio is very unlike the Windows way of doing audio, which the AudioManager is heavily influenced by. Since I don't have a Linux machine I have not been able to personally test this. https://github.com/feilen/ has graciously helped with testing. PulseAudio is very undocumented and not very widely used for what we need outside of official utilities. As such there's most likely a better way of doing things than I've done. Additional information can be found at https://github.com/username223/pulseaudio-device-changing. The "complex" PA API is asynchronous. Since our current AudioManager is running synchronously and would not work asynchronously (functions are expected to return valid data on function return) it is necessary to massage the PA API until it runs synchronously. This is done with a general workflow of 1. Register a callback function (`pa_context_get_source_info_list()`, for example). 2. Run the PA loop through `customPulseLoop()`. This will trigger any registered callbacks. Sometimes a `void*` is passed through the callback that can be used for custom data. `successCallback()` uses this to set the success variable. 3. Run the callback function and do required work. 4. Return to original function, do work or return values. It is not possible to run a `customPulseLoop()` inside of an already running loop (inside a callback), as this will lead to a PA assert error on runtime.
This commit is contained in:
@@ -37,7 +37,6 @@ HEADERS += src/overlaycontroller.h \
|
||||
src/utils/Matrix.h \
|
||||
src/utils/ChaperoneUtils.h \
|
||||
src/quaternion/quaternion.h \
|
||||
src/tabcontrollers/audiomanager/AudioManagerDummy.h \
|
||||
src/openvr/openvr_init.h \
|
||||
src/openvr/ivrinput_action.h \
|
||||
src/openvr/ivrinput_manifest.h \
|
||||
@@ -86,8 +85,18 @@ unix:!macx {
|
||||
SOURCES += src/media_keys/media_keys_dummy.cpp
|
||||
}
|
||||
|
||||
SOURCES += src/tabcontrollers/audiomanager/AudioManagerDummy.cpp
|
||||
HEADERS += src/tabcontrollers/audiomanager/AudioManagerDummy.h
|
||||
!noPulse {
|
||||
message(PulseAudio features enabled.)
|
||||
SOURCES += src/tabcontrollers/audiomanager/AudioManagerPulse.cpp
|
||||
HEADERS += src/tabcontrollers/audiomanager/AudioManagerPulse.h \
|
||||
src/tabcontrollers/audiomanager/AudioManagerPulse_internal.h
|
||||
LIBS += -lpulse
|
||||
}
|
||||
else {
|
||||
message(PulseAudio features disabled.)
|
||||
SOURCES += src/tabcontrollers/audiomanager/AudioManagerDummy.cpp
|
||||
HEADERS += src/tabcontrollers/audiomanager/AudioManagerDummy.h
|
||||
}
|
||||
}
|
||||
|
||||
macx {
|
||||
|
||||
Reference in New Issue
Block a user