naudio / NAudio

Audio and MIDI library for .NET
MIT License
5.58k stars 1.1k forks source link

directsound playback breaks with trimming enabled #1191

Open ispysoftware opened 1 month ago

ispysoftware commented 1 month ago

Setting <PublishTrimmed>false</PublishTrimmed> in the .csproj file of any app using net6.0+ breaks directsound playback. Seems like it's stripping out com references - needs some annotations in there to prevent stripping. Adding TrimmerRootAssembly and messing with TrimMode doesn't seem to have any effect. Disabling trimming fixes it but results in a 200mb file instead of a 50mb file

ispysoftware commented 1 month ago

I started rewriting things to get it to work but ended up needing to turn WaveFormat into a struct which opened up a whole can of worms. Workaround is to use SDL via nuget instead of DirectSound