[pulseaudio-discuss] java sound implementation using pulseaudio - ports
iivan at redhat.com
Wed Aug 27 17:26:18 PDT 2008
Thanks, that's what we decided to do.
I have a question regarding closing the pulseaudio sinks/source. Should
I use pa_context_suspend_sink/source_by_index/name or just mute them?
I'm not sure exactly what pa_context_suspend_sink_by_index should do;
I've tried using it and it didn't seem to have any effect (i.e. I could
still hear the sound).
Colin Guthrie wrote:
> Ioana Ivan wrote:
>> We've been trying to write an implementation of
>> javax.sound.sampled.Mixer(and the associated classes: SourceDataLine,
>> TargetDataLine, Clip, and Port) that uses pulseaudio as a backend. So
>> far, SourceDataLine, TargetDataLine and Clip are working (somewhat,
>> there are still issues that need to be fixed), but we're not sure how to
>> approach Port.
>> From the java API:
>> "Ports are simple lines for input or output of audio to or from audio
>> devices. Common examples of ports that act as source lines (mixer
>> inputs) include the microphone, line input, and CD-ROM drive. Ports that
>> act as target lines (mixer outputs) include the speaker, headphone, and
>> line output. You can access port using a Port.Info object."
>> Ports should have an open() and close() method, and ideally they should
>> also support volume and mute controls. There currently is an
>> implementation of Port in openjdk that uses alsa to enumerate the
>> devices that could connect to the sound system, and implement the
>> required methods.
>> We were wondering whether there's anything in the pulseaudio API that
>> could be used to do something similar, and, if not, how problematic
>> using the old version of Port(that uses alsa directly) with our mixer
>> that uses pulseaudio is.
> I spoke to you on the mailing list but this is a little clearer I think.
> Basically you just want to expose the volume of the various Sinks and
> Sources here. I would just get a list of all the Sinks and provide
> playback Ports that allow volume control and muting etc. and do a
> similar exposure for the Sources.
> I'd use the introspection stuff to do this (tho' not overly sure).
> You can probably use the source of pavucontrol to work out what to do here.
> You can of course export a volume on a "per stream" basis, but I'd
> imagine this doesn't map too well to the Java API seeing as streams will
> come and go quickly but sinks/sources will be slightly more long term
> (tho can still come and go (e.g. when a usb audio device is plugged in
> or a network sink is detected etc.)
> I think whatever is in the "Output devices" and "Input devices" tab in
> pavucontrol (from git) is probably what you want...
More information about the pulseaudio-discuss