maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Brainstorm (https://talk.maemo.org/forumdisplay.php?f=47)
-   -   [sandbox] Add caller specific ring tones & alarm specific tones (N900) (https://talk.maemo.org/showthread.php?t=41142)

srodin 2010-04-11 10:41

Re: [sandbox] Add caller specific ring tones & alarm specific tones (N900)
 
long time no responses on this thread. actually Venemo's idea sounds great, has anyone checked this option?

johnym 2010-04-24 07:47

Re: [sandbox] Add caller specific ring tones & alarm specific tones (N900)
 
Quote:

Originally Posted by kwotski (Post 485686)
This doesn't work, I'm sorry to say, because the phone app seems to block media player, even in silent profile. So the configured tone plays, but only after I answered the phone or hung up (haha).

If there's some way of getting around this (a more direct way of playing the ringtone, or removing the phone app's block, ...) and a way of stopping the file playing when you answer, hang up, or lose the call, then it might work.

I'm still waiting for the N900 to become available here in Australia, so I can't try it for myself, but here are a couple of ideas that might be worth experimenting with:

1) Select an mp3 as the default ring tone that is actually a symlink (or replace the already chosen ring tone with a symlink). Use the dbus approach to rewrite said symlink for each incoming call. This will only work if dbus sends the notification before the phone app starts playing the ring tone, doesn't cache the ring tone data, and doesn't do fancy stuff like resolving the symlink early when you configure the ring tone. If there's a race condition between the dbus event and the phone opening the ring tone file, renice(1)'ing the script to a better priority might work.

2) Instead of a symlink, try to make it a named pipe or unix domain socket, and have a daemon listening to the dbus messages and provide the appropriate audio data for the current caller. This requires more work, but would have the advantage of being able to provide silence up until the point where the caller info becomes available, so even if the dbus notification comes late, the right ring tone would be chosen (but you'd be perceived as being a tiny bit slower in answering your phone).

If anyone is able to test any of the two approaches, I'd love to hear the result. I only recently discovered that the N900 lacked this feature, and I'm thinking it might be a deal-breaker for me as I'm quite married to it on my old Palm...

EDIT: Argh, only now saw the later responses. Replace "mp3" above with the location of the converted wav file.

cipper 2010-04-24 13:03

Re: [sandbox] Add caller specific ring tones & alarm specific tones (N900)
 
Quote:

Originally Posted by Venemo (Post 557462)
Later I found out that actually the device converts the selected ringtone to a mono .wav file. (And it also does that quite buggyly. :p)
Look at "/home/user/.local/share/sounds".

So, a work-around would be the followig:
The same daemon described in my above post, but instead of manipulating the config, it should also convert the personal ringtones to .wav, and then simply rename the files before the phone application plays them. :D

I think that your solution would be too expensive in terms of cpu/battery and disk operations (solid state disks are capable of a limited number of writing operations).
We need a linux way for this, for example substituting the .local/share/sounds/Terrestial.aac.wav file with a FIFO file that is feeded by a fast mp3player (like mplayer) controlled by a daemon.

cipper 2010-04-24 13:05

Re: [sandbox] Add caller specific ring tones & alarm specific tones (N900)
 
just checked that mkfifo is provided by maemo default.

cipper 2010-04-24 13:27

Re: [sandbox] Add caller specific ring tones & alarm specific tones (N900)
 
just to laydown some steps:

1) preliminar operations (to do only once)
mv /home/user/.local/share/sounds/Terrestial.aac.wav /home/user/.local/share/sounds/Terrestial.aac.wav.bak
mkfifo /home/user/.local/share/sounds/fiforingtone.wav

2) when someone is calling
mplayer -ao pcm:file=/home/user/.local/share/sounds/fiforingtone.wav ringtone.mp3 &
PIDMPLAYER=$!

3) after answering or closing the call
kill $PIDMPLAYER

johnym 2010-04-26 05:59

Re: [sandbox] Add caller specific ring tones & alarm specific tones (N900)
 
Quote:

Originally Posted by cipper (Post 625836)
2) when someone is calling
mplayer -ao pcm:file=/home/user/.local/share/sounds/fiforingtone.wav ringtone.mp3 &

It's been a long time since I worked with named pipes, but if memory serves me a reader of a pipe will get an EOF (end-of-file) for any read if there is no writer attached, which would prevent the phone application from getting any data if it tries to read before the dbus notification has propagated to us. If that's the case, we'll need to have the perl script open the pipe for writing (and keep it open all the time), and simply funnel pcm data into it from mplayer when needed.

benny1967 2010-05-23 15:34

Re: [sandbox] Add caller specific ring tones & alarm specific tones (N900)
 
See
http://talk.maemo.org/showthread.php?t=52646

Seems to work at least for some ;)

Maybe if some bright guy could make sure that the phone app never starts playing a ringtone before the script changed the symlink....

Oh, and of course a GUI would be nice ;)

I added it as a solution to the original brainstorm proposal to get the whole thing into "under consideration" status.


All times are GMT. The time now is 03:59.

vBulletin® Version 3.8.8