aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Audio.Backends.SoundIo/Native/libsoundio/SoundIOChannelAreas.cs
blob: e0f375b96137ef1c6098f9d3062a3af81d778ed4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using System.Runtime.InteropServices;

namespace SoundIOSharp
{
    public struct SoundIOChannelAreas
    {
        static readonly int native_size = Marshal.SizeOf<SoundIoChannelArea>();

        internal SoundIOChannelAreas(IntPtr head, int channelCount, int frameCount)
        {
            this.head          = head;
            this.channel_count = channelCount;
            this.frame_count   = frameCount;
        }

        IntPtr head;
        int    channel_count;
        int    frame_count;

        public bool IsEmpty
        {
            get { return head == IntPtr.Zero; }
        }

        public SoundIOChannelArea GetArea(int channel)
        {
            return new SoundIOChannelArea(head + native_size * channel);
        }

        public int ChannelCount => channel_count;
        public int FrameCount => frame_count;
    }
}