-
-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Phone ringing and dialing sound #1203
base: master
Are you sure you want to change the base?
Conversation
|
1. alright so i guess hardcoding paths and looking at env variables ?
3. alright il leave that be
4. i agree, im in the proces of changing that
|
About 2.: Because I'm new to Vala I might be missing something but if
you compare https://valadoc.org/libcanberra/Canberra.FinishCallback.html
with the actual C api you can see it is missing the _userdata_
parameter. This together with the fact that seemingly this callback runs in a
special context where it has no access to anything makes it that it is
impossible to make the loop stop. The canberra docs also say something
about the context being unpredictable:
http://0pointer.de/lennart/projects/libcanberra/gtkdoc/libcanberra-canberra.html#ca-finish-callback-t
Pottering also says that you cant call Canberra functions from that
callback which makes it even more difficult.
Edit: Woopsie I just realized I should probably have used the cancel() function provided by libcanberra. Il try that out tomorrow and then maybe my ramblings are invalid.
So I guess doing C<=>Vala interop might be a solution but like I said Im
a nooby so I did not consider that an option.
|
Another small note about point 1.: This means also that its important to add freedesktop sound as a (optional) dependancy for packages otherwise you can get the fantastic user experience where it seems there is no sound but its just that you dont have a sound theme. But this is more of a distro maintainer's responsability I guess. |
About 1: You'd also need to use the active theme (if any) from Gtk.Settings.gtk_sound_theme_name. Check the specification for a detailed pseudocode on the sound lookup routine. About 2: The private Canberra.Context ctx;
private Canberra.Proplist props;
private uint32 id;
private boolean playing;
public void play_again() {
if (!playing) return;
ctx.play(id, props, () => {
Idle.add(() => {
play_again();
return Source.REMOVE;
});
});
}
public void play_loop() {
playing = true;
play_again();
}
public void cancel_loop() {
playing = false;
ctx.cancel(id);
} Bonus: You can easily add a few ms of silence between the sound plays by using Timeout.add() instead of Idle.add() - in case that makes it sound better. |
Nice! Thanks for the info. Il look into it. |
|
Okay, I will remove the singular sound also. I don't understand what you mean by 'main should not have a dependency on GStreamer', I did remove my dependancy on gst back to libcanberra already, did I forget a refrence somewhere ? |
BTW, I am meaning to redo the commits once you guys are happy with the code because I find them very ugly (no/bad messages, redundancy) if you would like that ofcourse. (and do rebase if needed) |
And if you like when we are done here I can put libcanberra on the deps wiki page. |
Ah, very nice that you took another look at my PR. I was starting to
worry that you maybe forgot about me. I will take a look at this stuff
asap (this week).
The actual ringing code also still realy pains me. Now that I gathered a
little bit more vala experience i'l give another shot at making it more
flexible. I hope I can put a little delay between the noises then.
…On 22/05/09 09:16, fiaxh wrote:
@fiaxh requested changes on this pull request.
> @@ -276,7 +276,6 @@ public class Dino.Plugins.Rtp.Plugin : RootInterface, VideoCallPlugin, Object {
device_monitor.stop();
}
destroy_call_pipe();
- Gst.deinit();
You aren't using Gstreamer for call sounds anymore.
> @@ -9,6 +9,7 @@ namespace Dino {
public signal void call_incoming(Call call, CallState state, Conversation conversation, bool video, bool multiparty);
public signal void call_outgoing(Call call, CallState state, Conversation conversation);
+ public signal void call_started_or_declined();
Please get rid of this signal. Instead, you should be able to connect to `call.notify["state"]` in the plugin and check for the respective states. We try to not move plugin logic into libdino, whenever possible.
> + Canberra
+ Gee
+ GLib
+ GModule
+ GObject
+ GDKPixbuf2
+)
+
+vala_precompile(PHONE_RINGER_VALA_C
+SOURCES
+ src/plugin.vala
+ src/register_plugin.vala
+CUSTOM_VAPIS
+ ${CMAKE_BINARY_DIR}/exports/xmpp-vala.vapi
+ ${CMAKE_BINARY_DIR}/exports/dino.vapi
+ ${CMAKE_BINARY_DIR}/exports/qlite.vapi
You are not using xmpp-vala or qlite in this plugin.
> + app.stream_interactor.get_module(Calls.IDENTITY).call_incoming.connect((call, state, conversation, video, multiparty) => {
+
+ loop_ringer();
+
+ call.notify["state"].connect(() => {
+ if (call.state != Dino.Entities.Call.State.RINGING) {
+ sound_context.cancel(ringer_id);
+ }
+ });
+
+ });
As @mar-v-in already mentioned, it would be a good idea to implement a `NotificationProvider` to get the call-specific notification events. The ringing sound can be started+stopped that way. You already did something in that direction in a previous version of this PR but unfortunately removed it again.
--
Reply to this email directly or view it on GitHub:
#1203 (review)
You are receiving this because you authored the thread.
Message ID: ***@***.***>
|
As mentioned here: dino#1203 (comment). This is a first draft of what adding the ringer as a NotificationProvider can look like. I made some assumptions which might be wrong. Further review will reveal this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looks quite good by now. But after trying it out, I think this really needs breaks between the sounds 😉 To put a delay between the sounds, you can replace Idle.add
with Timeout.add_seconds
, as mar-v-in mentioned before. You then need some variable to store whether it is currently supposed to be ringing or not (if the noise is retracted while the timeout is waiting), and then check it in the Timeout.
As mentioned here: dino#1203 (comment). This is a first draft of what adding the ringer as a NotificationProvider can look like. I made some assumptions which might be wrong. Further review will reveal this.
Gst.deinit caused the Dino proces to linger in the background when I tried using Gst in the phone ringer plugin. My reasoning for leaving it out even though Gst is not in use anymore in the ringer plugin is that this is a nasty bug that might crop up again in the future when someone tries to do anything else at all with Gst. I did the following things: - checked this https://gstreamer.freedesktop.org/documentation/gstreamer/gst.html#gst_deinit - tested that Dino works without the Gst.deinit - tried looking for a specific reason for the deinit with git log -L 276,+10 -- plugins/rtp/src/plugin.vala I didn't find anything so this made me conclude that it is better to leave it out.
@emildekeyser, I tried this out, and I like it... except the call is ringing tone is made even if I'm making the call using another client. What's worse is that that sound continues even after the call is connected (on the other device) and disconnected. So big 😢 and 👎 until that's fixed. (it should only make that noise if you're placing the call from this device. |
Yeah I am aware of this issue, this is on my backlog to fix, sorry I
should have added this to the pr description or something.
Not sure when I will have time for this maybe this weekend, maybe in a
couple weeks.
To be honest, I am really NOT enjoying working with this
DBus/GTK/GOBject ecosystem, you cannot believe how obscure everyting is.
So that is a factor which is also slowing me down :( but I find the idea
of XMPP calling very important so il try my best.
…On 23/03/01 02:08, Zach DeCook wrote:
@emildekeyser, I tried this out, and I like it... *except* the call is ringing tone is made even if I'm making the call using another client.
What's worse is that that sound continues even after the call is connected (on the other device) and disconnected.
So big 😢 and 👎 until that's fixed. (it should only make that noise if you're placing the call *from* this device.
--
Reply to this email directly or view it on GitHub:
#1203 (comment)
You are receiving this because you were mentioned.
Message ID: ***@***.***>
|
Issues
Progress