Search code examples
jmfjava

'Master Gain not supported' in OpenJDK


We have problems playing audio files using JavaZoom's libraries on OpenJDK in Linux, although it works perfectly on Sun JDK. Is there any workaround for this 'Master Gain not supported' exception?

Mohsen


Solution

  • I've noticed the same thing. I just check for Sun Java before trying to change the gain. Sucks, but on the bright side OpenJDK's audio is performing much better than Sun's for my needs.

    EDIT: since others will find this answer through web searches, I'm going to add a bit. OpenJDK's PulseAudioMixer does not appear to adhere to the JSAPI in some cases. For example, it insists that you stop() a line before flush()ing it. JSAPI however specifically says it's legal to flush before stopping. Or in the case you mention, the pulse audio implementation claims to support gain when you call isControlSupported, but then throws an exception anyway. Those are two reasons JavaZoom code won't work in OpenJDK. There are others. In some cases PulseAudioMixer isn't to blame, it just takes a different route in undefined cases (e.g., what happens if you call write() on a line that isn't open?!). I'm in the process of making some code I wrote more robust so it will run on OpenJDK.