示例#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 static Source Create()
 {
     unsafe
     {
         uint id;
         Al.GenSources(1, &id);
         AlHelper.GetAlError(Al.GetError());
         AlHelper.CheckName(id, "source");
         return(new Source(id));
     }
 }
示例#3
0
 public static Buffer Create()
 {
     unsafe
     {
         uint id;
         Al.GenBuffers(1, &id);
         AlHelper.GetAlError(Al.GetError());
         AlHelper.CheckName(id, "buffer");
         return(new Buffer(id));
     }
 }