Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        public static string GetDescription(this SoundPcmFormat format)
        {
            IntPtr ptr = SoundNativeMethods.SoundPcmFormatDescription(format);

            return(Marshal.PtrToStringAnsi(ptr));
        }
Esempio n. 6
0
 public static int SetSilence(this SoundPcmFormat format, IntPtr buf, uint samples)
 {
     return(SoundNativeMethods.SoundPcmFormatSetSilence(format, buf, samples));
 }
Esempio n. 7
0
 public static ulong GetSilence64(this SoundPcmFormat format)
 {
     return(SoundNativeMethods.SoundPcmFormatSilence64(format));
 }
Esempio n. 8
0
 public static uint GetSilence32(this SoundPcmFormat format)
 {
     return(SoundNativeMethods.SoundPcmFormatSilence32(format));
 }
Esempio n. 9
0
 public static ushort GetSilence16(this SoundPcmFormat format)
 {
     return(SoundNativeMethods.SoundPcmFormatSilence16(format));
 }
Esempio n. 10
0
 public static byte GetSilence(this SoundPcmFormat format)
 {
     return(SoundNativeMethods.SoundPcmFormatSilence(format));
 }
Esempio n. 11
0
 public static uint GetSize(this SoundPcmFormat format, uint samples)
 {
     return(SoundNativeMethods.SoundPcmFormatSize(format, samples));
 }
Esempio n. 12
0
 public static bool IsFloat(this SoundPcmFormat format)
 {
     return(SoundNativeMethods.SoundPcmFormatFloat(format) == 1);
 }
Esempio n. 13
0
 public static bool IsLinear(this SoundPcmFormat format)
 {
     return(SoundNativeMethods.SoundPcmFormatLinear(format) == 1);
 }
Esempio n. 14
0
 /// <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);
 }
Esempio n. 15
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);
 }