First, thank you for the AMAZING work. This is a very good example for whose who would like to learn how to write an APO.
Today I installed 0.9.2 from the installer. Everything works fine. I can see the volume change when editing the config.txt.
Then I checked out your code and built from VS 2013 (no code change) + integrated the latest muparserx.lib. The build was successful by generating an EqualizerAPO.dll under DEBUG mode (~1.2MB). I then overwrote my DLL with the installed one, followed by a reboot. However, the new DLL was not loaded, because I cannot see it from the process explorer and foobar cannot play any music files.
Does this whole replacement way work at all? I doubted if Windows has noticed my replacement and simply denied it.
I have read your development notes in the wiki, but it only involved the steps to install the dll manually. For a general question, what's your advice on debugging an APO?
Thanks a lot,
Hong
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hmm... did you already check the system generated logs (you should find some info from there if the .dll crashed or was prevent loading for some reason)?
BTW,
- which O/S do you have there?
- replacing the EqualizerAPO.dll and then reboot works least under Vista (I have done it this way) but I have not tried this under other O/S
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The problem might be that the VC runtime libraries for debug mode are not found when loading the DLL. You could copy msvcr120d.dll and msvcp120d.dll from C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\Debug_NonRedist\x64\Microsoft.VC120.DebugCRT to C:\Program Files\EqualizerAPO to make sure that they will be found.
Otherwise, try if the DLL is loaded when you build it in release mode. And make sure that you build the x64 variant (I guess you are using a 64 bit version of Windows).
Debugging should work then by just attaching to the audiodg.exe
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you Jonas and Juha for the reply. At least, your comments proved that the replacement way will work, although it hasn't work for me yet.
my system is win7 x64. I have compiled both EqualizerAPO and muparsex in 64bit in DEBUG mode and copied msvcr120d.dll and msvcp120d.dll from C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\Debug_NonRedist\x64\Microsoft.VC120.DebugCRT to C:\Program Files\EqualizerAPO. However, it was still not loaded after reboot.
I enabled boot log and browse a bunch of event logs but no luck. I will tried to add some logs to see if the dll was crashed at the initialization part.
Does the euqlizerAPO has its own log file?
Thanks again!
Last edit: Hongliang Li 2015-05-01
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, it is C:\Windows\ServiceProfiles\LocalService\AppData\Local\Temp\EqualizerAPO.log .
It will be created in case of errors or if trace messages are enabled in the registry, but it will only be written if EqualizerAPO.dll is active, so it will likely not help in your case.
BTW, you can execute the command
sc config audiosrv type= own
at the command line and reboot. Then you can replace the DLL without restart by just shutting down the Windows Audio service and starting it again afterwards.
You could try Process Monitor. You should see that svchost.exe accesses EqualizerAPO.dll. If the DLL is actually loaded, you should also see audiodg.exe access EqualizerAPO.dll. You can also compare the result with the original DLL to see where it fails.
Additionally, you could use Dependency Walker on EqualizerAPO.dll and see if there are missing dependencies.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you very much for the comments! I finally could hook my DLL to the audiodg.exe now and able to see my own logs.
I have one problem building under the release mode, not sure if you have seen the same before. When building in release mode, I got 18 unresolved external symbol errors (LNK2001). e.g.
error LNK2001: unresolved external symbol "public: virtual class std::basic_string<wchar_t,struct std::char_traits<wchar_t="">,class std::allocator<wchar_t> > __cdecl mup::IValue::ToString(void)const " C:\workspace\equalizerapo\ExpressionFilterFactory.obj EqualizerAPO*
All those link errors are related to muparsex.I have no such errors when building under debug mode. I checked the ToString function, the definition does exist. So it must be some configuration issue.
One difference between the 2 modes is that:
in debug mode, i used /MDd (multi-threaded debug DLL)
in release mode, i used /MD (multi-threaded DLL)
May that be wrong?
Thank you!
Hong
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hmm... ToString() ... is it inherited function from some of those 3rd party sources or function defined in vccorlib.h? If the latter case then it's supported since Win 8 ... https://msdn.microsoft.com/en-us/library/hh748258.aspx
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Do you have separate libs for muparserx for debug and release mode (muparserxd.lib and muparserx.lib)? I think that the debug lib is not compatible with release mode
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I found the root cause, that it happened in the Unicode settings. EqualizerAPO uses unicode while muparseX did not set. When the EuqalizerAPO tries to link the any function related with basic_string, it failed.
By setting the muparseX to compile in Unicode (Property -> Configuration Properties -> General-> Project Defaults -> Character Set) solved the problem.
Thanks you all for the help!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Jonas,
First, thank you for the AMAZING work. This is a very good example for whose who would like to learn how to write an APO.
Today I installed 0.9.2 from the installer. Everything works fine. I can see the volume change when editing the config.txt.
Then I checked out your code and built from VS 2013 (no code change) + integrated the latest muparserx.lib. The build was successful by generating an EqualizerAPO.dll under DEBUG mode (~1.2MB). I then overwrote my DLL with the installed one, followed by a reboot. However, the new DLL was not loaded, because I cannot see it from the process explorer and foobar cannot play any music files.
Does this whole replacement way work at all? I doubted if Windows has noticed my replacement and simply denied it.
I have read your development notes in the wiki, but it only involved the steps to install the dll manually. For a general question, what's your advice on debugging an APO?
Thanks a lot,
Hong
Hmm... did you already check the system generated logs (you should find some info from there if the .dll crashed or was prevent loading for some reason)?
BTW,
- which O/S do you have there?
- replacing the EqualizerAPO.dll and then reboot works least under Vista (I have done it this way) but I have not tried this under other O/S
The problem might be that the VC runtime libraries for debug mode are not found when loading the DLL. You could copy msvcr120d.dll and msvcp120d.dll from C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\Debug_NonRedist\x64\Microsoft.VC120.DebugCRT to C:\Program Files\EqualizerAPO to make sure that they will be found.
Otherwise, try if the DLL is loaded when you build it in release mode. And make sure that you build the x64 variant (I guess you are using a 64 bit version of Windows).
Debugging should work then by just attaching to the audiodg.exe
Thank you Jonas and Juha for the reply. At least, your comments proved that the replacement way will work, although it hasn't work for me yet.
my system is win7 x64. I have compiled both EqualizerAPO and muparsex in 64bit in DEBUG mode and copied msvcr120d.dll and msvcp120d.dll from C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\Debug_NonRedist\x64\Microsoft.VC120.DebugCRT to C:\Program Files\EqualizerAPO. However, it was still not loaded after reboot.
I enabled boot log and browse a bunch of event logs but no luck. I will tried to add some logs to see if the dll was crashed at the initialization part.
Does the euqlizerAPO has its own log file?
Thanks again!
Last edit: Hongliang Li 2015-05-01
Yes, it is C:\Windows\ServiceProfiles\LocalService\AppData\Local\Temp\EqualizerAPO.log .
It will be created in case of errors or if trace messages are enabled in the registry, but it will only be written if EqualizerAPO.dll is active, so it will likely not help in your case.
BTW, you can execute the command
at the command line and reboot. Then you can replace the DLL without restart by just shutting down the Windows Audio service and starting it again afterwards.
You could try Process Monitor. You should see that svchost.exe accesses EqualizerAPO.dll. If the DLL is actually loaded, you should also see audiodg.exe access EqualizerAPO.dll. You can also compare the result with the original DLL to see where it fails.
Additionally, you could use Dependency Walker on EqualizerAPO.dll and see if there are missing dependencies.
Thank you very much for the comments! I finally could hook my DLL to the audiodg.exe now and able to see my own logs.
I have one problem building under the release mode, not sure if you have seen the same before. When building in release mode, I got 18 unresolved external symbol errors (LNK2001). e.g.
All those link errors are related to muparsex.I have no such errors when building under debug mode. I checked the ToString function, the definition does exist. So it must be some configuration issue.
One difference between the 2 modes is that:
in debug mode, i used /MDd (multi-threaded debug DLL)
in release mode, i used /MD (multi-threaded DLL)
May that be wrong?
Thank you!
Hong
Hmm... ToString() ... is it inherited function from some of those 3rd party sources or function defined in vccorlib.h? If the latter case then it's supported since Win 8 ...
https://msdn.microsoft.com/en-us/library/hh748258.aspx
Do you have separate libs for muparserx for debug and release mode (muparserxd.lib and muparserx.lib)? I think that the debug lib is not compatible with release mode
I found the root cause, that it happened in the Unicode settings. EqualizerAPO uses unicode while muparseX did not set. When the EuqalizerAPO tries to link the any function related with basic_string, it failed.
By setting the muparseX to compile in Unicode (Property -> Configuration Properties -> General-> Project Defaults -> Character Set) solved the problem.
Thanks you all for the help!