Jump to content
  • Advertisement
Sign in to follow this  
BangorRipper

OpenAL

This topic is 4816 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

First of all is OpenAL supported by most modern day sound cards? And secondly are there any decent code snippets out there that make it easy to see how it is used for someone who has never ever dealt with sound in a game before thanks

Share this post


Link to post
Share on other sites
Advertisement
Yes, it is supported on any sound card as long as you install the most recent drivers.

For tutorials take a look at this site. Those are pretty much the best there is right now. Also you will want to look at the sample included in the SDK. It goes over a lot of other stuff as well.

There are a few tutorials on GameDev as well, here and here.

- Drew

Share this post


Link to post
Share on other sites
Good sound is based on the quality of the files used. So if the files that are free are of decent quality, then yes, that should be fine. However, if you are doing a professional game, you would want to use professional sounds [wink]. What type of project are you doing with OpenAL?

Share this post


Link to post
Share on other sites
just a small personal one so i guess free stuff is fine then, i am trying to do it using java, lwjgl actually, cannot seem to get the following to compile which i think is just some introductary basic code:

import net.java.games.joal.*;
import net.java.games.joal.util.*;
import java.io.*;
import java.nio.ByteBuffer;

public class Sound {

static AL al = ALFactory.getAL();

// Buffers hold sound data.
static int[] buffer = new int[1];;

// Sources are points emitting sound.
static int[] source = new int[1];
}


i get:

--------------------Configuration: JDK version 1.5.0_01 <Default>--------------------
C:\Documents and Settings\Danny\Desktop\Version2.0.13\Version2.0.7\Version2.0.5\Version2.0.5\Sound.java:1: package net.java.games.joal does not exist
import net.java.games.joal.*;
^
C:\Documents and Settings\Danny\Desktop\Version2.0.13\Version2.0.7\Version2.0.5\Version2.0.5\Sound.java:2: package net.java.games.joal.util does not exist
import net.java.games.joal.util.*;
^
C:\Documents and Settings\Danny\Desktop\Version2.0.13\Version2.0.7\Version2.0.5\Version2.0.5\Sound.java:8: cannot find symbol
symbol : class AL
location: class Sound
static AL al = ALFactory.getAL();
^
C:\Documents and Settings\Danny\Desktop\Version2.0.13\Version2.0.7\Version2.0.5\Version2.0.5\Sound.java:8: cannot find symbol
symbol : variable ALFactory
location: class Sound
static AL al = ALFactory.getAL();
^
4 errors

Process completed.

any ideas, i'm sorry but i am a total newbie :(

Share this post


Link to post
Share on other sites
Oh dear! I'm sorry but I cannot help you with that. Java is not my field of expertise [sad]. However, you might want to look around on these forums. Hopefully someone that knows OpenAL with Java can help.

Share this post


Link to post
Share on other sites
Quote:
Original post by BangorRipper
First of all is OpenAL supported by most modern day sound cards?
And secondly are there any decent code snippets out there that make it easy to see how it is used for someone who has never ever dealt with sound in a game before
thanks


OpenAL utilizes DirectSound on Windows platforms, so I cannot imagine that it wouldn't.
There's lots of snippets, just search Google ;-)
Game or not, you only need to know how to use it, not specificly for a game, since that's the same only with a different structure and command path.
You should also get the OpenAL SDK:
http://developer.creative.com/landing.asp?cat=1&sbcat=31&top=38

Share this post


Link to post
Share on other sites
ok, i have used the code from the space invaders example that comes part of lwjgl, but when i am for instance trying to get the shot sound to play when i shoot, how can i do it so that it works correctly when the shoot button is held down..i have the following

if(Keyboard.isKeyDown(Keyboard.KEY_SPACE)&&(!playerDead))
{
boolean firePressed = true;
if(firePressed)
{
tryToFire();
}
}

public void tryToFire()
{
createShipBullet();
shipBullet.renderBullet();
bulletCreated = true;
soundManager.playEffect(SOUND_SHOT);
}

is there something that needs including so that the sound is played correctly, if shoot is held down, its almost as though the sound is held until it is released and then the rest of the sound is played, thanks

Share this post


Link to post
Share on other sites
Quote:
Original post by BangorRipper
have sorted it now thanks for all replies


Can you post what you had to do for future references? Or was it just a slipup?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!