Open antithing opened 5 years ago
Which commit is this built from? 0x80070057
is E_INVALIDARG
, and according to MSDN that error is returned when:
Parameter pFormat points to an invalid format description; or the AUDCLNT_STREAMFLAGS_LOOPBACK flag is set but ShareMode is not equal to AUDCLNT_SHAREMODE_SHARED; or the AUDCLNT_STREAMFLAGS_CROSSPROCESS flag is set but ShareMode is equal to AUDCLNT_SHAREMODE_EXCLUSIVE.
Neither AUDCLNT_STREAMFLAGS_LOOPBACK
or AUDCLNT_STREAMFLAGS_CROSSPROCESS
are set, so it's not that, leaving only pFormat
. There used to be an issue where certain audio devices don't like the WAVE_FORMAT_EXTENSIBLE
tag even when it described an otherwise supported format, but that was fixed with commit 657978c732d3ed379ff4e65891fe21140433a248. It's returning exactly what IAudioClient::IsFormatSupported
gave back. Can you provide a full trace log? Set the ALSOFT_LOGLEVEL
env var to 3
to have the lib print more information.
Hi, thanks for getting back to me. This is using the current code, downloaded from git this morning.
I have added `ALSOFT_LOGLEVEL=3`` to the preprocessor args, but i see the same error msg:
AL lib: (EE) Failed to initialize audio client: 0x80070057
Failed to open OpenAL Soft on Microphone (Realtek Audio), Signed 16-bit, Mono, 44100hz (32768 samples)
Thank you for your time!
I have added `ALSOFT_LOGLEVEL=3`` to the preprocessor args
It's an environment variable, not a build option. Run:
set ALSOFT_LOGLEVEL=3 alrecord.exe -device "OpenAL Soft on Line In (Realtek Audio)"
Okay! That gives me:
alrecord.exe -device "OpenAL Soft on Line In (Realtek Audio)"
AL lib: (II) Initializing library v1.19.1-unknown UNKNOWN
AL lib: (II) Supported backends: wasapi, dsound, winmm, null, wave
AL lib: (II) Loading config C:\Users\bsh\AppData\Roaming\alsoft.ini...
AL lib: (II) Got binary: X:\dev\bsh\timecode\2019\openal-soft-master\build\Release, alrecord.exe
AL lib: (II) Loading config X:\dev\bsh\timecode\2019\openal-soft-master\build\Release\alsoft.ini...
AL lib: (II) Key disable-cpu-exts not found
AL lib: (II) Detected max CPUID function: 0xf (ext. 0x80000008)
AL lib: (II) Vendor ID: ""
AL lib: (II) Name: "Intel(R) Xeon(R) CPU E5-2667 v3 @ 3.20GHz"
AL lib: (II) Extensions: +SSE +SSE2 +SSE3 +SSE4.1
AL lib: (II) Key rt-prio not found
AL lib: (II) Key resampler not found
AL lib: (II) Key trap-al-error not found
AL lib: (II) Key trap-alc-error not found
AL lib: (II) Key reverb/boost not found
AL lib: (II) Key drivers not found
AL lib: (II) Starting message thread
AL lib: (II) Message thread initialization complete
AL lib: (II) Starting message loop
AL lib: (II) Initialized backend "wasapi"
AL lib: (II) Added "wasapi" for playback
AL lib: (II) Added "wasapi" for capture
AL lib: (II) Key excludefx not found
AL lib: (II) Key default-reverb not found
AL lib: (II) Capture format: Mono, Signed Short, 44100hz, 32768 / 32768 buffer
AL lib: (II) Got message "Enumerate Capture" (0x0006, this=000002264777C068)
AL lib: (II) Got device "OpenAL Soft on Line In (Realtek Audio)", "{70F58939-F82E-4155-AEE3-A7598D3278B0}", "{0.0.1.00000000}.{70f58939-f82e-4155-aee3-a7598d3278b0}"
AL lib: (II) Got message "Open Device" (0x0000, this=000002264777C068)
AL lib: (II) Got message "Reset Device" (0x0001, this=000002264777C068)
AL lib: (II) Created Float stereo-to-mono converter
AL lib: (II) Created converter for Mono format, dst: Signed Short 44100hz, src: Float 48000hz
AL lib: (EE) Failed to initialize audio client: 0x80070057
AL lib: (WW) Error generated on device 0000000000000000, code 0xa004
AL lib: (II) Freeing device 0000022647771FB0
AL lib: (II) Got message "Close Device" (0x0004, this=000002264777C068)
Failed to open OpenAL Soft on Line In (Realtek Audio), Signed 16-bit, Mono, 44100hz (32768 samples)
That's certainly odd, I'm not seeing anything really abnormal. Can you try with the latest master? It probably won't fix the issue, but I added some additional traces that may help give a bit more insight into what it's complaining about.
Thank you! Pulling down the latest master just now and building gives me:
alrecord.exe -device "OpenAL Soft on Line In (Realtek Audio)"
AL lib: (II) Initializing library v1.19.1-unknown UNKNOWN
AL lib: (II) Supported backends: wasapi, dsound, winmm, null, wave
AL lib: (II) Loading config C:\Users\bsh\AppData\Roaming\alsoft.ini...
AL lib: (II) Got binary: X:\dev\bsh\timecode\2019\openal-soft-master2\openal-soft-master\build\Release, alrecord.exe
AL lib: (II) Loading config X:\dev\bsh\timecode\2019\openal-soft-master2\openal-soft-master\build\Release\alsoft.ini...
AL lib: (II) Key disable-cpu-exts not found
AL lib: (II) Detected max CPUID function: 0xf (ext. 0x80000008)
AL lib: (II) Vendor ID: ""
AL lib: (II) Name: "Intel(R) Xeon(R) CPU E5-2667 v3 @ 3.20GHz"
AL lib: (II) Extensions: +SSE +SSE2 +SSE3 +SSE4.1
AL lib: (II) Key rt-prio not found
AL lib: (II) Key resampler not found
AL lib: (II) Key trap-al-error not found
AL lib: (II) Key trap-alc-error not found
AL lib: (II) Key reverb/boost not found
AL lib: (II) Key drivers not found
AL lib: (II) Starting message thread
AL lib: (II) Message thread initialization complete
AL lib: (II) Starting message loop
AL lib: (II) Initialized backend "wasapi"
AL lib: (II) Added "wasapi" for playback
AL lib: (II) Added "wasapi" for capture
AL lib: (II) Key excludefx not found
AL lib: (II) Key default-reverb not found
AL lib: (II) Capture format: Mono, Signed Short, 44100hz, 32768 / 32768 buffer
AL lib: (II) Got message "Enumerate Capture" (0x0006, this=00000193271330F8)
AL lib: (II) Got device "OpenAL Soft on Line In (Realtek Audio)", "{70F58939-F82E-4155-AEE3-A7598D3278B0}", "{0.0.1.00000000}.{70f58939-f82e-4155-aee3-a7598d3278b0}"
AL lib: (II) Got message "Open Device" (0x0000, this=00000193271330F8)
AL lib: (II) Got message "Reset Device" (0x0001, this=00000193271330F8)
AL lib: (II) Requesting capture format:
FormatTag = 0xfffe
Channels = 1
SamplesPerSec = 44100
AvgBytesPerSec = 88200
BlockAlign = 2
BitsPerSample = 16
Size = 22
Samples = 16
ChannelMask = 0x4
SubFormat = {00000001-0000-0010-8000-00aa00389b71}
AL lib: (II) Got capture format:
FormatTag = 0xfffe
Channels = 2
SamplesPerSec = 48000
AvgBytesPerSec = 384000
BlockAlign = 8
BitsPerSample = 32
Size = 22
Samples = 32
ChannelMask = 0x3
SubFormat = {00000003-0000-0010-8000-00aa00389b71}
AL lib: (II) Created Float stereo-to-mono converter
AL lib: (II) Created converter for Mono format, dst: Signed Short 44100hz, src: Float 48000hz
AL lib: (EE) Failed to initialize audio client: 0x80070057
AL lib: (WW) Error generated on device 0000000000000000, code 0xa004
AL lib: (II) Freeing device 0000019327143A40
AL lib: (II) Got message "Close Device" (0x0004, this=00000193271330F8)
Failed to open OpenAL Soft on Line In (Realtek Audio), Signed 16-bit, Mono, 44100hz (32768 samples)
I'm pretty stumped. The format looks fine, but it won't accept the format it just said is supported. I don't suppose there's debug mmdevapi/wasapi libs that can provide more information about why that call is failing? What if you try different parameters (just for testing purposes, e.g. try using the device's real format, 48khz AL_FORMAT_STEREO_FLOAT32)?
I tried:
alrecord.exe -device "OpenAL Soft on Microphone (Realtek Audio)" -r 48000 -b 32
and i get:
AL lib: (II) Initializing library v1.19.1-unknown UNKNOWN
AL lib: (II) Supported backends: wasapi, dsound, winmm, null, wave
AL lib: (II) Loading config C:\Users\bsh\AppData\Roaming\alsoft.ini...
AL lib: (II) Got binary: X:\dev\bsh\timecode\2019\openal-soft-master2\openal-soft-master\build\Release, alrecord.exe
AL lib: (II) Loading config X:\dev\bsh\timecode\2019\openal-soft-master2\openal-soft-master\build\Release\alsoft.ini...
AL lib: (II) Key disable-cpu-exts not found
AL lib: (II) Detected max CPUID function: 0xf (ext. 0x80000008)
AL lib: (II) Vendor ID: ""
AL lib: (II) Name: "Intel(R) Xeon(R) CPU E5-2667 v3 @ 3.20GHz"
AL lib: (II) Extensions: +SSE +SSE2 +SSE3 +SSE4.1
AL lib: (II) Key rt-prio not found
AL lib: (II) Key resampler not found
AL lib: (II) Key trap-al-error not found
AL lib: (II) Key trap-alc-error not found
AL lib: (II) Key reverb/boost not found
AL lib: (II) Key drivers not found
AL lib: (II) Starting message thread
AL lib: (II) Message thread initialization complete
AL lib: (II) Starting message loop
AL lib: (II) Initialized backend "wasapi"
AL lib: (II) Added "wasapi" for playback
AL lib: (II) Added "wasapi" for capture
AL lib: (II) Key excludefx not found
AL lib: (II) Key default-reverb not found
AL lib: (II) Capture format: Mono, Float, 48000hz, 32768 / 32768 buffer
AL lib: (II) Got message "Enumerate Capture" (0x0006, this=000001BE289E1288)
AL lib: (II) Got device "OpenAL Soft on Microphone (Realtek Audio)", "{9D8F7A57-81C4-411F-ABD2-E8B81D765710}", "{0.0.1.00000000}.{9d8f7a57-81c4-411f-abd2-e8b81d765710}"
AL lib: (II) Got message "Open Device" (0x0000, this=000001BE289E1288)
AL lib: (II) Got message "Reset Device" (0x0001, this=000001BE289E1288)
AL lib: (II) Requesting capture format:
FormatTag = 0xfffe
Channels = 1
SamplesPerSec = 48000
AvgBytesPerSec = 192000
BlockAlign = 4
BitsPerSample = 32
Size = 22
Samples = 32
ChannelMask = 0x4
SubFormat = {00000003-0000-0010-8000-00aa00389b71}
AL lib: (EE) Failed to initialize audio client: 0x80070057
AL lib: (WW) Error generated on device 0000000000000000, code 0xa004
AL lib: (II) Freeing device 000001BE28A0BFB0
AL lib: (II) Got message "Close Device" (0x0004, this=000001BE289E1288)
Failed to open OpenAL Soft on Microphone (Realtek Audio), Float 32-bit, Mono, 48000hz (32768 samples)
I have also tried stereo, and I get the same. Can you think of anything else that I can try? It's weird. Thanks!
... Using, for example, the inbuilt windows voice recorder app, it works fine.
Unfortunately I'm out of ideas. The only reason it should be getting this error is due to an unsupported format, but the format given is one it said is supported. Any other reason would have to be undocumented, but nothing looks out of the ordinary so I wouldn't know where to begin. All I can suggest to try at this point is using smaller or larger buffer sizes.
Hello! Just for information, suddenly it will help someone: the error above was caused by an antivirus in the system in my case (Kaspersky Endpoint Security). https://stackoverflow.com/questions/46281593/iaudioclientinitialize-returns-e-invalidarg-0x80070057-2147024809
Hi, and thank you for making this code available. I am trying to record from the Line in or Mic port and am failing. I build the libs and examples. I run the
openal-info.exe
application. It prints:I then want to run
alrecord.exe
, so i launch a cmd and run:alrecord.exe -device "OpenAL Soft on Line In (Realtek Audio)"
and i see:
AL lib: (EE) Failed to initialize audio client: 0x80070057 Failed to open OpenAL Soft on Line In (Realtek Audio), Signed 16-bit, Mono, 44100hz (32768 samples)
I am able to listen to this device in another application, so the audio input is fine. What can i look at to get this working?
Thank you.