Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411517 Posts in 69377 Topics- by 58431 Members - Latest Member: Bohdan_Zoshchenko

April 27, 2024, 08:43:39 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)openAL memory usage
Pages: [1]
Print
Author Topic: openAL memory usage  (Read 1565 times)
Glaiel-Gamer
Guest
« on: April 29, 2009, 02:19:02 PM »

Ok I know nothing about sound cards or anything, and I just hacked together a class using openAL that will start playing a list of WAV files at the same time (tracks for background music so I can fade them in and out and such like what I did in aether and closure)

Anyway I know that later on I'll need to use a better file format then WAV like ogg vorbis or whatever, but I still have some questions:

Right now my memory usage is almost 120 MB for this test, which is 5 tracks of music. Will a smaller file format stay small in memory, or is it decompressed to that large in memory anyway?

Is it standard to stream for this, or load all the tracks into memory in the beginning?

I've been listening to my 5 tracks for about 10 minutes (edit: 1 hour now) now and they still sound in sync, on different computers is this necessarily the case? Or will I have to continually poll playback position and reset on loop?

Anything else I should be aware of?
« Last Edit: April 29, 2009, 03:02:04 PM by Glaiel-Gamer » Logged
Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« Reply #1 on: April 30, 2009, 04:52:28 AM »

Right now my memory usage is almost 120 MB for this test, which is 5 tracks of music. Will a smaller file format stay small in memory, or is it decompressed to that large in memory anyway?

The file must be decompressed to be played, to the best of my knowledge.  So even oggs will use comparable memory, they'll just have a smaller disk footprint.

Is it standard to stream for this, or load all the tracks into memory in the beginning?

Streaming is the way go, in my opinion.  OpenAL supports buffer queues, which allow you to do streaming fairly easily.  The tricky part is decoding the ogg vorbis data into the buffers.  This unfortunately dead project of mine contains code that demonstrates how to do this.  Check out SoundWrapper.h/cpp in the source/base directory.  It's fairly well commented.
Logged



What would John Carmack do?
Ivan
Owl Country
Level 10
*


alright, let's see what we can see


View Profile
« Reply #2 on: April 30, 2009, 09:15:12 AM »

http://www.devmaster.net/articles/openal-tutorials/lesson8.php

this seems helpful
Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
Glaiel-Gamer
Guest
« Reply #3 on: April 30, 2009, 09:31:45 AM »

Will streaming cooperate with me wanting to separate tracks and play 5-6 at a time in sync though?
Logged
Rob Lach
Level 10
*****



View Profile WWW
« Reply #4 on: May 03, 2009, 05:29:23 PM »

Will streaming cooperate with me wanting to separate tracks and play 5-6 at a time in sync though?

If you are making some sort of rhythm game, probably not.

What I suggest is that if you are memory limited you might want to split your audio tracks into small slices, say 10 seconds and piece, and then load them in and out as you progress. I'm sure if you have some sort of syncing system already you'd be able to put them all together sequentially fairly easily.
Logged

BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #5 on: May 04, 2009, 01:42:37 AM »

Ivan's link looks perfect.
OpenAL forces you to handle streaming manually, but the tutorial shows you how. The upside is that syncing is explicit, so I should think you shouldn't have problems ensuring multiple tracks stay synced.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic