Revert "fix(pulseaudio): mute the default audio source directly"
This reverts commit 71eb3a90dfba09813b0bfe11dab2fd63e58ca322.
This commit is contained in:
parent
90b23d53d3
commit
611ebcc216
@ -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_source_mute_by_name);
|
load(context_set_sink_input_mute);
|
||||||
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_source_mute_by_name);
|
load(context_set_sink_input_mute);
|
||||||
load(context_unload_module);
|
load(context_unload_module);
|
||||||
load(context_get_state);
|
load(context_get_state);
|
||||||
load(operation_get_state);
|
load(operation_get_state);
|
||||||
@ -86,4 +86,4 @@ bool Soundux::PulseApi::setup()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -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);
|
||||||
@ -36,4 +36,4 @@ namespace Soundux
|
|||||||
pulse_forward_decl(context_move_source_output_by_index);
|
pulse_forward_decl(context_move_source_output_by_index);
|
||||||
} // namespace PulseApi
|
} // namespace PulseApi
|
||||||
} // namespace Soundux
|
} // namespace Soundux
|
||||||
#endif
|
#endif
|
@ -144,7 +144,8 @@ 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;
|
||||||
@ -195,6 +196,17 @@ 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()
|
||||||
{
|
{
|
||||||
@ -632,8 +644,8 @@ namespace Soundux::Objects
|
|||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
await(PulseApi::context_set_source_mute_by_name(
|
await(PulseApi::context_set_sink_input_mute(
|
||||||
context, defaultSource.c_str(), state,
|
context, *defaultSourceId, 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;
|
||||||
},
|
},
|
||||||
@ -641,7 +653,7 @@ namespace Soundux::Objects
|
|||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
Fancy::fancy.logTime().failure() << "Failed to mute default source" << std::endl;
|
Fancy::fancy.logTime().failure() << "Failed to mute loopback sink" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
@ -731,4 +743,4 @@ namespace Soundux::Objects
|
|||||||
return rtn;
|
return rtn;
|
||||||
}
|
}
|
||||||
} // namespace Soundux::Objects
|
} // namespace Soundux::Objects
|
||||||
#endif
|
#endif
|
@ -49,6 +49,7 @@ 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;
|
||||||
@ -98,4 +99,4 @@ namespace Soundux
|
|||||||
};
|
};
|
||||||
} // namespace Objects
|
} // namespace Objects
|
||||||
} // namespace Soundux
|
} // namespace Soundux
|
||||||
#endif
|
#endif
|
Loading…
x
Reference in New Issue
Block a user