﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
12229	Unit test for audio playback on Linux	Don-vip	team	"I have added a unit test for Audio (wav) playback in r9144:9146.

It works fine on Windows, but I can't get it working on our Jenkins/Linux server. The test results in:

Java 7:
{{{
javax.sound.sampled.LineUnavailableException
	at org.classpath.icedtea.pulseaudio.PulseAudioMixer.openImpl(PulseAudioMixer.java:714)
	at org.classpath.icedtea.pulseaudio.PulseAudioMixer.openLocal(PulseAudioMixer.java:588)
	at org.classpath.icedtea.pulseaudio.PulseAudioMixer.openLocal(PulseAudioMixer.java:584)
	at org.classpath.icedtea.pulseaudio.PulseAudioMixer.open(PulseAudioMixer.java:579)
	at org.classpath.icedtea.pulseaudio.PulseAudioDataLine.open(PulseAudioDataLine.java:94)
	at org.classpath.icedtea.pulseaudio.PulseAudioSourceDataLine.open(PulseAudioSourceDataLine.java:75)
	at org.classpath.icedtea.pulseaudio.PulseAudioSourceDataLine.open(PulseAudioSourceDataLine.java:90)
	at org.openstreetmap.josm.tools.AudioPlayer.run(AudioPlayer.java:348)
}}}

Java 8:
{{{
java.lang.IllegalArgumentException: No line matching interface SourceDataLine supporting format PCM_UNSIGNED 22050.0 Hz, 8 bit, mono, 1 bytes/frame,  is supported.
java.lang.IllegalArgumentException: No line matching interface SourceDataLine supporting format PCM_UNSIGNED 22050.0 Hz, 8 bit, mono, 1 bytes/frame,  is supported.
	at javax.sound.sampled.AudioSystem.getLine(AudioSystem.java:479)
	at org.openstreetmap.josm.tools.AudioPlayer.run(AudioPlayer.java:347)
}}}

Maybe because we don't have any sound card on the server.

I assume it is possible to use a virtual sound device as a workaround but I can't find how to do it.

I have installed pulseaudio server (apt-get install pulseaudio) and started it (service pulseaudio start).

When I try to play wav file manually with jenkins user I get:

{{{
jenkins@josm:~$ aplay /var/lib/jenkins/jobs/JOSM/workspace/test/data/regress/6851/20111003_121226.wav
Failed to create secure directory (/run/user/0/pulse): Permission denied
Failed to create secure directory (/run/user/0/pulse): Permission denied
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Access denied

aplay: main:722: audio open error: Connection refused
}}}

I have added jenkins user to `audio` and `pulse` groups, does not change anything.

When trying as root I get:

{{{
root@josm:~# aplay /var/lib/jenkins/jobs/JOSM/workspace/test/data/regress/6851/20111003_121226.wav
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Access denied

aplay: main:722: audio open error: Connection refused
}}}

Using `null` it seems to work, but I don't know if we can use it as default, or tell Java to use it:

{{{
root@josm:~# aplay -D null /var/lib/jenkins/jobs/JOSM/workspace/test/data/regress/6851/20111003_121226.wav
Playing WAVE '/var/lib/jenkins/jobs/JOSM/workspace/test/data/regress/6851/20111003_121226.wav' : Unsigned 8 bit, Rate 22050 Hz, Mono
}}}

I'm kind of lost here, can anyone with good knowledge of Audio on Linux please help me?"	enhancement	closed	normal	15.12	Core audio		fixed	unit test audio linux debian ubuntu alsa java sound jenkins pulseaudio wav	stoecker bastiK simon04 naoliv malenki skyper mdk
