Test release

This commit is contained in:
Vasiliy Doylov 2024-10-27 23:09:38 +03:00
parent c0c94dc81e
commit 999cddfdca
Signed by: NekoCWD
GPG key ID: B7BE22D44474A582
2 changed files with 34 additions and 5 deletions

View file

@ -1,3 +1,5 @@
# Q6Meow Output Switcher # Q6Meow Output Switcher
A bridge between q6meowd and callaudiod A bridge between q6meowd and callaudiod
This program will receive the callaudiod signal then call q6meowd to stop the stream, then set the ALSA ctl to speaker or earpeace, then call q6meowd to start the stream again

View file

@ -20,12 +20,23 @@
Alsa.ElemId speaker_id; Alsa.ElemId speaker_id;
Alsa.ElemId earpiece_id; Alsa.ElemId earpiece_id;
string speaker_mixer;
string earpiece_mixer;
string card_name;
private const GLib.OptionEntry[] options = {
{ "speaker", 's', OptionFlags.NONE, OptionArg.STRING, ref speaker_mixer, "mixer for speaker mode", "QUAT_MI2S_RX Voice Mixer VoiceMMode1" },
{ "earpiece", 'e', OptionFlags.NONE, OptionArg.STRING, ref earpiece_mixer, "mixer for earpiece mode", "SLIMBUS_0_RX Voice Mixer VoiceMMode1" },
{ "card", 'c', OptionFlags.NONE, OptionArg.STRING, ref card_name, "alsa card", "hw:0" },
{ null }
};
void get_mixes (string earpiece, string speaker) { void get_mixes (string earpiece, string speaker) {
var list = new List<Alsa.ElemId> (); var list = new List<Alsa.ElemId> ();
Alsa.Card card; Alsa.Card card;
Alsa.ElemList elem_list; Alsa.ElemList elem_list;
Alsa.ElemId elem_id; Alsa.ElemId elem_id;
Alsa.Card.open (out card, "hw:0"); Alsa.Card.open (out card, card_name);
Alsa.ElemList.alloc (out elem_list); Alsa.ElemList.alloc (out elem_list);
Alsa.ElemId.alloc (out elem_id); Alsa.ElemId.alloc (out elem_id);
card.elem_list (elem_list); // Getting list without items card.elem_list (elem_list); // Getting list without items
@ -48,17 +59,33 @@ void get_mixes (string earpiece, string speaker) {
} }
if (speaker_id != null) { if (speaker_id != null) {
message ("Speaker Setted %s", speaker_id.get_name ()); message ("Speaker Setted %s", speaker_id.get_name ());
} else {
error ("Speaker mixer not set");
} }
if (earpiece_id != null) { if (earpiece_id != null) {
message ("Earpiece Setted %s", earpiece_id.get_name ()); message ("Earpiece Setted %s", earpiece_id.get_name ());
} else {
error ("Earpiece mixer not set");
} }
} }
int main (string[] args) { int main (string[] args) {
Alsa.Card card;
message ("Card open: %d", Alsa.Card.open (out card, "hw:0", Alsa.CardOpenType.NONBLOCK));
get_mixes ("SLIMBUS_0_RX Voice Mixer VoiceMMode1", "QUAT_MI2S_RX Voice Mixer VoiceMMode1"); try {
var opt_context = new OptionContext ("\n\tThis program will receive the callaudiod signal then call q6meowd to stop the stream, then set the ALSA ctl to speaker or earpeace, then call q6meowd to start the stream again");
opt_context.set_help_enabled (true);
opt_context.add_main_entries (options, null);
opt_context.parse (ref args);
} catch (OptionError e) {
printerr ("error: %s\n", e.message);
printerr ("Run '%s --help' to see a full list of available command line options.\n", args[0]);
return 1;
}
Alsa.Card card;
message ("Card open: %d", Alsa.Card.open (out card, card_name, Alsa.CardOpenType.NONBLOCK));
get_mixes (earpiece_mixer, speaker_mixer);
Q6MeowD q6meowd_proxy = Bus.get_proxy_sync (BusType.SYSTEM, "org.postmarketos.q6meowd", "/org/postmarketos/q6meowd", DBusProxyFlags.NONE); Q6MeowD q6meowd_proxy = Bus.get_proxy_sync (BusType.SYSTEM, "org.postmarketos.q6meowd", "/org/postmarketos/q6meowd", DBusProxyFlags.NONE);
CallAudioD callaudiod_proxy = Bus.get_proxy_sync (BusType.SESSION, "org.mobian_project.CallAudio", "/org/mobian_project/CallAudio", DBusProxyFlags.NONE); CallAudioD callaudiod_proxy = Bus.get_proxy_sync (BusType.SESSION, "org.mobian_project.CallAudio", "/org/mobian_project/CallAudio", DBusProxyFlags.NONE);
((DBusProxy) callaudiod_proxy).g_properties_changed.connect ((props, inv) => { ((DBusProxy) callaudiod_proxy).g_properties_changed.connect ((props, inv) => {