JavaSound on Linux

[quote]“I’ve never heard of a game or even any application that needs exclusive access to the soundcard, especially not in 2011.”
[/quote]
My Finale 2007 and Sonar Home Studio 6 definitely don’t get along. Both are well-established commercial applications.

And if I use them and go to YouTube, YouTube often sounds like chipmunks or vice versa.

I’m wishing they had more “intuitive” configuration panels, as it is very hard to tell what either one of them is exactly doing with the sound system.

@philfrei:
Well, I’ve never heard of either of those programs, so I guess my point still holds :wink:
Either way, my first reaction now is that I probably wouldn’t use those programs due to the issues they seem to have - which is obviously not the reaction I would want my own users to have.

Well, Phil’s examples aren’t Linux applications, but you’ll find the same sort of thing with many Linux applications that are aimed at a more pro-audio user base. You’ll find that sort of thing more and more as you head along the consumer-audio -> pro-audio continuum (I say continuum, because it’s not an either / or thing). JACK takes over the soundcard so you’ll get the same scenario on Linux with any application that relies on JACK for example, and there are a lot of them. Sorry, but saying you wouldn’t use such program because it interferes with Flash is a daft statement if you don’t know what the program is for or why it functions the way it does. The reason these applications do this is because the performance is better, and depending on what you’re trying to do sometimes performance is more important.

So, while I’d like to make sure the existing high-performance ALSA audio drivers remain in the JDK, I also agree with you that the consumer end of the market needs to be better accommodated by additional mixers that support the newer consumer orientated ALSA features.

Bear in mind though that these mixers are already in OpenJDK, and almost all distributions except Mint ship OpenJDK as the default, so I don’t necessarily see it as big an issue in the Linux consumer space as you do at the moment!

[quote=“nsigma,post:63,topic:37148”]
Good, and now explain that to someone with no technical experience. They’re just going to look at you in disbelief, because audio from multiple applications is ubiquitous. We’re talking about video games here, not high-end commercial audio tools. Also, I didn’t say “intereferes with Flash”, but “needs exclusive access to the sound card”. Unlike JavaSound (in its current state on the Oracle JVM), even Flash doesn’t need exclusive access, it just tends to keep its lines open (which triggers ALSA/PulseAudio/whatever to keep a lock on the soundcard) longer than necessary.

[quote=“nsigma,post:63,topic:37148”]
The mixers are in OpenJDK, but they, too, have problems. As I’ve mentioned before, certain methods of Lines (like drain() or stop()) take ridiculous amounts of time to return, making things like repeating a short sound effect in quick succession very difficult. Also, Linux Mint does ship with OpenJDK, so I guess you’re right when you say that it’s not a huge problem - I just don’t want to keep going knowing that something is broken.

[quote=“Socob,post:64,topic:37148”]

Audio from multiple applications is not ubiquitous. Phil and I have both given you examples where this is not the case, and I could give you more Linux ones. It completely depends what the software is used for, and I’m not just talking high-end commercial audio tools (the commercial ones don’t even exist on Linux!). The only person who’s ever “looked” at me in disbelief about this is you (and yes I do sometimes do workshops around this area).

From a video games / consumer desktop perspective, which is obviously the focus here, then yes it’s needed and I’m not disputing that - I fail to see why you’re disputing that sometimes it isn’t!

Sorry, that was a flippant way of putting it, but it’s only fairly recently that Flash has been fixed in this regard, and if you search the Mint forums you’ll find people still sometimes having issue with Flash taking exclusive use of their soundcard.

I wonder if the long term lock from Flash (and from Java applets actually) is partly caused by caching in the browser too. Epiphany didn’t seem to have quite the same issue when I last tried it.

[quote=“Socob,post:64,topic:37148”]

Both Riven and I have said in this thread, don’t do this! The drivers and hardware underlying the mixer implementation are not designed to have lines continually opening and closing. Open a line and keep it open. This may involve you using a 3rd-party audio library like one of the ones I suggested earlier, or waiting for Paul to finish his software mixing project.

Well, this is, of course, a subjective issue (even if I didn’t think you’d challenge my claim that “normal” users wouldn’t accept single-application audio). My point was simply that it is extremely rare (I like to think of myself as advanced, technically, and even I hadn’t experienced issues like this before) and a severe limitation for the user which requires a convincing legitimation.

I’m not disputing that! I already mentioned high-end audio tools as a legitimate example, and I’m perfectly willing to accept the cases where such limitations are sufficient - again, they’re just rare.

Well, I didn’t know that. But as I said in my opening post, Linux audio is still a mess, because there are too many ways to do it. I guess issues like that are just another facet of that (along with poor support from commercial developers in the case of Flash, of course).

I didn’t intend on actually doing it, namely because of all the problems that have been mentioned - it’s just another thing I noticed while experimenting (also, it still feels weird to me to be told to just never use certain parts of the API). The concrete problem I was having is that with very short sound effects, even if I wrote the entire sound effect data to the line’s buffer, it wouldn’t play because the buffer was bigger than the data itself (at least I think that’s what happened). Thus, I needed a way to flush the buffer, but as I mentioned, the methods related to that took ages, defeating the purpose. I think what I ended up doing was just writing more data to the buffer until it was full. So that’s the story behind that :wink: