예제 #1
0
파일: Source.cs 프로젝트: bonomali/Ibasa
        public static void Create(Source[] sources, int index, int count)
        {
            if (sources == null)
            {
                throw new ArgumentNullException("sources");
            }
            if (index < 0)
            {
                throw new ArgumentOutOfRangeException("index", index, "index is less than 0.");
            }
            if (index + count > sources.Length)
            {
                throw new ArgumentOutOfRangeException("count", count, "index + count is greater than buffers.Length.");
            }

            unsafe
            {
                uint *ids = stackalloc uint[count];
                Al.GenSources(count, ids);
                AlHelper.GetAlError(Al.GetError());
                for (int i = 0; i < count; ++i)
                {
                    AlHelper.CheckName(ids[i], "source");
                    sources[index + i] = new Source(ids[i]);
                }
            }
        }
예제 #2
0
파일: Source.cs 프로젝트: bonomali/Ibasa
 public void Delete()
 {
     AlHelper.ThrowNullException(Id);
     unsafe
     {
         uint id = Id;
         Al.DeleteSources(1, &id);
     }
 }
예제 #3
0
        public Buffer(uint id)
            : this()
        {
            if (Al.IsBuffer(id) == 0)
            {
                throw new ArgumentException("id is not an OpenAL buffer identifier.", "id");
            }

            Id = id;
        }
예제 #4
0
파일: Source.cs 프로젝트: bonomali/Ibasa
        public Source(uint id)
            : this()
        {
            if (Al.IsSource(id) == 0)
            {
                throw new ArgumentException("id is not an OpenAL source identifier.", "id");
            }

            Id = id;
        }
예제 #5
0
 public static Buffer Create()
 {
     unsafe
     {
         uint id;
         Al.GenBuffers(1, &id);
         AlHelper.GetAlError(Al.GetError());
         AlHelper.CheckName(id, "buffer");
         return(new Buffer(id));
     }
 }
예제 #6
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));
            }
        }
예제 #7
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)));
            }
        }
예제 #8
0
파일: Source.cs 프로젝트: bonomali/Ibasa
        public Buffer Unqueue()
        {
            AlHelper.ThrowNullException(Id);

            unsafe
            {
                uint bid;
                Al.SourceUnqueueBuffers(Id, 1, &bid);
                return(new OpenAL.Buffer(bid));
            }
        }
예제 #9
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));
            }
        }
예제 #10
0
파일: Source.cs 프로젝트: bonomali/Ibasa
 public static Source Create()
 {
     unsafe
     {
         uint id;
         Al.GenSources(1, &id);
         AlHelper.GetAlError(Al.GetError());
         AlHelper.CheckName(id, "source");
         return(new Source(id));
     }
 }
예제 #11
0
파일: Source.cs 프로젝트: bonomali/Ibasa
        public void Queue(Buffer buffer)
        {
            AlHelper.ThrowNullException(Id);
            if (buffer == Buffer.Null)
            {
                throw new ArgumentNullException("buffer");
            }

            unsafe
            {
                uint bid = buffer.Id;
                Al.SourceQueueBuffers(Id, 1, &bid);
            }
        }
예제 #12
0
        public void BufferData(Format format, IntPtr data, int size, int frequency)
        {
            AlHelper.ThrowNullException(Id);
            if (data == IntPtr.Zero)
            {
                throw new ArgumentNullException("data");
            }

            unsafe
            {
                uint id = Id;
                Al.BufferData(Id, (int)format, data.ToPointer(), size, frequency);
            }
        }
예제 #13
0
파일: Source.cs 프로젝트: bonomali/Ibasa
        public void Queue(Buffer[] buffers)
        {
            AlHelper.ThrowNullException(Id);
            if (buffers == null)
            {
                throw new ArgumentNullException("buffers");
            }

            unsafe
            {
                uint *bids = stackalloc uint[buffers.Length];
                for (int i = 0; i < buffers.Length; ++i)
                {
                    bids[i] = buffers[i].Id;
                }
                Al.SourceQueueBuffers(Id, buffers.Length, bids);
            }
        }
예제 #14
0
        public void BufferData(Format format, byte[] data, int size, int frequency)
        {
            AlHelper.ThrowNullException(Id);
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            unsafe
            {
                fixed(byte *pointer = data)
                {
                    uint id = Id;

                    Al.BufferData(Id, (int)format, pointer, size, frequency);
                }
            }
        }
예제 #15
0
파일: Source.cs 프로젝트: bonomali/Ibasa
        public                        Buffer[] Unqueue(int count)
        {
            AlHelper.ThrowNullException(Id);
            if (count <= 0)
            {
                throw new ArgumentException("count is less than or equal to 0.", "count");
            }

            unsafe
            {
                uint *bids = stackalloc uint[count];
                Al.SourceUnqueueBuffers(Id, count, bids);

                Buffer[] buffers = new Buffer[count];
                for (int i = 0; i < count; ++i)
                {
                    buffers[i] = new Buffer(bids[i]);
                }
                return(buffers);
            }
        }
예제 #16
0
파일: Source.cs 프로젝트: bonomali/Ibasa
 public void Pause()
 {
     AlHelper.ThrowNullException(Id);
     Al.SourcePause(Id);
 }
예제 #17
0
파일: Source.cs 프로젝트: bonomali/Ibasa
 public void Stop()
 {
     AlHelper.ThrowNullException(Id);
     Al.SourceStop(Id);
 }
예제 #18
0
파일: Source.cs 프로젝트: bonomali/Ibasa
 public void Rewind()
 {
     AlHelper.ThrowNullException(Id);
     Al.SourceRewind(Id);
 }
예제 #19
0
파일: Source.cs 프로젝트: bonomali/Ibasa
 public void Play()
 {
     AlHelper.ThrowNullException(Id);
     Al.SourcePlay(Id);
 }