@clarionhq/recorder 0.0.1 → 0.1.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/LICENSE +21 -0
- package/README.md +110 -0
- package/android/build.gradle +97 -0
- package/android/gradle.properties +4 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/cpp/cpp-adapter.cpp +7 -0
- package/android/src/main/java/com/clarionhq/recorder/AudioLevelMeter.kt +38 -0
- package/android/src/main/java/com/clarionhq/recorder/ClarionRecorderPackage.kt +27 -0
- package/android/src/main/java/com/clarionhq/recorder/EncodeFile.kt +62 -0
- package/android/src/main/java/com/clarionhq/recorder/RecorderConfig.kt +33 -0
- package/android/src/main/java/com/clarionhq/recorder/RecorderConstants.kt +16 -0
- package/android/src/main/java/com/clarionhq/recorder/RecorderSession.kt +336 -0
- package/android/src/main/java/com/clarionhq/recorder/RecorderTypes.kt +29 -0
- package/android/src/main/java/com/margelo/nitro/clarion/recorder/HybridClarionRecorder.kt +174 -0
- package/clarionhq-recorder.podspec +31 -0
- package/ios/AudioLevelMeter.swift +37 -0
- package/ios/EncodeFile.swift +69 -0
- package/ios/HybridClarionRecorder.swift +186 -0
- package/ios/RecorderConstants.swift +11 -0
- package/ios/RecorderSession.swift +278 -0
- package/ios/RecorderTypes.swift +41 -0
- package/lib/RecorderEngine.d.ts +31 -0
- package/lib/RecorderEngine.d.ts.map +1 -0
- package/lib/RecorderEngine.js +245 -0
- package/lib/RecorderEngine.js.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/lib/native.d.ts +3 -0
- package/lib/native.d.ts.map +1 -0
- package/lib/native.js +3 -0
- package/lib/native.js.map +1 -0
- package/lib/specs/ClarionRecorder.nitro.d.ts +49 -0
- package/lib/specs/ClarionRecorder.nitro.d.ts.map +1 -0
- package/lib/specs/ClarionRecorder.nitro.js +2 -0
- package/lib/specs/ClarionRecorder.nitro.js.map +1 -0
- package/nitro.json +24 -0
- package/nitrogen/generated/android/ClarionRecorder+autolinking.cmake +81 -0
- package/nitrogen/generated/android/ClarionRecorder+autolinking.gradle +27 -0
- package/nitrogen/generated/android/ClarionRecorderOnLoad.cpp +62 -0
- package/nitrogen/generated/android/ClarionRecorderOnLoad.hpp +34 -0
- package/nitrogen/generated/android/c++/JFunc_void_NativeRecorderError.hpp +78 -0
- package/nitrogen/generated/android/c++/JFunc_void_double_double.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string_double_double_double.hpp +76 -0
- package/nitrogen/generated/android/c++/JHybridClarionRecorderSpec.cpp +207 -0
- package/nitrogen/generated/android/c++/JHybridClarionRecorderSpec.hpp +75 -0
- package/nitrogen/generated/android/c++/JNativeRecorderConfig.hpp +90 -0
- package/nitrogen/generated/android/c++/JNativeRecorderError.hpp +65 -0
- package/nitrogen/generated/android/c++/JNativeRecorderResult.hpp +77 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/ClarionRecorderOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/Func_void_NativeRecorderError.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/Func_void_double_double.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/Func_void_std__string.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/Func_void_std__string_double_double_double.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/HybridClarionRecorderSpec.kt +125 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/NativeRecorderConfig.kt +91 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/NativeRecorderError.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/NativeRecorderResult.kt +76 -0
- package/nitrogen/generated/ios/ClarionRecorder+autolinking.rb +62 -0
- package/nitrogen/generated/ios/ClarionRecorder-Swift-Cxx-Bridge.cpp +89 -0
- package/nitrogen/generated/ios/ClarionRecorder-Swift-Cxx-Bridge.hpp +297 -0
- package/nitrogen/generated/ios/ClarionRecorder-Swift-Cxx-Umbrella.hpp +56 -0
- package/nitrogen/generated/ios/ClarionRecorderAutolinking.mm +33 -0
- package/nitrogen/generated/ios/ClarionRecorderAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridClarionRecorderSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridClarionRecorderSpecSwift.hpp +188 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_NativeRecorderError.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_NativeRecorderResult.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_double_double.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string_double_double_double.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridClarionRecorderSpec.swift +67 -0
- package/nitrogen/generated/ios/swift/HybridClarionRecorderSpec_cxx.swift +354 -0
- package/nitrogen/generated/ios/swift/NativeRecorderConfig.swift +108 -0
- package/nitrogen/generated/ios/swift/NativeRecorderError.swift +39 -0
- package/nitrogen/generated/ios/swift/NativeRecorderResult.swift +54 -0
- package/nitrogen/generated/shared/c++/HybridClarionRecorderSpec.cpp +34 -0
- package/nitrogen/generated/shared/c++/HybridClarionRecorderSpec.hpp +84 -0
- package/nitrogen/generated/shared/c++/NativeRecorderConfig.hpp +116 -0
- package/nitrogen/generated/shared/c++/NativeRecorderError.hpp +91 -0
- package/nitrogen/generated/shared/c++/NativeRecorderResult.hpp +103 -0
- package/package.json +66 -8
- package/src/RecorderEngine.ts +298 -0
- package/src/index.ts +8 -0
- package/src/native.ts +5 -0
- package/src/specs/ClarionRecorder.nitro.ts +58 -0
- package/index.js +0 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ClarionRecorderAutolinking.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
// TODO: Use empty enums once Swift supports exporting them as namespaces
|
|
11
|
+
// See: https://github.com/swiftlang/swift/pull/83616
|
|
12
|
+
public final class ClarionRecorderAutolinking {
|
|
13
|
+
public typealias bridge = margelo.nitro.clarion.recorder.bridge.swift
|
|
14
|
+
|
|
15
|
+
public static func createClarionRecorder() -> bridge.std__shared_ptr_HybridClarionRecorderSpec_ {
|
|
16
|
+
let hybridObject = HybridClarionRecorder()
|
|
17
|
+
return { () -> bridge.std__shared_ptr_HybridClarionRecorderSpec_ in
|
|
18
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
19
|
+
return __cxxWrapped.getCxxPart()
|
|
20
|
+
}()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public static func isClarionRecorderRecyclable() -> Bool {
|
|
24
|
+
return HybridClarionRecorder.self is any RecyclableView.Type
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridClarionRecorderSpecSwift.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridClarionRecorderSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::clarion::recorder {
|
|
11
|
+
} // namespace margelo::nitro::clarion::recorder
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridClarionRecorderSpecSwift.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "HybridClarionRecorderSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridClarionRecorderSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace ClarionRecorder { class HybridClarionRecorderSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
// Forward declaration of `NativeRecorderConfig` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::clarion::recorder { struct NativeRecorderConfig; }
|
|
17
|
+
// Forward declaration of `NativeRecorderResult` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::clarion::recorder { struct NativeRecorderResult; }
|
|
19
|
+
// Forward declaration of `NativeRecorderError` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::clarion::recorder { struct NativeRecorderError; }
|
|
21
|
+
|
|
22
|
+
#include <string>
|
|
23
|
+
#include <NitroModules/Promise.hpp>
|
|
24
|
+
#include "NativeRecorderConfig.hpp"
|
|
25
|
+
#include <optional>
|
|
26
|
+
#include "NativeRecorderResult.hpp"
|
|
27
|
+
#include <functional>
|
|
28
|
+
#include "NativeRecorderError.hpp"
|
|
29
|
+
|
|
30
|
+
#include "ClarionRecorder-Swift-Cxx-Umbrella.hpp"
|
|
31
|
+
|
|
32
|
+
namespace margelo::nitro::clarion::recorder {
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The C++ part of HybridClarionRecorderSpec_cxx.swift.
|
|
36
|
+
*
|
|
37
|
+
* HybridClarionRecorderSpecSwift (C++) accesses HybridClarionRecorderSpec_cxx (Swift), and might
|
|
38
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
39
|
+
*
|
|
40
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
41
|
+
* the future, HybridClarionRecorderSpec_cxx can directly inherit from the C++ class HybridClarionRecorderSpec
|
|
42
|
+
* to simplify the whole structure and memory management.
|
|
43
|
+
*/
|
|
44
|
+
class HybridClarionRecorderSpecSwift: public virtual HybridClarionRecorderSpec {
|
|
45
|
+
public:
|
|
46
|
+
// Constructor from a Swift instance
|
|
47
|
+
explicit HybridClarionRecorderSpecSwift(const ClarionRecorder::HybridClarionRecorderSpec_cxx& swiftPart):
|
|
48
|
+
HybridObject(HybridClarionRecorderSpec::TAG),
|
|
49
|
+
_swiftPart(swiftPart) { }
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
// Get the Swift part
|
|
53
|
+
inline ClarionRecorder::HybridClarionRecorderSpec_cxx& getSwiftPart() noexcept {
|
|
54
|
+
return _swiftPart;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public:
|
|
58
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
59
|
+
return _swiftPart.getMemorySize();
|
|
60
|
+
}
|
|
61
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
62
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridClarionRecorderSpecSwift>(other)) {
|
|
63
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
void dispose() noexcept override {
|
|
68
|
+
_swiftPart.dispose();
|
|
69
|
+
}
|
|
70
|
+
std::string toString() override {
|
|
71
|
+
return _swiftPart.toString();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public:
|
|
75
|
+
// Properties
|
|
76
|
+
inline std::string getState() noexcept override {
|
|
77
|
+
auto __result = _swiftPart.getState();
|
|
78
|
+
return __result;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public:
|
|
82
|
+
// Methods
|
|
83
|
+
inline std::shared_ptr<Promise<void>> prepare(const NativeRecorderConfig& config) override {
|
|
84
|
+
auto __result = _swiftPart.prepare(std::forward<decltype(config)>(config));
|
|
85
|
+
if (__result.hasError()) [[unlikely]] {
|
|
86
|
+
std::rethrow_exception(__result.error());
|
|
87
|
+
}
|
|
88
|
+
auto __value = std::move(__result.value());
|
|
89
|
+
return __value;
|
|
90
|
+
}
|
|
91
|
+
inline std::shared_ptr<Promise<void>> start() override {
|
|
92
|
+
auto __result = _swiftPart.start();
|
|
93
|
+
if (__result.hasError()) [[unlikely]] {
|
|
94
|
+
std::rethrow_exception(__result.error());
|
|
95
|
+
}
|
|
96
|
+
auto __value = std::move(__result.value());
|
|
97
|
+
return __value;
|
|
98
|
+
}
|
|
99
|
+
inline std::shared_ptr<Promise<void>> pause() override {
|
|
100
|
+
auto __result = _swiftPart.pause();
|
|
101
|
+
if (__result.hasError()) [[unlikely]] {
|
|
102
|
+
std::rethrow_exception(__result.error());
|
|
103
|
+
}
|
|
104
|
+
auto __value = std::move(__result.value());
|
|
105
|
+
return __value;
|
|
106
|
+
}
|
|
107
|
+
inline std::shared_ptr<Promise<void>> resume() override {
|
|
108
|
+
auto __result = _swiftPart.resume();
|
|
109
|
+
if (__result.hasError()) [[unlikely]] {
|
|
110
|
+
std::rethrow_exception(__result.error());
|
|
111
|
+
}
|
|
112
|
+
auto __value = std::move(__result.value());
|
|
113
|
+
return __value;
|
|
114
|
+
}
|
|
115
|
+
inline std::shared_ptr<Promise<NativeRecorderResult>> stop() override {
|
|
116
|
+
auto __result = _swiftPart.stop();
|
|
117
|
+
if (__result.hasError()) [[unlikely]] {
|
|
118
|
+
std::rethrow_exception(__result.error());
|
|
119
|
+
}
|
|
120
|
+
auto __value = std::move(__result.value());
|
|
121
|
+
return __value;
|
|
122
|
+
}
|
|
123
|
+
inline std::shared_ptr<Promise<void>> discard() override {
|
|
124
|
+
auto __result = _swiftPart.discard();
|
|
125
|
+
if (__result.hasError()) [[unlikely]] {
|
|
126
|
+
std::rethrow_exception(__result.error());
|
|
127
|
+
}
|
|
128
|
+
auto __value = std::move(__result.value());
|
|
129
|
+
return __value;
|
|
130
|
+
}
|
|
131
|
+
inline std::shared_ptr<Promise<void>> release() override {
|
|
132
|
+
auto __result = _swiftPart.release();
|
|
133
|
+
if (__result.hasError()) [[unlikely]] {
|
|
134
|
+
std::rethrow_exception(__result.error());
|
|
135
|
+
}
|
|
136
|
+
auto __value = std::move(__result.value());
|
|
137
|
+
return __value;
|
|
138
|
+
}
|
|
139
|
+
inline double addStateListener(const std::function<void(const std::string& /* state */)>& listener) override {
|
|
140
|
+
auto __result = _swiftPart.addStateListener(listener);
|
|
141
|
+
if (__result.hasError()) [[unlikely]] {
|
|
142
|
+
std::rethrow_exception(__result.error());
|
|
143
|
+
}
|
|
144
|
+
auto __value = std::move(__result.value());
|
|
145
|
+
return __value;
|
|
146
|
+
}
|
|
147
|
+
inline double addAudioLevelListener(const std::function<void(double /* rms */, double /* peak */)>& listener) override {
|
|
148
|
+
auto __result = _swiftPart.addAudioLevelListener(listener);
|
|
149
|
+
if (__result.hasError()) [[unlikely]] {
|
|
150
|
+
std::rethrow_exception(__result.error());
|
|
151
|
+
}
|
|
152
|
+
auto __value = std::move(__result.value());
|
|
153
|
+
return __value;
|
|
154
|
+
}
|
|
155
|
+
inline double addChunkListener(const std::function<void(const std::string& /* uri */, double /* startMs */, double /* endMs */, double /* sizeBytes */)>& listener) override {
|
|
156
|
+
auto __result = _swiftPart.addChunkListener(listener);
|
|
157
|
+
if (__result.hasError()) [[unlikely]] {
|
|
158
|
+
std::rethrow_exception(__result.error());
|
|
159
|
+
}
|
|
160
|
+
auto __value = std::move(__result.value());
|
|
161
|
+
return __value;
|
|
162
|
+
}
|
|
163
|
+
inline double addErrorListener(const std::function<void(const NativeRecorderError& /* error */)>& listener) override {
|
|
164
|
+
auto __result = _swiftPart.addErrorListener(listener);
|
|
165
|
+
if (__result.hasError()) [[unlikely]] {
|
|
166
|
+
std::rethrow_exception(__result.error());
|
|
167
|
+
}
|
|
168
|
+
auto __value = std::move(__result.value());
|
|
169
|
+
return __value;
|
|
170
|
+
}
|
|
171
|
+
inline void removeListener(double id) override {
|
|
172
|
+
auto __result = _swiftPart.removeListener(std::forward<decltype(id)>(id));
|
|
173
|
+
if (__result.hasError()) [[unlikely]] {
|
|
174
|
+
std::rethrow_exception(__result.error());
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
inline void removeAllListeners() override {
|
|
178
|
+
auto __result = _swiftPart.removeAllListeners();
|
|
179
|
+
if (__result.hasError()) [[unlikely]] {
|
|
180
|
+
std::rethrow_exception(__result.error());
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
private:
|
|
185
|
+
ClarionRecorder::HybridClarionRecorderSpec_cxx _swiftPart;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
} // namespace margelo::nitro::clarion::recorder
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `() -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void {
|
|
15
|
+
public typealias bridge = margelo.nitro.clarion.recorder.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: () -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping () -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call() -> Void {
|
|
25
|
+
self.closure()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void {
|
|
44
|
+
return Unmanaged<Func_void>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_NativeRecorderError.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ error: NativeRecorderError) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_NativeRecorderError {
|
|
15
|
+
public typealias bridge = margelo.nitro.clarion.recorder.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ error: NativeRecorderError) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ error: NativeRecorderError) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(error: NativeRecorderError) -> Void {
|
|
25
|
+
self.closure(error)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_NativeRecorderError`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_NativeRecorderError>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_NativeRecorderError {
|
|
44
|
+
return Unmanaged<Func_void_NativeRecorderError>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_NativeRecorderResult.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ value: NativeRecorderResult) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_NativeRecorderResult {
|
|
15
|
+
public typealias bridge = margelo.nitro.clarion.recorder.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ value: NativeRecorderResult) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ value: NativeRecorderResult) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(value: NativeRecorderResult) -> Void {
|
|
25
|
+
self.closure(value)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_NativeRecorderResult`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_NativeRecorderResult>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_NativeRecorderResult {
|
|
44
|
+
return Unmanaged<Func_void_NativeRecorderResult>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_double_double.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ rms: Double, _ peak: Double) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_double_double {
|
|
15
|
+
public typealias bridge = margelo.nitro.clarion.recorder.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ rms: Double, _ peak: Double) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ rms: Double, _ peak: Double) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(rms: Double, peak: Double) -> Void {
|
|
25
|
+
self.closure(rms, peak)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_double_double`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_double_double>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_double_double {
|
|
44
|
+
return Unmanaged<Func_void_double_double>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__exception_ptr.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ error: Error) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_std__exception_ptr {
|
|
15
|
+
public typealias bridge = margelo.nitro.clarion.recorder.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ error: Error) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ error: Error) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(error: std.exception_ptr) -> Void {
|
|
25
|
+
self.closure(RuntimeError.from(cppError: error))
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_std__exception_ptr`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__exception_ptr>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr {
|
|
44
|
+
return Unmanaged<Func_void_std__exception_ptr>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__string.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ state: String) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_std__string {
|
|
15
|
+
public typealias bridge = margelo.nitro.clarion.recorder.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ state: String) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ state: String) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(state: std.string) -> Void {
|
|
25
|
+
self.closure(String(state))
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_std__string`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__string>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__string {
|
|
44
|
+
return Unmanaged<Func_void_std__string>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__string_double_double_double.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ uri: String, _ startMs: Double, _ endMs: Double, _ sizeBytes: Double) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_std__string_double_double_double {
|
|
15
|
+
public typealias bridge = margelo.nitro.clarion.recorder.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ uri: String, _ startMs: Double, _ endMs: Double, _ sizeBytes: Double) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ uri: String, _ startMs: Double, _ endMs: Double, _ sizeBytes: Double) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(uri: std.string, startMs: Double, endMs: Double, sizeBytes: Double) -> Void {
|
|
25
|
+
self.closure(String(uri), startMs, endMs, sizeBytes)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_std__string_double_double_double`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__string_double_double_double>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__string_double_double_double {
|
|
44
|
+
return Unmanaged<Func_void_std__string_double_double_double>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridClarionRecorderSpec.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/// See ``HybridClarionRecorderSpec``
|
|
11
|
+
public protocol HybridClarionRecorderSpec_protocol: HybridObject {
|
|
12
|
+
// Properties
|
|
13
|
+
var state: String { get }
|
|
14
|
+
|
|
15
|
+
// Methods
|
|
16
|
+
func prepare(config: NativeRecorderConfig) throws -> Promise<Void>
|
|
17
|
+
func start() throws -> Promise<Void>
|
|
18
|
+
func pause() throws -> Promise<Void>
|
|
19
|
+
func resume() throws -> Promise<Void>
|
|
20
|
+
func stop() throws -> Promise<NativeRecorderResult>
|
|
21
|
+
func discard() throws -> Promise<Void>
|
|
22
|
+
func release() throws -> Promise<Void>
|
|
23
|
+
func addStateListener(listener: @escaping (_ state: String) -> Void) throws -> Double
|
|
24
|
+
func addAudioLevelListener(listener: @escaping (_ rms: Double, _ peak: Double) -> Void) throws -> Double
|
|
25
|
+
func addChunkListener(listener: @escaping (_ uri: String, _ startMs: Double, _ endMs: Double, _ sizeBytes: Double) -> Void) throws -> Double
|
|
26
|
+
func addErrorListener(listener: @escaping (_ error: NativeRecorderError) -> Void) throws -> Double
|
|
27
|
+
func removeListener(id: Double) throws -> Void
|
|
28
|
+
func removeAllListeners() throws -> Void
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public extension HybridClarionRecorderSpec_protocol {
|
|
32
|
+
/// Default implementation of ``HybridObject.toString``
|
|
33
|
+
func toString() -> String {
|
|
34
|
+
return "[HybridObject ClarionRecorder]"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/// See ``HybridClarionRecorderSpec``
|
|
39
|
+
open class HybridClarionRecorderSpec_base {
|
|
40
|
+
private weak var cxxWrapper: HybridClarionRecorderSpec_cxx? = nil
|
|
41
|
+
public init() { }
|
|
42
|
+
public func getCxxWrapper() -> HybridClarionRecorderSpec_cxx {
|
|
43
|
+
#if DEBUG
|
|
44
|
+
guard self is any HybridClarionRecorderSpec else {
|
|
45
|
+
fatalError("`self` is not a `HybridClarionRecorderSpec`! Did you accidentally inherit from `HybridClarionRecorderSpec_base` instead of `HybridClarionRecorderSpec`?")
|
|
46
|
+
}
|
|
47
|
+
#endif
|
|
48
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
49
|
+
return cxxWrapper
|
|
50
|
+
} else {
|
|
51
|
+
let cxxWrapper = HybridClarionRecorderSpec_cxx(self as! any HybridClarionRecorderSpec)
|
|
52
|
+
self.cxxWrapper = cxxWrapper
|
|
53
|
+
return cxxWrapper
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* A Swift base-protocol representing the ClarionRecorder HybridObject.
|
|
60
|
+
* Implement this protocol to create Swift-based instances of ClarionRecorder.
|
|
61
|
+
* ```swift
|
|
62
|
+
* class HybridClarionRecorder : HybridClarionRecorderSpec {
|
|
63
|
+
* // ...
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
public typealias HybridClarionRecorderSpec = HybridClarionRecorderSpec_protocol & HybridClarionRecorderSpec_base
|