Esempio n. 1
0
        public unsafe AudioFormat[] GetOutputFormatList(byte[] magicCookie = null)
        {
            var afi = new AudioFormatInfo ();
            afi.AudioStreamBasicDescription = this;

            var type_size = sizeof (AudioFormat);
            uint size;
            if (AudioFormatPropertyNative.AudioFormatGetPropertyInfo (AudioFormatProperty.OutputFormatList, type_size, ref afi, out size) != 0)
                return null;

            Debug.Assert (sizeof (AudioFormat) == type_size);

            var data = new AudioFormat[size / type_size];
            fixed (AudioFormat* ptr = &data[0]) {
                var res = AudioFormatPropertyNative.AudioFormatGetProperty (AudioFormatProperty.OutputFormatList, type_size, ref afi, ref size, ptr);
                if (res != 0)
                    return null;

                Array.Resize (ref data, (int) size / type_size);
                return data;
            }
        }
Esempio n. 2
0
        public unsafe AudioFormat[] GetFormatList(byte[] magicCookie)
        {
            if (magicCookie == null)
                throw new ArgumentNullException ("magicCookie");

            var afi = new AudioFormatInfo ();
            afi.AudioStreamBasicDescription = this;

            fixed (byte* b = magicCookie)
            {
                afi.MagicCookieWeak = b;
                afi.MagicCookieSize = magicCookie.Length;

                var type_size = sizeof (AudioFormat);
                uint size;
                if (AudioFormatPropertyNative.AudioFormatGetPropertyInfo (AudioFormatProperty.FormatList, type_size, ref afi, out size) != 0)
                    return null;

                Debug.Assert (sizeof (AudioFormat) == type_size);

                var data = new AudioFormat[size / type_size];
                fixed (AudioFormat* ptr = &data[0]) {
                    var res = AudioFormatPropertyNative.AudioFormatGetProperty (AudioFormatProperty.FormatList, type_size, ref afi, ref size, ptr);
                    if (res != 0)
                        return null;

                    Array.Resize (ref data, (int)size / type_size);
                    return data;
                }
            }
        }
Esempio n. 3
0
 public static unsafe extern AudioFormatError AudioFormatGetProperty(AudioFormatProperty propertyID, int inSpecifierSize, ref AudioFormatInfo inSpecifier,
     ref uint ioDataSize, AudioFormat* outPropertyData);
Esempio n. 4
0
 public static unsafe extern AudioFormatError AudioFormatGetProperty(AudioFormatProperty inPropertyID, int inSpecifierSize, AudioFormat* inSpecifier, ref int ioPropertyDataSize,
     out uint outPropertyData);
Esempio n. 5
0
        public static unsafe AudioFormat? GetFirstPlayableFormat(AudioFormat[] formatList)
        {
            if (formatList == null)
                throw new ArgumentNullException ("formatList");
            if (formatList.Length < 2)
                throw new ArgumentException ("formatList");

             			fixed (AudioFormat* item = &formatList[0]) {
                uint index;
                int size = sizeof (uint);
                var ptr_size = sizeof (AudioFormat) * formatList.Length;
                if (AudioFormatPropertyNative.AudioFormatGetProperty (AudioFormatProperty.FirstPlayableFormatFromList, ptr_size, item, ref size, out index) != 0)
                    return null;

                return formatList [index];
            }
        }