maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   how to output audio to phone speaker? (N900) (https://talk.maemo.org/showthread.php?t=61902)

craftyguy 2010-09-08 05:52

how to output audio to phone speaker? (N900)
 
I'm considering developing an application, and one feature is to output audio over the phone speaker that you hear when you hold the N900 up to your ear (like when on the phone). I cannot find any information in the developer guide posted in the wiki. Is this possible?

pycage 2010-09-08 06:03

Re: how to output audio to phone speaker? (N900)
 
Some mixer settings make this possible but I don't remember the details.
Play with the switches in alsamixer -c0 until you get it to play over the ear piece.

uvatbc 2010-09-08 08:20

Re: how to output audio to phone speaker? (N900)
 
Quote:

Originally Posted by craftyguy (Post 810302)
I'm considering developing an application, and one feature is to output audio over the phone speaker that you hear when you hold the N900 up to your ear (like when on the phone). I cannot find any information in the developer guide posted in the wiki. Is this possible?

I've been researching this a bit, and I have only very vague hints (QT specific):
If you're using a QMediaPlayer object then by using QMediaPlayer::service() to get a QMediaService and then QMediaService::control(QAudioEndpointSelector_iid) to get a QAudioEndpointSelector, you should be able to select the audio output.

I haven't yet figured out what iid to pass to the service() function.
This is all theoretical so far, so if you do manage, please let me know as well.

craftyguy 2010-09-08 13:55

Re: how to output audio to phone speaker? (N900)
 
I've never used QT before, but a quick look at the documentation reveals this:

Quote:

QList<QString> QAudioEndpointSelector::availableEndpoints () const [pure virtual]

Returns a list of available audio endpoints.
Could this be used to get a list of all possible endpoints, so it would be easier to figure out what the proper endpoint is for the handset speaker?

pelago 2010-09-08 14:17

Re: how to output audio to phone speaker? (N900)
 
Good luck with this. I've sometimes wanted to listen to audio from Media Player or the web (e.g. web-based voicemail messages, or voicemail messages that come as email attachments) in private without having to use headphones, so if you can make this work that would be helpful. Or are you only thinking about trying to make this work for one app, rather than system-wide?

craftyguy 2010-09-08 14:45

Re: how to output audio to phone speaker? (N900)
 
Quote:

Originally Posted by pelago (Post 810675)
Good luck with this. I've sometimes wanted to listen to audio from Media Player or the web (e.g. web-based voicemail messages, or voicemail messages that come as email attachments) in private without having to use headphones, so if you can make this work that would be helpful. Or are you only thinking about trying to make this work for one app, rather than system-wide?

My idea is to make it work for one app. If I can figure it out, I would have absolutely no problem with sharing the solution with others so that they may implement it in their applications :)

uvatbc 2010-09-08 15:16

Re: how to output audio to phone speaker? (N900)
 
Quote:

Originally Posted by craftyguy (Post 810655)
I've never used QT before, but a quick look at the documentation reveals this:

Could this be used to get a list of all possible endpoints, so it would be easier to figure out what the proper endpoint is for the handset speaker?

That function will give you a list of the available endpoints, and then void setActiveEndpoint ( const QString & name ) will select one for you.

The problem is that QAudioEndpointSelector does not have a public constructor. This means that it is not supposed to be constructed by us on stack or heap - some factory class or API will return us an object or a derived class object.

It might even be that we (as devs) are supposed to derive and instantiate it, but, in this particular context I can't see how that makes sense.

The only thing that makes sense right now is the usage of QAudioEndpointSelector_iid to get to an object - which was the thrust of my previous comment.

RafaLL92 2010-10-03 17:58

Re: how to output audio to phone speaker? (N900)
 
That would be great if it could be implemented at least to the built-in media player!
Forgetting the headphones could be overcome to some extent :)

Whats the status? Is the 'project' dead?

uvatbc 2010-10-03 18:04

Re: how to output audio to phone speaker? (N900)
 
It's not a project - OP asked a development question regarding redirection of audio output.
I have tried a few bits of code, but so far I have only been able to easily change audio input source, not audio output.
I think I'll have to look at pulseaudio to see if there is an API to do what OP and I need.

kojacker 2010-11-22 18:14

Re: how to output audio to phone speaker? (N900)
 
Just wondering was this ever solved? I'm researching for a way to change the audio output to the ear piece speaker and came across this thread. Anyone get it working?

craftyguy 2010-11-22 18:44

Re: how to output audio to phone speaker? (N900)
 
Quote:

Originally Posted by kojacker (Post 880459)
Just wondering was this ever solved? I'm researching for a way to change the audio output to the ear piece speaker and came across this thread. Anyone get it working?

I could never find anything after reviewing all of the audio documentation I could find around N900/maemo5, so I gave up. :(


Hopefully you can figure out a way :)

SavageD 2010-11-22 21:07

Re: how to output audio to phone speaker? (N900)
 
A possible work around would be to go to this file.

/var/lib/pulse-nokia/ihf.parameters

Look through the file with a text editor untill you see this line:

x-maemo.alsa_sink.mixer_control = "HP DAC: control,Headphone:off,Earphone: off"

And change it to:

x-maemo.alsa_sink.mixer_control = "HP DAC: off,Headphone: off,Earphone: control"

And restart pulse audio daemon, I know it's not practical for a program but it's still worth a look.

Edit: On second thought forget it...I think it's too risky.

uvatbc 2011-01-22 09:06

Re: how to output audio to phone speaker? (N900)
 
I'm responding to this thread which is about 2 months old, but hopefully the interested members are still subscribed.
I'm back to bashing my head against this particular wall and came up with the following links which may be useful:
http://pulseaudio.org/wiki/Developer...elopingClients
http://pulseaudio.org/wiki/SampleAsyncDeviceList
http://pulseaudio.org/wiki/DBusInterface

I was thinking along the lines of:
1. Use PA api to enumerate all clients (including me)
2. Use PA api to enumerate the various audio sinks
3. Change my client's sink to the user specified sink.

craftyguy 2011-01-23 03:17

Re: how to output audio to phone speaker? (N900)
 
Wow thanks for digging into this a bit more! Hopefully I will get a chance to take a look in the next week or two.

gvaf 2011-01-23 19:48

Re: how to output audio to phone speaker? (N900)
 
I am trying to do the same for my app using qt and pulseaudio.

You can find the audio devices from the command line:
[
Quote:

pactl list
You can modify a sample application http://0pointer.de/lennart/projects/...c-example.html

I believe there is some kind of policy in pulseaudio:
Have a look on
Quote:

/etc/pulse/xpolicy.conf
/usr/share/policy/etc/rx51/syspart.conf
We need to find a way to mimic the configuration for skype or telepathy. But I am not sure what is the proper configuration?:confused:


All times are GMT. The time now is 22:14.

vBulletin® Version 3.8.8