public bool SetVolumeScalarControl(OMENDataFlow renderCapture, List <VolumeChannelSturcture> volumeData) { CAudioDataFlow cmediaDataFlow = CAudioDataFlow.eRender; if (renderCapture == OMENDataFlow.Capture) { cmediaDataFlow = CAudioDataFlow.eCapture; } bool rev = false; ReturnValue revData; foreach (var channle in volumeData) { revData = CAudioSDKService.Instance.ConfigureJackDeviceData( cmediaDataFlow, CAudioDriverReadWrite.Write, new CAudioClientData() { ApiName = CAudioAPIFunctionPoint.VolumeScalarControl.ToString(), SetValue = channle.ChannelValue, SetExtraValue = (CAudioVolumeChannel)channle.ChannelIndex }); } return(rev); }
private CAudioJackDeviceInfo GetJackDevice(CAudioDataFlow deviceType) { uint devCount = 0; CAudioDeviceInfo devInfo; CAudioJackDeviceInfo jackDeviceInfo = new CAudioJackDeviceInfo(); int rev = NativeMethods.CMI_GetDeviceCount(deviceType, ref devCount); if (0 == devCount) { //Device not found!! return(null); } else { for (int i = 0; i < devCount; i++) { rev = NativeMethods.CMI_GetDeviceById(deviceType, i, out devInfo); switch (devInfo.DeviceState) { case CAudioDeviceState.Active: jackDeviceInfo.m_devInfo = devInfo; break; } } ; } return(jackDeviceInfo); }
public bool SetMuteControl(OMENDataFlow renderCapture, int isMute) { CAudioDataFlow cmediaDataFlow = CAudioDataFlow.eRender; if (renderCapture == OMENDataFlow.Capture) { cmediaDataFlow = CAudioDataFlow.eCapture; } bool rev = false; ReturnValue revData; revData = CAudioSDKService.Instance.ConfigureJackDeviceData(cmediaDataFlow, CAudioDriverReadWrite.Write, new CAudioClientData() { ApiName = CAudioAPIFunctionPoint.MuteControl.ToString(), SetValue = isMute }); if (revData.RevCode != 0) { return(rev); } return(rev); }
public ReturnValue ConfigureJackDeviceData(CAudioDataFlow dataFlow, CAudioDriverReadWrite readWrite, CAudioClientData clientData) { ReturnValue revData = new ReturnValue() { RevCode = -1, RevMessage = $"API Name [{clientData.ApiName}] not Correct!" }; CAudioAPIFunctionPoint sdkAPI; if (!Enum.TryParse(clientData.ApiName, out sdkAPI)) { return(revData); } if (readWrite == CAudioDriverReadWrite.Write && clientData.SetValue == null && clientData.SetExtraValue == null) { revData.RevMessage = "SetValue Can't be Null"; return(revData); } CAudioStructure rwData = null; CAudioJackDeviceInfo jackInfo = null; jackInfo = _cmediaJackInfoRender; if (dataFlow == CAudioDataFlow.eCapture || sdkAPI > CAudioAPIFunctionPoint.VOICECLARITY_NOISESUPP_LEVEL) { jackInfo = _cmediajackInfoCapture; } rwData = new CAudioStructure() { JackInfo = jackInfo, ApiPropertyName = clientData.ApiName, ReadWrite = readWrite, WriteData = clientData.SetValueToByteArray(), WriteExtraData = clientData.SetExtraValueToByteArray() }; if (clientData.SetValue != null || clientData.SetExtraValue != null) { rwData.IsWriteExtra = true; } revData = ConfigurePropertyControl(rwData); return(revData); }
public VolumeControlStructure GetVolumeControl(OMENDataFlow renderCapture) { CAudioDataFlow cmediaDataFlow = CAudioDataFlow.eRender; if (renderCapture == OMENDataFlow.Capture) { cmediaDataFlow = CAudioDataFlow.eCapture; } VolumeControlStructure volumeControl = new VolumeControlStructure(); var rev = CAudioSDKService.Instance.ConfigureJackDeviceData(cmediaDataFlow, CAudioDriverReadWrite.Read, new CAudioClientData() { ApiName = CAudioAPIFunctionPoint.GetMaxVol.ToString() }); if (rev.RevCode != 0) { return(null); } volumeControl.MaxValue = double.Parse(rev.RevValue); rev = CAudioSDKService.Instance.ConfigureJackDeviceData(cmediaDataFlow, CAudioDriverReadWrite.Read, new CAudioClientData() { ApiName = CAudioAPIFunctionPoint.GetMinVol.ToString() }); if (rev.RevCode != 0) { return(null); } volumeControl.MinValue = double.Parse(rev.RevValue); rev = CAudioSDKService.Instance.ConfigureJackDeviceData(cmediaDataFlow, CAudioDriverReadWrite.Read, new CAudioClientData() { ApiName = CAudioAPIFunctionPoint.VolumeScalarControl.ToString() }); if (rev.RevCode != 0) { return(null); } volumeControl.ScalarValue = double.Parse(rev.RevValue); rev = CAudioSDKService.Instance.ConfigureJackDeviceData(cmediaDataFlow, CAudioDriverReadWrite.Read, new CAudioClientData() { ApiName = CAudioAPIFunctionPoint.GetVolStep.ToString() }); if (rev.RevCode != 0) { return(null); } volumeControl.StepValue = double.Parse(rev.RevValue); rev = CAudioSDKService.Instance.ConfigureJackDeviceData(cmediaDataFlow, CAudioDriverReadWrite.Read, new CAudioClientData() { ApiName = CAudioAPIFunctionPoint.MuteControl.ToString() }); if (rev.RevCode != 0) { return(null); } volumeControl.IsMuted = int.Parse(rev.RevValue); //Get Channel data volumeControl.ChannelValues = new System.Collections.Generic.List <VolumeChannelSturcture>(); rev = CAudioSDKService.Instance.ConfigureJackDeviceData(cmediaDataFlow, CAudioDriverReadWrite.Read, new CAudioClientData() { ApiName = CAudioAPIFunctionPoint.VolumeControl.ToString(), SetValue = null, SetExtraValue = CAudioVolumeChannel.Master }); if (rev.RevCode != 0) { return(null); } VolumeChannelSturcture channel = new VolumeChannelSturcture() { ChannelValue = float.Parse(rev.RevValue), ChannelIndex = OMENVolumeChannel.Master }; volumeControl.ChannelValues.Add(channel); rev = CAudioSDKService.Instance.ConfigureJackDeviceData(cmediaDataFlow, CAudioDriverReadWrite.Read, new CAudioClientData() { ApiName = CAudioAPIFunctionPoint.VolumeControl.ToString(), SetValue = null, SetExtraValue = CAudioVolumeChannel.FrontLeft }); if (rev.RevCode != 0) { return(null); } channel = new VolumeChannelSturcture() { ChannelValue = float.Parse(rev.RevValue), ChannelIndex = OMENVolumeChannel.FrontLeft }; volumeControl.ChannelValues.Add(channel); rev = CAudioSDKService.Instance.ConfigureJackDeviceData(cmediaDataFlow, CAudioDriverReadWrite.Read, new CAudioClientData() { ApiName = CAudioAPIFunctionPoint.VolumeControl.ToString(), SetValue = null, SetExtraValue = CAudioVolumeChannel.FrontRight }); if (rev.RevCode != 0) { return(null); } channel = new VolumeChannelSturcture() { ChannelValue = float.Parse(rev.RevValue), ChannelIndex = OMENVolumeChannel.FrontRight }; volumeControl.ChannelValues.Add(channel); return(volumeControl); }
public static extern int CMI_GetDeviceById(CAudioDataFlow type, int id, out CAudioDeviceInfo deviceInfo);
public static extern int CMI_GetDeviceCount(CAudioDataFlow type, ref uint DevCount);