@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.
Files changed (91) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +110 -0
  3. package/android/build.gradle +97 -0
  4. package/android/gradle.properties +4 -0
  5. package/android/src/main/AndroidManifest.xml +4 -0
  6. package/android/src/main/cpp/cpp-adapter.cpp +7 -0
  7. package/android/src/main/java/com/clarionhq/recorder/AudioLevelMeter.kt +38 -0
  8. package/android/src/main/java/com/clarionhq/recorder/ClarionRecorderPackage.kt +27 -0
  9. package/android/src/main/java/com/clarionhq/recorder/EncodeFile.kt +62 -0
  10. package/android/src/main/java/com/clarionhq/recorder/RecorderConfig.kt +33 -0
  11. package/android/src/main/java/com/clarionhq/recorder/RecorderConstants.kt +16 -0
  12. package/android/src/main/java/com/clarionhq/recorder/RecorderSession.kt +336 -0
  13. package/android/src/main/java/com/clarionhq/recorder/RecorderTypes.kt +29 -0
  14. package/android/src/main/java/com/margelo/nitro/clarion/recorder/HybridClarionRecorder.kt +174 -0
  15. package/clarionhq-recorder.podspec +31 -0
  16. package/ios/AudioLevelMeter.swift +37 -0
  17. package/ios/EncodeFile.swift +69 -0
  18. package/ios/HybridClarionRecorder.swift +186 -0
  19. package/ios/RecorderConstants.swift +11 -0
  20. package/ios/RecorderSession.swift +278 -0
  21. package/ios/RecorderTypes.swift +41 -0
  22. package/lib/RecorderEngine.d.ts +31 -0
  23. package/lib/RecorderEngine.d.ts.map +1 -0
  24. package/lib/RecorderEngine.js +245 -0
  25. package/lib/RecorderEngine.js.map +1 -0
  26. package/lib/index.d.ts +4 -0
  27. package/lib/index.d.ts.map +1 -0
  28. package/lib/index.js +2 -0
  29. package/lib/index.js.map +1 -0
  30. package/lib/native.d.ts +3 -0
  31. package/lib/native.d.ts.map +1 -0
  32. package/lib/native.js +3 -0
  33. package/lib/native.js.map +1 -0
  34. package/lib/specs/ClarionRecorder.nitro.d.ts +49 -0
  35. package/lib/specs/ClarionRecorder.nitro.d.ts.map +1 -0
  36. package/lib/specs/ClarionRecorder.nitro.js +2 -0
  37. package/lib/specs/ClarionRecorder.nitro.js.map +1 -0
  38. package/nitro.json +24 -0
  39. package/nitrogen/generated/android/ClarionRecorder+autolinking.cmake +81 -0
  40. package/nitrogen/generated/android/ClarionRecorder+autolinking.gradle +27 -0
  41. package/nitrogen/generated/android/ClarionRecorderOnLoad.cpp +62 -0
  42. package/nitrogen/generated/android/ClarionRecorderOnLoad.hpp +34 -0
  43. package/nitrogen/generated/android/c++/JFunc_void_NativeRecorderError.hpp +78 -0
  44. package/nitrogen/generated/android/c++/JFunc_void_double_double.hpp +75 -0
  45. package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
  46. package/nitrogen/generated/android/c++/JFunc_void_std__string_double_double_double.hpp +76 -0
  47. package/nitrogen/generated/android/c++/JHybridClarionRecorderSpec.cpp +207 -0
  48. package/nitrogen/generated/android/c++/JHybridClarionRecorderSpec.hpp +75 -0
  49. package/nitrogen/generated/android/c++/JNativeRecorderConfig.hpp +90 -0
  50. package/nitrogen/generated/android/c++/JNativeRecorderError.hpp +65 -0
  51. package/nitrogen/generated/android/c++/JNativeRecorderResult.hpp +77 -0
  52. package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/ClarionRecorderOnLoad.kt +35 -0
  53. package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/Func_void_NativeRecorderError.kt +80 -0
  54. package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/Func_void_double_double.kt +80 -0
  55. package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/Func_void_std__string.kt +80 -0
  56. package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/Func_void_std__string_double_double_double.kt +80 -0
  57. package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/HybridClarionRecorderSpec.kt +125 -0
  58. package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/NativeRecorderConfig.kt +91 -0
  59. package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/NativeRecorderError.kt +61 -0
  60. package/nitrogen/generated/android/kotlin/com/margelo/nitro/clarion/recorder/NativeRecorderResult.kt +76 -0
  61. package/nitrogen/generated/ios/ClarionRecorder+autolinking.rb +62 -0
  62. package/nitrogen/generated/ios/ClarionRecorder-Swift-Cxx-Bridge.cpp +89 -0
  63. package/nitrogen/generated/ios/ClarionRecorder-Swift-Cxx-Bridge.hpp +297 -0
  64. package/nitrogen/generated/ios/ClarionRecorder-Swift-Cxx-Umbrella.hpp +56 -0
  65. package/nitrogen/generated/ios/ClarionRecorderAutolinking.mm +33 -0
  66. package/nitrogen/generated/ios/ClarionRecorderAutolinking.swift +26 -0
  67. package/nitrogen/generated/ios/c++/HybridClarionRecorderSpecSwift.cpp +11 -0
  68. package/nitrogen/generated/ios/c++/HybridClarionRecorderSpecSwift.hpp +188 -0
  69. package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
  70. package/nitrogen/generated/ios/swift/Func_void_NativeRecorderError.swift +46 -0
  71. package/nitrogen/generated/ios/swift/Func_void_NativeRecorderResult.swift +46 -0
  72. package/nitrogen/generated/ios/swift/Func_void_double_double.swift +46 -0
  73. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  74. package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
  75. package/nitrogen/generated/ios/swift/Func_void_std__string_double_double_double.swift +46 -0
  76. package/nitrogen/generated/ios/swift/HybridClarionRecorderSpec.swift +67 -0
  77. package/nitrogen/generated/ios/swift/HybridClarionRecorderSpec_cxx.swift +354 -0
  78. package/nitrogen/generated/ios/swift/NativeRecorderConfig.swift +108 -0
  79. package/nitrogen/generated/ios/swift/NativeRecorderError.swift +39 -0
  80. package/nitrogen/generated/ios/swift/NativeRecorderResult.swift +54 -0
  81. package/nitrogen/generated/shared/c++/HybridClarionRecorderSpec.cpp +34 -0
  82. package/nitrogen/generated/shared/c++/HybridClarionRecorderSpec.hpp +84 -0
  83. package/nitrogen/generated/shared/c++/NativeRecorderConfig.hpp +116 -0
  84. package/nitrogen/generated/shared/c++/NativeRecorderError.hpp +91 -0
  85. package/nitrogen/generated/shared/c++/NativeRecorderResult.hpp +103 -0
  86. package/package.json +66 -8
  87. package/src/RecorderEngine.ts +298 -0
  88. package/src/index.ts +8 -0
  89. package/src/native.ts +5 -0
  90. package/src/specs/ClarionRecorder.nitro.ts +58 -0
  91. package/index.js +0 -1
