From 06a3aaa5fd38097a4644921a269d6ca282fb31eb Mon Sep 17 00:00:00 2001 From: Xerxes Rånby Date: Tue, 9 Jul 2013 17:13:32 +0200 Subject: www/devmaster/lesson*.html: net.java.games.joal.* -> com.jogamp.openal.* MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Java OpenAL JOAL HTML tutorials are now usefull. This change made is possible to copy and paste the many code sections of the JOAL tutorial into working applications. Signed-off-by: Xerxes Rånby --- www/devmaster/lesson4.html | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'www/devmaster/lesson4.html') diff --git a/www/devmaster/lesson4.html b/www/devmaster/lesson4.html index 5830f15..64b44f3 100644 --- a/www/devmaster/lesson4.html +++ b/www/devmaster/lesson4.html @@ -28,20 +28,20 @@ OpenAL Lesson 4: The ALC tutorial from DevMaster.net to JOAL.

-

Up until now we have been letting Alut do all the real tricky +

Up until now we have been letting ALut do all the real tricky stuff for us. For example handling the audio devices. It's really nice that - the Alut library is there to provide this functionality, but any smart coder + the ALut library is there to provide this functionality, but any smart coder will want to know exactly what their doing. We may want to, at some point, use the Alc directly. In this tutorial we will expose the Alc layer and take a look at how to handle the devices on our own.

-ALFactory.initialize();
 ALC alc = ALFactory.getALC();
 
 
 String deviceName = "DirectSound3D";
+// deviceName = null; // Passing a null String to alcOpenDevice will open the default device on your system!
 
-ALC.Device device = alc.alcOpenDevice(deviceName);
+ALCdevice device = alc.alcOpenDevice(deviceName);
 

So what is an Alc device? Try to think of it in terms of a resource. OpenAL grabs a handle to the hardware being used, which must in turn @@ -53,7 +53,7 @@ ALC.Device device = alc.alcOpenDevice(deviceName); to 'alcOpenDevice' is a perfectly valid argument. It forces the Alc to use a default device.

-ALC.Context context = alc.alcCreateContext(device, null);
+ALCcontext context = alc.alcCreateContext(device, null);
 alc.alcMakeContextCurrent(context);
 

What is an Alc context? OpenGL coders will recall that there @@ -85,10 +85,10 @@ alc.alcMakeContextCurrent(context); appropriate context is current. And if you do decide to do this, then there may be times when you want to know exactly which context is current without going through a big check.

-
ALC.Context curContext = alc.alcGetCurrentContext();
+
ALCcontext curContext = alc.alcGetCurrentContext();
 

Once you have your context you can also obtain the device in use by that context.

-
ALC.Device curDevice = alc.alcGetContextsDevice(curContext);
+
ALCdevice curDevice = alc.alcGetContextsDevice(curContext);
 

Above we used the context we retrieved to find out which device it was using. There is also one other cool feature that was built into Alc for @@ -116,13 +116,13 @@ alc.alcCloseDevice(device); There is but a few more Alc functions we have not yet covered.

public int alcGetError();
 
-public boolean alcIsExtensionPresent(ALC.Device device, String extName);
+public boolean alcIsExtensionPresent(ALCdevice device, String extName);
 
-public int alcGetEnumValue(ALC.Device device, String enumName);
+public int alcGetEnumValue(ALCdevice device, String enumName);
 
-public String alcGetString(ALC.Device device, int token);
+public String alcGetString(ALCdevice device, int token);
 
-public void alcGetIntegerv(ALC.Device device, int token, int size, int[] dest);
+public void alcGetIntegerv(ALCdevice device, int token, int size, int[] dest);
 

It may be pretty obvious to you what these do, but lets humour ourselves and have a closer look. First we have 'alcGetError' which is just @@ -145,7 +145,7 @@ alc.alcCloseDevice(device); exist yet.

Well that's most of Alc for you. I hope it gave you a better understanding of how OpenAL interacts with the operation system. You might try - writing your own initialization routines so you can cast off Alut altogether. + writing your own initialization routines so you can cast off ALut altogether. Either way have fun with it.

-- cgit v1.2.3