Hello!
In our game package (www.andromedaonline.net) we are having problems with
sounds. We have placed them in a jar file, and are trying to access them
from there.
The jar file has a directory structure. A number of sounds have the same
name, but are in a different directory (for example, our game has 5 races.
Each race has the same set of sounds- button clicks, etc, but the actual
sound is different).
We've attempted doing this (for buttonClickSoun d, made when a player hits a
button):
soundJar = new JarResources("A ndromedaSFX.jar ");
URL clickSoundURL = new
URL(soundJar.ge tResource("/com/Andromeda/sounds/main/Main-click.wav"));
buttonClickSoun d = Applet.newAudio Clip(clickSound URL);
However soundJar.getRes ource returns BYTE and we need STRING in the above
example. we replaced "clickSound URL" with:
URL clickSoundURL = PreGamePanel.cl ass.getResource ("Main-click.wav");
but that returns a null pointer exception (presumably because I don't have
the directory structure... Nor do I know how it's supposed to know which jar
file to get the file from in the second example).
Nobody here has any experience with accessing .wav files from a jar file. We
would greatly appreciate any help one could offer.
Thank you for your time.
Nick Soutter
In our game package (www.andromedaonline.net) we are having problems with
sounds. We have placed them in a jar file, and are trying to access them
from there.
The jar file has a directory structure. A number of sounds have the same
name, but are in a different directory (for example, our game has 5 races.
Each race has the same set of sounds- button clicks, etc, but the actual
sound is different).
We've attempted doing this (for buttonClickSoun d, made when a player hits a
button):
soundJar = new JarResources("A ndromedaSFX.jar ");
URL clickSoundURL = new
URL(soundJar.ge tResource("/com/Andromeda/sounds/main/Main-click.wav"));
buttonClickSoun d = Applet.newAudio Clip(clickSound URL);
However soundJar.getRes ource returns BYTE and we need STRING in the above
example. we replaced "clickSound URL" with:
URL clickSoundURL = PreGamePanel.cl ass.getResource ("Main-click.wav");
but that returns a null pointer exception (presumably because I don't have
the directory structure... Nor do I know how it's supposed to know which jar
file to get the file from in the second example).
Nobody here has any experience with accessing .wav files from a jar file. We
would greatly appreciate any help one could offer.
Thank you for your time.
Nick Soutter
Comment