Exemple #1
0
        public static Context CreateAndActivate(PlaybackDevice device)
        {
            Context c = Create(device);

            c.Activate();
            return(c);
        }
Exemple #2
0
        internal Context(IntPtr handle, PlaybackDevice device)
        {
            this.Handle = handle;
            this.Device = device;

            OpenAL.DebugFormat("Context {0} created for {1}", handle, device.Name);
        }
Exemple #3
0
        internal Context(IntPtr handle, PlaybackDevice device)
        {
            this.Handle = handle;
            this.Device = device;

            OpenAL.DebugFormat ("Context {0} created for {1}", handle, device.Name);
        }
Exemple #4
0
        // ReSharper restore InconsistentNaming

        public static Context Create(PlaybackDevice device)
        {
            OpenAL.DebugFormat("Creating context for {0}", device.Name);

            Context c = new Context(alcCreateContext(device.Handle, IntPtr.Zero), device);

            OpenAL.ErrorCheck(device);

            device.Context = c;

            return(c);
        }
Exemple #5
0
        public static IEnumerable <PlaybackDevice> GetPlaybackDevices(out PlaybackDevice defaultDevice)
        {
            defaultDevice = null;

            OpenAL.Debug("Getting playback devices");

            string defaultName = null;

            string[] strings = new string[0];
            if (GetIsExtensionPresent("ALC_ENUMERATE_ALL_EXT"))
            {
                defaultName = Marshal.PtrToStringAnsi(alcGetString(IntPtr.Zero, ALC_DEFAULT_ALL_DEVICES_SPECIFIER));
                strings     = ReadStringsFromMemory(alcGetString(IntPtr.Zero, ALC_ALL_DEVICES_SPECIFIER));
            }
            else if (GetIsExtensionPresent("ALC_ENUMERATION_EXT"))
            {
                defaultName = Marshal.PtrToStringAnsi(alcGetString(IntPtr.Zero, ALC_DEFAULT_DEVICE_SPECIFIER));
                strings     = ReadStringsFromMemory(alcGetString(IntPtr.Zero, ALC_DEVICE_SPECIFIER));
            }

            PlaybackDevice[] devices = new PlaybackDevice[strings.Length];
            for (int i = 0; i < strings.Length; ++i)
            {
                string s = strings[i];
                devices[i] = new PlaybackDevice(s);

                if (s == defaultName)
                {
                    defaultDevice = devices[i];
                }

                OpenAL.DebugFormat("Found playback device {0}{1}", s, (s == defaultName) ? " (Default)" : String.Empty);
            }

            return(devices);
        }
Exemple #6
0
 public static Context CreateAndActivate(PlaybackDevice device)
 {
     Context c = Create (device);
     c.Activate ();
     return c;
 }
Exemple #7
0
        // ReSharper restore InconsistentNaming
        public static Context Create(PlaybackDevice device)
        {
            OpenAL.DebugFormat ("Creating context for {0}", device.Name);

            Context c = new Context (alcCreateContext (device.Handle, IntPtr.Zero), device);
            OpenAL.ErrorCheck (device);

            device.Context = c;

            return c;
        }
Exemple #8
0
        public static IEnumerable<PlaybackDevice> GetPlaybackDevices(out PlaybackDevice defaultDevice)
        {
            defaultDevice = null;

            OpenAL.Debug ("Getting playback devices");

            string defaultName = null;
            string[] strings = new string[0];
            if (GetIsExtensionPresent ("ALC_ENUMERATE_ALL_EXT"))
            {
                defaultName = Marshal.PtrToStringAnsi (alcGetString (IntPtr.Zero, ALC_DEFAULT_ALL_DEVICES_SPECIFIER));
                strings = ReadStringsFromMemory (alcGetString (IntPtr.Zero, ALC_ALL_DEVICES_SPECIFIER));
            }
            else if (GetIsExtensionPresent ("ALC_ENUMERATION_EXT"))
            {
                defaultName = Marshal.PtrToStringAnsi (alcGetString (IntPtr.Zero, ALC_DEFAULT_DEVICE_SPECIFIER));
                strings = ReadStringsFromMemory (alcGetString (IntPtr.Zero, ALC_DEVICE_SPECIFIER));
            }

            PlaybackDevice[] devices = new PlaybackDevice[strings.Length];
            for (int i = 0; i < strings.Length; ++i)
            {
                string s = strings[i];
                devices[i] = new PlaybackDevice (s);

                if (s == defaultName)
                    defaultDevice = devices[i];

                OpenAL.DebugFormat ("Found playback device {0}{1}", s, (s == defaultName) ? " (Default)" : String.Empty);
            }

            return devices;
        }