In this situation, I would recommend taking a look at GSPlayer or TCPMP Player (open source software, C ++), you can use the code to create the dll. GSPlayer uses WaveOut internally, so don't worry about DirectSound. However, you will need to check the license and make sure that you are not violating it. After creating such a DLL, you can use it with p / invoke. If you are the OEM device of your target device, another option that excludes .ogg will add βManage Windows Media Playerβ on your sample OS and use it with C # as an ActiveX control. There is more information on how to do it here , here and here.
Update: In response to a similar question, it is recommended to use FMOD, although it is not free for commercial use, as indicated by @ mack369's comment.
source share