Loading audio in LWJGL2 with OpenAL?

Hello people!

Started testing out some new ideas, refactoring some code and ran into some problems.

I’m trying to incorporate a new class into my current project that handles sound using the openAL library, which will be initialized in my main game class. 0

In my project, I’ve borrowed code which draws a simple pyramid which is not very useful for this particular test, I’m just trying to fire up some audio when I press a key, or just set it to play and turn off when I exit the app. I have a main class, game class and an audio class (called AudioMaster). I have other classes (Window, Input etc) but none of that is relevant to my problem.

http://pastebin.java-gaming.org/381f79c345d1e audio class

http://pastebin.java-gaming.org/7381f873c541d game class

The game class calls the function AudioMaster.init(); //init is the name of the function from the audio class
The game class initializes all the gameplay code(graphics,input,etc), and the main initializes the game class itself as well as the window itself.

The audio class was borrowed from a tutorial made by Oskar Veerhoek. His example works fine but his window is created in the same class. Ive managed to incorporate some of his other tutorials by refactoring the without a hassle, but audio seems a little tricky. Anyway Help with this would be much appreciated. Thanks!! ;D

Heres the error:

[quote]Exception in thread “main” java.lang.UnsatisfiedLinkError: org.lwjgl.openal.AL10.nalGetError()I
at org.lwjgl.openal.AL10.nalGetError(Native Method)
at org.lwjgl.openal.AL10.alGetError(AL10.java:617)
at org.lwjgl.openal.Util.checkALError(Util.java:62)
at org.lwjgl.openal.AL10.alDeleteBuffers(AL10.java:1097)
at com.base.engine.AudioMaster.Init(AudioMaster.java:40)
at com.base.engine.Game.(Game.java:21)
at com.base.engine.MainComponent.(MainComponent.java:18)
at com.base.engine.MainComponent.main(MainComponent.java:120)
[/quote]
http://pastebin.java-gaming.org/81f7c044d5e18 original audio code LWJGL2 OpenAL

https://www.youtube.com/watch?v=r6GGRCQtReE Link to openal tutorial from oskar veerhoek.

https://www.youtube.com/watch?v=ss3AnSxJ2X8&list=PLEETnX-uPtBXP_B2yupUKlflXBznWIlL5 game loop template from bennybox

I feel this post is in the wrong place. If you think it should be moved, please do so. Thanks

I use this to load audio:

public static Audio loadSound(String path, String fileType) {
		Audio sound = null;
		InputStream in = ResourceLoader.getResourceAsStream(path);
		try {
			sound = AudioLoader.getAudio(fileType, in);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return sound;
	}

But I have LWJGL2 and Slick.

I don’t have the time to watch videos right now. Can you post something closer to a simple example of the problem?

Sometimes, when trying to figure out where the default file locations are, I make a file and use .createNewFile(), then do a search with File Explorer or the equivalent on Mac.