add PdBuffer
This commit is contained in:
parent
3441b7b4b9
commit
30256c77a5
2 changed files with 25 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
UnityProject/Library
|
24
UnityProject/Assets/Scripts/PdConnection/PdBuffer.cs
Normal file
24
UnityProject/Assets/Scripts/PdConnection/PdBuffer.cs
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue