Esempio n. 1
0
        public unsafe static bool BASS_Encode_GetACMFormat(int handle, ref ACMFORMAT codec, string title, BASSACMFormat flags)
        {
            int num = BassEnc.BASS_Encode_GetACMFormatUnicode(0, IntPtr.Zero, 0, null, BASSACMFormat.BASS_ACM_NONE);

            byte[] array  = new byte[(num > codec.FormatLength) ? num : codec.FormatLength];
            bool   result = false;

            byte[] array2 = new byte[Marshal.SizeOf(codec) + (int)codec.waveformatex.cbSize];
            int    num2   = Marshal.SizeOf(codec);
            IntPtr intPtr = Marshal.AllocHGlobal(num2);

            Marshal.StructureToPtr(codec, intPtr, false);
            Marshal.Copy(intPtr, array2, 0, num2);
            Marshal.FreeHGlobal(intPtr);
            for (int i = 0; i < codec.extension.Length; i++)
            {
                array2[18 + i] = codec.extension[i];
            }
            Array.Copy(array2, array, num2);
            fixed(byte *ptr = array)
            {
                if (BassEnc.BASS_Encode_GetACMFormat(handle, (IntPtr)((void *)ptr), num, title, flags) > 0)
                {
                    codec  = new ACMFORMAT((IntPtr)((void *)ptr));
                    result = true;
                }
            }

            return(result);
        }
Esempio n. 2
0
        public ACMFORMAT()
        {
            int num = BassEnc.BASS_Encode_GetACMFormat(0, IntPtr.Zero, 0, null, BASSACMFormat.BASS_ACM_NONE);

            this.waveformatex        = new WAVEFORMATEX();
            this.waveformatex.cbSize = (short)(num - 18);
            if (this.waveformatex.cbSize >= 0)
            {
                this.extension = new byte[(int)this.waveformatex.cbSize];
            }
        }
Esempio n. 3
0
        public unsafe static ACMFORMAT BASS_Encode_GetACMFormatSuggest(int handle, BASSACMFormat flags, WAVEFormatTag format)
        {
            ACMFORMAT result = null;
            int       num    = BassEnc.BASS_Encode_GetACMFormatUnicode(0, IntPtr.Zero, 0, null, BASSACMFormat.BASS_ACM_NONE);

            fixed(byte *ptr = new byte[num])
            {
                if (BassEnc.BASS_Encode_GetACMFormat(handle, (IntPtr)((void *)ptr), num, null, (BASSACMFormat)Utils.MakeLong((int)flags, (int)format)) > 0)
                {
                    result = new ACMFORMAT((IntPtr)((void *)ptr));
                }
            }

            return(result);
        }