OESF Portal | OESF Forum | OESF Wiki | LinuxPDA | #planetgemini chat on matrix.org | #gemini-pda chat on Freenode | #zaurus and #alarmz chat on Freenode | ELSI (coming soon) | Ibiblio

IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Mono headphone output?
defunked
post Jul 23 2018, 08:06 AM
Post #1





Group: Members
Posts: 24
Joined: 21-July 18
Member No.: 826,576



I have come across two audio related problems with Sailfish CE on the Gemini. First, when headphones are plugged in to the device, the speakers continue to produce audio along with the headphone. It is my understanding that the Gemini has a single stereo audio DAC, but I expected the OS/driver to switch the output path from the speakers/amplifier to the headphones, when the headphones are inserted. In addition, the headphone are mono, along with the speakers.. That is certainly not right. I know the speakers are mono (and apparently phase inverted), but my understanding was that this hardware bug did not apply to the headphone jack. Has any one else noticed this behavior?

Bluetooth audio sending works fine.

Go to the top of the page
 
+Quote Post
vader
post Jul 23 2018, 01:28 PM
Post #2





Group: Members
Posts: 253
Joined: 21-January 18
Member No.: 816,775



QUOTE(defunked @ Jul 24 2018, 02:06 AM) *
I have come across two audio related problems with Sailfish CE on the Gemini. First, when headphones are plugged in to the device, the speakers continue to produce audio along with the headphone. It is my understanding that the Gemini has a single stereo audio DAC, but I expected the OS/driver to switch the output path from the speakers/amplifier to the headphones, when the headphones are inserted. In addition, the headphone are mono, along with the speakers.. That is certainly not right. I know the speakers are mono (and apparently phase inverted), but my understanding was that this hardware bug did not apply to the headphone jack. Has any one else noticed this behavior?

Bluetooth audio sending works fine.


I thought I was the only one who had this - due to my tinkering with trying to get SDL audio to work. The sound should automatically switch to headphones when they are inserted, but on mine (and apparently yours) they don't. Most fixes I found online involve using alsamixer to set the automute, although I can only see the master volume. On a positive, I have a command that will fix this, and I am writing an app (learning QML) which will do it in a friendly way. To get headphone output only (in stereo), you change the pulseaudio output port with (type in thumbterm or whatever terminal you use):

pactl set-sink-port output-wired_headphone

This routes the audio to the headphones. To set it back to the speakers, type:

pactl set-sink-port output-speaker

I'm sure there is a setting somewhere to control the automute, but I can't find it. I am still learning about Sailfish, but I do love that you *can* actually change things when they aren't right. For example, I added my SD card to /etc/fstab so it automounts when I reboot. I am still playing with the sound, and maybe I will find a proper fix, but until then, at least you can listen via headphones smile.gif


NOTE: If you don't set the port back after listening, then all sound will go to the headphones - alerts, ringtones etc! You won't hear the phone ringtone from the speakers, even when you unplug them.
Go to the top of the page
 
+Quote Post
vader
post Jul 23 2018, 06:59 PM
Post #3





Group: Members
Posts: 253
Joined: 21-January 18
Member No.: 816,775



I've been reading the mer porters pages and can confirm that the headphones do have a sense switch (/sys/devices/virtual/switch/h2w) which you can set up with dbus. I'm also looking for the silver button i/o so we can use it for things. I'll try to set them up tonight and if it is successful, I'll post the fix.
Go to the top of the page
 
+Quote Post
defunked
post Jul 24 2018, 07:47 AM
Post #4





Group: Members
Posts: 24
Joined: 21-July 18
Member No.: 826,576



Good to know it isn't a hardware problem with my particular unit.

I am still getting to know my way around Sailfish. I tried to build the simple QML Hello World example, and can't seem to get it to run on the simulator. I prefer to program in straight C, with a text editor and simple compiling scripts. As such, build tools make my head spin. I am used to writing GUI stuff in GTK+ so I don't have to mess around with C++, but I guess I am being pushed to into C++ land with sailfish. Is it possible to skip QML and build a UI directly from C++ with QT?

I have been reluctant to mess around in /etc/ out of concern that changes will get over-written during an OS update. Any idea what an OS update would over-write from that perspective?

Thanks for the information on pulse audio control.
Go to the top of the page
 
+Quote Post
vader
post Jul 24 2018, 02:05 PM
Post #5





Group: Members
Posts: 253
Joined: 21-January 18
Member No.: 816,775



QUOTE(defunked @ Jul 25 2018, 01:47 AM) *
Good to know it isn't a hardware problem with my particular unit.

I am still getting to know my way around Sailfish. I tried to build the simple QML Hello World example, and can't seem to get it to run on the simulator. I prefer to program in straight C, with a text editor and simple compiling scripts. As such, build tools make my head spin. I am used to writing GUI stuff in GTK+ so I don't have to mess around with C++, but I guess I am being pushed to into C++ land with sailfish. Is it possible to skip QML and build a UI directly from C++ with QT?


I develop on the gemini using vi (or if I feel lazy, tIDE). Have you installed openrepos? The app is called storeman and gives you access to third party apps/libs etc. You need to enable third party installs in the settings somewhere smile.gif I am a C programmer (linux embedded devices) who dabbles in lots of things. I am going to teach myself QML only so I can be a good citizen on sailfish smile.gif


QUOTE(defunked @ Jul 25 2018, 01:47 AM) *
I have been reluctant to mess around in /etc/ out of concern that changes will get over-written during an OS update. Any idea what an OS update would over-write from that perspective?


If it is an incremental update (ie. pkcon refresh; pkcon update) then you should be ok. Burning new firmware will of course blot everything.

As far as headphones go, I added an accessories.ini to /etc/ohm/plugins.d which monitored the headphone socket. It works brilliantly when inserting the headphones, but doesn't seem to detect/do anything when they are removed. I will probably just write a shell inotify script which directly calls pactl.
Go to the top of the page
 
+Quote Post
andrewl
post Jul 24 2018, 11:24 PM
Post #6





Group: Members
Posts: 122
Joined: 3-January 18
Member No.: 815,731



QUOTE(defunked @ Jul 23 2018, 08:06 AM) *
d. In addition, the headphone are mono, along with the speakers.. That is certainly not right. I know the speakers are mono (and apparently phase inverted), but my understanding was that this hardware bug did not apply to the headphone jack. Has any one else noticed this behavior?


I don't think that problem is a Sailfish one, it's been reported with the shipped Android too.
Go to the top of the page
 
+Quote Post
vader
post Jul 25 2018, 02:26 PM
Post #7





Group: Members
Posts: 253
Joined: 21-January 18
Member No.: 816,775



QUOTE(andrewl @ Jul 25 2018, 05:24 PM) *
I don't think that problem is a Sailfish one, it's been reported with the shipped Android too.


It could still be software, because if you set the pulseaudio port to output-speaker+wired_headphone, then you get mono from the headphones. This is how the system (at least mine) was set up. The speakers and headphones played at the same time. When you set the port to output-wired_headphones, you get stereo - and quite nice at that.

I tried to fix it the standard way by sending a uevent upon headphone insertion, which is picked up by pulse, but it didn't work properly. The insertion would stop the speakers and only play in the headphones, but removing the headphones didn't enable the speakers again. I'm not a pulseaudio guru, so after a bit of playing/searching, I gave up.

I wrote my own simple headphone switcher which does work - I will try to package it up for others to use. I compiled inotifywait and wrote a simple script which waits on /sys/class/switch/h2w/, then reads the state file when something changes. A value of 2 means headphones inserted (pactl set-sink-port output-wired_headphone), and 0 means not inserted (pactl set-sink-port output-speaker). Seems to work well, and doesn't use CPU (the wait sleeps until something changes in that directory). I'm sure a pulseaudio guru could get the proper behaviour working, but this works for now smile.gif I added the startup to droid-hal-startup.sh, as systemd doesn't do the usual (better) rc/rc.local thing.

I am a debian guy, and have to work out how to package the utility - but when I do, I'll post it here.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 17th October 2019 - 01:36 PM