Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (843)
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 3694 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  

EgonOlsen (42 views)
2018-06-10 19:43:48

EgonOlsen (22 views)
2018-06-10 19:43:44

EgonOlsen (43 views)
2018-06-10 19:43:20

DesertCoockie (197 views)
2018-05-13 18:23:11

nelsongames (124 views)
2018-04-24 18:15:36

nelsongames (123 views)
2018-04-24 18:14:32

ivj94 (863 views)
2018-03-24 14:47:39

ivj94 (124 views)
2018-03-24 14:46:31

ivj94 (768 views)
2018-03-24 14:43:53

Solater (140 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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!