Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (756)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (842)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  SingleStaticSource tutorial  (Read 2979 times)
0 Members and 1 Guest are viewing this topic.
Offline romiodelta

Innocent Bystander

« Posted 2007-10-24 02:09:00 »

Hi, Guys

I'm new to JOAL.
I'm trying to run the SingleStaticSource tutorial.
But I'm getting some weird errors.
Can anyone help me with this,please?

Exception in thread "main" java.lang.RuntimeException: Can not get proc address for method "alcCaptureCloseDevice": Couldn't set value of field "_addressof_alcCaptureCloseDevice" in class
   at com.sun.gluegen.runtime.ProcAddressHelper.resetProcAddressTable(
   at lesson1.SingleStaticSource.main(
Caused by: java.lang.RuntimeException: Unable to find and load OpenAL library
   at com.sun.gluegen.runtime.ProcAddressHelper.resetProcAddressTable(
   ... 4 more

I'm using Linux fedora and Java 1.6.0
And JOAL (joal-1.1.1-linux-i586)
And here is the source code.

import java.nio.ByteBuffer;


public class SingleStaticSource {

   static AL al = ALFactory.getAL();
   static int[] buffer = new int[1];
   static int[] source = new int[1];
   static float[] sourcePos = { 0.0f, 0.0f, 0.0f };
   static float[] sourceVel = { 0.0f, 0.0f, 0.0f };
   static float[] listenerPos = { 0.0f, 0.0f, 0.0f };
   static float[] listenerVel = { 0.0f, 0.0f, 0.0f };

   static int LoadALData() {
      int[] format = new int[1];
      int[] size = new int[1];
      ByteBuffer[] data = new ByteBuffer[1];
      int[] freq = new int[1];
      int[] loop = new int[1];
      al.alGenBuffers(1, buffer, 0);
      if(al.alGetError() != AL.AL_NO_ERROR ) return AL.AL_FALSE;
      ALut.alutLoadWAVFile("Gun1.wav", format, data, size, freq, loop);
      if (data[0] == null) {
         throw new RuntimeException("Error loading WAV file");
      System.out.println("sound size = " + size[0]);
      System.out.println("sound freq = " + freq[0]);
      al.alBufferData(buffer[0], format[0], data[0], size[0], freq[0]);
      al.alGenSources(1, source, 0);

      al.alSourcei(source[0], AL.AL_BUFFER, buffer[0]);
      al.alSourcef(source[0], AL.AL_PITCH, 1.0f);
      al.alSourcef(source[0], AL.AL_GAIN, 1.0f);
      al.alSourcefv(source[0], AL.AL_POSITION, sourcePos, 0);
      al.alSourcefv(source[0], AL.AL_VELOCITY, sourceVel, 0);
      al.alSourcei(source[0], AL.AL_LOOPING, loop[0]);

        if(al.alGetError() == AL.AL_NO_ERROR)
            return AL.AL_TRUE;

        return AL.AL_FALSE;
   static void setListenerValues() {
      al.alListenerfv(AL.AL_POSITION, listenerPos, 0);
      al.alListenerfv(AL.AL_VELOCITY, listenerVel, 0);
      al.alListenerfv(AL.AL_ORIENTATION, listenerOri, 0);

   static void killAllData() {
      al.alDeleteBuffers(1, buffer, 0);
      al.alDeleteSources(1, source, 0);

   public static void main(String[] args) {

      al = ALFactory.getAL();
      if (LoadALData() == AL.AL_FALSE)

      char[] c = new char[1];
      while (c[0] != 'q') {
         try {
            BufferedReader buf = new BufferedReader(new InputStreamReader(;
            System.out.println("Press a key and hit ENTER: \n" + "'p' to play, 's' to stop, " +"'h' to pause and 'q' to quit");
            switch (c[0]) {
                 case 'p' :
                    // Pressing 'p' will begin playing the sample.
                 case 's' :
                    // Pressing 's' will stop the sample from playing.
                 case 'h' :
                    // Pressing 'n' will pause (hold) the sample.
                 case 'q' :
         } catch (IOException e) {

The error occurs at the very beginning 'ALut.alutInit();'.
I have no idea why.
Can anyone tell me?

Offline Ultraq

Junior Devvie

That's what she said

« Reply #1 - Posted 2007-10-24 20:45:39 »

2 things come to mind:

 - alcCaptureCloseDevice is an OpenAL 1.1 function.  Maybe installing an OpenAL 1.1 driver for your soundcard might help?
 - the 'caused by' part of the stack trace points to the lines in the JOAL code which indicate that an OpenAL driver couldn't be found at all.  Installing OpenAL and making sure the OpenAL libraries are somewhere on the library path (although the installation should already do that) should help here.

Ultraq's Final MooCow
Bits and Pieces by Emanuel Rabina
Pages: [1]
  ignore  |  Print  

DesertCoockie (54 views)
2018-05-13 18:23:11

nelsongames (86 views)
2018-04-24 18:15:36

nelsongames (76 views)
2018-04-24 18:14:32

ivj94 (761 views)
2018-03-24 14:47:39

ivj94 (93 views)
2018-03-24 14:46:31

ivj94 (645 views)
2018-03-24 14:43:53

Solater (104 views)
2018-03-17 05:04:08

nelsongames (187 views)
2018-03-05 17:56:34

Gornova (428 views)
2018-03-02 22:15:33

buddyBro (1088 views)
2018-02-28 16:59:18
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!