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]); } } }
public static Source Create() { unsafe { uint id; Al.GenSources(1, &id); AlHelper.GetAlError(Al.GetError()); AlHelper.CheckName(id, "source"); return(new Source(id)); } }