com.shinolab.autd3-sdk.pattern 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUTD3.Pattern.asmdef +16 -0
- package/AUTD3.Pattern.asmdef.meta +7 -0
- package/AssemblyInfo.cs +6 -0
- package/AssemblyInfo.cs.meta +11 -0
- package/GlobalUsings.cs +7 -0
- package/GlobalUsings.cs.meta +11 -0
- package/LICENSE.md +21 -0
- package/LICENSE.md.meta +7 -0
- package/Ops.cs +140 -0
- package/Ops.cs.meta +11 -0
- package/Pattern.cs +465 -0
- package/Pattern.cs.meta +11 -0
- package/Plugins/linux-x64/libautd3_pattern.so +0 -0
- package/Plugins/linux-x64/libautd3_pattern.so.meta +35 -0
- package/Plugins/linux-x64.meta +8 -0
- package/Plugins/osx-arm64/libautd3_pattern.dylib +0 -0
- package/Plugins/osx-arm64/libautd3_pattern.dylib.meta +35 -0
- package/Plugins/osx-arm64.meta +8 -0
- package/Plugins/win-x64/autd3_pattern.dll +0 -0
- package/Plugins/win-x64/autd3_pattern.dll.meta +35 -0
- package/Plugins/win-x64.meta +8 -0
- package/Plugins.meta +8 -0
- package/README.md +41 -0
- package/README.md.meta +7 -0
- package/THIRD-PARTY-LICENSES.md +835 -0
- package/THIRD-PARTY-LICENSES.md.meta +7 -0
- package/csc.rsp +2 -0
- package/csc.rsp.meta +7 -0
- package/package.json +15 -0
- package/package.json.meta +7 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "AUTD3.Pattern",
|
|
3
|
+
"rootNamespace": "AUTD3",
|
|
4
|
+
"references": [
|
|
5
|
+
"AUTD3.Core"
|
|
6
|
+
],
|
|
7
|
+
"includePlatforms": [],
|
|
8
|
+
"excludePlatforms": [],
|
|
9
|
+
"allowUnsafeCode": false,
|
|
10
|
+
"overrideReferences": false,
|
|
11
|
+
"precompiledReferences": [],
|
|
12
|
+
"autoReferenced": true,
|
|
13
|
+
"defineConstraints": [],
|
|
14
|
+
"versionDefines": [],
|
|
15
|
+
"noEngineReferences": false
|
|
16
|
+
}
|
package/AssemblyInfo.cs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
using System.Runtime.CompilerServices;
|
|
2
|
+
|
|
3
|
+
// Declared in source (not as csproj <InternalsVisibleTo> items) so that Unity, which
|
|
4
|
+
// compiles these sources via an .asmdef and never sees the csproj, grants the same access.
|
|
5
|
+
[assembly: InternalsVisibleTo("AUTD3")]
|
|
6
|
+
[assembly: InternalsVisibleTo("AUTD3.Pattern.Holo")]
|
package/GlobalUsings.cs
ADDED
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shun Suzuki
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/LICENSE.md.meta
ADDED
package/Ops.cs
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
|
|
3
|
+
namespace AUTD3
|
|
4
|
+
{
|
|
5
|
+
public enum PatternBank : byte
|
|
6
|
+
{
|
|
7
|
+
B0 = 0,
|
|
8
|
+
B1 = 1,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
public enum PatternCompression : byte
|
|
12
|
+
{
|
|
13
|
+
PhaseFull = 1,
|
|
14
|
+
PhaseHalf = 2,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public sealed class WritePatternCompressed : ICommand
|
|
18
|
+
{
|
|
19
|
+
private readonly PatternBank _bank;
|
|
20
|
+
private readonly uint _index;
|
|
21
|
+
private readonly PatternCompression _format;
|
|
22
|
+
private readonly PatternBuffer[] _patterns;
|
|
23
|
+
|
|
24
|
+
public WritePatternCompressed(PatternBank bank, uint index, PatternCompression format, PatternBuffer[] patterns)
|
|
25
|
+
{
|
|
26
|
+
if (patterns.Length == 0 || patterns.Length > 4)
|
|
27
|
+
{
|
|
28
|
+
throw new Autd3Exception("WritePatternCompressed expects 1..=4 pattern buffers");
|
|
29
|
+
}
|
|
30
|
+
_bank = bank;
|
|
31
|
+
_index = index;
|
|
32
|
+
_format = format;
|
|
33
|
+
_patterns = patterns;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
IntPtr ICommand.CreateOp()
|
|
37
|
+
{
|
|
38
|
+
var handles = new IntPtr[_patterns.Length];
|
|
39
|
+
for (var i = 0; i < _patterns.Length; i++)
|
|
40
|
+
{
|
|
41
|
+
handles[i] = _patterns[i].Handle;
|
|
42
|
+
}
|
|
43
|
+
return NativePattern.autd3_op_write_pattern_compressed((byte)_bank, _index, (byte)_format, handles, (UIntPtr)handles.Length);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public sealed class WritePatternBuffer : ICommand
|
|
48
|
+
{
|
|
49
|
+
private readonly PatternBank _bank;
|
|
50
|
+
private readonly ushort _index;
|
|
51
|
+
private readonly PatternBuffer _buffer;
|
|
52
|
+
|
|
53
|
+
public WritePatternBuffer(PatternBank bank, ushort index, PatternBuffer emissions)
|
|
54
|
+
{
|
|
55
|
+
_bank = bank;
|
|
56
|
+
_index = index;
|
|
57
|
+
_buffer = emissions;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
IntPtr ICommand.CreateOp() =>
|
|
61
|
+
NativePattern.autd3_op_write_pattern_buffer((byte)_bank, _index, _buffer.Handle);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public sealed class ConfigPattern : ICommand
|
|
65
|
+
{
|
|
66
|
+
private readonly PatternBank _bank;
|
|
67
|
+
private readonly SamplingConfig _config;
|
|
68
|
+
private readonly uint _size;
|
|
69
|
+
private readonly LoopBehavior _loopBehavior;
|
|
70
|
+
|
|
71
|
+
public ConfigPattern(PatternBank bank, SamplingConfig config, uint size, LoopBehavior? loopBehavior = null)
|
|
72
|
+
{
|
|
73
|
+
_bank = bank;
|
|
74
|
+
_config = config;
|
|
75
|
+
_size = size;
|
|
76
|
+
_loopBehavior = loopBehavior ?? LoopBehavior.Infinite;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
IntPtr ICommand.CreateOp()
|
|
80
|
+
{
|
|
81
|
+
var sampling = _config.CreateHandle();
|
|
82
|
+
try
|
|
83
|
+
{
|
|
84
|
+
return NativePattern.autd3_op_config_pattern((byte)_bank, sampling, _size, _loopBehavior.Rep);
|
|
85
|
+
}
|
|
86
|
+
finally
|
|
87
|
+
{
|
|
88
|
+
NativeCore.autd3_core_sampling_config_free(sampling);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public sealed class ConfigFociStm : ICommand
|
|
94
|
+
{
|
|
95
|
+
private readonly PatternBank _bank;
|
|
96
|
+
private readonly SamplingConfig _config;
|
|
97
|
+
private readonly uint _size;
|
|
98
|
+
private readonly byte _numFoci;
|
|
99
|
+
private readonly Velocity _soundSpeed;
|
|
100
|
+
private readonly LoopBehavior _loopBehavior;
|
|
101
|
+
|
|
102
|
+
public ConfigFociStm(PatternBank bank, SamplingConfig config, uint size, byte numFoci, Velocity? soundSpeed = null, LoopBehavior? loopBehavior = null)
|
|
103
|
+
{
|
|
104
|
+
_bank = bank;
|
|
105
|
+
_config = config;
|
|
106
|
+
_size = size;
|
|
107
|
+
_numFoci = numFoci;
|
|
108
|
+
_soundSpeed = soundSpeed ?? Velocity.FromMS(340f);
|
|
109
|
+
_loopBehavior = loopBehavior ?? LoopBehavior.Infinite;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
IntPtr ICommand.CreateOp()
|
|
113
|
+
{
|
|
114
|
+
var sampling = _config.CreateHandle();
|
|
115
|
+
try
|
|
116
|
+
{
|
|
117
|
+
return NativePattern.autd3_op_config_foci_stm((byte)_bank, sampling, _size, _numFoci, _soundSpeed.MPerS, _loopBehavior.Rep);
|
|
118
|
+
}
|
|
119
|
+
finally
|
|
120
|
+
{
|
|
121
|
+
NativeCore.autd3_core_sampling_config_free(sampling);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
public sealed class ChangePatternBank : ICommand
|
|
127
|
+
{
|
|
128
|
+
private readonly PatternBank _bank;
|
|
129
|
+
private readonly TransitionMode _transitionMode;
|
|
130
|
+
|
|
131
|
+
public ChangePatternBank(PatternBank bank, TransitionMode? transitionMode = null)
|
|
132
|
+
{
|
|
133
|
+
_bank = bank;
|
|
134
|
+
_transitionMode = transitionMode ?? TransitionMode.Immediate;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
IntPtr ICommand.CreateOp() =>
|
|
138
|
+
NativePattern.autd3_op_change_pattern_bank((byte)_bank, _transitionMode.Mode, _transitionMode.Value);
|
|
139
|
+
}
|
|
140
|
+
}
|
package/Ops.cs.meta
ADDED