Detect headphones in Windows [duplicate]

So…I think I might found something REALY obscure.. Can any of you guys check if that works? – You MUST have the NAudio library referenced.. var enumerator = new MMDeviceEnumerator(); var d = enumerator.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia); Console.WriteLine(d.Properties[new Guid(“46d16a2c-5654-41c0-911e-7860d2bce7ee”)].Value.ToString()); This property return’s 1 (Plugged) or 0 (Unplugged).. and It’s working realy good for me.. UPDATE: Just published … Read more

Play audio from a stream using C#

Edit: Answer updated to reflect changes in recent versions of NAudio It’s possible using the NAudio open source .NET audio library I have written. It looks for an ACM codec on your PC to do the conversion. The Mp3FileReader supplied with NAudio currently expects to be able to reposition within the source stream (it builds … Read more