Inertia's picture

OpenAL Device Choices

I've recently bought a Creative Labs Soundblaster X-Fi Platinum Fatal1ty Champion Series (TM)(C)(R) card (hope I did not forget any buzzwords) and getting the impression that it finally works as it should, but AudioContext is giving me some troubles porting the old Alut code. (I want to confirm that OpenTK's X-Ram class works as advertised by me :P)

The card did not ship with a driver CD, I've installed latest drivers and oalinst right from creative labs website.

My impression is that AudioContext uses the wrong tokens to select it's device, here's c&p from some AlcGetString queries.

Mind the "Detected by OpenTK" is simply what AudioContext.AvailableDevices returns. Also I have nothing connected to the SPDIF Out, so it's correctly recognizing Speakers to use for output.

Using Creative Labs driver (result identical for x32 and x64):

Quote:

Detected by OpenTK:
Generic Software
Returned by AlcGetString.DefaultDeviceSpecifier:
Generic Software
Returned by AlcGetString.DefaultAllDevicesSpecifier:
Generic Software on Speakers (Creative SB X-Fi)
Returned by AlcGetStringList.DeviceSpecifier:
Generic Software
Returned by AlcGetStringList.AllDevicesSpecifier:
Generic Software on Speakers (Creative SB X-Fi)
Generic Software on SPDIF Out (Creative SB X-Fi)

using OpenAL Soft drivers (copied to app dir, result identical for x32 and x64)

Quote:

Detected by OpenTK:
DirectSound Software
Wave File Writer
Returned by AlcGetString.DefaultDeviceSpecifier:
DirectSound Software
Returned by AlcGetString.DefaultAllDevicesSpecifier:
DirectSound Software on Speakers (Creative SB X-Fi)
Returned by AlcGetStringList.DeviceSpecifier:
DirectSound Software
Wave File Writer
Returned by AlcGetStringList.AllDevicesSpecifier:
DirectSound Software on Speakers (Creative SB X-Fi)
DirectSound Software on SPDIF Out (Creative SB X-Fi)
Wave File Writer

------------------------------------------------

However when I run the EfxEnumerateWin32.exe from the OpenAL SDK I get these device choices:

Quote:

Enumerate EFX Application

Select OpenAL Device:
1. SB X-Fi Audio [E800](DEFAULT)
2. Generic Software

Running EfxEnumerateWin64.exe gives:

Quote:

Enumerate EFX Application

Select OpenAL Device:
1. Generic Software(DEFAULT)

---------------------------------------------

