public static readonly SoundPcmFormat IEC958_SUBFRAME; // IEC-958 CPU Endian static SoundPcmFormats() { if (BitConverter.IsLittleEndian) { S16 = SoundPcmFormat.S16_LE; U16 = SoundPcmFormat.U16_LE; S24 = SoundPcmFormat.S24_LE; U24 = SoundPcmFormat.U24_LE; S32 = SoundPcmFormat.S32_LE; U32 = SoundPcmFormat.U32_LE; FLOAT = SoundPcmFormat.FLOAT_LE; FLOAT64 = SoundPcmFormat.FLOAT64_LE; IEC958_SUBFRAME = SoundPcmFormat.IEC958_SUBFRAME_LE; } else { S16 = SoundPcmFormat.S16_BE; U16 = SoundPcmFormat.U16_BE; S24 = SoundPcmFormat.S24_BE; U24 = SoundPcmFormat.U24_BE; S32 = SoundPcmFormat.S32_BE; U32 = SoundPcmFormat.U32_BE; FLOAT = SoundPcmFormat.FLOAT_BE; FLOAT64 = SoundPcmFormat.FLOAT64_BE; IEC958_SUBFRAME = SoundPcmFormat.IEC958_SUBFRAME_BE; } }
public static int GetPhysicalWidth(this SoundPcmFormat format) { int ret = SoundNativeMethods.SoundPcmFormatPhysicalWidth(format); if (ret < 0) { throw new InvalidOperationException( string.Format("Cannot retrieve physical width for {0}, {1}", format, ret)); } return(ret); }
public static bool IsCpuEndian(this SoundPcmFormat format) { int ret = SoundNativeMethods.SoundPcmFormatCpuEndian(format); if (ret < 0) { throw new InvalidOperationException( string.Format("{0} format is endianess independent: {1}", format, ret)); } return(ret == 1); }
public static bool IsUnsigned(this SoundPcmFormat format) { int ret = SoundNativeMethods.SoundPcmFormatUnsigned(format); if (ret < 0) { throw new InvalidOperationException( string.Format("{0} is not a linear format: {1}", format, ret)); } return(ret == 1); }
public static string GetDescription(this SoundPcmFormat format) { IntPtr ptr = SoundNativeMethods.SoundPcmFormatDescription(format); return(Marshal.PtrToStringAnsi(ptr)); }
public static int SetSilence(this SoundPcmFormat format, IntPtr buf, uint samples) { return(SoundNativeMethods.SoundPcmFormatSetSilence(format, buf, samples)); }
public static ulong GetSilence64(this SoundPcmFormat format) { return(SoundNativeMethods.SoundPcmFormatSilence64(format)); }
public static uint GetSilence32(this SoundPcmFormat format) { return(SoundNativeMethods.SoundPcmFormatSilence32(format)); }
public static ushort GetSilence16(this SoundPcmFormat format) { return(SoundNativeMethods.SoundPcmFormatSilence16(format)); }
public static byte GetSilence(this SoundPcmFormat format) { return(SoundNativeMethods.SoundPcmFormatSilence(format)); }
public static uint GetSize(this SoundPcmFormat format, uint samples) { return(SoundNativeMethods.SoundPcmFormatSize(format, samples)); }
public static bool IsFloat(this SoundPcmFormat format) { return(SoundNativeMethods.SoundPcmFormatFloat(format) == 1); }
public static bool IsLinear(this SoundPcmFormat format) { return(SoundNativeMethods.SoundPcmFormatLinear(format) == 1); }
/// <summary> /// Tests the presence of an access type in a <see cref="SoundPcmFormatMask"/> instance. /// </summary> /// <returns>Value indicating </returns> public bool IsSet(SoundPcmFormat val) { return(SoundNativeMethods.SoundPcmFormatMaskTest(handle, val) == 0); }
/// <summary> /// Makes an access type missing from a <see cref="SoundPcmFormatMask"/> instance. /// </summary> /// <param name="val">Access to unset.</param> public void Unset(SoundPcmFormat val) { SoundNativeMethods.SoundPcmFormatMaskSet(handle, val); }