Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
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 2632 times)
0 Members and 1 Guest are viewing this topic.
Offline xjedi

Senior Newbie





« Posted 2008-06-23 15: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 www.wingsofapocalypse.blogspot.com if you are curious.
Offline Ultraq

Junior Member




That's what she said


« Reply #1 - Posted 2008-06-24 09: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 (http://btanks.sourceforge.net/blog/2007/08/28/openal-programming-faq/) lists it as something like the following (my rough translation from the C/C++ code on the site):

1  
2  
3  
4  
5  
6  
7  
8  
// 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,
    ALC_INVALID, ALC_INVALID
};

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 18: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.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (26 views)
2014-07-24 01:59:36

Riven (25 views)
2014-07-23 21:16:32

Riven (20 views)
2014-07-23 21:07:15

Riven (22 views)
2014-07-23 20:56:16

ctomni231 (51 views)
2014-07-18 06:55:21

Zero Volt (46 views)
2014-07-17 23:47:54

danieldean (37 views)
2014-07-17 23:41:23

MustardPeter (40 views)
2014-07-16 23:30:00

Cero (56 views)
2014-07-16 00:42:17

Riven (55 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!