com.shinolab.autd3-sdk.pattern 0.9.0 → 0.10.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/Ops.cs +36 -33
- package/Pattern.cs +481 -220
- package/Plugins/linux-x64/libautd3_pattern.so +0 -0
- package/Plugins/osx-arm64/libautd3_pattern.dylib +0 -0
- package/Plugins/win-x64/autd3_pattern.dll +0 -0
- package/THIRD-PARTY-LICENSES.md +32 -181
- package/package.json +2 -2
package/Ops.cs
CHANGED
|
@@ -9,44 +9,42 @@ namespace AUTD3
|
|
|
9
9
|
B1 = 1,
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
public enum
|
|
12
|
+
public enum PhaseDepth : byte
|
|
13
13
|
{
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
Bits8 = 8,
|
|
15
|
+
Bits4 = 4,
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
public static class
|
|
18
|
+
public static class PhaseDepthExt
|
|
19
19
|
{
|
|
20
|
-
public static int
|
|
20
|
+
public static int MaxCount(this PhaseDepth depth)
|
|
21
21
|
{
|
|
22
|
-
if (NativePattern.
|
|
22
|
+
if (NativePattern.autd3_phase_depth_max_count((byte)depth, out var maxCount) != 0)
|
|
23
23
|
{
|
|
24
|
-
throw new Autd3Exception($"unknown
|
|
24
|
+
throw new Autd3Exception($"unknown phase depth {depth}");
|
|
25
25
|
}
|
|
26
|
-
return (int)
|
|
26
|
+
return (int)maxCount;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
public sealed class
|
|
30
|
+
public sealed class WritePatternPhase : ICommand
|
|
31
31
|
{
|
|
32
32
|
private readonly PatternBank _bank;
|
|
33
|
-
private readonly
|
|
34
|
-
private readonly
|
|
35
|
-
private readonly
|
|
33
|
+
private readonly ushort _index;
|
|
34
|
+
private readonly PhaseDepth _depth;
|
|
35
|
+
private readonly Intensity _intensity;
|
|
36
|
+
private readonly PhaseBuffer[] _patterns;
|
|
36
37
|
|
|
37
|
-
public
|
|
38
|
+
public WritePatternPhase(PatternBank bank, ushort index, PhaseDepth depth, Intensity intensity, PhaseBuffer[] patterns)
|
|
38
39
|
{
|
|
39
|
-
if (patterns.Length == 0 || patterns.Length > 4)
|
|
40
|
-
{
|
|
41
|
-
throw new Autd3Exception("WritePatternCompressed expects 1..=4 pattern buffers");
|
|
42
|
-
}
|
|
43
40
|
_bank = bank;
|
|
44
41
|
_index = index;
|
|
45
|
-
|
|
42
|
+
_depth = depth;
|
|
43
|
+
_intensity = intensity;
|
|
46
44
|
_patterns = patterns;
|
|
47
45
|
}
|
|
48
46
|
|
|
49
|
-
IntPtr ICommand.CreateOp()
|
|
47
|
+
IntPtr ICommand.CreateOp(Geometry geometry)
|
|
50
48
|
{
|
|
51
49
|
var handles = new SafeHandle[_patterns.Length];
|
|
52
50
|
for (var i = 0; i < _patterns.Length; i++)
|
|
@@ -54,7 +52,7 @@ namespace AUTD3
|
|
|
54
52
|
handles[i] = _patterns[i].Handle;
|
|
55
53
|
}
|
|
56
54
|
using var lease = new HandleArray(handles);
|
|
57
|
-
return NativePattern.
|
|
55
|
+
return NativePattern.autd3_op_write_pattern_phase((byte)_bank, _index, (byte)_depth, _intensity.Value, lease.Pointers, (UIntPtr)lease.Pointers.Length);
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
58
|
|
|
@@ -62,17 +60,22 @@ namespace AUTD3
|
|
|
62
60
|
{
|
|
63
61
|
private readonly PatternBank _bank;
|
|
64
62
|
private readonly ushort _index;
|
|
65
|
-
private readonly
|
|
63
|
+
private readonly PhaseBuffer _phases;
|
|
64
|
+
private readonly PatternIntensity _intensities;
|
|
66
65
|
|
|
67
|
-
public WritePatternBuffer(PatternBank bank, ushort index,
|
|
66
|
+
public WritePatternBuffer(PatternBank bank, ushort index, PhaseBuffer phases, PatternIntensity intensities)
|
|
68
67
|
{
|
|
69
68
|
_bank = bank;
|
|
70
69
|
_index = index;
|
|
71
|
-
|
|
70
|
+
_phases = phases;
|
|
71
|
+
_intensities = intensities;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
IntPtr ICommand.CreateOp()
|
|
75
|
-
|
|
74
|
+
IntPtr ICommand.CreateOp(Geometry geometry)
|
|
75
|
+
{
|
|
76
|
+
using var intensityLease = new HandleLease(_intensities.Buffer?.Handle);
|
|
77
|
+
return NativePattern.autd3_op_write_pattern_buffer((byte)_bank, _index, _phases.Handle, intensityLease.Pointer, _intensities.Uniform);
|
|
78
|
+
}
|
|
76
79
|
}
|
|
77
80
|
|
|
78
81
|
public sealed class ConfigPattern : ICommand
|
|
@@ -90,7 +93,7 @@ namespace AUTD3
|
|
|
90
93
|
_loopBehavior = loopBehavior ?? LoopBehavior.Infinite;
|
|
91
94
|
}
|
|
92
95
|
|
|
93
|
-
IntPtr ICommand.CreateOp()
|
|
96
|
+
IntPtr ICommand.CreateOp(Geometry geometry)
|
|
94
97
|
{
|
|
95
98
|
var sampling = _config.CreateHandle();
|
|
96
99
|
try
|
|
@@ -113,17 +116,17 @@ namespace AUTD3
|
|
|
113
116
|
private readonly Velocity _soundSpeed;
|
|
114
117
|
private readonly LoopBehavior _loopBehavior;
|
|
115
118
|
|
|
116
|
-
public ConfigFociStm(PatternBank bank, SamplingConfig config, uint size, byte numFoci, Velocity
|
|
119
|
+
public ConfigFociStm(PatternBank bank, SamplingConfig config, uint size, byte numFoci, Velocity soundSpeed, LoopBehavior? loopBehavior = null)
|
|
117
120
|
{
|
|
118
121
|
_bank = bank;
|
|
119
122
|
_config = config;
|
|
120
123
|
_size = size;
|
|
121
124
|
_numFoci = numFoci;
|
|
122
|
-
_soundSpeed = soundSpeed
|
|
125
|
+
_soundSpeed = soundSpeed;
|
|
123
126
|
_loopBehavior = loopBehavior ?? LoopBehavior.Infinite;
|
|
124
127
|
}
|
|
125
128
|
|
|
126
|
-
IntPtr ICommand.CreateOp()
|
|
129
|
+
IntPtr ICommand.CreateOp(Geometry geometry)
|
|
127
130
|
{
|
|
128
131
|
var sampling = _config.CreateHandle();
|
|
129
132
|
try
|
|
@@ -137,18 +140,18 @@ namespace AUTD3
|
|
|
137
140
|
}
|
|
138
141
|
}
|
|
139
142
|
|
|
140
|
-
public sealed class
|
|
143
|
+
public sealed class ActivatePatternBank : ICommand
|
|
141
144
|
{
|
|
142
145
|
private readonly PatternBank _bank;
|
|
143
146
|
private readonly TransitionMode _transitionMode;
|
|
144
147
|
|
|
145
|
-
public
|
|
148
|
+
public ActivatePatternBank(PatternBank bank, TransitionMode? transitionMode = null)
|
|
146
149
|
{
|
|
147
150
|
_bank = bank;
|
|
148
151
|
_transitionMode = transitionMode ?? TransitionMode.Immediate;
|
|
149
152
|
}
|
|
150
153
|
|
|
151
|
-
IntPtr ICommand.CreateOp() =>
|
|
152
|
-
NativePattern.
|
|
154
|
+
IntPtr ICommand.CreateOp(Geometry geometry) =>
|
|
155
|
+
NativePattern.autd3_op_activate_pattern_bank((byte)_bank, _transitionMode.Mode, _transitionMode.Value);
|
|
153
156
|
}
|
|
154
157
|
}
|