Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (526)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (593)
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  
  FMOD and OpenAL.... Where to Start?  (Read 4668 times)
0 Members and 1 Guest are viewing this topic.
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Posted 2008-05-12 07:20:11 »

I've been using OpenGL for a long time, but I've surprisingly never put any sounds into it. Can anyone point me towards some tutorials and/or examples that use this feature?

I have no idea the benefits / differences between OpenAL and FMOD, but I have both sound effects and 2 minute looping background sounds. I've also got plenty of them. I was thinking OGG compression was best... can OpenAL read it?

I've been reading http://www.lwjgl.org/documentation_openal_01.php but it doesn't compare OpenAL and FMOD or anything like that.

I also don't care about position of sound playing or anything because my game is in orthogonal mode. That's why I've always just used Java's built-in sound functions.

[EDIT]
Gosh.. I've been all over the internet trying to figure out how to very simply play OGG files. If all else fails I'll use WAV for now (I need this implemented for Tuesday). I looked in Slick's source code, but there's a rather obscene number of included classes (a number higher than I have in my entire game) that I would need just to play some sounds, so I've steered clear of that. I literally just want to play and loop WAV and OGG files. I don't care about position, velocity, Doppler effect... But the internet seems to want me to be way complicated. I'm about to use Java's methods for it.

See my work:
OTC Software
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #1 - Posted 2008-05-12 08:29:49 »

FMOD has been removed in the latest LWJGL, so you probably don't want to start using that. OpenAL is, frankly, a right pain to use. IIRC the recommendation was to switch to the Slick audio library if you just want basic sound playback.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 78
Projects: 15


★★★★★


« Reply #2 - Posted 2008-05-12 08:40:28 »

The recommended alternative to FMod is not slick but slick-util, which is a part of normal slick.
It can be found at http://slick.cokeandcode.com/downloads/util/
with javadoc being at http://slick.cokeandcode.com/javadoc-util/
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #3 - Posted 2008-05-12 09:18:44 »

Haha, okay. Looks like I'll be using Kevin Glass's help yet again. I'm in the middle of trying to get Jorbis to work without OpenAL (holy crap what a pain... the file that uses the library is 2000 lines long. Why is that not a part of the library, don't ask me).

In my opinion, a sound library should pretty much be like this:
Sounds.add("name",new Sound("location"));
Sounds.play("name");

BAM!

I'll take a look at Slick if I can't get this JOrbis craziness to work.

[EDIT]
After spending another 45 minutes of my wading through an absolutely garbage tutorial on JOrbis (with plenty of archaic programming techniques, I might add), I discovered that, although promised, the tutorial never actually tells you how to play your file, even though you've spent 2000 lines of code learning how to get the API to create it. You end up with an InputStream. Hmmm... Anyway, deleted.

Off to Slick's utilities! Rah!

See my work:
OTC Software
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #4 - Posted 2008-05-12 09:30:28 »

or use http://www.cokeandcode.com/node/625

Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #5 - Posted 2008-05-12 09:53:02 »

Haha. If only the world worked through Kevin Glass's eyes, we'd all be happier people. Naturally, using his implementation worked almost immediately.

Cheers, and thanks for all the help, everyone.

1  
2  
3  
4  
5  
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
   at java.io.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:136)
   at org.newdawn.slick.openal.OggDecoder.getData(OggDecoder.java:322)
   at org.newdawn.slick.openal.SoundStore.getOgg(SoundStore.java:844)
   at org.newdawn.slick.openal.SoundStore.getOgg(SoundStore.java:813)


I can't load an OGG file that is two and a half minutes long! Come on, now! Any way I can get around this?

See my work:
OTC Software
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 78
Projects: 15


★★★★★


« Reply #6 - Posted 2008-05-12 10:46:08 »

you can increase your heap size, just add the vm arguement to what ever size you like, e.g

1  
-Xmx512M
Offline tom
« Reply #7 - Posted 2008-05-12 12:27:02 »

I wrote a an OGGInputStream and OGGPlayer that can be used to stream ogg files. http://home.halden.net/tombr/ogg/ogg.html

It was written a while ago aginst an older version of LWGJL, so some coding is probably needed to get it to compile.

Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #8 - Posted 2008-05-12 18:44:34 »

you can increase your heap size, just add the vm arguement to what ever size you like, e.g

1  
-Xmx512M

I know I can do that, I was just hoping to avoid it. Is there any way to have Webstart do this automatically?

I also don't know how to get Eclipse to do this.

See my work:
OTC Software
Offline kevglass

« JGO Spiffy Duke »


Medals: 210
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #9 - Posted 2008-05-12 18:48:08 »

Webstart:

Quote
    <j2se href="http://java.sun.com/products/autodl/j2se" version="1.5+" max-heap-size="128m"/>

Eclipse:

1) Run > Run....
2) Select the Run profile for your app/game
3) Arguments Tab
4) VM Arguments input box is where you put things like -Xmx512m

Or... if you're happy to poll the music you could just stream it right from the file, meaning you don't load everything into memory.

EDIT: Possibly the funniest thing I read in months:
Quote
If only the world worked through Kevin Glass's eyes, we'd all be happier people.
Oh, how little you know! Smiley

Kev

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #10 - Posted 2008-05-12 18:50:35 »

Or... if you're happy to poll the music you could just stream it right from the file, meaning you don't load everything into memory.

Kev

Great, thanks for the response. It's very possible that polling the music would be fine, seeing as it only ever plays in one instance. How would I do this? I'm currently using your utils from Slick: SoundStore and Audio. I store loaded Audio files into a map and then play them from there.

See my work:
OTC Software
Offline kevglass

« JGO Spiffy Duke »


Medals: 210
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #11 - Posted 2008-05-12 18:56:02 »

Really, you shouldn't be using this API through SlickUtil, but still. You can call:

1  
SoundStore.get().getOggStream(string/url);


You'll get a StreamSound back, and thats an AudioImpl which is an Audio. You need to remember to call

1  
SoundStore.get().poll(delta);


In your game loop to give the streaming chance to take place. I would warn you that I don't think any one has used Slick Util in that particular use case yet tho, so I guess we'll work through it like normal Smiley

Kev

Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #12 - Posted 2008-05-12 19:01:57 »

Great, doesn't look exceptionally difficult. I'll give it a go later today.

See my work:
OTC Software
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.

toopeicgaming1999 (72 views)
2014-11-26 15:22:04

toopeicgaming1999 (61 views)
2014-11-26 15:20:36

toopeicgaming1999 (15 views)
2014-11-26 15:20:08

SHC (29 views)
2014-11-25 12:00:59

SHC (27 views)
2014-11-25 11:53:45

Norakomi (32 views)
2014-11-25 11:26:43

Gibbo3771 (27 views)
2014-11-24 19:59:16

trollwarrior1 (40 views)
2014-11-22 12:13:56

xFryIx (78 views)
2014-11-13 12:34:49

digdugdiggy (56 views)
2014-11-12 21:11:50
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!