Hi !
Featured games (88)
games approved by the League of Dukes
Games in Showcase (679)
Games in Android Showcase (194)
games submitted by our members
Games in WIP (732)
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  
  limit on sources?  (Read 2917 times)
0 Members and 1 Guest are viewing this topic.
Offline xjedi

Senior Newbie

« Posted 2008-06-23 13:31:10 »

I'm working on a game and Sometimes when I have around 30 sounds playing at the same time i start to get errors and the sounds eventually stop playing all together. I devised a way to fix this problem by clearing the sources and making sure it doesn't get over 30 sources at one time, but I want to know if there is anyway I can increase the number of sound sources I can play at once and if not then whats the limit?

As I get further along in my game project I can Imagine that I will eventually need more than 30 sounds playing at once. Thanks!

you can check out my project at if you are curious.
Offline Ultraq

Junior Devvie

That's what she said

« Reply #1 - Posted 2008-06-24 07:33:18 »

The number of sources available to you is hardware dependant.  There is an OpenAL function to let you know how many sources are available... but I currently don't have the OpenAL SDK and it's docs installed Roll Eyes  I'm guessing it'll be one of the alGet() or alcGet() functions, when passed one of the constants, named something like NUM_SOURCES.

(will edit this post once I re-install SDK and find the appropriate functions/constants)

[EDIT]: Maybe I'm going crazy, but I can't seem to find what needs to be done to get the number of sources.  I'm sure you can keep calling alGenSources() until it starts returning errors, but that doesn't seem like a nice solution.

[EDIT again]: This site ( lists it as something like the following (my rough translation from the C/C++ code on the site):

// Get size/number of attributes
int[] attributesSize = new int[1];
alcGetIntegerv(device, ALC_ATTRIBUTES_SIZE, 1, attributesSize, 0);
int numAttributes = attributesSize[0];

// Get values of attributes
int[] attributes = new int[numAttributes];
alcGetIntegerv(device, ALC_ALL_ATTRIBUTES, numAttributes, attributes, 0);

The values in attributes[] will be ordered as follows:
ALCint attrs[] = {
    ALC_STEREO_SOURCES, stereo_sources,
    ALC_MONO_SOURCES, mono_sources,

So I guess the number of (mono) sources will be in attributes[3].

Ultraq's Final MooCow
Bits and Pieces by Emanuel Rabina
Offline xjedi

Senior Newbie

« Reply #2 - Posted 2008-06-26 16:09:28 »

Thanks man! I haven't tried it yet but I will get back to you and let you know if it works
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Hydroque (17 views)
2016-05-26 14:45:46

Mac70 (39 views)
2016-05-24 21:16:33

theagentd (42 views)
2016-05-14 18:38:35

theagentd (76 views)
2016-05-10 22:37:41

theagentd (84 views)
2016-05-10 22:33:46

IanParcs (110 views)
2016-04-18 14:18:53

KaiHH (108 views)
2016-04-18 08:35:41

KaiHH (130 views)
2016-04-15 12:43:58

theagentd (135 views)
2016-04-14 02:16:17

theagentd (157 views)
2016-04-14 02:15:43
FPS Camera Tutorial
by Hydroque
2016-05-22 05:40:58

Website offering 3D Models specifically for games for free
by vusman
2016-05-18 17:23:09

Website offering 3D Models specifically for games for free
by vusman
2016-05-09 08:50:56

Website offering 3D Models specifically for games for free
by vusman
2016-05-06 11:10:21

Website offering 3D Models specifically for games for free
by vusman
2016-04-29 12:56:17

List of Learning Resources
by SilverTiger
2016-02-05 09:39:47

List of Learning Resources
by SilverTiger
2016-02-05 09:38:38

List of Learning Resources
by SilverTiger
2016-02-05 09:35:50 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!