<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>8815</bug_id>
          
          <creation_ts>2015-12-16 11:10:02 +0000</creation_ts>
          <short_desc>Add possibility to choose audio output</short_desc>
          <delta_ts>2016-01-08 13:22:55 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>6</classification_id>
          <classification>Yocto Project Subprojects</classification>
          <product>Sato</product>
          <component>sato</component>
          <version>2.1</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>2.1</target_milestone>
          
          <blocked>6362</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Cristina Agurida">cristina-danielax.agurida</reporter>
          <assigned_to name="Jussi Kukkonen">jku</assigned_to>
          <cc>alexandru.c.georgescu</cc>
    
    <cc>alexandru.costinx.roman</cc>
    
    <cc>jianxun.zhang</cc>
    
    <cc>jku</cc>
    
    <cc>maxin.baby.john</cc>
    
    <cc>maxin.john</cc>
    
    <cc>ross.burton</cc>
    
    <cc>tanuk</cc>
    
    <cc>yp.bsp.watcher</cc>
    
    <cc>yp.watcher</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>57297</commentid>
    <comment_count>0</comment_count>
    <who name="Cristina Agurida">cristina-danielax.agurida</who>
    <bug_when>2015-12-16 11:10:02 +0000</bug_when>
    <thetext>At the moment BSPs are configured to choose as default audio output the HDMI if it&apos;s present. So if we have a NUC, for example, that has HDMI and audio jack then the audio jack cannot be used. There should be a method to choose the default output for audio playback maybe even in the graphical interface.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57307</commentid>
    <comment_count>1</comment_count>
    <who name="Jussi Kukkonen">jku</who>
    <bug_when>2015-12-16 16:25:01 +0000</bug_when>
    <thetext>This is not the first case where QA has needed to manually modify the audio setup to be able to test things: I suggested that we consider adding a tool so they could do it easier.

There do not seem to be (easy) command line tools for controlling pulseaudio, but pavucontrol is not too big. It does depend on gtkmm though...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57309</commentid>
    <comment_count>2</comment_count>
    <who name="Maxin B. John (inactive)">maxin.baby.john</who>
    <bug_when>2015-12-16 16:45:32 +0000</bug_when>
    <thetext>We can also consider the command line tool - pacmd for this purpose.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57320</commentid>
    <comment_count>3</comment_count>
    <who name="Maxin B. John">maxin.john</who>
    <bug_when>2015-12-17 09:13:06 +0000</bug_when>
    <thetext>pacmd is provided by &quot;pulseaudio-misc&quot; package:

ie: in local.conf:
IMAGE_INSTALL_append = &quot; pulseaudio-misc&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57381</commentid>
    <comment_count>4</comment_count>
    <who name="Maxin B. John">maxin.john</who>
    <bug_when>2015-12-18 12:49:02 +0000</bug_when>
    <thetext>Prepared an image with &quot;pulseaudio-misc&quot; for pacmd and &quot;alsa-utils-aplay&quot; for aplay.

ie: 
IMAGE_INSTALL_append =&quot; pulseaudio-misc alsa-utils-aplay&quot;

After booting the device, listed the available devices using aplay:

