com.shinolab.autd3-sdk.modulation 0.5.0 → 0.6.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/Modulation.cs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
using System;
|
|
2
|
+
using System.Threading;
|
|
2
3
|
using System.Collections;
|
|
3
4
|
using System.Collections.Generic;
|
|
4
5
|
using System.Runtime.InteropServices;
|
|
@@ -18,6 +19,20 @@ namespace AUTD3
|
|
|
18
19
|
{
|
|
19
20
|
private const string Lib = "autd3_modulation";
|
|
20
21
|
|
|
22
|
+
private const string ClientLib = "autd3capi";
|
|
23
|
+
|
|
24
|
+
static NativeModulation()
|
|
25
|
+
{
|
|
26
|
+
NativeAbi.Verify(Lib, autd3_abi_version());
|
|
27
|
+
NativeAbi.Verify(ClientLib, autd3capi_abi_version());
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
[DllImport(Lib)]
|
|
31
|
+
private static extern uint autd3_abi_version();
|
|
32
|
+
|
|
33
|
+
[DllImport(ClientLib, EntryPoint = "autd3_abi_version")]
|
|
34
|
+
private static extern uint autd3capi_abi_version();
|
|
35
|
+
|
|
21
36
|
[DllImport(Lib)]
|
|
22
37
|
internal static extern IntPtr autd3_modulation_buffer_new();
|
|
23
38
|
|
|
@@ -47,7 +62,7 @@ namespace AUTD3
|
|
|
47
62
|
internal static extern void autd3_modulation_sine_option_free(IntPtr option);
|
|
48
63
|
|
|
49
64
|
[DllImport(Lib)]
|
|
50
|
-
internal static extern int autd3_modulation_sine(byte mode, float freq, uint freqInt, IntPtr option, IntPtr buffer);
|
|
65
|
+
internal static extern int autd3_modulation_sine(byte mode, float freq, uint freqInt, IntPtr option, IntPtr buffer, byte[] outErr, UIntPtr outErrLen);
|
|
51
66
|
|
|
52
67
|
[DllImport(Lib)]
|
|
53
68
|
internal static extern IntPtr autd3_modulation_square_option_new(byte low, byte high, float duty, IntPtr samplingConfig);
|
|
@@ -56,7 +71,7 @@ namespace AUTD3
|
|
|
56
71
|
internal static extern void autd3_modulation_square_option_free(IntPtr option);
|
|
57
72
|
|
|
58
73
|
[DllImport(Lib)]
|
|
59
|
-
internal static extern int autd3_modulation_square(byte mode, float freq, uint freqInt, IntPtr option, IntPtr buffer);
|
|
74
|
+
internal static extern int autd3_modulation_square(byte mode, float freq, uint freqInt, IntPtr option, IntPtr buffer, byte[] outErr, UIntPtr outErrLen);
|
|
60
75
|
|
|
61
76
|
[DllImport(Lib)]
|
|
62
77
|
internal static extern IntPtr autd3_modulation_fourier_option_new([MarshalAs(UnmanagedType.I1)] bool hasScaleFactor, float scaleFactor, [MarshalAs(UnmanagedType.I1)] bool clamp, byte offset);
|
|
@@ -65,7 +80,7 @@ namespace AUTD3
|
|
|
65
80
|
internal static extern void autd3_modulation_fourier_option_free(IntPtr option);
|
|
66
81
|
|
|
67
82
|
[DllImport(Lib)]
|
|
68
|
-
internal static extern int autd3_modulation_fourier(SineComponentNative[] components, UIntPtr numComponents, IntPtr option, IntPtr buffer);
|
|
83
|
+
internal static extern int autd3_modulation_fourier(SineComponentNative[] components, UIntPtr numComponents, IntPtr option, IntPtr buffer, byte[] outErr, UIntPtr outErrLen);
|
|
69
84
|
|
|
70
85
|
[DllImport(Lib)]
|
|
71
86
|
internal static extern int autd3_modulation_constant(byte intensity, IntPtr buffer);
|
|
@@ -76,13 +91,15 @@ namespace AUTD3
|
|
|
76
91
|
[DllImport(Lib)]
|
|
77
92
|
internal static extern int autd3_modulation_radiation_pressure_inplace(IntPtr buffer);
|
|
78
93
|
|
|
79
|
-
[DllImport(
|
|
94
|
+
[DllImport(ClientLib)]
|
|
80
95
|
internal static extern IntPtr autd3_op_modulation(byte bank, IntPtr samplingConfig, IntPtr modulationBuffer, ushort loopRep, byte transitionMode, ulong transitionValue, uint transitionMarginNs);
|
|
81
96
|
}
|
|
82
97
|
|
|
83
98
|
public sealed class ModulationBuffer : IDisposable, IEnumerable<byte>
|
|
84
99
|
{
|
|
85
|
-
|
|
100
|
+
private IntPtr _handle;
|
|
101
|
+
|
|
102
|
+
internal IntPtr Handle => _handle;
|
|
86
103
|
|
|
87
104
|
private ModulationBuffer(IntPtr handle)
|
|
88
105
|
{
|
|
@@ -90,7 +107,7 @@ namespace AUTD3
|
|
|
90
107
|
{
|
|
91
108
|
throw new Autd3Exception("failed to create modulation buffer");
|
|
92
109
|
}
|
|
93
|
-
|
|
110
|
+
_handle = handle;
|
|
94
111
|
}
|
|
95
112
|
|
|
96
113
|
internal ModulationBuffer() : this(NativeModulation.autd3_modulation_buffer_new())
|
|
@@ -136,19 +153,20 @@ namespace AUTD3
|
|
|
136
153
|
|
|
137
154
|
public void Dispose()
|
|
138
155
|
{
|
|
139
|
-
|
|
156
|
+
var handle = Interlocked.Exchange(ref _handle, IntPtr.Zero);
|
|
157
|
+
if (handle != IntPtr.Zero)
|
|
140
158
|
{
|
|
141
|
-
NativeModulation.autd3_modulation_buffer_free(
|
|
142
|
-
Handle = IntPtr.Zero;
|
|
159
|
+
NativeModulation.autd3_modulation_buffer_free(handle);
|
|
143
160
|
}
|
|
144
161
|
GC.SuppressFinalize(this);
|
|
145
162
|
}
|
|
146
163
|
|
|
147
164
|
~ModulationBuffer()
|
|
148
165
|
{
|
|
149
|
-
|
|
166
|
+
var handle = Interlocked.Exchange(ref _handle, IntPtr.Zero);
|
|
167
|
+
if (handle != IntPtr.Zero)
|
|
150
168
|
{
|
|
151
|
-
NativeModulation.autd3_modulation_buffer_free(
|
|
169
|
+
NativeModulation.autd3_modulation_buffer_free(handle);
|
|
152
170
|
}
|
|
153
171
|
}
|
|
154
172
|
}
|
|
@@ -294,9 +312,10 @@ namespace AUTD3
|
|
|
294
312
|
option.Amplitude, option.Offset, option.Phase.Radian, option.Clamp, sampling);
|
|
295
313
|
try
|
|
296
314
|
{
|
|
297
|
-
|
|
315
|
+
var err = new byte[NativeAbi.ErrorBufferLength];
|
|
316
|
+
if (NativeModulation.autd3_modulation_sine(modeCode, freq.HzValue, freq.HzIntValue, optionHandle, dst.Handle, err, (UIntPtr)err.Length) != 0)
|
|
298
317
|
{
|
|
299
|
-
throw new Autd3Exception(
|
|
318
|
+
throw new Autd3Exception(NativeUtil.Utf8(err));
|
|
300
319
|
}
|
|
301
320
|
}
|
|
302
321
|
finally
|
|
@@ -325,9 +344,10 @@ namespace AUTD3
|
|
|
325
344
|
option.Low, option.High, option.Duty, sampling);
|
|
326
345
|
try
|
|
327
346
|
{
|
|
328
|
-
|
|
347
|
+
var err = new byte[NativeAbi.ErrorBufferLength];
|
|
348
|
+
if (NativeModulation.autd3_modulation_square(modeCode, freq.HzValue, freq.HzIntValue, optionHandle, dst.Handle, err, (UIntPtr)err.Length) != 0)
|
|
329
349
|
{
|
|
330
|
-
throw new Autd3Exception(
|
|
350
|
+
throw new Autd3Exception(NativeUtil.Utf8(err));
|
|
331
351
|
}
|
|
332
352
|
}
|
|
333
353
|
finally
|
|
@@ -377,9 +397,10 @@ namespace AUTD3
|
|
|
377
397
|
option.ScaleFactor.HasValue, option.ScaleFactor ?? 0f, option.Clamp, option.Offset);
|
|
378
398
|
try
|
|
379
399
|
{
|
|
380
|
-
|
|
400
|
+
var err = new byte[NativeAbi.ErrorBufferLength];
|
|
401
|
+
if (NativeModulation.autd3_modulation_fourier(native, (UIntPtr)components.Length, fourierOption, dst.Handle, err, (UIntPtr)err.Length) != 0)
|
|
381
402
|
{
|
|
382
|
-
throw new Autd3Exception(
|
|
403
|
+
throw new Autd3Exception(NativeUtil.Utf8(err));
|
|
383
404
|
}
|
|
384
405
|
}
|
|
385
406
|
finally
|
package/ModulationOps.cs
CHANGED
|
@@ -11,13 +11,20 @@ namespace AUTD3
|
|
|
11
11
|
|
|
12
12
|
internal static class NativeModulationOp
|
|
13
13
|
{
|
|
14
|
-
|
|
14
|
+
private const string Lib = "autd3capi";
|
|
15
|
+
|
|
16
|
+
static NativeModulationOp() => NativeAbi.Verify(Lib, autd3_abi_version());
|
|
17
|
+
|
|
18
|
+
[DllImport(Lib)]
|
|
19
|
+
private static extern uint autd3_abi_version();
|
|
20
|
+
|
|
21
|
+
[DllImport(Lib)]
|
|
15
22
|
internal static extern IntPtr autd3_op_write_modulation_buffer(byte bank, uint offset, IntPtr modulationBuffer);
|
|
16
23
|
|
|
17
|
-
[DllImport(
|
|
24
|
+
[DllImport(Lib)]
|
|
18
25
|
internal static extern IntPtr autd3_op_config_modulation(byte bank, IntPtr samplingConfig, uint size, ushort rep);
|
|
19
26
|
|
|
20
|
-
[DllImport(
|
|
27
|
+
[DllImport(Lib)]
|
|
21
28
|
internal static extern IntPtr autd3_op_change_modulation_bank(byte bank, byte transitionMode, ulong transitionValue, uint transitionMarginNs);
|
|
22
29
|
}
|
|
23
30
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/THIRD-PARTY-LICENSES.md
CHANGED
|
@@ -854,11 +854,41 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
854
854
|
|
|
855
855
|
Used by:
|
|
856
856
|
|
|
857
|
-
- autd3-
|
|
858
|
-
- autd3-
|
|
859
|
-
- autd3-
|
|
860
|
-
|
|
861
|
-
|
|
857
|
+
- autd3-rs-core 0.6.0 — https://github.com/shinolab/autd3-sdk
|
|
858
|
+
- autd3-rs-modulation 0.6.0 — https://github.com/shinolab/autd3-sdk
|
|
859
|
+
- autd3-cpu-wire 0.6.0 — https://github.com/shinolab/autd3-sdk
|
|
860
|
+
|
|
861
|
+
```
|
|
862
|
+
MIT License
|
|
863
|
+
|
|
864
|
+
Copyright (c) 2026 Shun Suzuki
|
|
865
|
+
|
|
866
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
867
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
868
|
+
in the Software without restriction, including without limitation the rights
|
|
869
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
870
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
871
|
+
furnished to do so, subject to the following conditions:
|
|
872
|
+
|
|
873
|
+
The above copyright notice and this permission notice shall be included in all
|
|
874
|
+
copies or substantial portions of the Software.
|
|
875
|
+
|
|
876
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
877
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
878
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
879
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
880
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
881
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
882
|
+
SOFTWARE.
|
|
883
|
+
|
|
884
|
+
```
|
|
885
|
+
|
|
886
|
+
## MIT License
|
|
887
|
+
|
|
888
|
+
Used by:
|
|
889
|
+
|
|
890
|
+
- autd3-ffi-abi 0.6.0 — https://github.com/shinolab/autd3-sdk
|
|
891
|
+
- autd3-ffi-modulation 0.6.0 — https://github.com/shinolab/autd3-sdk
|
|
862
892
|
- chrono 0.4.45 — https://github.com/chronotope/chrono
|
|
863
893
|
- wide 1.5.0 — https://github.com/Lokathor/wide
|
|
864
894
|
- winapi-i686-pc-windows-gnu 0.4.0 — https://github.com/retep998/winapi-rs
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"url": "git+https://github.com/shinolab/autd3-sdk.git",
|
|
6
6
|
"directory": "bindings/unity/com.shinolab.autd3-sdk.modulation"
|
|
7
7
|
},
|
|
8
|
-
"version": "0.
|
|
8
|
+
"version": "0.6.0",
|
|
9
9
|
"displayName": "AUTD3 Modulation",
|
|
10
10
|
"description": "AUTD3 amplitude modulation waveforms (Unity binding).",
|
|
11
11
|
"unity": "6000.0",
|
|
@@ -15,6 +15,6 @@
|
|
|
15
15
|
"url": "https://github.com/shinolab"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"com.shinolab.autd3-sdk.core": "0.
|
|
18
|
+
"com.shinolab.autd3-sdk.core": "0.6.0"
|
|
19
19
|
}
|
|
20
20
|
}
|