I am using this code provided here.
http://www.codeproject.com/Articles/18520/Vista-Core-Audio-API-Master-Volume-Control
I am trying to control the volume of my application and 1 additional process that my application starts. Is there a way to use this code above as per application instead of master?
Here is the code in the form
MMDeviceEnumerator DevEnum = new MMDeviceEnumerator();
device = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
beiVolumControl.EditValue = (int)(device.AudioEndpointVolume.MasterVolumeLevelScalar * 100);
By comments listed there is a way to pick the device using a friendly name but I don't see any examples listed anywhere.
Here is the code used when my volume slider changes
//change the Volume
void ritbVolumeControl_EditValueChanged(object sender, EventArgs e)
{
TrackBarControl trackBar = sender as TrackBarControl;
//only use in vista or above.
if (useAlternateSound == false)
{
device.AudioEndpointVolume.MasterVolumeLevelScalar = ((float)trackBar.Value / 100.0f);
}
else
{
//probably using xp or lower.
}
// MessageBox.Show(trackBar.Value.ToString());
}
The End Goal is to Control my Application and one other process's volume if it's possible without controlling the master volume of all applications. So I can mute them and still use skype voice chat for an example. Am I going about this the wrong way?
Thanks.