Missing Stone sound resolved (and sound mixing on Linux)
Posted: Sun Dec 16, 2012 11:26 am
I had a look at CGoban and hacked it a bit to make the stone sound use the same sound system as the perfectly working pass sound.
Fortunately that wasn't hard, because it is basically just copy/paste (take pass sound code, insert at stone sound code, replacing it), takes maybe 10 minutes.
As a nice side effect, the sound now works on Linux systems without any wrappers (aoss/padsp) even with soundcards that don't have hardware mixing (provided you use OpenJDK 7 which supports softwaremixing via ALSA, dunno about Oracle Java).
While on it, I also added a volume slider for the stone/pass sound effects, since it was pretty loud in certain teaching games compared to the teacher's voice
.
Unfortunately, WMS has expressed in the past that he does not want any "custom-modified" clients to be released publicly, or he might ban people, so I cannot offer it for download.
If you want to modify your own client though, assuming you have decompiled source code, just search for the "pass.au" sound, copy/paste the line that loads it to do the same with the "stone.au" sound, and check the next 'if' command below that. It's the one that decides whether to play a pass or a stone sound. The 'else' bracket is the stone sound, there you can replace the a.b(0).c() method which calls the sound the old way by code you can easily derive from how "pass.au" is loaded: You'll end up with a simple line "yourstonesound.play();", exactly as with the pass sound.
Don't forget to declare a "private static AudioClip yourstonesound = null;" in the beginning, same as is done for the pass sound. It's really all just copy/pasting. ^^
(The "import java.applet.AudioClip;" is already there since it's used for the pass sound, so you don't need to add anything else. Yay!)
Fortunately that wasn't hard, because it is basically just copy/paste (take pass sound code, insert at stone sound code, replacing it), takes maybe 10 minutes.
As a nice side effect, the sound now works on Linux systems without any wrappers (aoss/padsp) even with soundcards that don't have hardware mixing (provided you use OpenJDK 7 which supports softwaremixing via ALSA, dunno about Oracle Java).
While on it, I also added a volume slider for the stone/pass sound effects, since it was pretty loud in certain teaching games compared to the teacher's voice
Unfortunately, WMS has expressed in the past that he does not want any "custom-modified" clients to be released publicly, or he might ban people, so I cannot offer it for download.
If you want to modify your own client though, assuming you have decompiled source code, just search for the "pass.au" sound, copy/paste the line that loads it to do the same with the "stone.au" sound, and check the next 'if' command below that. It's the one that decides whether to play a pass or a stone sound. The 'else' bracket is the stone sound, there you can replace the a.b(0).c() method which calls the sound the old way by code you can easily derive from how "pass.au" is loaded: You'll end up with a simple line "yourstonesound.play();", exactly as with the pass sound.
Don't forget to declare a "private static AudioClip yourstonesound = null;" in the beginning, same as is done for the pass sound. It's really all just copy/pasting. ^^
(The "import java.applet.AudioClip;" is already there since it's used for the pass sound, so you don't need to add anything else. Yay!)