Merge lp:~aacid/unity8-session-snap/pulse_alsa into lp:unity8-session-snap

Proposed by Albert Astals Cid
Status: Merged
Merge reported by: Michael Terry
Merged at revision: not available
Proposed branch: lp:~aacid/unity8-session-snap/pulse_alsa
Merge into: lp:unity8-session-snap
Diff against target: 33 lines (+15/-0)
2 files modified
overlay/snappyenv (+7/-0)
post-process/post-process.mk (+8/-0)
To merge this branch: bzr merge lp:~aacid/unity8-session-snap/pulse_alsa
Reviewer Review Type Date Requested Status
Unity8 Session Snap team Pending
Review via email: mp+311756@code.launchpad.net

Commit message

Make unity8-dash music scope work

Need to enable pulseaudio and alsa.

The pulseaudio change is a bit dodgy, needs someone with pulseaudio/phone experience to review

Description of the change

Make sure the file $HOME/snap/unity8-session/common/.local/share/pulse/touch.pa is not there for the user you're testing this on, that file is created by https://code.launchpad.net/~mterry/ubuntu-touch-session/pulse-in-snap/+merge/306662 and it's a bit of trouble since it's a one off copy of the file so later modifications won't apply, i'll comment about it on that MR

To post a comment you must log in.
84. By Albert Astals Cid

ARCH not SNAP_ARCH

85. By Albert Astals Cid

Merge

Revision history for this message
Michael Terry (mterry) wrote :

OK, I committed your also ALSA block in snappyenv, since that seemed uncontroversial.

As we discussed on IRC, I'd like to see if we can just stop using Touch's pulseaudio configuration instead of hacking it up. I guess that would mean changing [1] to simply not touch PULSE_CLIENTCONFIG or PULSE_SCRIPT when SNAP is defined. And then we don't need to futz with that file in this MP.

You said you were looking into whether the desktop config would be suitable?

[1] https://code.launchpad.net/~mterry/ubuntu-touch-session/pulse-in-snap/+merge/306662

Revision history for this message
Michael Terry (mterry) wrote :

OK, I added the rest of your changes (the pulseaudio ones) after futzing with our setup a bit.

So now, ubuntu-touch-session's pulseaudio script won't touch PULSE_CLIENTCONFIG and PULSE_SCRIPT if they are already set. And our snappyenv script will set those and other PULSE_* variables.

And our post-process.sh script will now use your sed lines (and the one that used to be in ubuntu-touch-session.

With all these changes, which will be available in the edge snap by your morning, pulseaudio seems to come up and music can be played in the Music scope... But I can't hear it on my laptop. Do you actually hear anything on your end? How do you test all this?

Revision history for this message
Michael Terry (mterry) wrote :

(Oh and I had looked a little bit into the differences in Touch and Desktop pulseaudio scripts -- looks like Touch does a lot of stuff, so not very easy to just switch to Desktop. Hence why I just went ahead with your sed tricks.)

Revision history for this message
Albert Astals Cid (aacid) wrote :

Yeah it just works. See https://www.youtube.com/watch?v=eZZ2hgOdXqA

To try to debug what's wrong for you i suggest you do use try mode

  sudo snap try --devmode bla/bla/bla/snap/prime

and then change the exec line
  bla/bla/bla/prime/usr/share/upstart/sessions/pulseaudio.conf
to
  exec pulseaudio -vvvv --start --log-target=newfile:/home/my/user/pulseverbose.log --log-time=1

it'll create a very detailed log of what's going on (note it's a new file every time, i.e. appends .1, .2, etc)

Revision history for this message
Albert Astals Cid (aacid) wrote :

I realized my phone has a very low volume recording so that youtube video had almost no sound :D This should be a bit better https://www.youtube.com/watch?v=pImkaiK7O4w make sure your pc volume is to the top though since it's a bit hard to hear here

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'overlay/snappyenv'
2--- overlay/snappyenv 2016-11-28 21:34:24 +0000
3+++ overlay/snappyenv 2016-11-29 14:44:44 +0000
4@@ -78,6 +78,13 @@
5 export LD_LIBRARY_PATH=$SNAP/usr/lib/pulse-8.0/modules:$LD_LIBRARY_PATH
6 export LD_LIBRARY_PATH=$SNAP/usr/lib/telepathy/gabble-0/lib:$LD_LIBRARY_PATH
7
8+# ALSA
9+export ALSA_CONFIG_PATH=$SNAP/usr/share/alsa/alsa.conf
10+export ALSA_MIXER_SIMPLE=$SNAP/usr/share/alsa/smixer.conf
11+export ALSA_MIXER_SIMPLE_MODULES=$SNAP/usr/lib/$ARCH/alsa-lib/smixer
12+export ALSA_CONFIG_UCM=$SNAP/usr/share/alsa/ucm
13+export ALSA_CONFIG_TPLG=$SNAP/usr/share/alsa/topology
14+
15 # We can't write to XDG_GREETER_DATA_DIR, so create it. lp:1644586
16 export XDG_GREETER_DATA_DIR=$SNAP_COMMON/lightdm-data
17 mkdir -p $XDG_GREETER_DATA_DIR
18
19=== modified file 'post-process/post-process.mk'
20--- post-process/post-process.mk 2016-11-15 14:34:47 +0000
21+++ post-process/post-process.mk 2016-11-29 14:44:44 +0000
22@@ -9,3 +9,11 @@
23 # the format of SNAP here... Which is bad practice, but I don't know of a
24 # good workaround for that right now.
25 sed -i 's|^Exec=/usr|Exec=/snap/unity8-session/current/usr|g' "${SNAPCRAFT_STAGE}"/usr/share/dbus-1/services/*.service
26+ # pulseaudio: disable fake sink TODO figure out why this is needed on the phone but not on the desktop
27+ sed -i 's|load-module module-null|# load-module module-null|g' "${SNAPCRAFT_STAGE}"/etc/pulse/touch.pa
28+ # pulseaudio: enable udev module TODO figure out why this is bad on the phone but needed on the desktop
29+ cat "${SNAPCRAFT_STAGE}"/etc/pulse/touch.pa | tr '\n' '\r' | sed -e 's@#.ifexists module-udev-detect.so\r#load-module module-udev-detect\r#.endif@.ifexists module-udev-detect.so\rload-module module-udev-detect\r.endif@g' | tr '\r' '\n' > /tmp/touch.pa
30+ mv /tmp/touch.pa "${SNAPCRAFT_STAGE}"/etc/pulse/touch.pa
31+ # ALSA: let it know about SNAP env var
32+ sed -i 's|@func datadir|@func getenv vars [ SNAP ] default "/" } { @func datadir|g' "${SNAPCRAFT_STAGE}"/usr/share/alsa/alsa.conf
33+ sed -i -E 's|<confdir:(.*)>|@hooks [ { func load files [ { @func concat strings [ { @func getenv vars [ SNAP ] default "/" } { @func datadir } "\1" ] } ] } ]|g' "${SNAPCRAFT_STAGE}"/usr/share/alsa/cards/*.conf

Subscribers

People subscribed via source and target branches