static internal AudioChannelLayout FromHandle(IntPtr h) { var layout = new AudioChannelLayout(); layout.AudioTag = (AudioChannelLayoutTag)Marshal.ReadInt32(h, 0); layout.Bitmap = Marshal.ReadInt32(h, 4); layout.Channels = new AudioChannelDescription [Marshal.ReadInt32(h, 8)]; int p = 12; for (int i = 0; i < layout.Channels.Length; i++) { var desc = new AudioChannelDescription(); desc.Label = (AudioChannelLabel)Marshal.ReadInt32(h, p); desc.Flags = (AudioChannelFlags)Marshal.ReadInt32(h, p + 4); desc.Coords = new float [3]; desc.Coords [0] = ReadFloat(h, p + 8); desc.Coords [1] = ReadFloat(h, p + 12); desc.Coords [2] = ReadFloat(h, p + 16); layout.Channels [i] = desc; p += 20; } return(layout); }
internal unsafe AudioChannelLayout(IntPtr h) { AudioTag = (AudioChannelLayoutTag)Marshal.ReadInt32(h, 0); ChannelUsage = (AudioChannelBit)Marshal.ReadInt32(h, 4); Channels = new AudioChannelDescription [Marshal.ReadInt32(h, 8)]; int p = 12; for (int i = 0; i < Channels.Length; i++) { Channels [i] = (AudioChannelDescription)Marshal.PtrToStructure((IntPtr)(unchecked (((byte *)h) + p)), typeof(AudioChannelDescription)); p += Marshal.SizeOf(typeof(AudioChannelDescription)); } }
internal unsafe AudioChannelLayout(IntPtr h) { AudioTag = (AudioChannelLayoutTag)Marshal.ReadInt32(h, 0); ChannelUsage = (AudioChannelBit)Marshal.ReadInt32(h, 4); Channels = new AudioChannelDescription [Marshal.ReadInt32(h, 8)]; int p = 12; int size = sizeof(AudioChannelDescription); for (int i = 0; i < Channels.Length; i++) { Channels [i] = *(AudioChannelDescription *)(unchecked (((byte *)h) + p)); p += size; } }
internal static AudioChannelLayout FromHandle(IntPtr h) { var layout = new AudioChannelLayout (); layout.AudioTag = (AudioChannelLayoutTag) Marshal.ReadInt32 (h, 0); layout.Bitmap = Marshal.ReadInt32 (h, 4); layout.Channels = new AudioChannelDescription [Marshal.ReadInt32 (h, 8)]; int p = 12; for (int i = 0; i < layout.Channels.Length; i++){ var desc = new AudioChannelDescription (); desc.Label = (AudioChannelLabel) Marshal.ReadInt32 (h, p); desc.Flags = (AudioChannelFlags) Marshal.ReadInt32 (h, p+4); desc.Coords = new float [3]; desc.Coords [0] = ReadFloat (h, p+8); desc.Coords [1] = ReadFloat (h, p+12); desc.Coords [2] = ReadFloat (h, p+16); layout.Channels [i] = desc; p += 20; } return layout; }
internal unsafe AudioChannelLayout (IntPtr h) { AudioTag = (AudioChannelLayoutTag) Marshal.ReadInt32 (h, 0); ChannelUsage = (AudioChannelBit) Marshal.ReadInt32 (h, 4); Channels = new AudioChannelDescription [Marshal.ReadInt32 (h, 8)]; int p = 12; int size = sizeof (AudioChannelDescription); for (int i = 0; i < Channels.Length; i++){ Channels [i] = *(AudioChannelDescription *) (unchecked (((byte *) h) + p)); p += size; } }