[wdmaudiodev] Re: [EXTERNAL] APO with OutputDebugString

  • From: Joey Lag <itsjoeylag@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Fri, 22 May 2020 08:50:27 +0100

Thank you for your tips Matthew! I ended up trying the user-mode debugger with 
unaltered sysvad to no avail. After this I moved from my vmmon virtualbox setup 
to the hyper-v setup and this seems to have solved the issues (debug messages 
being printed now and the crash no longer occurs) - so something in my previous 
setup must have been interfering somehow.

I have a further question to ask. The proprietary algorithm I am implementing 
requires a fixed sample rate and buffer size. To my understanding (and 
confirming via debug messages), APOInitialize is called (several times) 
whenever the sample rate is changed from sound settings - thereby I can 
reinitialize the algorithm for every APOInitialize call with the latest sample 
rate. With respect to the buffer size, I seem to be getting a constant 480 
frames for each APOProcess call (regardless of sample rate - tried with 
44.1kHz, 48kHz, 96kHz). This is in contrast to 
https://www.freelists.org/post/wdmaudiodev/Can-number-of-valid-frames-in-connection-buffer-be-changed-from-480-to-any-other-Number-when-the-Sample-rate-is-selected-to-48Khz
 
<https://www.freelists.org/post/wdmaudiodev/Can-number-of-valid-frames-in-connection-buffer-be-changed-from-480-to-any-other-Number-when-the-Sample-rate-is-selected-to-48Khz>
 where Rajendra's buffer sizes are changing with sample rate. You’ve also 
mentioned here that "The APO contract is that the caller of APOProcess can give 
you any size buffer it likes, even all the way down to a single sample!” - 
should I proceed by assuming this is still the case despite my observations so 
far?

Cheers! 
Joey

On 20 May 2020, at 17:49, Matthew van Eerde (Redacted sender 
"Matthew.van.Eerde" for DMARC) <dmarc-noreply@xxxxxxxxxxxxx> wrote:

OK, then you don’t need DisableProtectedAudioDg. audiodg.exe is no longer a 
protected process in Windows 10.
 
I would suggest attaching a user-mode debugger to audiodg.exe to debug what 
is happening when you turn on the effect. It is also probably a good idea to 
run some/all of the HLK tests for APOs and see if the error messages (if 
there are any) point in any particular direction.
 
From: Joey Lag <mailto:itsjoeylag@xxxxxxxxx>
Sent: Wednesday, May 20, 2020 9:47 AM
To: wdmaudiodev@xxxxxxxxxxxxx <mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] Re: [EXTERNAL] APO with OutputDebugString
 
Version number 10.0.18363.836 


On 20 May 2020, at 17:40, Joey Lag <itsjoeylag@xxxxxxxxx 
<mailto:itsjoeylag@xxxxxxxxx>> wrote:
 
I am running Windows 10 Pro 64bit


On 20 May 2020, at 17:22, Matthew van Eerde (Redacted sender 
"Matthew.van.Eerde" for DMARC) <dmarc-noreply@xxxxxxxxxxxxx 
<mailto:dmarc-noreply@xxxxxxxxxxxxx>> wrote:
 
What version of Windows are you running in your VM?
 
<0C72FADF23C14D47B5CE3E35B60144C9.png>
From: wdmaudiodev-bounce@xxxxxxxxxxxxx 
<mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx> <wdmaudiodev-bounce@xxxxxxxxxxxxx 
<mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx>> on behalf of Joey Lag 
<itsjoeylag@xxxxxxxxx <mailto:itsjoeylag@xxxxxxxxx>>
Sent: Wednesday, May 20, 2020 9:15:02 AM
To: wdmaudiodev@xxxxxxxxxxxxx <mailto:wdmaudiodev@xxxxxxxxxxxxx
<wdmaudiodev@xxxxxxxxxxxxx <mailto:wdmaudiodev@xxxxxxxxxxxxx>>
Subject: [EXTERNAL] [wdmaudiodev] APO with OutputDebugString
 
Greetings audio gurus!
 
I am reaching out to you as I am looking to incorporate a proprietary DSP 
algorithm within a windows driver. This is my first experience with windows 
driver development, and I have been doing some reading, in particular:
https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/introduction-to-wdm
 