root@genericx86-64:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: HDMI [HDA Intel HDMI], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: HDMI [HDA Intel HDMI], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 0: ALC283 Analog [ALC283 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Verified the output by playing a wave file using aplay:

# aplay -D hw:1,0 test.wav (sound on headset)
# aplay -D hw:0,3 test.wav (sound on HDMI) 


Listed the available sinks using pacmd:

root@genericx86-64:~# pacmd list-sinks|grep index
  * index: 0
    index: 1

root@genericx86-64:~# pacmd list-sinks |grep name
	name: &lt;alsa_output.pci-0000_00_03.0.hdmi-stereo&gt;
		alsa.name = &quot;HDMI 0&quot;
		alsa.subdevice_name = &quot;subdevice #0&quot;
		alsa.card_name = &quot;HDA Intel HDMI&quot;
		alsa.long_card_name = &quot;HDA Intel HDMI at 0xf7134000 irq 45&quot;
		alsa.driver_name = &quot;snd_hda_intel&quot;
		device.profile.name = &quot;hdmi-stereo&quot;
		alsa.mixer_name = &quot;Intel Broadwell HDMI&quot;
		device.icon_name = &quot;audio-card-pci&quot;
				device.icon_name = &quot;video-display&quot;
				device.product.name = &quot;W2261&quot;
	name: &lt;alsa_output.pci-0000_00_1b.0.analog-stereo&gt;
		alsa.name = &quot;ALC283 Analog&quot;
		alsa.subdevice_name = &quot;subdevice #0&quot;
		alsa.card_name = &quot;HDA Intel PCH&quot;
		alsa.long_card_name = &quot;HDA Intel PCH at 0xf7130000 irq 44&quot;
		alsa.driver_name = &quot;snd_hda_intel&quot;
		device.profile.name = &quot;analog-stereo&quot;
		alsa.mixer_name = &quot;Realtek ALC283&quot;
		device.icon_name = &quot;audio-card-pci&quot;
				device.icon_name = &quot;audio-headphones&quot;


As we run the commands as &quot;root&quot;, pacmd fails to spawn pulseaudio. We can temporarily test switching sound between devices using this script:

root@genericx86-64:~# cat test.sh 
#!/bin/sh

pulseaudio &amp;

pacmd set-default-sink 1
aplay test.wav 

pacmd set-default-sink 0
aplay test.wav</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57386</commentid>
    <comment_count>5</comment_count>
    <who name="Cristina Agurida">cristina-danielax.agurida</who>
    <bug_when>2015-12-18 13:22:55 +0000</bug_when>
    <thetext>It seems that the indexes keep changing so before run the script it is necessary to verify the number of them by giving the command &quot;pacmd list-sinks&quot;. Also add a sleep state in the script after &quot;pulseaudio &amp;&quot; if it does not start immediately.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57427</commentid>
    <comment_count>6</comment_count>
    <who name="Alexandru Roman">alexandru.costinx.roman</who>
    <bug_when>2015-12-22 14:19:58 +0000</bug_when>
    <thetext>The workaround works.
Also I was able to play sound on HDMI by putting this line: load-module module-alsa-sink device=hw:0,3 in /etc/pulse/default.pa (John Maxin idea)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57431</commentid>
    <comment_count>7</comment_count>
    <who name="Maxin B. John">maxin.john</who>
    <bug_when>2015-12-22 16:09:38 +0000</bug_when>
    <thetext>If we plan to bring &quot;pavucontrol&quot; from meta-oe to oe-core, we will have to move below listed recipes to oe-core as well. That means, a large number of new recipes for a UI application which configures pulseaudio (undesirable).

	new file:   ../meta/recipes-core/glib-2.0/glibmm/remove-examples.patch
	new file:   ../meta/recipes-core/glib-2.0/glibmm_2.44.0.bb
	new file:   ../meta/recipes-core/libsigc++-2.0/libsigc++-2.0_2.2.11.bb
	new file:   ../meta/recipes-core/mm-common/mm-common_0.9.8.bb
	new file:   ../meta/recipes-gnome/atk/atkmm_2.22.7.bb
	new file:   ../meta/recipes-gnome/gtk+/gtkmm_2.24.3.bb
	new file:   ../meta/recipes-graphics/cairo/cairomm_1.11.2.bb
	new file:   ../meta/recipes-graphics/pango/pangomm_2.36.0.bb
	new file:   ../meta/recipes-multimedia/pulseaudio/pavucontrol_3.0.bb
	new file:   ../meta/recipes-support/libcanberra/files/0001-build-gtk-and-gtk3-version-for-canberra_gtk_play.patch
	new file:   ../meta/recipes-support/libcanberra/libcanberra_0.30.bb


These changes are available in this branch:
http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=maxin/pavucontrol</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57439</commentid>
    <comment_count>8</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2015-12-22 21:24:34 +0000</bug_when>
    <thetext>That&apos;s *a lot* of extra deps.  Is there something a bit less massive?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57455</commentid>
    <comment_count>9</comment_count>
    <who name="Maxin B. John">maxin.john</who>
    <bug_when>2015-12-23 10:22:55 +0000</bug_when>
    <thetext>Searching an alternative for pavucontrol resulted in &quot;qpaeq&quot;. However, that also seems to have a number of extra deps like PyQt4 and sip.

May be enabling the command line tool (pacmd) could save us from adding new recipes to oe-core.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57458</commentid>
    <comment_count>10</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2015-12-23 11:58:37 +0000</bug_when>
    <thetext>pacmd is probably a good starting point then!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57469</commentid>
    <comment_count>11</comment_count>
    <who name="Maxin B. John">maxin.john</who>
    <bug_when>2015-12-23 14:53:52 +0000</bug_when>
    <thetext>patch sent to oe-core:

http://lists.openembedded.org/pipermail/openembedded-core/2015-December/114597.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57481</commentid>
    <comment_count>12</comment_count>
    <who name="Maxin B. John">maxin.john</who>
    <bug_when>2015-12-28 15:45:42 +0000</bug_when>
    <thetext>Accepted upstream:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=4b543f7405430a2ab452dbd334b4b0a430e1091c</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57483</commentid>
    <comment_count>13</comment_count>
    <who name="Tanu Kaskinen">tanuk</who>
    <bug_when>2015-12-29 04:49:46 +0000</bug_when>
    <thetext>Note that pactl is better than pacmd. pactl shouldn&apos;t have any issues with spawning the daemon as needed.

Another thing: you can use the sink name instead of the index, if you want a stable identifier.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57672</commentid>
    <comment_count>14</comment_count>
    <who name="Maxin B. John">maxin.john</who>
    <bug_when>2016-01-08 13:22:55 +0000</bug_when>
    <thetext>http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=4b543f7405430a2ab452dbd334b4b0a430e1091c</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>