Merge pull request #587 from moralrecordings/pulseaudio_fix
This commit is contained in:
commit
5106ba5307
@ -37,7 +37,7 @@ bool Soundux::PulseApi::setup()
|
|||||||
load(context_move_sink_input_by_index);
|
load(context_move_sink_input_by_index);
|
||||||
load(context_move_source_output_by_name);
|
load(context_move_source_output_by_name);
|
||||||
load(context_move_source_output_by_index);
|
load(context_move_source_output_by_index);
|
||||||
load(context_set_sink_input_mute);
|
load(context_set_source_mute_by_name);
|
||||||
load(context_unload_module);
|
load(context_unload_module);
|
||||||
load(context_get_state);
|
load(context_get_state);
|
||||||
load(operation_get_state);
|
load(operation_get_state);
|
||||||
@ -69,7 +69,7 @@ bool Soundux::PulseApi::setup()
|
|||||||
load(context_move_sink_input_by_index);
|
load(context_move_sink_input_by_index);
|
||||||
load(context_move_source_output_by_name);
|
load(context_move_source_output_by_name);
|
||||||
load(context_move_source_output_by_index);
|
load(context_move_source_output_by_index);
|
||||||
load(context_set_sink_input_mute);
|
load(context_set_source_mute_by_name);
|
||||||
load(context_unload_module);
|
load(context_unload_module);
|
||||||
load(context_get_state);
|
load(context_get_state);
|
||||||
load(operation_get_state);
|
load(operation_get_state);
|
||||||
|
@ -26,9 +26,9 @@ namespace Soundux
|
|||||||
pulse_forward_decl(context_get_server_info);
|
pulse_forward_decl(context_get_server_info);
|
||||||
pulse_forward_decl(context_set_state_callback);
|
pulse_forward_decl(context_set_state_callback);
|
||||||
pulse_forward_decl(context_set_default_source);
|
pulse_forward_decl(context_set_default_source);
|
||||||
pulse_forward_decl(context_set_sink_input_mute);
|
|
||||||
pulse_forward_decl(context_get_module_info_list);
|
pulse_forward_decl(context_get_module_info_list);
|
||||||
pulse_forward_decl(context_move_sink_input_by_name);
|
pulse_forward_decl(context_move_sink_input_by_name);
|
||||||
|
pulse_forward_decl(context_set_source_mute_by_name);
|
||||||
pulse_forward_decl(context_move_sink_input_by_index);
|
pulse_forward_decl(context_move_sink_input_by_index);
|
||||||
pulse_forward_decl(context_get_sink_input_info_list);
|
pulse_forward_decl(context_get_sink_input_info_list);
|
||||||
pulse_forward_decl(context_move_source_output_by_name);
|
pulse_forward_decl(context_move_source_output_by_name);
|
||||||
|
@ -144,8 +144,7 @@ namespace Soundux::Objects
|
|||||||
|
|
||||||
fetchLoopBackSinkId();
|
fetchLoopBackSinkId();
|
||||||
|
|
||||||
if (!nullSink || !loopBack || !loopBackSink || !passthrough || !passthroughSink || !passthroughLoopBack ||
|
if (!nullSink || !loopBack || !loopBackSink || !passthrough || !passthroughSink || !passthroughLoopBack)
|
||||||
!defaultSourceId)
|
|
||||||
{
|
{
|
||||||
unloadLeftOvers();
|
unloadLeftOvers();
|
||||||
return false;
|
return false;
|
||||||
@ -196,17 +195,6 @@ namespace Soundux::Objects
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
this));
|
this));
|
||||||
await(PulseApi::context_get_sink_input_info_list(
|
|
||||||
context,
|
|
||||||
[]([[maybe_unused]] pa_context *ctx, const pa_sink_input_info *info, [[maybe_unused]] int eol,
|
|
||||||
void *userData) {
|
|
||||||
auto *thiz = reinterpret_cast<PulseAudio *>(userData);
|
|
||||||
if (info && info->name == thiz->defaultSource)
|
|
||||||
{
|
|
||||||
thiz->defaultSourceId = info->index;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
this));
|
|
||||||
}
|
}
|
||||||
void PulseAudio::fetchLoopBackSinkId()
|
void PulseAudio::fetchLoopBackSinkId()
|
||||||
{
|
{
|
||||||
@ -644,8 +632,8 @@ namespace Soundux::Objects
|
|||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
await(PulseApi::context_set_sink_input_mute(
|
await(PulseApi::context_set_source_mute_by_name(
|
||||||
context, *defaultSourceId, state,
|
context, defaultSource.c_str(), state,
|
||||||
+[]([[maybe_unused]] pa_context *ctx, int success, void *userData) {
|
+[]([[maybe_unused]] pa_context *ctx, int success, void *userData) {
|
||||||
*reinterpret_cast<bool *>(userData) = success;
|
*reinterpret_cast<bool *>(userData) = success;
|
||||||
},
|
},
|
||||||
@ -653,7 +641,7 @@ namespace Soundux::Objects
|
|||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
Fancy::fancy.logTime().failure() << "Failed to mute loopback sink" << std::endl;
|
Fancy::fancy.logTime().failure() << "Failed to mute default source" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
|
@ -49,7 +49,6 @@ namespace Soundux
|
|||||||
std::string serverName;
|
std::string serverName;
|
||||||
|
|
||||||
std::string defaultSource;
|
std::string defaultSource;
|
||||||
std::optional<std::uint32_t> defaultSourceId;
|
|
||||||
|
|
||||||
std::map<std::string, std::uint32_t> movedApplications;
|
std::map<std::string, std::uint32_t> movedApplications;
|
||||||
std::map<std::string, std::uint32_t> movedPassthroughApplications;
|
std::map<std::string, std::uint32_t> movedPassthroughApplications;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user