public WaveHeader(bool extensible) { RiffChunkID = 0x46464952; // "RIFF" Format = 0x45564157; // "WAVE" FmtChunkID = 0x20746D66; // "fmt " FmtChunkSize = 0x10; AudioFormat = 1; NumChannels = 1; // will be updated later for extensible BlockAlign = 2; // will be updated later for extensible BitsPerSample = 16; // 16bit audio only for now DataChunkID = 0x61746164; // "data" if (extensible) { FmtChunkSize = 40; AudioFormat = WaveFormatExtensible; ExtraDataSize = 22; ValidBitsPerSample = 16; // all bits AvailableChannelMask = ChannelMask.Invalid; } }
public void highPassFilter(ChannelMask mask, WirelessTypes.HighPassFilter filter) { msclPINVOKE.WirelessNodeConfig_highPassFilter__SWIG_1(swigCPtr, ChannelMask.getCPtr(mask), (int)filter); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } }
public void hardwareOffset(ChannelMask mask, ushort offset) { msclPINVOKE.WirelessNodeConfig_hardwareOffset__SWIG_1(swigCPtr, ChannelMask.getCPtr(mask), offset); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } }
public void inputRange(ChannelMask mask, WirelessTypes.InputRange range) { msclPINVOKE.WirelessNodeConfig_inputRange__SWIG_1(swigCPtr, ChannelMask.getCPtr(mask), (int)range); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } }
public void pullUpResistor(ChannelMask mask, bool enable) { msclPINVOKE.WirelessNodeConfig_pullUpResistor__SWIG_1(swigCPtr, ChannelMask.getCPtr(mask), enable); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } }
public void activeChannels(ChannelMask channels) { msclPINVOKE.WirelessNodeConfig_activeChannels__SWIG_1(swigCPtr, ChannelMask.getCPtr(channels)); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } }
public WirelessTypes.ThermocoupleType thermocoupleType(ChannelMask mask) { WirelessTypes.ThermocoupleType ret = (WirelessTypes.ThermocoupleType)msclPINVOKE.WirelessNodeConfig_thermocoupleType__SWIG_0(swigCPtr, ChannelMask.getCPtr(mask)); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public WirelessTypes.CalCoef_EquationType equationType(ChannelMask mask) { WirelessTypes.CalCoef_EquationType ret = (WirelessTypes.CalCoef_EquationType)msclPINVOKE.WirelessNodeConfig_equationType__SWIG_0(swigCPtr, ChannelMask.getCPtr(mask)); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public WirelessTypes.Filter getLowPassFilter(ChannelMask mask) { WirelessTypes.Filter ret = (WirelessTypes.Filter)msclPINVOKE.WirelessNode_getLowPassFilter(swigCPtr, ChannelMask.getCPtr(mask)); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public WirelessTypes.CalCoef_EquationType getFactoryCalibrationEqType(ChannelMask mask) { WirelessTypes.CalCoef_EquationType ret = (WirelessTypes.CalCoef_EquationType)msclPINVOKE.WirelessNode_getFactoryCalibrationEqType(swigCPtr, ChannelMask.getCPtr(mask)); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public WirelessTypes.CalCoef_Unit getUnit(ChannelMask mask) { WirelessTypes.CalCoef_Unit ret = (WirelessTypes.CalCoef_Unit)msclPINVOKE.WirelessNode_getUnit(swigCPtr, ChannelMask.getCPtr(mask)); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public WirelessTypes.InputRange inputRange(ChannelMask mask) { WirelessTypes.InputRange ret = (WirelessTypes.InputRange)msclPINVOKE.WirelessNodeConfig_inputRange__SWIG_0(swigCPtr, ChannelMask.getCPtr(mask)); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public WirelessTypes.HighPassFilter highPassFilter(ChannelMask mask) { WirelessTypes.HighPassFilter ret = (WirelessTypes.HighPassFilter)msclPINVOKE.WirelessNodeConfig_highPassFilter__SWIG_0(swigCPtr, ChannelMask.getCPtr(mask)); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
private unsafe void X3DAudioInitialize(ChannelMask speakerChannelMask, float speedOfSound, out X3DAudioHandle handle) { handle = default(X3DAudioHandle); fixed(void *p = &handle) { _initializeDelegate((int)speakerChannelMask, speedOfSound, (IntPtr)p); } }
public WirelessTypes.SettlingTime filterSettlingTime(ChannelMask mask) { WirelessTypes.SettlingTime ret = (WirelessTypes.SettlingTime)msclPINVOKE.WirelessNodeConfig_filterSettlingTime__SWIG_0(swigCPtr, ChannelMask.getCPtr(mask)); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public virtual InputRanges inputRanges(ChannelMask channels, WirelessTypes.Voltage excitationVoltage) { InputRanges ret = new InputRanges(msclPINVOKE.NodeFeatures_inputRanges__SWIG_1(swigCPtr, ChannelMask.getCPtr(channels), (int)excitationVoltage), true); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public LinearEquation getFactoryCalibrationLinearEq(ChannelMask mask) { LinearEquation ret = new LinearEquation(msclPINVOKE.WirelessNode_getFactoryCalibrationLinearEq(swigCPtr, ChannelMask.getCPtr(mask)), true); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public WirelessPollData poll(ChannelMask mask) { WirelessPollData ret = new WirelessPollData(msclPINVOKE.WirelessNode_poll(swigCPtr, ChannelMask.getCPtr(mask)), true); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public AutoShuntCalResult autoShuntCal(ChannelMask mask, ShuntCalCmdInfo commandInfo) { AutoShuntCalResult ret = new AutoShuntCalResult(msclPINVOKE.WirelessNode_autoShuntCal(swigCPtr, ChannelMask.getCPtr(mask), ShuntCalCmdInfo.getCPtr(commandInfo)), true); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
/// <summary> /// <b>XAudio2.8 only:</b> Returns the channel mask for this voice. /// </summary> /// <param name="channelMask"> /// Returns the channel mask for this voice. This corresponds to the /// <see cref="WaveFormatExtensible.ChannelMask" /> member of the <see cref="WaveFormatExtensible" /> class. /// </param> /// <returns>HRESULT</returns> public unsafe int GetChannelMaskNative(out ChannelMask channelMask) { if(Version != XAudio2Version.XAudio2_8) throw new InvalidOperationException("The Channelmask of a mastering voice is only available using XAudio2.8."); fixed (void* p = &channelMask) { return InteropCalls.CallI(UnsafeBasePtr, p, ((void**)(*(void**)UnsafeBasePtr))[19]); } }
public virtual ChannelMask as_ChannelMask() { ChannelMask ret = new ChannelMask(msclPINVOKE.Value_as_ChannelMask(swigCPtr), true); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public ushort debounceFilter(ChannelMask mask) { ushort ret = msclPINVOKE.WirelessNodeConfig_debounceFilter__SWIG_0(swigCPtr, ChannelMask.getCPtr(mask)); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public virtual InputRanges inputRanges(ChannelMask channels) { InputRanges ret = new InputRanges(msclPINVOKE.NodeFeatures_inputRanges(swigCPtr, ChannelMask.getCPtr(channels)), true); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public ChannelMask channelMask() { ChannelMask ret = new ChannelMask(msclPINVOKE.ConfigIssue_channelMask(swigCPtr), false); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public float gaugeFactor(ChannelMask mask) { float ret = msclPINVOKE.WirelessNodeConfig_gaugeFactor__SWIG_0(swigCPtr, ChannelMask.getCPtr(mask)); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public virtual bool supportsInputRange(WirelessTypes.InputRange range, ChannelMask channels) { bool ret = msclPINVOKE.NodeFeatures_supportsInputRange__SWIG_1(swigCPtr, (int)range, ChannelMask.getCPtr(channels)); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public LinearEquation linearEquation(ChannelMask mask) { LinearEquation ret = new LinearEquation(msclPINVOKE.WirelessNodeConfig_linearEquation__SWIG_0(swigCPtr, ChannelMask.getCPtr(mask)), false); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public ushort hardwareOffset(ChannelMask mask) { ushort ret = msclPINVOKE.WirelessNodeConfig_hardwareOffset__SWIG_0(swigCPtr, ChannelMask.getCPtr(mask)); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public bool pullUpResistor(ChannelMask mask) { bool ret = msclPINVOKE.WirelessNodeConfig_pullUpResistor__SWIG_0(swigCPtr, ChannelMask.getCPtr(mask)); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public ChannelMask activeChannels() { ChannelMask ret = new ChannelMask(msclPINVOKE.WirelessNodeConfig_activeChannels__SWIG_0(swigCPtr), true); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public ChannelMask derivedChannelMask(WirelessTypes.DerivedCategory category) { ChannelMask ret = new ChannelMask(msclPINVOKE.WirelessNodeConfig_derivedChannelMask__SWIG_0(swigCPtr, (int)category), true); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public TempSensorOptions tempSensorOptions(ChannelMask mask) { TempSensorOptions ret = new TempSensorOptions(msclPINVOKE.WirelessNodeConfig_tempSensorOptions__SWIG_0(swigCPtr, ChannelMask.getCPtr(mask)), true); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
/// <summary> /// Initializes a new instance of the <see cref="WaveFormatExtensible" /> class. /// </summary> /// <param name="sampleRate"> /// Samplerate of the waveform-audio. This value will get applied to the /// <see cref="WaveFormat.SampleRate" /> property. /// </param> /// <param name="bits"> /// Bits per sample of the waveform-audio. This value will get applied to the /// <see cref="WaveFormat.BitsPerSample" /> property and the <see cref="ValidBitsPerSample" /> property. /// </param> /// <param name="channels"> /// Number of channels of the waveform-audio. This value will get applied to the /// <see cref="WaveFormat.Channels" /> property. /// </param> /// <param name="subFormat">Subformat of the data. This value will get applied to the <see cref="SubFormat" /> property.</param> public WaveFormatExtensible(int sampleRate, int bits, int channels, Guid subFormat) : base(sampleRate, bits, channels, AudioEncoding.Extensible, WaveFormatExtensibleExtraSize) { _samplesUnion = (short) bits; _subFormat = SubTypeFromWaveFormat(this); int cm = 0; for (int i = 0; i < channels; i++) { cm |= (1 << i); } _channelMask = (ChannelMask) cm; _subFormat = subFormat; }
public WaveFormatExtensible(int sampleRate, int bits, int channels, Guid subFormat) : base(sampleRate, bits, channels, AudioEncoding.Extensible, 22) { _validBitsPerSample = (short)bits; _subFormat = SubTypeFromWaveFormat(this); int cm = 0; for (int i = 0; i < channels; i++) { cm |= (1 << i); } _channelMask = (CSCore.ChannelMask)cm; _subFormat = subFormat; }
public WaveFormatExtensible(int sampleRate, int bits, int channels, Guid subFormat, ChannelMask channelMask) : this(sampleRate, bits, channels, subFormat) { var totalChannelMaskValues = Enum.GetValues(typeof(ChannelMask)); int valuesSet = 0; for (int i = 0; i < totalChannelMaskValues.Length; i++) { if ((channelMask & (CSCore.ChannelMask)totalChannelMaskValues.GetValue(i)) == (CSCore.ChannelMask)totalChannelMaskValues.GetValue(i)) valuesSet++; } if (channels != valuesSet) throw new ArgumentException("Channels has to equal the set bits in the channelmask"); _channelMask = channelMask; }
public ChannelMatrix(ChannelMask inputMask, ChannelMask outputMask) { _inputMask = inputMask; _outputMask = outputMask; if ((int)inputMask <= 0) throw new ArgumentException("Invalid inputMask"); if ((int)outputMask <= 0) throw new ArgumentException("Invalid outputMask"); _matrix = new ChannelMatrixElement[GetValuesOfChannelMask(inputMask).Length, GetValuesOfChannelMask(outputMask).Length]; for (int x = 0; x < _matrix.GetLength(0); x++) { for (int y = 0; y < _matrix.GetLength(1); y++) { _matrix[x, y] = new ChannelMatrixElement(GetValuesOfChannelMask(inputMask)[x], GetValuesOfChannelMask(outputMask)[y]); } } }
private static ChannelMask[] GetValuesOfChannelMask(ChannelMask channelMask) { Array totalChannelMaskValues = Enum.GetValues(typeof (ChannelMask)); var values = new List<ChannelMask>(); for (int i = 0; i < totalChannelMaskValues.Length; i++) { if ((channelMask & ((ChannelMask) totalChannelMaskValues.GetValue(i))) == (ChannelMask) totalChannelMaskValues.GetValue(i)) values.Add((ChannelMask) totalChannelMaskValues.GetValue(i)); } return values.ToArray(); }
/// <summary> /// Gets a <see cref="ChannelMatrix"/> to convert between the two specified <see cref="ChannelMask"/>s. /// </summary> /// <param name="from">The <see cref="ChannelMask"/> of the input stream.</param> /// <param name="to">The desired <see cref="ChannelMask"/> of the output stream.</param> /// <returns>A <see cref="ChannelMatrix"/> to convert between the two specified <see cref="ChannelMask"/>s.</returns> /// <exception cref="ArgumentException"><paramref name="from"/> equals <paramref name="to"/></exception> /// <exception cref="KeyNotFoundException">No accurate <see cref="ChannelMatrix"/> was found.</exception> public static ChannelMatrix GetMatrix(ChannelMask from, ChannelMask to) { return Factory.GetMatrix(from, to); }
public FactoryEntry(ChannelMask input, ChannelMask output, ChannelMatrix matrix) { Input = input; Output = output; Matrix = matrix; }
private static bool TryExtractChannelMask(WaveFormat waveFormat, out ChannelMask channelMask) { channelMask = 0; var waveFormatExtensible = waveFormat as WaveFormatExtensible; if (waveFormatExtensible != null) channelMask = waveFormatExtensible.ChannelMask; else if (waveFormat.Channels == 1) channelMask = ChannelMasks.MonoMask; else if (waveFormat.Channels == 2) channelMask = ChannelMasks.StereoMask; else return false; return true; }
public ChannelMatrixElement(ChannelMask inputChannel, ChannelMask outputChannel) { InputChannel = inputChannel; OutputChannel = outputChannel; }
public static ChannelMatrix GetMatrix(ChannelMask from, ChannelMask to) { if (from == to) throw new ArgumentException("from must not equal to."); var matrix = FactoryEntries.FirstOrDefault(x => x.Input == @from && x.Output == to); if(matrix == null) throw new KeyNotFoundException("Could not find a channel matrix for specified channelmasks."); return matrix.Matrix; }
public virtual void Read(BinaryReader br) { RiffChunkID = br.ReadInt32(); RiffChunkSize = br.ReadInt32(); Format = br.ReadInt32(); FmtChunkID = br.ReadInt32(); FmtChunkSize = br.ReadInt32(); AudioFormat = br.ReadUInt16(); NumChannels = br.ReadInt16(); SampleRate = br.ReadInt32(); ByteRate = br.ReadInt32(); BlockAlign = br.ReadInt16(); BitsPerSample = br.ReadInt16(); if (AudioFormat == WaveFormatExtensible) { ExtraDataSize = br.ReadInt16(); ValidBitsPerSample = br.ReadInt16(); AvailableChannelMask = (ChannelMask) br.ReadInt32(); FormatGuid[0] = br.ReadUInt32(); FormatGuid[1] = br.ReadUInt32(); FormatGuid[2] = br.ReadUInt32(); FormatGuid[3] = br.ReadUInt32(); } DataChunkID = br.ReadInt32(); DataChunkSize = br.ReadInt32(); }
public WAVEFORMATEXTENSIBLE(WAVEFORMATEXTENSIBLE o) { wFormatTag = o.wFormatTag; nChannels = o.nChannels; nSamplesPerSec = o.nSamplesPerSec; nAvgBytesPerSec = o.nAvgBytesPerSec; nBlockAlign = o.nBlockAlign; wBitsPerSample = o.wBitsPerSample; cbSize = o.cbSize; wValidBitsPerSample = o.wValidBitsPerSample; dwChannelMask = o.dwChannelMask; SubFormat = o.SubFormat; }
private bool ReorganizeForMultiChannelWave() { // check if stereo, 3 channel or 5 channel... if (!(_fileHeader.numChannels == 2 || _fileHeader.numChannels == 3 || _fileHeader.numChannels == 5)) return false; // check if all channels have names to guess order.... for (int i = 0; i < _channelInfoHeader.Length; i++) { if (_channelInfo[i].Name == null || !(_channelInfo[i].Name.Contains("_") || _channelInfo[i].Name.Contains("."))) { return false; } } // extract common name and channel postfixes int[] tmpChannelOrder = new int[_fileHeader.numChannels]; string[] tmpChannelNames = new string[_fileHeader.numChannels]; for (int i = 0; i < _fileHeader.numChannels; i++) { string channelName = _channelInfo[i].Name; // get unique parts of name int pos = Math.Max(channelName.LastIndexOf('.'), _channelInfo[i].Name.LastIndexOf('_')); tmpChannelNames[i] = channelName.Substring(pos + 1); string tmpString = channelName.Substring(0, pos); // check if common part of name is the same for all channels if (_commonFileName == null) { _commonFileName = tmpString; } else if (_commonFileName != tmpString) { return false; } // check if all channels have the same sampleRate if (_commonSampleRate == 0) { _commonSampleRate = _channelInfo[i].sampleRate; } else if (_commonSampleRate != _channelInfo[i].sampleRate) { return false; } } // try to guess channel mapping, return false if inconsistent... _channelMask = ChannelMask.Invalid; for (int i = 0; i < _fileHeader.numChannels; i++) { if (tmpChannelNames[i] == "LEFT" || tmpChannelNames[i] == "L") { _channelMask |= ChannelMask.SpeakerFrontLeft; tmpChannelOrder[i] = 0; } else if (tmpChannelNames[i] == "RIGHT" || tmpChannelNames[i] == "R") { _channelMask |= ChannelMask.SpeakerFrontRight; tmpChannelOrder[i] = 1; } else if (tmpChannelNames[i] == "CENTRE" || tmpChannelNames[i] == "C") { if (_fileHeader.numChannels < 3) { return false; } _channelMask |= ChannelMask.SpeakerFrontCenter; tmpChannelOrder[i] = 2; } else if (tmpChannelNames[i] == "LS") { if (_fileHeader.numChannels != 5) { return false; } _channelMask |= ChannelMask.SpeakerBackLeft; tmpChannelOrder[i] = 3; } else if (tmpChannelNames[i] == "RS") { if (_fileHeader.numChannels != 5) { return false; } _channelMask |= ChannelMask.SpeakerBackRight; tmpChannelOrder[i] = 4; } else { return false; } } // it's important to export samples in the right order: L, R, C, BL, BR - this array is for reordering... _channelOrder = tmpChannelOrder; return true; }