// Copyright Epic Games, Inc. All Rights Reserved.
// This file is automatically generated. Changes to this file may be overwritten.
namespace Epic.OnlineServices.RTCAudio
{
///
/// This struct is used to represent an audio buffer received in callbacks from and .
///
public class AudioBuffer : ISettable
{
///
/// Pointer to the data with the interleaved audio frames in signed 16 bits format.
///
public short[] Frames { get; set; }
///
/// Sample rate for the samples in the Frames buffer.
///
public uint SampleRate { get; set; }
///
/// Number of channels for the samples in the Frames buffer.
///
public uint Channels { get; set; }
internal void Set(AudioBufferInternal? other)
{
if (other != null)
{
Frames = other.Value.Frames;
SampleRate = other.Value.SampleRate;
Channels = other.Value.Channels;
}
}
public void Set(object other)
{
Set(other as AudioBufferInternal?);
}
}
[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential, Pack = 8)]
internal struct AudioBufferInternal : ISettable, System.IDisposable
{
private int m_ApiVersion;
private System.IntPtr m_Frames;
private uint m_FramesCount;
private uint m_SampleRate;
private uint m_Channels;
public short[] Frames
{
get
{
short[] value;
Helper.TryMarshalGet(m_Frames, out value, m_FramesCount);
return value;
}
set
{
Helper.TryMarshalSet(ref m_Frames, value, out m_FramesCount);
}
}
public uint SampleRate
{
get
{
return m_SampleRate;
}
set
{
m_SampleRate = value;
}
}
public uint Channels
{
get
{
return m_Channels;
}
set
{
m_Channels = value;
}
}
public void Set(AudioBuffer other)
{
if (other != null)
{
m_ApiVersion = RTCAudioInterface.AudiobufferApiLatest;
Frames = other.Frames;
SampleRate = other.SampleRate;
Channels = other.Channels;
}
}
public void Set(object other)
{
Set(other as AudioBuffer);
}
public void Dispose()
{
Helper.TryMarshalDispose(ref m_Frames);
}
}
}