SV: <Sound Dev> Opening multiple output lines
kalli at midverk.is
Fri May 9 12:58:51 PDT 2008
I added software sound mixing to the gervill Project which writes to default directaudio backend.
And thus allows true sharing of audio device (within the Java application).
Frá: sound-dev-bounces at openjdk.java.net [sound-dev-bounces at openjdk.java.net] Fyrir hönd Mark Wielaard [mark at klomp.org]
Sent: 9. maí 2008 00:48
Viðtakandi: Thomas Fitzsimmons
Afrit: sound-dev at openjdk.java.net; distro-pkg-dev at openjdk.java.net
Efni: Re: <Sound Dev> Opening multiple output lines
On Sun, 2008-05-04 at 19:19 +0200, Mark Wielaard wrote:
> I had the same problem with a similar setup and with applications that
> forget to close a line they don't use anymore (unfortunately this seems
> very common). With the current directaudio backend I don't see how multiple
> lines for the same hardware device could work though. So I am using a
> trick to look for "sloppy" applications. If the last line opened in the
> directaudio device was for the same hardware format then we silence that
> one first so we can hand out a new one. This seems to work surprisingly
> well. And it doesn't seem to interfere with applications that handle the
> hardware formats they need explicitly.
> With gcjwebplugin and this patch we can happily play the vNES games :)
> Of course a real solution would be to import or write a better mixer
> that does share lines properly.
I updated the patch a little to make it all a bit more robust. It splits
the locks, so there is no longer one gaint static one (I shouldn't have
reused the lockNative one and made that static in the original patch).
And it makes sure that all methods that require the nativeLock check the
doIO inside their synchronized block and the lock around nStop() isn't
released before the flag is set. ALSA can actually hang when called on a
pcm you already stopped or closed. This race was already in the code,
since a DataSourceLine could be asynchronously stopped or closed at any
time. My patch just exposed it more easily, because DirectAudioDevice is
the mixer that is now always used by defailt.
2008-05-08 Mark Wielaard <mark at klomp.org>
* patches/icedtea-directaudio-close-trick.patch: Use new static
lockLast for nOpen/nClose guarding. Make lockNative non-static
again. Do all checks before native calls of doIO inside
lockNative guard. Set doIO to false after nClose before dropping
I do think we should write a new MixerProvider based on a modern
soundserver, like pulseaudio. The current DirectAudioDeviceProvider code
cannot easily be extended to provide true software sound mixing. And the
way it opens direct hardware alsa devices means it locks out other
Patch against original code (updated patch file in icedtea6).
No virus found in this incoming message.
Checked by AVG.
Version: 7.5.524 / Virus Database: 269.23.10/1421 - Release Date: 7.5.2008 17:23
More information about the distro-pkg-dev