@@ -0,0 +1,61 @@
1
+ ///
2
+ /// NativeRecorderError.kt
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
+ package com.margelo.nitro.clarion.recorder
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "NativeRecorderError".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class NativeRecorderError(
21
+ @DoNotStrip
22
+ @Keep
23
+ val code: String,
24
+ @DoNotStrip
25
+ @Keep
26
+ val message: String,
27
+ @DoNotStrip
28
+ @Keep
29
+ val recoverable: Boolean
30
+ ) {
31
+ /* primary constructor */
32
+
33
+ override fun equals(other: Any?): Boolean {
34
+ if (this === other) return true
35
+ if (other !is NativeRecorderError) return false
36
+ return Objects.deepEquals(this.code, other.code)
37
+ && Objects.deepEquals(this.message, other.message)
38
+ && Objects.deepEquals(this.recoverable, other.recoverable)
39
+ }
40
+
41
+ override fun hashCode(): Int {
42
+ return arrayOf(
43
+ code,
44
+ message,
45
+ recoverable
46
+ ).contentDeepHashCode()
47
+ }
48
+
49
+ companion object {
50
+ /**
51
+ * Constructor called from C++
52
+ */
53
+ @DoNotStrip
54
+ @Keep
55
+ @Suppress("unused")
56
+ @JvmStatic
57
+ private fun fromCpp(code: String, message: String, recoverable: Boolean): NativeRecorderError {
58
+ return NativeRecorderError(code, message, recoverable)
59
+ }
60
+ }
61
+ }
@@ -0,0 +1,76 @@
1
+ ///
2
+ /// NativeRecorderResult.kt
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
+ package com.margelo.nitro.clarion.recorder
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "NativeRecorderResult".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class NativeRecorderResult(
21
+ @DoNotStrip
22
+ @Keep
23
+ val uri: String,
24
+ @DoNotStrip
25
+ @Keep
26
+ val durationMs: Double,
27
+ @DoNotStrip
28
+ @Keep
29
+ val sizeBytes: Double,
30
+ @DoNotStrip
31
+ @Keep
32
+ val sampleRate: Double,
33
+ @DoNotStrip
34
+ @Keep
35
+ val channels: Double,
36
+ @DoNotStrip
37
+ @Keep
38
+ val bitDepth: Double
39
+ ) {
40
+ /* primary constructor */
41
+
42
+ override fun equals(other: Any?): Boolean {
43
+ if (this === other) return true
44
+ if (other !is NativeRecorderResult) return false
45
+ return Objects.deepEquals(this.uri, other.uri)
46
+ && Objects.deepEquals(this.durationMs, other.durationMs)
47
+ && Objects.deepEquals(this.sizeBytes, other.sizeBytes)
48
+ && Objects.deepEquals(this.sampleRate, other.sampleRate)
49
+ && Objects.deepEquals(this.channels, other.channels)
50
+ && Objects.deepEquals(this.bitDepth, other.bitDepth)
51
+ }
52
+
53
+ override fun hashCode(): Int {
54
+ return arrayOf(
55
+ uri,
56
+ durationMs,
57
+ sizeBytes,
58
+ sampleRate,
59
+ channels,
60
+ bitDepth
61
+ ).contentDeepHashCode()
62
+ }
63
+
64
+ companion object {
65
+ /**
66
+ * Constructor called from C++
67
+ */
68
+ @DoNotStrip
69
+ @Keep
70
+ @Suppress("unused")
71
+ @JvmStatic
72
+ private fun fromCpp(uri: String, durationMs: Double, sizeBytes: Double, sampleRate: Double, channels: Double, bitDepth: Double): NativeRecorderResult {
73
+ return NativeRecorderResult(uri, durationMs, sizeBytes, sampleRate, channels, bitDepth)
74
+ }
75
+ }
76
+ }
@@ -0,0 +1,62 @@
1
+ #
2
+ # ClarionRecorder+autolinking.rb
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
+ # This is a Ruby script that adds all files generated by Nitrogen
9
+ # to the given podspec.
10
+ #
11
+ # To use it, add this to your .podspec:
12
+ # ```ruby
13
+ # Pod::Spec.new do |spec|
14
+ # # ...
15
+ #
16
+ # # Add all files generated by Nitrogen
17
+ # load 'nitrogen/generated/ios/ClarionRecorder+autolinking.rb'
18
+ # add_nitrogen_files(spec)
19
+ # end
20
+ # ```
21
+
22
+ def add_nitrogen_files(spec)
23
+ Pod::UI.puts "[NitroModules] 🔥 ClarionRecorder is boosted by nitro!"
24
+
25
+ spec.dependency "NitroModules"
26
+
27
+ current_source_files = Array(spec.attributes_hash['source_files'])
28
+ spec.source_files = current_source_files + [
29
+ # Generated cross-platform specs
30
+ "nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
31
+ # Generated bridges for the cross-platform specs
32
+ "nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
33
+ ]
34
+
35
+ current_public_header_files = Array(spec.attributes_hash['public_header_files'])
36
+ spec.public_header_files = current_public_header_files + [
37
+ # Generated specs
38
+ "nitrogen/generated/shared/**/*.{h,hpp}",
39
+ # Swift to C++ bridging helpers
40
+ "nitrogen/generated/ios/ClarionRecorder-Swift-Cxx-Bridge.hpp"
41
+ ]
42
+
43
+ current_private_header_files = Array(spec.attributes_hash['private_header_files'])
44
+ spec.private_header_files = current_private_header_files + [
45
+ # iOS specific specs
46
+ "nitrogen/generated/ios/c++/**/*.{h,hpp}",
47
+ # Views are framework-specific and should be private
48
+ "nitrogen/generated/shared/**/views/**/*"
49
+ ]
50
+
51
+ current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
52
+ spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
53
+ # Use C++ 20
54
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
55
+ # Enables C++ <-> Swift interop (by default it's only ObjC)
56
+ "SWIFT_OBJC_INTEROP_MODE" => "objcxx",
57
+ # Enables stricter modular headers
58
+ "DEFINES_MODULE" => "YES",
59
+ # Disable auto-generated ObjC header for Swift (Static linkage on Xcode 26.4 breaks here)
60
+ "SWIFT_INSTALL_OBJC_HEADER" => "NO",
61
+ })
62
+ end
@@ -0,0 +1,89 @@
1
+ ///
2
+ /// ClarionRecorder-Swift-Cxx-Bridge.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 "ClarionRecorder-Swift-Cxx-Bridge.hpp"
9
+
10
+ // Include C++ implementation defined types
11
+ #include "ClarionRecorder-Swift-Cxx-Umbrella.hpp"
12
+ #include "HybridClarionRecorderSpecSwift.hpp"
13
+ #include <NitroModules/NitroDefines.hpp>
14
+
15
+ namespace margelo::nitro::clarion::recorder::bridge::swift {
16
+
17
+ // pragma MARK: std::function<void()>
18
+ Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
19
+ auto swiftClosure = ClarionRecorder::Func_void::fromUnsafe(swiftClosureWrapper);
20
+ return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
21
+ swiftClosure.call();
22
+ };
23
+ }
24
+
25
+ // pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
26
+ Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
27
+ auto swiftClosure = ClarionRecorder::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
28
+ return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
29
+ swiftClosure.call(error);
30
+ };
31
+ }
32
+
33
+ // pragma MARK: std::function<void(const NativeRecorderResult& /* result */)>
34
+ Func_void_NativeRecorderResult create_Func_void_NativeRecorderResult(void* NON_NULL swiftClosureWrapper) noexcept {
35
+ auto swiftClosure = ClarionRecorder::Func_void_NativeRecorderResult::fromUnsafe(swiftClosureWrapper);
36
+ return [swiftClosure = std::move(swiftClosure)](const NativeRecorderResult& result) mutable -> void {
37
+ swiftClosure.call(result);
38
+ };
39
+ }
40
+
41
+ // pragma MARK: std::function<void(const std::string& /* state */)>
42
+ Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept {
43
+ auto swiftClosure = ClarionRecorder::Func_void_std__string::fromUnsafe(swiftClosureWrapper);
44
+ return [swiftClosure = std::move(swiftClosure)](const std::string& state) mutable -> void {
45
+ swiftClosure.call(state);
46
+ };
47
+ }
48
+
49
+ // pragma MARK: std::function<void(double /* rms */, double /* peak */)>
50
+ Func_void_double_double create_Func_void_double_double(void* NON_NULL swiftClosureWrapper) noexcept {
51
+ auto swiftClosure = ClarionRecorder::Func_void_double_double::fromUnsafe(swiftClosureWrapper);
52
+ return [swiftClosure = std::move(swiftClosure)](double rms, double peak) mutable -> void {
53
+ swiftClosure.call(rms, peak);
54
+ };
55
+ }
56
+
57
+ // pragma MARK: std::function<void(const std::string& /* uri */, double /* startMs */, double /* endMs */, double /* sizeBytes */)>
58
+ Func_void_std__string_double_double_double create_Func_void_std__string_double_double_double(void* NON_NULL swiftClosureWrapper) noexcept {
59
+ auto swiftClosure = ClarionRecorder::Func_void_std__string_double_double_double::fromUnsafe(swiftClosureWrapper);
60
+ return [swiftClosure = std::move(swiftClosure)](const std::string& uri, double startMs, double endMs, double sizeBytes) mutable -> void {
61
+ swiftClosure.call(uri, startMs, endMs, sizeBytes);
62
+ };
63
+ }
64
+
65
+ // pragma MARK: std::function<void(const NativeRecorderError& /* error */)>
66
+ Func_void_NativeRecorderError create_Func_void_NativeRecorderError(void* NON_NULL swiftClosureWrapper) noexcept {
67
+ auto swiftClosure = ClarionRecorder::Func_void_NativeRecorderError::fromUnsafe(swiftClosureWrapper);
68
+ return [swiftClosure = std::move(swiftClosure)](const NativeRecorderError& error) mutable -> void {
69
+ swiftClosure.call(error);
70
+ };
71
+ }
72
+
73
+ // pragma MARK: std::shared_ptr<HybridClarionRecorderSpec>
74
+ std::shared_ptr<HybridClarionRecorderSpec> create_std__shared_ptr_HybridClarionRecorderSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
75
+ ClarionRecorder::HybridClarionRecorderSpec_cxx swiftPart = ClarionRecorder::HybridClarionRecorderSpec_cxx::fromUnsafe(swiftUnsafePointer);
76
+ return std::make_shared<margelo::nitro::clarion::recorder::HybridClarionRecorderSpecSwift>(swiftPart);
77
+ }
78
+ void* NON_NULL get_std__shared_ptr_HybridClarionRecorderSpec_(std__shared_ptr_HybridClarionRecorderSpec_ cppType) {
79
+ std::shared_ptr<margelo::nitro::clarion::recorder::HybridClarionRecorderSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::clarion::recorder::HybridClarionRecorderSpecSwift>(cppType);
80
+ #ifdef NITRO_DEBUG
81
+ if (swiftWrapper == nullptr) [[unlikely]] {
82
+ throw std::runtime_error("Class \"HybridClarionRecorderSpec\" is not implemented in Swift!");
83
+ }
84
+ #endif
85
+ ClarionRecorder::HybridClarionRecorderSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
86
+ return swiftPart.toUnsafe();
87
+ }
88
+
89
+ } // namespace margelo::nitro::clarion::recorder::bridge::swift
@@ -0,0 +1,297 @@
1
+ ///
2
+ /// ClarionRecorder-Swift-Cxx-Bridge.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
+ // Forward declarations of C++ defined types
11
+ // Forward declaration of `HybridClarionRecorderSpec` to properly resolve imports.
12
+ namespace margelo::nitro::clarion::recorder { class HybridClarionRecorderSpec; }
13
+ // Forward declaration of `NativeRecorderError` to properly resolve imports.
14
+ namespace margelo::nitro::clarion::recorder { struct NativeRecorderError; }
15
+ // Forward declaration of `NativeRecorderResult` to properly resolve imports.
16
+ namespace margelo::nitro::clarion::recorder { struct NativeRecorderResult; }
17
+
18
+ // Forward declarations of Swift defined types
19
+ // Forward declaration of `HybridClarionRecorderSpec_cxx` to properly resolve imports.
20
+ namespace ClarionRecorder { class HybridClarionRecorderSpec_cxx; }
21
+
22
+ // Include C++ defined types
23
+ #include "HybridClarionRecorderSpec.hpp"
24
+ #include "NativeRecorderError.hpp"
25
+ #include "NativeRecorderResult.hpp"
26
+ #include <NitroModules/Promise.hpp>
27
+ #include <NitroModules/PromiseHolder.hpp>
28
+ #include <NitroModules/Result.hpp>
29
+ #include <exception>
30
+ #include <functional>
31
+ #include <memory>
32
+ #include <optional>
33
+ #include <string>
34
+
35
+ /**
36
+ * Contains specialized versions of C++ templated types so they can be accessed from Swift,
37
+ * as well as helper functions to interact with those C++ types from Swift.
38
+ */
39
+ namespace margelo::nitro::clarion::recorder::bridge::swift {
40
+
41
+ // pragma MARK: std::shared_ptr<Promise<void>>
42
+ /**
43
+ * Specialized version of `std::shared_ptr<Promise<void>>`.
44
+ */
45
+ using std__shared_ptr_Promise_void__ = std::shared_ptr<Promise<void>>;
46
+ inline std::shared_ptr<Promise<void>> create_std__shared_ptr_Promise_void__() noexcept {
47
+ return Promise<void>::create();
48
+ }
49
+ inline PromiseHolder<void> wrap_std__shared_ptr_Promise_void__(std::shared_ptr<Promise<void>> promise) noexcept {
50
+ return PromiseHolder<void>(std::move(promise));
51
+ }
52
+
53
+ // pragma MARK: std::function<void()>
54
+ /**
55
+ * Specialized version of `std::function<void()>`.
56
+ */
57
+ using Func_void = std::function<void()>;
58
+ /**
59
+ * Wrapper class for a `std::function<void()>`, this can be used from Swift.
60
+ */
61
+ class Func_void_Wrapper final {
62
+ public:
63
+ explicit Func_void_Wrapper(std::function<void()>&& func): _function(std::make_unique<std::function<void()>>(std::move(func))) {}
64
+ inline void call() const noexcept {
65
+ _function->operator()();
66
+ }
67
+ private:
68
+ std::unique_ptr<std::function<void()>> _function;
69
+ } SWIFT_NONCOPYABLE;
70
+ Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept;
71
+ inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept {
72
+ return Func_void_Wrapper(std::move(value));
73
+ }
74
+
75
+ // pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
76
+ /**
77
+ * Specialized version of `std::function<void(const std::exception_ptr&)>`.
78
+ */
79
+ using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
80
+ /**
81
+ * Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
82
+ */
83
+ class Func_void_std__exception_ptr_Wrapper final {
84
+ public:
85
+ explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
86
+ inline void call(std::exception_ptr error) const noexcept {
87
+ _function->operator()(error);
88
+ }
89
+ private:
90
+ std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
91
+ } SWIFT_NONCOPYABLE;
92
+ Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
93
+ inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
94
+ return Func_void_std__exception_ptr_Wrapper(std::move(value));
95
+ }
96
+
97
+ // pragma MARK: std::optional<std::string>
98
+ /**
99
+ * Specialized version of `std::optional<std::string>`.
100
+ */
101
+ using std__optional_std__string_ = std::optional<std::string>;
102
+ inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
103
+ return std::optional<std::string>(value);
104
+ }
105
+ inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
106
+ return optional.has_value();
107
+ }
108
+ inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
109
+ return optional.value();
110
+ }
111
+
112
+ // pragma MARK: std::optional<double>
113
+ /**
114
+ * Specialized version of `std::optional<double>`.
115
+ */
116
+ using std__optional_double_ = std::optional<double>;
117
+ inline std::optional<double> create_std__optional_double_(const double& value) noexcept {
118
+ return std::optional<double>(value);
119
+ }
120
+ inline bool has_value_std__optional_double_(const std::optional<double>& optional) noexcept {
121
+ return optional.has_value();
122
+ }
123
+ inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
124
+ return optional.value();
125
+ }
126
+
127
+ // pragma MARK: std::shared_ptr<Promise<NativeRecorderResult>>
128
+ /**
129
+ * Specialized version of `std::shared_ptr<Promise<NativeRecorderResult>>`.
130
+ */
131
+ using std__shared_ptr_Promise_NativeRecorderResult__ = std::shared_ptr<Promise<NativeRecorderResult>>;
132
+ inline std::shared_ptr<Promise<NativeRecorderResult>> create_std__shared_ptr_Promise_NativeRecorderResult__() noexcept {
133
+ return Promise<NativeRecorderResult>::create();
134
+ }
135
+ inline PromiseHolder<NativeRecorderResult> wrap_std__shared_ptr_Promise_NativeRecorderResult__(std::shared_ptr<Promise<NativeRecorderResult>> promise) noexcept {
136
+ return PromiseHolder<NativeRecorderResult>(std::move(promise));
137
+ }
138
+
139
+ // pragma MARK: std::function<void(const NativeRecorderResult& /* result */)>
140
+ /**
141
+ * Specialized version of `std::function<void(const NativeRecorderResult&)>`.
142
+ */
143
+ using Func_void_NativeRecorderResult = std::function<void(const NativeRecorderResult& /* result */)>;
144
+ /**
145
+ * Wrapper class for a `std::function<void(const NativeRecorderResult& / * result * /)>`, this can be used from Swift.
146
+ */
147
+ class Func_void_NativeRecorderResult_Wrapper final {
148
+ public:
149
+ explicit Func_void_NativeRecorderResult_Wrapper(std::function<void(const NativeRecorderResult& /* result */)>&& func): _function(std::make_unique<std::function<void(const NativeRecorderResult& /* result */)>>(std::move(func))) {}
150
+ inline void call(NativeRecorderResult result) const noexcept {
151
+ _function->operator()(result);
152
+ }
153
+ private:
154
+ std::unique_ptr<std::function<void(const NativeRecorderResult& /* result */)>> _function;
155
+ } SWIFT_NONCOPYABLE;
156
+ Func_void_NativeRecorderResult create_Func_void_NativeRecorderResult(void* NON_NULL swiftClosureWrapper) noexcept;
157
+ inline Func_void_NativeRecorderResult_Wrapper wrap_Func_void_NativeRecorderResult(Func_void_NativeRecorderResult value) noexcept {
158
+ return Func_void_NativeRecorderResult_Wrapper(std::move(value));
159
+ }
160
+
161
+ // pragma MARK: std::function<void(const std::string& /* state */)>
162
+ /**
163
+ * Specialized version of `std::function<void(const std::string&)>`.
164
+ */
165
+ using Func_void_std__string = std::function<void(const std::string& /* state */)>;
166
+ /**
167
+ * Wrapper class for a `std::function<void(const std::string& / * state * /)>`, this can be used from Swift.
168
+ */
169
+ class Func_void_std__string_Wrapper final {
170
+ public:
171
+ explicit Func_void_std__string_Wrapper(std::function<void(const std::string& /* state */)>&& func): _function(std::make_unique<std::function<void(const std::string& /* state */)>>(std::move(func))) {}
172
+ inline void call(std::string state) const noexcept {
173
+ _function->operator()(state);
174
+ }
175
+ private:
176
+ std::unique_ptr<std::function<void(const std::string& /* state */)>> _function;
177
+ } SWIFT_NONCOPYABLE;
178
+ Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept;
179
+ inline Func_void_std__string_Wrapper wrap_Func_void_std__string(Func_void_std__string value) noexcept {
180
+ return Func_void_std__string_Wrapper(std::move(value));
181
+ }
182
+
183
+ // pragma MARK: std::function<void(double /* rms */, double /* peak */)>
184
+ /**
185
+ * Specialized version of `std::function<void(double, double)>`.
186
+ */
187
+ using Func_void_double_double = std::function<void(double /* rms */, double /* peak */)>;
188
+ /**
189
+ * Wrapper class for a `std::function<void(double / * rms * /, double / * peak * /)>`, this can be used from Swift.
190
+ */
191
+ class Func_void_double_double_Wrapper final {
192
+ public:
193
+ explicit Func_void_double_double_Wrapper(std::function<void(double /* rms */, double /* peak */)>&& func): _function(std::make_unique<std::function<void(double /* rms */, double /* peak */)>>(std::move(func))) {}
194
+ inline void call(double rms, double peak) const noexcept {
195
+ _function->operator()(rms, peak);
196
+ }
197
+ private:
198
+ std::unique_ptr<std::function<void(double /* rms */, double /* peak */)>> _function;
199
+ } SWIFT_NONCOPYABLE;
200
+ Func_void_double_double create_Func_void_double_double(void* NON_NULL swiftClosureWrapper) noexcept;
201
+ inline Func_void_double_double_Wrapper wrap_Func_void_double_double(Func_void_double_double value) noexcept {
202
+ return Func_void_double_double_Wrapper(std::move(value));
203
+ }
204
+
205
+ // pragma MARK: std::function<void(const std::string& /* uri */, double /* startMs */, double /* endMs */, double /* sizeBytes */)>
206
+ /**
207
+ * Specialized version of `std::function<void(const std::string&, double, double, double)>`.
208
+ */
209
+ using Func_void_std__string_double_double_double = std::function<void(const std::string& /* uri */, double /* startMs */, double /* endMs */, double /* sizeBytes */)>;
210
+ /**
211
+ * Wrapper class for a `std::function<void(const std::string& / * uri * /, double / * startMs * /, double / * endMs * /, double / * sizeBytes * /)>`, this can be used from Swift.
212
+ */
213
+ class Func_void_std__string_double_double_double_Wrapper final {
214
+ public:
215
+ explicit Func_void_std__string_double_double_double_Wrapper(std::function<void(const std::string& /* uri */, double /* startMs */, double /* endMs */, double /* sizeBytes */)>&& func): _function(std::make_unique<std::function<void(const std::string& /* uri */, double /* startMs */, double /* endMs */, double /* sizeBytes */)>>(std::move(func))) {}
216
+ inline void call(std::string uri, double startMs, double endMs, double sizeBytes) const noexcept {
217
+ _function->operator()(uri, startMs, endMs, sizeBytes);
218
+ }
219
+ private:
220
+ std::unique_ptr<std::function<void(const std::string& /* uri */, double /* startMs */, double /* endMs */, double /* sizeBytes */)>> _function;
221
+ } SWIFT_NONCOPYABLE;
222
+ Func_void_std__string_double_double_double create_Func_void_std__string_double_double_double(void* NON_NULL swiftClosureWrapper) noexcept;
223
+ inline Func_void_std__string_double_double_double_Wrapper wrap_Func_void_std__string_double_double_double(Func_void_std__string_double_double_double value) noexcept {
224
+ return Func_void_std__string_double_double_double_Wrapper(std::move(value));
225
+ }
226
+
227
+ // pragma MARK: std::function<void(const NativeRecorderError& /* error */)>
228
+ /**
229
+ * Specialized version of `std::function<void(const NativeRecorderError&)>`.
230
+ */
231
+ using Func_void_NativeRecorderError = std::function<void(const NativeRecorderError& /* error */)>;
232
+ /**
233
+ * Wrapper class for a `std::function<void(const NativeRecorderError& / * error * /)>`, this can be used from Swift.
234
+ */
235
+ class Func_void_NativeRecorderError_Wrapper final {
236
+ public:
237
+ explicit Func_void_NativeRecorderError_Wrapper(std::function<void(const NativeRecorderError& /* error */)>&& func): _function(std::make_unique<std::function<void(const NativeRecorderError& /* error */)>>(std::move(func))) {}
238
+ inline void call(NativeRecorderError error) const noexcept {
239
+ _function->operator()(error);
240
+ }
241
+ private:
242
+ std::unique_ptr<std::function<void(const NativeRecorderError& /* error */)>> _function;
243
+ } SWIFT_NONCOPYABLE;
244
+ Func_void_NativeRecorderError create_Func_void_NativeRecorderError(void* NON_NULL swiftClosureWrapper) noexcept;
245
+ inline Func_void_NativeRecorderError_Wrapper wrap_Func_void_NativeRecorderError(Func_void_NativeRecorderError value) noexcept {
246
+ return Func_void_NativeRecorderError_Wrapper(std::move(value));
247
+ }
248
+
249
+ // pragma MARK: std::shared_ptr<HybridClarionRecorderSpec>
250
+ /**
251
+ * Specialized version of `std::shared_ptr<HybridClarionRecorderSpec>`.
252
+ */
253
+ using std__shared_ptr_HybridClarionRecorderSpec_ = std::shared_ptr<HybridClarionRecorderSpec>;
254
+ std::shared_ptr<HybridClarionRecorderSpec> create_std__shared_ptr_HybridClarionRecorderSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
255
+ void* NON_NULL get_std__shared_ptr_HybridClarionRecorderSpec_(std__shared_ptr_HybridClarionRecorderSpec_ cppType);
256
+
257
+ // pragma MARK: std::weak_ptr<HybridClarionRecorderSpec>
258
+ using std__weak_ptr_HybridClarionRecorderSpec_ = std::weak_ptr<HybridClarionRecorderSpec>;
259
+ inline std__weak_ptr_HybridClarionRecorderSpec_ weakify_std__shared_ptr_HybridClarionRecorderSpec_(const std::shared_ptr<HybridClarionRecorderSpec>& strong) noexcept { return strong; }
260
+
261
+ // pragma MARK: Result<std::shared_ptr<Promise<void>>>
262
+ using Result_std__shared_ptr_Promise_void___ = Result<std::shared_ptr<Promise<void>>>;
263
+ inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::shared_ptr<Promise<void>>& value) noexcept {
264
+ return Result<std::shared_ptr<Promise<void>>>::withValue(value);
265
+ }
266
+ inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::exception_ptr& error) noexcept {
267
+ return Result<std::shared_ptr<Promise<void>>>::withError(error);
268
+ }
269
+
270
+ // pragma MARK: Result<std::shared_ptr<Promise<NativeRecorderResult>>>
271
+ using Result_std__shared_ptr_Promise_NativeRecorderResult___ = Result<std::shared_ptr<Promise<NativeRecorderResult>>>;
272
+ inline Result_std__shared_ptr_Promise_NativeRecorderResult___ create_Result_std__shared_ptr_Promise_NativeRecorderResult___(const std::shared_ptr<Promise<NativeRecorderResult>>& value) noexcept {
273
+ return Result<std::shared_ptr<Promise<NativeRecorderResult>>>::withValue(value);
274
+ }
275
+ inline Result_std__shared_ptr_Promise_NativeRecorderResult___ create_Result_std__shared_ptr_Promise_NativeRecorderResult___(const std::exception_ptr& error) noexcept {
276
+ return Result<std::shared_ptr<Promise<NativeRecorderResult>>>::withError(error);
277
+ }
278
+
279
+ // pragma MARK: Result<double>
280
+ using Result_double_ = Result<double>;
281
+ inline Result_double_ create_Result_double_(double value) noexcept {
282
+ return Result<double>::withValue(std::move(value));
283
+ }
284
+ inline Result_double_ create_Result_double_(const std::exception_ptr& error) noexcept {
285
+ return Result<double>::withError(error);
286
+ }
287
+
288
+ // pragma MARK: Result<void>
289
+ using Result_void_ = Result<void>;
290
+ inline Result_void_ create_Result_void_() noexcept {
291
+ return Result<void>::withValue();
292
+ }
293
+ inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
294
+ return Result<void>::withError(error);
295
+ }
296
+
297
+ } // namespace margelo::nitro::clarion::recorder::bridge::swift
@@ -0,0 +1,56 @@
1
+ ///
2
+ /// ClarionRecorder-Swift-Cxx-Umbrella.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
+ // Forward declarations of C++ defined types
11
+ // Forward declaration of `HybridClarionRecorderSpec` to properly resolve imports.
12
+ namespace margelo::nitro::clarion::recorder { class HybridClarionRecorderSpec; }
13
+ // Forward declaration of `NativeRecorderConfig` to properly resolve imports.
14
+ namespace margelo::nitro::clarion::recorder { struct NativeRecorderConfig; }
15
+ // Forward declaration of `NativeRecorderError` to properly resolve imports.
16
+ namespace margelo::nitro::clarion::recorder { struct NativeRecorderError; }
17
+ // Forward declaration of `NativeRecorderResult` to properly resolve imports.
18
+ namespace margelo::nitro::clarion::recorder { struct NativeRecorderResult; }
19
+
20
+ // Include C++ defined types
21
+ #include "HybridClarionRecorderSpec.hpp"
22
+ #include "NativeRecorderConfig.hpp"
23
+ #include "NativeRecorderError.hpp"
24
+ #include "NativeRecorderResult.hpp"
25
+ #include <NitroModules/Promise.hpp>
26
+ #include <NitroModules/Result.hpp>
27
+ #include <exception>
28
+ #include <functional>
29
+ #include <memory>
30
+ #include <optional>
31
+ #include <string>
32
+
33
+ // C++ helpers for Swift
34
+ #include "ClarionRecorder-Swift-Cxx-Bridge.hpp"
35
+
36
+ // Common C++ types used in Swift
37
+ #include <NitroModules/ArrayBufferHolder.hpp>
38
+ #include <NitroModules/AnyMapUtils.hpp>
39
+ #include <NitroModules/RuntimeError.hpp>
40
+ #include <NitroModules/DateToChronoDate.hpp>
41
+
42
+ // Forward declarations of Swift defined types
43
+ // Forward declaration of `HybridClarionRecorderSpec_cxx` to properly resolve imports.
44
+ namespace ClarionRecorder { class HybridClarionRecorderSpec_cxx; }
45
+
46
+ // Include Swift defined types
47
+ #if __has_include("ClarionRecorder-Swift.h")
48
+ // This header is generated by Xcode/Swift on every app build.
49
+ // If it cannot be found, make sure the Swift module's name (= podspec name) is actually "ClarionRecorder".
50
+ #include "ClarionRecorder-Swift.h"
51
+ // Same as above, but used when building with frameworks (`use_frameworks`)
52
+ #elif __has_include(<ClarionRecorder/ClarionRecorder-Swift.h>)
53
+ #include <ClarionRecorder/ClarionRecorder-Swift.h>
54
+ #else
55
+ #error ClarionRecorder's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "ClarionRecorder", and try building the app first.
56
+ #endif
@@ -0,0 +1,33 @@
1
+ ///
2
+ /// ClarionRecorderAutolinking.mm
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 <Foundation/Foundation.h>
9
+ #import <NitroModules/HybridObjectRegistry.hpp>
10
+ #import "ClarionRecorder-Swift-Cxx-Umbrella.hpp"
11
+ #import <type_traits>
12
+
13
+ #include "HybridClarionRecorderSpecSwift.hpp"
14
+
15
+ @interface ClarionRecorderAutolinking : NSObject
16
+ @end
17
+
18
+ @implementation ClarionRecorderAutolinking
19
+
20
+ + (void) load {
21
+ using namespace margelo::nitro;
22
+ using namespace margelo::nitro::clarion::recorder;
23
+
24
+ HybridObjectRegistry::registerHybridObjectConstructor(
25
+ "ClarionRecorder",
26
+ []() -> std::shared_ptr<HybridObject> {
27
+ std::shared_ptr<HybridClarionRecorderSpec> hybridObject = ClarionRecorder::ClarionRecorderAutolinking::createClarionRecorder();
28
+ return hybridObject;
29
+ }
30
+ );
31
+ }
32
+
33
+ @end