2018-11-14 18:22:50 -08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
|
|
namespace SoundIOSharp
|
|
|
|
|
{
|
2020-11-27 11:55:00 -08:00
|
|
|
|
public struct SoundIOChannelAreas
|
|
|
|
|
{
|
|
|
|
|
static readonly int native_size = Marshal.SizeOf<SoundIoChannelArea>();
|
2018-11-14 18:22:50 -08:00
|
|
|
|
|
2020-11-27 11:55:00 -08:00
|
|
|
|
internal SoundIOChannelAreas(IntPtr head, int channelCount, int frameCount)
|
|
|
|
|
{
|
|
|
|
|
this.head = head;
|
|
|
|
|
this.channel_count = channelCount;
|
|
|
|
|
this.frame_count = frameCount;
|
|
|
|
|
}
|
2018-11-14 18:22:50 -08:00
|
|
|
|
|
2020-11-27 11:55:00 -08:00
|
|
|
|
IntPtr head;
|
|
|
|
|
int channel_count;
|
|
|
|
|
int frame_count;
|
2018-11-14 18:22:50 -08:00
|
|
|
|
|
2020-11-27 11:55:00 -08:00
|
|
|
|
public bool IsEmpty
|
|
|
|
|
{
|
|
|
|
|
get { return head == IntPtr.Zero; }
|
|
|
|
|
}
|
2018-11-14 18:22:50 -08:00
|
|
|
|
|
2020-11-27 11:55:00 -08:00
|
|
|
|
public SoundIOChannelArea GetArea(int channel)
|
|
|
|
|
{
|
|
|
|
|
return new SoundIOChannelArea(head + native_size * channel);
|
|
|
|
|
}
|
2018-11-14 18:22:50 -08:00
|
|
|
|
|
2020-11-27 11:55:00 -08:00
|
|
|
|
public int ChannelCount => channel_count;
|
|
|
|
|
public int FrameCount => frame_count;
|
|
|
|
|
}
|
|
|
|
|
}
|