Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (580)
games submitted by our members
Games in WIP (500)
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 2240 times)
0 Members and 1 Guest are viewing this topic.
Offline romiodelta

Innocent Bystander





« Posted 2007-10-24 04: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 net.java.games.joal.impl.ALCProcAddressTable
   at com.sun.gluegen.runtime.ProcAddressHelper.resetProcAddressTable(ProcAddressHelper.java:68)
   at net.java.games.joal.impl.ALProcAddressLookup.resetALCProcAddressTable(ALProcAddressLookup.java:109)
   at net.java.games.joal.impl.ALCImpl.alcOpenDevice(ALCImpl.java:342)
   at net.java.games.joal.util.ALut.alutInit(ALut.java:69)
   at lesson1.SingleStaticSource.main(SingleStaticSource.java:139)
Caused by: java.lang.RuntimeException: Unable to find and load OpenAL library
   at net.java.games.joal.impl.ALProcAddressLookup$DynamicLookup.dynamicLookupFunction(ALProcAddressLookup.java:66)
   at com.sun.gluegen.runtime.ProcAddressHelper.resetProcAddressTable(ProcAddressHelper.java:64)
   ... 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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.ByteBuffer;

import net.java.games.joal.AL;
import net.java.games.joal.ALFactory;
import net.java.games.joal.util.ALut;


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);
      ALut.alutExit();
   }


   public static void main(String[] args) {

      ALut.alutInit();
      al = ALFactory.getAL();
      al.alGetError();
      if (LoadALData() == AL.AL_FALSE)
          System.exit(1);
      setListenerValues();

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

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


Offline Ultraq

Junior Member




That's what she said


« Reply #1 - Posted 2007-10-24 22: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  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (48 views)
2014-04-15 18:08:23

BurntPizza (44 views)
2014-04-15 03:46:01

UprightPath (60 views)
2014-04-14 17:39:50

UprightPath (42 views)
2014-04-14 17:35:47

Porlus (58 views)
2014-04-14 15:48:38

tom_mai78101 (82 views)
2014-04-10 04:04:31

BurntPizza (140 views)
2014-04-08 23:06:04

tom_mai78101 (240 views)
2014-04-05 13:34:39

trollwarrior1 (200 views)
2014-04-04 12:06:45

CJLetsGame (207 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org 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‑gaming.org
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!