soundvision/UnityProject/Assets/Scripts/PdConnection/PdBuffer.cs

25 lines
597 B
C#
Raw Normal View History

2019-07-06 14:22:52 +00:00
using System;
using System.IO.MemoryMappedFiles;
namespace PdConnection
{
public class PdBuffer : IDisposable
{
private readonly MemoryMappedFile memoryMappedFile_;
private readonly MemoryMappedViewAccessor viewAccessor_;
public PdBuffer()
{
memoryMappedFile_ = MemoryMappedFile.OpenExisting("shared_memory");
viewAccessor_ = memoryMappedFile_.CreateViewAccessor();
}
public void Dispose()
{
viewAccessor_?.Dispose();
memoryMappedFile_?.Dispose();
}
}
}