<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows-hardware%2Fdrivers%2Fkernel%2Fintroduction-to-wdm&data=02%7C01%7CMatthew.van.Eerde%40microsoft.com%7C501119ba24144310d2c108d7fcdd69cb%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637255900204883649&sdata=l8Aac%2Fg5x1Vy63erW3QdPUAAKHtTab9UjkQlboFGKY4%3D&reserved=0>
https://docs.microsoft.com/en-us/windows-hardware/drivers/audio/wdm-audio-architecture--basic-concepts
 
<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows-hardware%2Fdrivers%2Faudio%2Fwdm-audio-architecture--basic-concepts&data=02%7C01%7CMatthew.van.Eerde%40microsoft.com%7C501119ba24144310d2c108d7fcdd69cb%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637255900204888655&sdata=l2vlOQ7NkahGb%2B3mnwnI9lSnxgzEKPLFCLIat1P1qaw%3D&reserved=0>
https://docs.microsoft.com/en-gb/windows/win32/learnwin32/module-2--using-com-in-your-windows-program
 
<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-gb%2Fwindows%2Fwin32%2Flearnwin32%2Fmodule-2--using-com-in-your-windows-program&data=02%7C01%7CMatthew.van.Eerde%40microsoft.com%7C501119ba24144310d2c108d7fcdd69cb%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637255900204898647&sdata=q%2FjwlCcEpPI%2Fgd%2Fxwu1FxmfpRX1YIjry7vWKKv2uifI%3D&reserved=0>
https://docs.microsoft.com/en-us/cpp/atl/active-template-library-atl-concepts?view=vs-2019
 
<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fcpp%2Fatl%2Factive-template-library-atl-concepts%3Fview%3Dvs-2019&data=02%7C01%7CMatthew.van.Eerde%40microsoft.com%7C501119ba24144310d2c108d7fcdd69cb%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637255900204903649&sdata=zBd9TO4BIspKvP0GHR1RoXSsJt1xCYxOrM0sm4zJTCQ%3D&reserved=0>
 
From my reading, I have understood that software DSP is handled in ATL 
COM-based objects known as audio processing objects which exist in the 
user-mode Audio Engine which communicates with the drivers on the 
kernel-side. As a result I have begun editing the SYSVAD example project, in 
particular the Swap APO. The DSP algorithm runs on a proprietary software 
framework, and to test whether everything works correctly I have created an 
identical channel swap example with it and incorporated it within the MFX 
swap apo example. My testing setup uses a virtual box VM as the target, 
through which I use vmmon with windbg for debugging (Setup based on the steps 
at 
https://www.youtube.com/watch?v=XUlbYRFFYf0&list=PLZ4EgN7ZCzJx2DRXTRUXRrB2njWnx1kA2
 
<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DXUlbYRFFYf0%26list%3DPLZ4EgN7ZCzJx2DRXTRUXRrB2njWnx1kA2&data=02%7C01%7CMatthew.van.Eerde%40microsoft.com%7C501119ba24144310d2c108d7fcdd69cb%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637255900204913645&sdata=eHht8g9ufvqA1ouRJCuTOYQls9k9Npof544LweCbp1k%3D&reserved=0>).
 Both host and target computers are 64-bit windows 10. 
 
I seem to be running into issues with this simple example - whenever I switch 
on the audio enhancements for the sysvad driver (which should apply the 
channel swap using our internal framework) a window pops up saying that 
“Windows has detected that audio enhancements for the following device are 
causing problems: [sysvad device name]. Audio enhancements for this device 
have been disabled. Would you like to reenable?”. As an initial step, I have 
included several “OutputDebugString” string calls to print some output to the 
debugger but this doesn’t seem to show through dbgview (run on target machine 
with administrator permissions with all capture types selected under capture 
menu). Any suggestions on what I have to do to see this output? I have also 
put in several OutputDebugString calls within the unaltered sysvad example 
and similarly I cannot obtain any debugging output. Also, I have added 
“DisableProtectedAudioDG” as a DWORD and set it to 1 in 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Audio but this 
has not helped.
 
Many thanks guys. I understand that you’re all volunteering to help on this 
mailing list, so any clarifications are much appreciated!
 
- Joey
 
 
 

Other related posts: