soundvision/UnityProject/Assets/Scripts/PdConnection/PdBuffer.cs
Chikashi Miyama 30256c77a5 add PdBuffer
2019-07-06 16:22:52 +02:00

24 lines
597 B
C#

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();
}
}
}