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

Nope, the new example launcher can deal with console apps just fine. ;)

Vista x86 with oal-soft and the new oal redist (by creative): everything looks ok.

AttachmentSize
audio-info-vista-x86-sigmatel.txt3.05 KB
audio-info-vista-x86-soft.txt2.88 KB
Inertia's picture

Thank you very much, I take it you plugged in a microphone now? It would also be very useful if you could run it under ubuntu again, with a microphone plugged in (I don't need another log from that, if the exception is gone with a mic).

I don't want to steal your time, but it is important to know whether Windows and Ubuntu react differently to that condition.

Something that I find a bit curious is that Ubuntu seems to thread my foreach() loops for the Dictionaries, while windows does not. The lists are alphabetical, but your ubuntu log is unsorted as if multiple threads work on an iteration each. (Autowah should be the 1st Efx Effect, Bandpass the 1st Filter, etc.) I have not spawned any threads in the app. Weird.

Mincus's picture

Running on an ICH7 onboard laptop chipset. Attached the output, I think it's as expected.
Edit: Should add it's running on Windows 7 64-bit. The microphone is an onboard laptop one

With VS2010: the intellisense changes under C# seems to behave in a similar way as Visual Basic has done in the past, so I suspect it's intentional.
The main problem I found with the change is that intellisense is very slow as well, and if the intellisense pop-up isn't there when you hit enter, then it goes to the next line. What this means is that if you're typing quickly, the application stops whilst it finds the intellisense information, you type several characters then hit enter expecting it to auto-complete the rest and instead you get a new line with an uncompleted word. Very annoying. :o/
I've gone back to 2008 anyway. ;o)

AttachmentSize
aldiag-output.txt2.54 KB
the Fiddler's picture

I plugged in a microphone, verified it works, but received the same error on Ubuntu. I don't know whether this is a configuration error on my part or an OpenAL Soft issue.

I will try to compile the newest version 1.8 and test again.

Edit: Ah regarding Dictionary, there are no ordering guarantees. You'd have to use a SortedDictionary for that.

Inertia's picture

Thanks Mincus, regarding Intellisense there is the option to add letters to a list of keys that can be used to confirm the selection, but no clue how to add Enter/Return to it :( Even the space bar would be acceptable, but having to delete letters after using Intellisense is just crap.

@Fiddler I've never seen foreach behave like that for dictionaries, it has been reliably working like a for-loop (under windows) and all logs posted here so far (besides the ubuntu one) are nicely sorted as expected.

the Fiddler's picture

Dictionary: the order of the elements is not guaranteed. The order is an implementation detail and (probably) depends on the order of insertions - it is allowed to change between different runtimes or even different runtime versions (3.5 to 3.5SP1). Bottom line: don't depend on it. Use a SortedDictionary or SortedList if you need a specific order! :)

Inertia's picture

I've some ideas why it could fail on Ubuntu, if your mic works in other applications and you could not get it to work with the example, don't bother anymore. I'll post an updated version tomorrow with somewhat improved error tolerance. (currently it just tries to open the device by it's name, not by IntPtr.Zero etc.)

Inertia's picture

This time it's a debug x86 build, so it's a little more verbose. Could you please run it under Ubuntu and attach logs? (perfect would be 1 log with mic plugged in, and one without)

I believe to have found the AL Error regarding "200 sources not deleted" (and a second one related to Efx), apparently for some drivers it's an error to call AL.Delete***( 0 ) or Efx.Delete***( 0 ), i.e. it only accepts deletion of sources that were previously successfully generated by AL commands. The X-Fi hardware driver handles it gracefully, but the software drivers don't.

I can also provide source code if that helps with testing (just trying to save you time building it since I do that anyways).

Edit: attached log

AttachmentSize
X-Fi Platinum Fatal1ty.txt3.32 KB
AL Diag v2 Debug.rar53.01 KB
the Fiddler's picture

Ok, Ubuntu amd64 with OpenAL Soft 1.4 attached.

AttachmentSize
audio-info-oalsoft-ubuntu.txt3.63 KB
Inertia's picture

Thanks alot :)

"This application is currently running as x64"
I think this is a bug related to VS2010 beta, I have previously built (other apps) for x64 and IntPtr.Size was 4. The diagnosis app v2 is built for x86 (not AnyCPU), but IntPtr.Size is not 4 -.-

The AL and Efx errors are gone, which is satisfactory. I've taken a look at alsa.c (OpenAL Soft 1.4.272) and the related lines of code are:

if(!(ok(psnd_pcm_hw_params_any(data->pcmHandle, p), "any") &&
         /* set interleaved access */
         ok(psnd_pcm_hw_params_set_access(data->pcmHandle, p, SND_PCM_ACCESS_MMAP_INTERLEAVED), "set access") &&
         /* set format (implicitly sets sample bits) */
         ok(psnd_pcm_hw_params_set_format(data->pcmHandle, p, alsaFormat), "set format") &&
         /* set channels (implicitly sets frame bits) */
         ok(psnd_pcm_hw_params_set_channels(data->pcmHandle, p, aluChannelsFromFormat(pDevice->Format)), "set channels") &&
         /* set rate (implicitly constrains period/buffer parameters) */
         ok(psnd_pcm_hw_params_set_rate(data->pcmHandle, p, frequency, 0), "set rate") &&
         /* set buffer size in frame units (implicitly sets period size/bytes/time and buffer time/bytes) */
         ok(psnd_pcm_hw_params_set_buffer_size_min(data->pcmHandle, p, &bufferSizeInFrames), "set buffer size min") &&
         /* install and prepare hardware configuration */
         ok(psnd_pcm_hw_params(data->pcmHandle, p), "set params")))
    {
        AL_PRINT("%s failed: %s\n", err, psnd_strerror(i)); // [b]this is line 564[/b]
        ....etc

...so the problem is related to the parameters passed into Alc.CaptureOpenDevice. It would be good to know whether this is a bug and has been fixed with v1.8 of the driver, the win x86 build from their website works flawless (but it most likely never calls anything in alsa.c).

I'll see if I can cook up a more meaningful test application for this.