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.
@@ -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
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: ce6a927f79537120c5adc89716004e13
3
+ AssemblyDefinitionImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -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")]
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: acf177a5e5810d3f2b129ea4664ed0da
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,7 @@
1
+ #if UNITY_5_3_OR_NEWER || AUTD3_UNITY
2
+ global using Vector3 = UnityEngine.Vector3;
3
+ global using Quaternion = UnityEngine.Quaternion;
4
+ #else
5
+ global using Vector3 = System.Numerics.Vector3;
6
+ global using Quaternion = System.Numerics.Quaternion;
7
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: d7ea8712e16c81c592e072ff4499f14c
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
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.
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 44e5c572511bb2b7ce5226b73e29e1e8
3
+ DefaultImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
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
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 59b38aa836b3191542c8d5c778133942
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: