How to use / access APIs in Visual Studio Express Edition C#

779 views Asked by At

I am working on an Auto Volume Control program that listens to the sound coming from the laptop and sets it to a certain decibel level if it is more than a specified limit.

On researching, I found out about CoreAudioAPIs and even downloaded the Windows 10 SDK to gain access to the APIs.

But I am not able to access the API. I am using C# in Visual Studio Express Edition 2015. When I write "using CoreAudioAPI" , I get the red squiggly under CoreAudioAPI. Same with MMDevice and EndpointVolume APIs, I can't find them!

I tried Adding Reference but the API is not listed.

The code below gives errors:

MMDeviceEnumerator devEnum = new MMDeviceEnumerator();
MMDevice defaultDevice = 
devEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);

Can someone please tell me how do I access an API in a C# program on a VS Express edition?

1

There are 1 answers

3
rene On

The namespace comes from an external library created by xfx and described in their blog post Core Audio for .NET.

The source code of the library is found on GitHub and the zip is linked from the blog post.

Once you either compiled or extracted the binaries you have to add a reference to those dll's from your project.
Make sure you use the browse option and navigate to the folder with the assemblies that contain Core Audio for .NET.

After adding the correct assembly, the namespace will be recognized and your code will compile/no longer complain about the namespace.