Ioana Ivan wrote: > Hi, > > 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). http://0pointer.de/lennart/projects/pulseaudio/doxygen/introspect_8h.html 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... HTHs Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mandriva Linux Contributor [http://www.mandriva.com/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/]