LWJGL
May 17, 2012, 02:18:10 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL 2.8.3 released!
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: How to enumerate available sound-renderers  (Read 5385 times)
Skippy0
Newbie
*
Posts: 14


« on: May 01, 2005, 03:04:54 »

OpenGL can enumerate DisplayModes,
OpenAL can't enumerate sound-renderers?

Hardcoding in AL.create(String, int, int, boolean) isn't really a
solution and usually ends up targeting the software-driver on
every system, except the dev's.

I might have missed something... maybe :wink:
Logged
Sormuras
Newbie
*
Posts: 46



« Reply #1 on: February 02, 2006, 04:54:10 »

Hej Skippy0,

the enumeration of available sound devices(renderers) is switched off by the current implementation on LWJGL. That is because the ALC.alcGetString(int i) always uses the current device. Here's line 167 from ALC.java:
Code:

String result = nalcGetString(AL.device.device, pname);


If one could pass 0 as the first parameter, the returned value would be the enumeration encoded in one string. Here's some C code from SDK (aldlist.cpp from the Framework sample):
Code:

char *devices;
devices = (char *)ALFunction.alcGetString(NULL,ALC_DEVICE_SPECIFIER);
// go through device list (each device terminated with a single NULL, list terminated with double NULL)
while (*devices != NULL) {
  ALCdevice *device = ALFunction.alcOpenDevice(devices);
  if (device) {
    ALFunction.alcMakeContextCurrent(context);
    // if new actual device name isn't already in the list, then add it...
    actualDeviceName = ALFunction.alcGetString(device, ALC_DEVICE_SPECIFIER);
    ...
  }
  ...
}


You didn't miss something, LWJGL is missing something. Smiley

Cheers,
Sormuras


Edit: Fixed typos and added more source details.
Logged
Matzon
Administrator
Demigod
*****
Posts: 2177



« Reply #2 on: February 02, 2006, 05:25:35 »

the problem is that we can't support the function in an exact context, since they implemented it in a hack'ish way.

They seperate the different suppliers by using \0 as the seperator (usually the end of string seperator). So if you call the fucntion you will always only get the first supplier back.
The only way to fix this - which no one has needed before - is to create an entirely new lwjgl-specific OpenAL method that returns the implementers as an array of strings...
Logged

http://certusgames.com (Free Online Multiplayer Java Games)
http://lwjgl.org (OpenGL/OpenAL for Java)
Sormuras
Newbie
*
Posts: 46



« Reply #3 on: February 02, 2006, 05:56:38 »

Hi Matzon!

Yes, the way "they" return the list is ... c-stylish. That's a good example why I prefer hacking in Java. Smiley

On topic. At least Skippy0 and me need that enumration. And to add another analogy next to the one with GLs display modes, take the java.io package that enumerates all NICs - because sometimes, you want the end-user of your application to choose the screen resolution, the NIC(IP address) to bind a service to and regarding OpenAL, you want to offer all available sound devices.

+1 for enumerating all sound device names in a clean String[] like you suggested.
Logged
Evil-Devil
Prolific Timewaster
****
Posts: 268



WWW
« Reply #4 on: February 02, 2006, 10:01:47 »

That would be really cool to have that implemented.

I have a onBoard Sound additional to my SB Live! and like to have the possibility to change the device that is used for sound playback.
Logged
Sormuras
Newbie
*
Posts: 46



« Reply #5 on: February 02, 2006, 14:02:26 »

Counting all - non ever needed this - we have a +3... Smiley
Logged
Matzon
Administrator
Demigod
*****
Posts: 2177



« Reply #6 on: February 02, 2006, 14:58:03 »

I am on it - already comitted to cvs - just looking into rewriting it a bit to use less native code.

new method is String[] AL.getImplementations()
Logged

http://certusgames.com (Free Online Multiplayer Java Games)
http://lwjgl.org (OpenGL/OpenAL for Java)
Sormuras
Newbie
*
Posts: 46



« Reply #7 on: February 02, 2006, 20:32:00 »

Quote from: "Matzon"
new method is String[] AL.getImplementations()


Danke!  Cheesy
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!