Running openal-info.exe (with OpenAL Soft in it's dir) returns

Available playback devices:
    DirectSound Software on Speakers (Creative SB X-Fi)
    DirectSound Software on SPDIF Out (Creative SB X-Fi)
    Wave File Writer
Available capture devices:
    WaveIn on Line-In 2/Mic 2 (Creative SB X-
    WaveIn on Digital-In (Creative SB X-Fi)
    WaveIn on S/PDIF-In (Creative SB X-Fi)
    WaveIn on Auxiliary (Creative SB X-Fi)
    WaveIn on Microphone (Creative SB X-Fi)
    WaveIn on Auxiliary 2 (Creative SB X-Fi)
    WaveIn on Line-In (Creative SB X-Fi)
Default device: DirectSound Software
Default capture device: WaveIn on Line-In 2/Mic 2 (Creative SB X-
ALC version: 1.1
ALC extensions:
    ALC_ENUMERATE_ALL_EXT, ALC_ENUMERATION_EXT, ALC_EXT_CAPTURE, ALC_EXT_EFX
OpenAL vendor string: OpenAL Community
OpenAL renderer string: OpenAL Soft
OpenAL version string: 1.1 ALSOFT 1.8.466
OpenAL extensions:
    AL_EXTX_buffer_sub_data, AL_EXT_EXPONENT_DISTANCE, AL_EXT_FLOAT32,
    AL_EXT_IMA4, AL_EXT_LINEAR_DISTANCE, AL_EXT_MCFORMATS, AL_EXT_OFFSET,
    AL_EXTX_source_distance_model, AL_LOKI_quadriphonic
EFX version: 1.0
Max auxiliary sends: 2
Available filters:
    Low-pass
Available effects:
    EAX Reverb
    Reverb
    Echo

Running openal-info.exe without OpenAL Soft returns:

Available playback devices:
    SB X-Fi Audio [E800]
    Generic Software on Speakers (Creative SB X-Fi)
    Generic Software on SPDIF Out (Creative SB X-Fi)
Available capture devices:
    Line-In 2/Mic 2 (Creative SB X-
    Digital-In (Creative SB X-Fi)
    S/PDIF-In (Creative SB X-Fi)
    Auxiliary (Creative SB X-Fi)
    Microphone (Creative SB X-Fi)
    Auxiliary 2 (Creative SB X-Fi)
    Line-In (Creative SB X-Fi)
Default device: SB X-Fi Audio [E800]
Default capture device: Line-In 2/Mic 2 (Creative SB X-
ALC version: 1.1
ALC extensions:
    None
OpenAL vendor string: Creative Labs Inc.
OpenAL renderer string: SB X-Fi Audio [E800]
OpenAL version string: OpenAL version 1.1
OpenAL extensions:
    EAX
EAX1.0
EAX2.0
EAX3.0
EAX4.0
EAX5.0
 
EFX version: 1.0
Max auxiliary sends: 2
Available filters:
    Low-pass
Available effects:
    EAX Reverb
    Reverb
    Chorus
    Distortion
    Echo
    Flanger
    Frequency Shifter
    Vocal Morpher
    Pitch Shifter
    Ring Modulator
    Autowah
    Compressor
    Equalizer

openal-info is most likely an x86 app (came with the OpenAL Soft x86 driver), could it be that my x64 driver is simply broken?

I kinda miss the "Generic Hardware" device, which is probably the "SB X-Fi Audio [E800]". (mind the device name is identical to "OpenAL renderer string: SB X-Fi Audio [E800]" returned by openal-info)

Either way I think AudioContext should use AlcGetString.DefaultAllDevicesSpecifier to select the default device. With both drivers it selects the most appropriate device.

Edit: Could it be that the problem is related to either a) the disabled onboard sound or b) the graphic card's HDMI out? Another solution might be http://icculus.org/alextreg/wiki/ALC_ENUMERATE_ALL_EXT currently AudioContext uses ALC_ENUMERATE_EXT only.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

Try changing GetString.DeviceSpecifier to GetStringList.AllDevicesSpecifier in AudioContext.LoadAvailableDevices. Does it return the correct devices after the change?

Other than that, you can force a specific device using the AudioContext(string device) constructor.

Inertia's picture

After the change the list returned is

Quote:

Generic Software on Speakers (Creative SB X-Fi)
Generic Software on SPDIF Out (Creative SB X-Fi)

but it should be this:

"openal-info" wrote:

Available playback devices:
SB X-Fi Audio [E800]
Generic Software on Speakers (Creative SB X-Fi)
Generic Software on SPDIF Out (Creative SB X-Fi)

I have already tried creating an AudioContext with "SB X-Fi Audio [E800]" as parameter, but it would not use any other device than before according to AL.Get( ALGetString..) and the available Efx Extensions are the same as for software.

You might have missed my edit to the initial post (when I commited changes your reply was suddenly there), could that be part of the issue?

the Fiddler's picture

Yep, I missed your edit. How do you use ALC_ENUMERATE_ALL_EXT?

Inertia's picture

Idk, the AL Extension registry is not quite like the GL one. The only other info there is 2 tokens:

* ALC_ALL_DEVICES_SPECIFIER (0x1013)
    * ALC_DEFAULT_ALL_DEVICES_SPECIFIER (0x1012)

So basically the changes you suggested in your last post are using the Extension already.

I find it rather strange that explicitly requesting a device by name does not give the expected result, maybe the char* handling is not right. I'll take a look.

Inertia's picture

Alc.OpenDevice() is ok, it returns null for the string "SB X-Fi Audio [E800]" but a non-zero pointer for "Generic Software". Alc.GetString is ok aswell.

The different reports by EfxEnumerateWinXX.exe appear to be connected with their x86 framework. But I'm running debug x86 builds from VS2010 here - targeting .Net 2.0 - so I should get all devices the 32-Bit driver knows of?

the Fiddler's picture

Could it be that Creative really doesn't ship 64bit drivers? Compiling for x86 should give you the same results as EfxEnumerateWin86.exe - provided we are not missing something obvious.

Does openal-info do anything different than AudioContext? It's source code should be distributed with OpenAL Soft.

Another idea (to verify the differences between x86 and x64) is to compile openal-info for x64.

Inertia's picture

I had a quick glance at it and as far as I can see the command patterns in Alfw (OpenAL SDK), openal-info and AudioContext are close to identical. It's most likely a driver problem on my end, reinstalling oalinst did not help so far though.

here's an openal-info log from a X-Fi card (eXtremegamer edition IIRC) under windows xp x86, what is really weird is that neither of the 2 logs contains any ALC Extensions. Could it be - because the extensions were promoted to core 1.1 - that they are not in the list anymore? But why does OpenAL Soft list them?

He'll test my example app too, but needs Net Framework installed first and that's not going to happen tonight.

Available playback devices:
    SB X-Fi Audio [CC00]
    Generic Software on Lautsprecher (Creative SB X-Fi)
    Generic Software on SPDIF Out (Creative SB X-Fi)
Available capture devices:
    Microphone (Creative SB X-Fi)
    "What U Hear" (Creative SB X-Fi
    Line-In (Creative SB X-Fi)
    Auxiliary (Creative SB X-Fi)
Default device: SB X-Fi Audio [CC00]
Default capture device: Microphone (Creative SB X-Fi)
ALC version: 1.1
ALC extensions:
    None
OpenAL vendor string: Creative Labs Inc.
OpenAL renderer string: SB X-Fi Audio [CC00]
OpenAL version string: OpenAL version 1.1
OpenAL extensions:
    EAX
EAX1.0
EAX2.0
EAX3.0
EAX4.0
EAX5.0
 
EFX version: 1.0
Max auxiliary sends: 2
Available filters:
    Low-pass
Available effects:
    EAX Reverb
    Reverb
    Chorus
    Distortion
    Echo
    Flanger
    Frequency Shifter
    Vocal Morpher
    Pitch Shifter
    Ring Modulator
    Autowah
    Compressor
    Equalizer
martinsm's picture

Afaik OpenAL-Soft doesn't support hardware features of any sound card. It does everything in software - that is why it's name contains word Soft (as in Software).
And that is why it is behaves same on any hardware - it does not suffer from bad or missing drivers for soundcard.

Inertia's picture

That is correct and because 99.5% of those who use OpenTK.Audio use the software driver, the issues listed above did not show up yet ;)

[Extensions]
It appears the missing extension strings are a driver quirk. Tests like Alc.IsExtensionPresent() will correctly return true/false, but you cannot get a full list from Alc.GetString.

For example, this code will fork correctly to "1". However the extensions string returned by Alc.GetString is 2x null (blank).

 if (Alc.IsExtensionPresent(IntPtr.Zero, "ALC_ENUMERATION_EXT"))
            {
                if (Alc.IsExtensionPresent(IntPtr.Zero, "ALC_ENUMERATE_ALL_EXT"))
                    printDevices(AlcGetStringList.AllDevicesSpecifier, "playback "); // 1
                else
                    printDevices(AlcGetStringList.DeviceSpecifier, "playback ");
                printDevices(AlcGetStringList.CaptureDeviceSpecifier, "capture ");
            }
            else
                Console.WriteLine("No device enumeration available.");

[Device Detection]
I've ported parts of strangesoft's openal-info to OpenTK.Audio, it gives me the following result:

Quote:

Available playback devices:
SB X-Fi Audio [E800]
Generic Software on Speakers (Creative SB X-Fi)
Generic Software on SPDIF Out (Creative SB X-Fi)
Available capture devices:
Line-In 2/Mic 2 (Creative SB X-
Digital-In (Creative SB X-Fi)
S/PDIF-In (Creative SB X-Fi)
Auxiliary (Creative SB X-Fi)
Microphone (Creative SB X-Fi)
Auxiliary 2 (Creative SB X-Fi)
Line-In (Creative SB X-Fi)
Default device:
SB X-Fi Audio [E800]
Default capture device:
Line-In 2/Mic 2 (Creative SB X-
ALC version: 1.1
ALC extensions: for device (96234192)
None
ALC extensions: for device (null)

I'm not quite sure yet what the difference to AudioContext is, but this is the desired - correct - result. It uses Alc to create the dummy context - not AudioContext - so the problem is very likely in AudioContext's constructor.

AttachmentSize
Audio-info.cs3.51 KB
the Fiddler's picture

The AudioContext doesn't create a dummy context before querying available devices. Actually, I don't recall the OpenAL manual mentioning anything about dummy contexts.

Maybe that's the reason for the discrepancy.