[Openal] OpenalSoft 1.7.411 & malformed version number on ppc G5and i386 macbook ok

Jason Daly jdaly at ist.ucf.edu
Tue Apr 7 19:25:19 PDT 2009


The OpenAL device list is a NULL-delimited list, terminated by a 
double-NULL.  This can be a pain to deal with, but it was necessary 
because hardware vendors often like to put any kind of character in 
their device names, including the useful delimiters like spaces, tabs, 
commas, and semicolons.

Try this code (stolen from an old Creative example):


char *deviceList;
char *devices[12];
int numDevices;

deviceList = (char *)alcGetString(NULL, ALC_DEVICE_SPECIFIER);
memset(devices, 0, sizeof(devices));
for (numDevices = 0; numDevices < 12; numDevices++) {
    devices[numDevices] = deviceList;
    deviceList += strlen(deviceList);
    if (deviceList[0] == 0) {
        if (deviceList[1] == 0) {
            break;
        } else {
            deviceList += 1;
        }
    }
}

for (i = 0; i < numDevices; i++)
{
   printf("Device %d:  %s\n", i, devices[i]);
}
       



Manolache Adrian wrote:
> After each compile i tried to run openal-info but twice i received:
> "ALC error Invalid Context occured"
>  
> I then ran my own program and tried to enumerate the devices like so:
>  
>     char *device = (char*)alcGetString(NULL, 
> ALC_DEFAULT_DEVICE_SPECIFIER);
>     char *deviceS = (char*)alcGetString(NULL, ALC_DEVICE_SPECIFIER);
>     printf("Device: %s\nDevice: %s", deviceS, device);
>     int a = 0;
>     while(1)
>     {
>         while (*(deviceS++));
>         a++;
>         deviceS++;
>         if (a==2)
>             break;
>        if ((*deviceS))
> printf("Device: %s\n", deviceS);
>     }
> exit(0);
>
> The output looked like this:
> Device: Wave File Writer
>  
> I'm wondering what am i doing wrong, portaudio should have been 
> present in there, right?
> What am i missing?
>  
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://opensource.creative.com/pipermail/openal/attachments/20090407/e02bdf85/attachment-0001.html


More information about the Openal mailing list