Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some old Windows apps request hard-coded device name #14

Closed
Hiradur opened this issue Jul 28, 2015 · 6 comments
Closed

Some old Windows apps request hard-coded device name #14

Hiradur opened this issue Jul 28, 2015 · 6 comments

Comments

@Hiradur
Copy link

Hiradur commented Jul 28, 2015

Unreal Tournament 2004 fails to load OpenAL Soft with the following message in ALSOFT_LOGFILE:

AL lib: (WW) ALCmmdevPlayback_open: Failed to find device name matching "DirectSound3D"
AL lib: (EE) ALCmmdevPlayback_open: Device init failed: 0x80004005"

Apparently the device name "DirectSound3D" is hard coded. I did a fulltext search on the whole directory and even looked at UT2004.exe in a Hex viewer but was unable to find where it's actually defined. I had no luck searching for it in the registry as well.

Is it possible to rename the OpenAL Soft device in alsoft.ini? I saw it's possible for Linux backends but there are no keys for Windows backends in the sample file.

@kcat
Copy link
Owner

kcat commented Jul 29, 2015

OpenAL Soft doesn't really let you change the device name, just the device it opens for backends where the 'default' is its own device (e.g. in ALSA, the default is a separate "default" device not necessarily included in the enumerated devices). The app still sees the same names.

There unfortunately isn't a nice way to handle this. If there's no way to change the device name it tries to use, OpenAL Soft would have to explicitly check for that name and handle it as a default device like the name "OpenAL Soft" behaves. But first, I'd actually check if it's failing due to "DirectSound3D" not working, or if it's falling back to the real default device and it's failing on something else. Setting the ALSOFT_LOGLEVEL environment variable to 3 will show when it succeeds in opening a device as well.

@Hiradur
Copy link
Author

Hiradur commented Aug 2, 2015

I see. This is the whole log file with ALSOFT_LOGLEVEL=3

AL lib: (II) alc_initconfig: Supported backends: mmdevapi, dsound, winmm, null, wave
AL lib: (II) ReadALConfig: Loading config C:\Users\Hiradur\AppData\Roaming\alsoft.ini...
AL lib: (II) GetConfigValue: Key disable-cpu-exts not found
AL lib: (II) FillCPUCaps: Detected max CPUID function: 0xa (ext. 0x80000008)
AL lib: (II) FillCPUCaps: Vendor ID: ""
AL lib: (II) FillCPUCaps: Name: "Intel(R) Core(TM)2 Quad CPU    Q6600  @ 2.40GHz"
AL lib: (II) FillCPUCaps: Extensions: +SSE +SSE2 -SSE4.1
AL lib: (II) GetConfigValue: Key rt-prio not found
AL lib: (II) GetConfigValue: Key resampler not found
AL lib: (II) GetConfigValue: Key trap-al-error not found
AL lib: (II) GetConfigValue: Key trap-alc-error not found
AL lib: (II) GetConfigValue: Key reverb/boost not found
AL lib: (II) GetConfigValue: Key reverb/emulate-eax not found
AL lib: (II) GetConfigValue: Key drivers not found
AL lib: (II) ALCmmdevProxy_messageHandler: Starting message thread
AL lib: (II) ALCmmdevProxy_messageHandler: Message thread initialization complete
AL lib: (II) ALCmmdevProxy_messageHandler: Starting message loop
AL lib: (II) alc_initconfig: Initialized backend "mmdevapi"
AL lib: (II) alc_initconfig: Added "mmdevapi" for playback
AL lib: (II) alc_initconfig: Initialized backend "dsound"
AL lib: (II) alc_initconfig: Added "dsound" for capture
AL lib: (II) GetConfigValue: Key excludefx not found
AL lib: (II) GetConfigValue: Key default-reverb not found
AL lib: (II) GetConfigValue: Key channels not found
AL lib: (II) GetConfigValue: Key sample-type not found
AL lib: (II) GetConfigValue: Key format not found
AL lib: (II) GetConfigValue: Key frequency not found
AL lib: (II) GetConfigValue: Key periods not found
AL lib: (II) GetConfigValue: Key period_size not found
AL lib: (II) GetConfigValue: Key sources not found
AL lib: (II) GetConfigValue: Key slots not found
AL lib: (II) GetConfigValue: Key sends not found
AL lib: (II) GetConfigValue: Key cf_level not found
AL lib: (II) GetConfigValue: Key midi/internal-synth not found
AL lib: (II) SSynth_create: Not using internal MIDI synth
AL lib: (II) ALCmmdevProxy_messageHandler: Got message 1029
AL lib: (II) add_device: Got device "Lautsprecher (Realtek High Definition Audio)", "{0.0.0.00000000}.{d6999160-f893-47c3-89bb-fcab18aea143}"
AL lib: (II) add_device: Got device "Lautsprecher (Realtek High Definition Audio)", "{0.0.0.00000000}.{d6999160-f893-47c3-89bb-fcab18aea143}"
AL lib: (WW) ALCmmdevPlayback_open: Failed to find device name matching "DirectSound3D"
AL lib: (EE) ALCmmdevPlayback_open: Device init failed: 0x80004005

I've been trying to get UT2004 to work with OpenAL Soft for two years. All other games work fine with OpenAL Soft. I tried it on two different computers, Windows 7 and 8.1. I tried with different sound cards (onboard sound + M-Audio Fast Track Pro), too.

@hanfling
Copy link

Hiradur: You will find the hardcoded name in ALAudio.dll, not inside UT2004.exe.
Depending on config -- the device name it tries is either "MMSYSTEM", "DirectSound3D" or "DirectSound".
However, it dynamically loads the OpenAL32.dll, and if it can't find them it loads the DefOpenAL32.dll. So using a wrapper DefOpenAL32.dll without having an OpenAL32.dll in dll search path might be an option. Basic idea would be that the wrapper DefOpenAL32.dll would support these three device names as the default device.

@kcat
Copy link
Owner

kcat commented Aug 15, 2015

With commits a5aaa3c and c1146d2, OpenAL Soft will now recognize "DirectSound3D", "DirectSound", and "MMSYSTEM" on Windows and open the default device for it (it won't necessarily use DirectSound or WinMM since the backend may already be determined by the time a device is opened, and builds for other OSs will not recognize these names). This essentially matches the behavior of Creative's router, which ignores them for legacy purposes too.

@kcat kcat closed this as completed Aug 15, 2015
@Hiradur
Copy link
Author

Hiradur commented Aug 15, 2015

Great!
I can confirm that UT2004 now loads OpenAL Soft correctly. However, the mixing is off (sounds on left channel only, music on right and left and many sounds are cut short or don't play at all). I only did a quick test as I'm going on vacation now. I'll open a new ticket when I'm back.

@Hiradur Hiradur changed the title Set custom device name on Windows Some old Windows apps request hard-coded device name Sep 14, 2015
@mirh
Copy link

mirh commented Dec 3, 2022

However, it dynamically loads the OpenAL32.dll, and if it can't find them it loads the DefOpenAL32.dll.

I feel a lot like this is yet another consequence of #757

Except for the fact that once upon a time, enumeration sucked even more
https://github.com/rpavlik/openal-svn-mirror/blob/2100ac09b0e2a72053f7ff05a70bb8587fcad7ba/win/Router/alc.cpp#L1480

Device = UseMMSYSTEM ? "MMSYSTEM" : Use3DSound ? "DirectSound3D" : "DirectSound";

It's pretty wild to see how before version 1.1 of OpenAL, the library was more to abstract direct access to each OS native api rather than being "its own independent powerhouse".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants