Пример #1
0
        public static int GetEnumValue(string enumname)
        {
            unsafe
            {
                int   length = Encoding.ASCII.GetByteCount(enumname);
                byte *chars  = stackalloc byte[length];
                AlHelper.StringToAnsi(enumname, chars, length);

                return(Al.GetEnumValue(chars));
            }
        }
Пример #2
0
        public static IntPtr GetFunctionPointer(string fname)
        {
            unsafe
            {
                int   length = Encoding.ASCII.GetByteCount(fname);
                byte *chars  = stackalloc byte[length];
                AlHelper.StringToAnsi(fname, chars, length);

                return(new IntPtr(Al.GetProcAddress(chars)));
            }
        }
Пример #3
0
        public static bool IsExtensionPresent(string extension)
        {
            unsafe
            {
                int   length = Encoding.ASCII.GetByteCount(extension);
                byte *chars  = stackalloc byte[length];
                AlHelper.StringToAnsi(extension, chars, length);

                return(Al.IsExtensionPresent(chars));
            }
        }
Пример #4
0
        public Device(string name)
            : this()
        {
            unsafe
            {
                int   name_length = name == null ? 0 : Encoding.ASCII.GetByteCount(name);
                byte *name_ansi   = stackalloc byte[name_length + 1];
                AlHelper.StringToAnsi(name, name_ansi, name_length);
                name_ansi = name == null ? null : name_ansi;

                Handle = Alc.OpenDevice(name_ansi);
                if (Handle == IntPtr.Zero)
                {
                    throw new OpenALException(string.Format(
                                                  "OpenDevice({0}) failed.", name));
                }
            }
        }
Пример #5
0
        public CaptureDevice(string name, uint frequency, Format format, int buffersize)
            : this()
        {
            unsafe
            {
                int   name_length = name == null ? 0 : Encoding.ASCII.GetByteCount(name);
                byte *name_ansi   = stackalloc byte[name_length + 1];
                AlHelper.StringToAnsi(name, name_ansi, name_length);
                name_ansi = name == null ? null : name_ansi;

                Handle = Alc.CaptureOpenDevice(name_ansi, frequency, (int)format, buffersize);
                if (Handle == IntPtr.Zero)
                {
                    throw new OpenALException(string.Format(
                                                  "CaptureOpenDevice({0}, {1}, {2}, {3}) failed.", name, frequency, format, buffersize));
                }
            }
        }