react-native-audio-concat 0.2.3 → 0.3.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/AudioConcat.podspec +2 -21
- package/README.md +3 -7
- package/android/build.gradle +2 -54
- package/android/src/main/java/com/{margelo/nitro/audioconcat/AudioConcat.kt → audioconcat/AudioConcatModule.kt} +73 -31
- package/android/src/main/java/com/audioconcat/AudioConcatPackage.kt +33 -0
- package/ios/AudioConcat.h +5 -0
- package/ios/AudioConcat.mm +104 -0
- package/lib/module/NativeAudioConcat.js +5 -0
- package/lib/module/NativeAudioConcat.js.map +1 -0
- package/lib/module/index.js +2 -28
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NativeAudioConcat.d.ts +12 -0
- package/lib/typescript/src/NativeAudioConcat.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -27
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +14 -18
- package/src/NativeAudioConcat.ts +12 -0
- package/src/index.tsx +4 -32
- package/android/CMakeLists.txt +0 -24
- package/android/src/main/cpp/cpp-adapter.cpp +0 -6
- package/android/src/main/java/com/margelo/nitro/audioconcat/AudioConcatPackage.kt +0 -22
- package/ios/AudioConcat.swift +0 -75
- package/lib/module/AudioConcat.nitro.js +0 -4
- package/lib/module/AudioConcat.nitro.js.map +0 -1
- package/lib/typescript/src/AudioConcat.nitro.d.ts +0 -16
- package/lib/typescript/src/AudioConcat.nitro.d.ts.map +0 -1
- package/nitro.json +0 -17
- package/nitrogen/generated/android/audioconcat+autolinking.cmake +0 -82
- package/nitrogen/generated/android/audioconcat+autolinking.gradle +0 -27
- package/nitrogen/generated/android/audioconcatOnLoad.cpp +0 -44
- package/nitrogen/generated/android/audioconcatOnLoad.hpp +0 -25
- package/nitrogen/generated/android/c++/JAudioData.hpp +0 -53
- package/nitrogen/generated/android/c++/JAudioDataOrSilence.cpp +0 -26
- package/nitrogen/generated/android/c++/JAudioDataOrSilence.hpp +0 -72
- package/nitrogen/generated/android/c++/JHybridAudioConcatSpec.cpp +0 -77
- package/nitrogen/generated/android/c++/JHybridAudioConcatSpec.hpp +0 -64
- package/nitrogen/generated/android/c++/JSilentData.hpp +0 -53
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/audioconcat/AudioData.kt +0 -29
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/audioconcat/AudioDataOrSilence.kt +0 -42
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/audioconcat/HybridAudioConcatSpec.kt +0 -52
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/audioconcat/SilentData.kt +0 -29
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/audioconcat/audioconcatOnLoad.kt +0 -35
- package/nitrogen/generated/ios/AudioConcat+autolinking.rb +0 -60
- package/nitrogen/generated/ios/AudioConcat-Swift-Cxx-Bridge.cpp +0 -48
- package/nitrogen/generated/ios/AudioConcat-Swift-Cxx-Bridge.hpp +0 -160
- package/nitrogen/generated/ios/AudioConcat-Swift-Cxx-Umbrella.hpp +0 -53
- package/nitrogen/generated/ios/AudioConcatAutolinking.mm +0 -33
- package/nitrogen/generated/ios/AudioConcatAutolinking.swift +0 -25
- package/nitrogen/generated/ios/c++/HybridAudioConcatSpecSwift.cpp +0 -11
- package/nitrogen/generated/ios/c++/HybridAudioConcatSpecSwift.hpp +0 -81
- package/nitrogen/generated/ios/swift/AudioData.swift +0 -35
- package/nitrogen/generated/ios/swift/AudioDataOrSilence.swift +0 -18
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +0 -47
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +0 -47
- package/nitrogen/generated/ios/swift/HybridAudioConcatSpec.swift +0 -49
- package/nitrogen/generated/ios/swift/HybridAudioConcatSpec_cxx.swift +0 -142
- package/nitrogen/generated/ios/swift/SilentData.swift +0 -35
- package/nitrogen/generated/shared/c++/AudioData.hpp +0 -67
- package/nitrogen/generated/shared/c++/HybridAudioConcatSpec.cpp +0 -21
- package/nitrogen/generated/shared/c++/HybridAudioConcatSpec.hpp +0 -70
- package/nitrogen/generated/shared/c++/SilentData.hpp +0 -67
- package/src/AudioConcat.nitro.ts +0 -19
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// AudioConcat-Swift-Cxx-Umbrella.hpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#pragma once
|
|
9
|
-
|
|
10
|
-
// Forward declarations of C++ defined types
|
|
11
|
-
// Forward declaration of `AudioData` to properly resolve imports.
|
|
12
|
-
namespace margelo::nitro::audioconcat { struct AudioData; }
|
|
13
|
-
// Forward declaration of `HybridAudioConcatSpec` to properly resolve imports.
|
|
14
|
-
namespace margelo::nitro::audioconcat { class HybridAudioConcatSpec; }
|
|
15
|
-
// Forward declaration of `SilentData` to properly resolve imports.
|
|
16
|
-
namespace margelo::nitro::audioconcat { struct SilentData; }
|
|
17
|
-
|
|
18
|
-
// Include C++ defined types
|
|
19
|
-
#include "AudioData.hpp"
|
|
20
|
-
#include "HybridAudioConcatSpec.hpp"
|
|
21
|
-
#include "SilentData.hpp"
|
|
22
|
-
#include <NitroModules/Promise.hpp>
|
|
23
|
-
#include <NitroModules/Result.hpp>
|
|
24
|
-
#include <exception>
|
|
25
|
-
#include <memory>
|
|
26
|
-
#include <string>
|
|
27
|
-
#include <variant>
|
|
28
|
-
#include <vector>
|
|
29
|
-
|
|
30
|
-
// C++ helpers for Swift
|
|
31
|
-
#include "AudioConcat-Swift-Cxx-Bridge.hpp"
|
|
32
|
-
|
|
33
|
-
// Common C++ types used in Swift
|
|
34
|
-
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
35
|
-
#include <NitroModules/AnyMapUtils.hpp>
|
|
36
|
-
#include <NitroModules/RuntimeError.hpp>
|
|
37
|
-
#include <NitroModules/DateToChronoDate.hpp>
|
|
38
|
-
|
|
39
|
-
// Forward declarations of Swift defined types
|
|
40
|
-
// Forward declaration of `HybridAudioConcatSpec_cxx` to properly resolve imports.
|
|
41
|
-
namespace AudioConcat { class HybridAudioConcatSpec_cxx; }
|
|
42
|
-
|
|
43
|
-
// Include Swift defined types
|
|
44
|
-
#if __has_include("AudioConcat-Swift.h")
|
|
45
|
-
// This header is generated by Xcode/Swift on every app build.
|
|
46
|
-
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "AudioConcat".
|
|
47
|
-
#include "AudioConcat-Swift.h"
|
|
48
|
-
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
49
|
-
#elif __has_include(<AudioConcat/AudioConcat-Swift.h>)
|
|
50
|
-
#include <AudioConcat/AudioConcat-Swift.h>
|
|
51
|
-
#else
|
|
52
|
-
#error AudioConcat's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "AudioConcat", and try building the app first.
|
|
53
|
-
#endif
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// AudioConcatAutolinking.mm
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#import <Foundation/Foundation.h>
|
|
9
|
-
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
-
#import "AudioConcat-Swift-Cxx-Umbrella.hpp"
|
|
11
|
-
#import <type_traits>
|
|
12
|
-
|
|
13
|
-
#include "HybridAudioConcatSpecSwift.hpp"
|
|
14
|
-
|
|
15
|
-
@interface AudioConcatAutolinking : NSObject
|
|
16
|
-
@end
|
|
17
|
-
|
|
18
|
-
@implementation AudioConcatAutolinking
|
|
19
|
-
|
|
20
|
-
+ (void) load {
|
|
21
|
-
using namespace margelo::nitro;
|
|
22
|
-
using namespace margelo::nitro::audioconcat;
|
|
23
|
-
|
|
24
|
-
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
-
"AudioConcat",
|
|
26
|
-
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
-
std::shared_ptr<HybridAudioConcatSpec> hybridObject = AudioConcat::AudioConcatAutolinking::createAudioConcat();
|
|
28
|
-
return hybridObject;
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
@end
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// AudioConcatAutolinking.swift
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
public final class AudioConcatAutolinking {
|
|
9
|
-
public typealias bridge = margelo.nitro.audioconcat.bridge.swift
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Creates an instance of a Swift class that implements `HybridAudioConcatSpec`,
|
|
13
|
-
* and wraps it in a Swift class that can directly interop with C++ (`HybridAudioConcatSpec_cxx`)
|
|
14
|
-
*
|
|
15
|
-
* This is generated by Nitrogen and will initialize the class specified
|
|
16
|
-
* in the `"autolinking"` property of `nitro.json` (in this case, `AudioConcat`).
|
|
17
|
-
*/
|
|
18
|
-
public static func createAudioConcat() -> bridge.std__shared_ptr_HybridAudioConcatSpec_ {
|
|
19
|
-
let hybridObject = AudioConcat()
|
|
20
|
-
return { () -> bridge.std__shared_ptr_HybridAudioConcatSpec_ in
|
|
21
|
-
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
22
|
-
return __cxxWrapped.getCxxPart()
|
|
23
|
-
}()
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridAudioConcatSpecSwift.cpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#include "HybridAudioConcatSpecSwift.hpp"
|
|
9
|
-
|
|
10
|
-
namespace margelo::nitro::audioconcat {
|
|
11
|
-
} // namespace margelo::nitro::audioconcat
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridAudioConcatSpecSwift.hpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#pragma once
|
|
9
|
-
|
|
10
|
-
#include "HybridAudioConcatSpec.hpp"
|
|
11
|
-
|
|
12
|
-
// Forward declaration of `HybridAudioConcatSpec_cxx` to properly resolve imports.
|
|
13
|
-
namespace AudioConcat { class HybridAudioConcatSpec_cxx; }
|
|
14
|
-
|
|
15
|
-
// Forward declaration of `AudioData` to properly resolve imports.
|
|
16
|
-
namespace margelo::nitro::audioconcat { struct AudioData; }
|
|
17
|
-
// Forward declaration of `SilentData` to properly resolve imports.
|
|
18
|
-
namespace margelo::nitro::audioconcat { struct SilentData; }
|
|
19
|
-
|
|
20
|
-
#include <string>
|
|
21
|
-
#include <NitroModules/Promise.hpp>
|
|
22
|
-
#include "AudioData.hpp"
|
|
23
|
-
#include "SilentData.hpp"
|
|
24
|
-
#include <variant>
|
|
25
|
-
#include <vector>
|
|
26
|
-
|
|
27
|
-
#include "AudioConcat-Swift-Cxx-Umbrella.hpp"
|
|
28
|
-
|
|
29
|
-
namespace margelo::nitro::audioconcat {
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* The C++ part of HybridAudioConcatSpec_cxx.swift.
|
|
33
|
-
*
|
|
34
|
-
* HybridAudioConcatSpecSwift (C++) accesses HybridAudioConcatSpec_cxx (Swift), and might
|
|
35
|
-
* contain some additional bridging code for C++ <> Swift interop.
|
|
36
|
-
*
|
|
37
|
-
* Since this obviously introduces an overhead, I hope at some point in
|
|
38
|
-
* the future, HybridAudioConcatSpec_cxx can directly inherit from the C++ class HybridAudioConcatSpec
|
|
39
|
-
* to simplify the whole structure and memory management.
|
|
40
|
-
*/
|
|
41
|
-
class HybridAudioConcatSpecSwift: public virtual HybridAudioConcatSpec {
|
|
42
|
-
public:
|
|
43
|
-
// Constructor from a Swift instance
|
|
44
|
-
explicit HybridAudioConcatSpecSwift(const AudioConcat::HybridAudioConcatSpec_cxx& swiftPart):
|
|
45
|
-
HybridObject(HybridAudioConcatSpec::TAG),
|
|
46
|
-
_swiftPart(swiftPart) { }
|
|
47
|
-
|
|
48
|
-
public:
|
|
49
|
-
// Get the Swift part
|
|
50
|
-
inline AudioConcat::HybridAudioConcatSpec_cxx& getSwiftPart() noexcept {
|
|
51
|
-
return _swiftPart;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public:
|
|
55
|
-
inline size_t getExternalMemorySize() noexcept override {
|
|
56
|
-
return _swiftPart.getMemorySize();
|
|
57
|
-
}
|
|
58
|
-
void dispose() noexcept override {
|
|
59
|
-
_swiftPart.dispose();
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
public:
|
|
63
|
-
// Properties
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
public:
|
|
67
|
-
// Methods
|
|
68
|
-
inline std::shared_ptr<Promise<std::string>> concatAudioFiles(const std::vector<std::variant<AudioData, SilentData>>& data, const std::string& outputPath) override {
|
|
69
|
-
auto __result = _swiftPart.concatAudioFiles(data, outputPath);
|
|
70
|
-
if (__result.hasError()) [[unlikely]] {
|
|
71
|
-
std::rethrow_exception(__result.error());
|
|
72
|
-
}
|
|
73
|
-
auto __value = std::move(__result.value());
|
|
74
|
-
return __value;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
private:
|
|
78
|
-
AudioConcat::HybridAudioConcatSpec_cxx _swiftPart;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
} // namespace margelo::nitro::audioconcat
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// AudioData.swift
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
import NitroModules
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Represents an instance of `AudioData`, backed by a C++ struct.
|
|
12
|
-
*/
|
|
13
|
-
public typealias AudioData = margelo.nitro.audioconcat.AudioData
|
|
14
|
-
|
|
15
|
-
public extension AudioData {
|
|
16
|
-
private typealias bridge = margelo.nitro.audioconcat.bridge.swift
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Create a new instance of `AudioData`.
|
|
20
|
-
*/
|
|
21
|
-
init(filePath: String) {
|
|
22
|
-
self.init(std.string(filePath))
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
var filePath: String {
|
|
26
|
-
@inline(__always)
|
|
27
|
-
get {
|
|
28
|
-
return String(self.__filePath)
|
|
29
|
-
}
|
|
30
|
-
@inline(__always)
|
|
31
|
-
set {
|
|
32
|
-
self.__filePath = std.string(newValue)
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// AudioDataOrSilence.swift
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* An Swift enum with associated values representing a Variant/Union type.
|
|
12
|
-
* JS type: `struct | struct`
|
|
13
|
-
*/
|
|
14
|
-
@frozen
|
|
15
|
-
public indirect enum AudioDataOrSilence {
|
|
16
|
-
case first(AudioData)
|
|
17
|
-
case second(SilentData)
|
|
18
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
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 © 2025 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
import NitroModules
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Wraps a Swift `(_ error: Error) -> Void` as a class.
|
|
13
|
-
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
|
-
*/
|
|
15
|
-
public final class Func_void_std__exception_ptr {
|
|
16
|
-
public typealias bridge = margelo.nitro.audioconcat.bridge.swift
|
|
17
|
-
|
|
18
|
-
private let closure: (_ error: Error) -> Void
|
|
19
|
-
|
|
20
|
-
public init(_ closure: @escaping (_ error: Error) -> Void) {
|
|
21
|
-
self.closure = closure
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@inline(__always)
|
|
25
|
-
public func call(error: std.exception_ptr) -> Void {
|
|
26
|
-
self.closure(RuntimeError.from(cppError: error))
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
-
* This acquires one additional strong reference on the object!
|
|
32
|
-
*/
|
|
33
|
-
@inline(__always)
|
|
34
|
-
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
-
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Casts an unsafe pointer to a `Func_void_std__exception_ptr`.
|
|
40
|
-
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__exception_ptr>`.
|
|
41
|
-
* This removes one strong reference from the object!
|
|
42
|
-
*/
|
|
43
|
-
@inline(__always)
|
|
44
|
-
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr {
|
|
45
|
-
return Unmanaged<Func_void_std__exception_ptr>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
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 © 2025 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
import NitroModules
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Wraps a Swift `(_ value: String) -> Void` as a class.
|
|
13
|
-
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
|
-
*/
|
|
15
|
-
public final class Func_void_std__string {
|
|
16
|
-
public typealias bridge = margelo.nitro.audioconcat.bridge.swift
|
|
17
|
-
|
|
18
|
-
private let closure: (_ value: String) -> Void
|
|
19
|
-
|
|
20
|
-
public init(_ closure: @escaping (_ value: String) -> Void) {
|
|
21
|
-
self.closure = closure
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@inline(__always)
|
|
25
|
-
public func call(value: std.string) -> Void {
|
|
26
|
-
self.closure(String(value))
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
-
* This acquires one additional strong reference on the object!
|
|
32
|
-
*/
|
|
33
|
-
@inline(__always)
|
|
34
|
-
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
-
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Casts an unsafe pointer to a `Func_void_std__string`.
|
|
40
|
-
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__string>`.
|
|
41
|
-
* This removes one strong reference from the object!
|
|
42
|
-
*/
|
|
43
|
-
@inline(__always)
|
|
44
|
-
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__string {
|
|
45
|
-
return Unmanaged<Func_void_std__string>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridAudioConcatSpec.swift
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
import Foundation
|
|
9
|
-
import NitroModules
|
|
10
|
-
|
|
11
|
-
/// See ``HybridAudioConcatSpec``
|
|
12
|
-
public protocol HybridAudioConcatSpec_protocol: HybridObject {
|
|
13
|
-
// Properties
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// Methods
|
|
17
|
-
func concatAudioFiles(data: [AudioDataOrSilence], outputPath: String) throws -> Promise<String>
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/// See ``HybridAudioConcatSpec``
|
|
21
|
-
open class HybridAudioConcatSpec_base {
|
|
22
|
-
private weak var cxxWrapper: HybridAudioConcatSpec_cxx? = nil
|
|
23
|
-
public init() { }
|
|
24
|
-
public func getCxxWrapper() -> HybridAudioConcatSpec_cxx {
|
|
25
|
-
#if DEBUG
|
|
26
|
-
guard self is HybridAudioConcatSpec else {
|
|
27
|
-
fatalError("`self` is not a `HybridAudioConcatSpec`! Did you accidentally inherit from `HybridAudioConcatSpec_base` instead of `HybridAudioConcatSpec`?")
|
|
28
|
-
}
|
|
29
|
-
#endif
|
|
30
|
-
if let cxxWrapper = self.cxxWrapper {
|
|
31
|
-
return cxxWrapper
|
|
32
|
-
} else {
|
|
33
|
-
let cxxWrapper = HybridAudioConcatSpec_cxx(self as! HybridAudioConcatSpec)
|
|
34
|
-
self.cxxWrapper = cxxWrapper
|
|
35
|
-
return cxxWrapper
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* A Swift base-protocol representing the AudioConcat HybridObject.
|
|
42
|
-
* Implement this protocol to create Swift-based instances of AudioConcat.
|
|
43
|
-
* ```swift
|
|
44
|
-
* class HybridAudioConcat : HybridAudioConcatSpec {
|
|
45
|
-
* // ...
|
|
46
|
-
* }
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
public typealias HybridAudioConcatSpec = HybridAudioConcatSpec_protocol & HybridAudioConcatSpec_base
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridAudioConcatSpec_cxx.swift
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
import Foundation
|
|
9
|
-
import NitroModules
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* A class implementation that bridges HybridAudioConcatSpec over to C++.
|
|
13
|
-
* In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
|
|
14
|
-
*
|
|
15
|
-
* Also, some Swift types need to be bridged with special handling:
|
|
16
|
-
* - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
|
|
17
|
-
* - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
|
|
18
|
-
* - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
|
|
19
|
-
*/
|
|
20
|
-
open class HybridAudioConcatSpec_cxx {
|
|
21
|
-
/**
|
|
22
|
-
* The Swift <> C++ bridge's namespace (`margelo::nitro::audioconcat::bridge::swift`)
|
|
23
|
-
* from `AudioConcat-Swift-Cxx-Bridge.hpp`.
|
|
24
|
-
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
|
25
|
-
*/
|
|
26
|
-
public typealias bridge = margelo.nitro.audioconcat.bridge.swift
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Holds an instance of the `HybridAudioConcatSpec` Swift protocol.
|
|
30
|
-
*/
|
|
31
|
-
private var __implementation: any HybridAudioConcatSpec
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
|
35
|
-
*/
|
|
36
|
-
private var __cxxPart: bridge.std__weak_ptr_HybridAudioConcatSpec_
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Create a new `HybridAudioConcatSpec_cxx` that wraps the given `HybridAudioConcatSpec`.
|
|
40
|
-
* All properties and methods bridge to C++ types.
|
|
41
|
-
*/
|
|
42
|
-
public init(_ implementation: any HybridAudioConcatSpec) {
|
|
43
|
-
self.__implementation = implementation
|
|
44
|
-
self.__cxxPart = .init()
|
|
45
|
-
/* no base class */
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Get the actual `HybridAudioConcatSpec` instance this class wraps.
|
|
50
|
-
*/
|
|
51
|
-
@inline(__always)
|
|
52
|
-
public func getHybridAudioConcatSpec() -> any HybridAudioConcatSpec {
|
|
53
|
-
return __implementation
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Casts this instance to a retained unsafe raw pointer.
|
|
58
|
-
* This acquires one additional strong reference on the object!
|
|
59
|
-
*/
|
|
60
|
-
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
61
|
-
return Unmanaged.passRetained(self).toOpaque()
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Casts an unsafe pointer to a `HybridAudioConcatSpec_cxx`.
|
|
66
|
-
* The pointer has to be a retained opaque `Unmanaged<HybridAudioConcatSpec_cxx>`.
|
|
67
|
-
* This removes one strong reference from the object!
|
|
68
|
-
*/
|
|
69
|
-
public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridAudioConcatSpec_cxx {
|
|
70
|
-
return Unmanaged<HybridAudioConcatSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Gets (or creates) the C++ part of this Hybrid Object.
|
|
75
|
-
* The C++ part is a `std::shared_ptr<HybridAudioConcatSpec>`.
|
|
76
|
-
*/
|
|
77
|
-
public func getCxxPart() -> bridge.std__shared_ptr_HybridAudioConcatSpec_ {
|
|
78
|
-
let cachedCxxPart = self.__cxxPart.lock()
|
|
79
|
-
if cachedCxxPart.__convertToBool() {
|
|
80
|
-
return cachedCxxPart
|
|
81
|
-
} else {
|
|
82
|
-
let newCxxPart = bridge.create_std__shared_ptr_HybridAudioConcatSpec_(self.toUnsafe())
|
|
83
|
-
__cxxPart = bridge.weakify_std__shared_ptr_HybridAudioConcatSpec_(newCxxPart)
|
|
84
|
-
return newCxxPart
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Get the memory size of the Swift class (plus size of any other allocations)
|
|
92
|
-
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
|
93
|
-
*/
|
|
94
|
-
@inline(__always)
|
|
95
|
-
public var memorySize: Int {
|
|
96
|
-
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Call dispose() on the Swift class.
|
|
101
|
-
* This _may_ be called manually from JS.
|
|
102
|
-
*/
|
|
103
|
-
@inline(__always)
|
|
104
|
-
public func dispose() {
|
|
105
|
-
self.__implementation.dispose()
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Properties
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
// Methods
|
|
112
|
-
@inline(__always)
|
|
113
|
-
public final func concatAudioFiles(data: bridge.std__vector_std__variant_AudioData__SilentData__, outputPath: std.string) -> bridge.Result_std__shared_ptr_Promise_std__string___ {
|
|
114
|
-
do {
|
|
115
|
-
let __result = try self.__implementation.concatAudioFiles(data: data.map({ __item in { () -> AudioDataOrSilence in
|
|
116
|
-
let __variant = bridge.std__variant_AudioData__SilentData_(__item)
|
|
117
|
-
switch __variant.index() {
|
|
118
|
-
case 0:
|
|
119
|
-
let __actual = __variant.get_0()
|
|
120
|
-
return .first(__actual)
|
|
121
|
-
case 1:
|
|
122
|
-
let __actual = __variant.get_1()
|
|
123
|
-
return .second(__actual)
|
|
124
|
-
default:
|
|
125
|
-
fatalError("Variant can never have index \(__variant.index())!")
|
|
126
|
-
}
|
|
127
|
-
}() }), outputPath: String(outputPath))
|
|
128
|
-
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__string__ in
|
|
129
|
-
let __promise = bridge.create_std__shared_ptr_Promise_std__string__()
|
|
130
|
-
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__string__(__promise)
|
|
131
|
-
__result
|
|
132
|
-
.then({ __result in __promiseHolder.resolve(std.string(__result)) })
|
|
133
|
-
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
134
|
-
return __promise
|
|
135
|
-
}()
|
|
136
|
-
return bridge.create_Result_std__shared_ptr_Promise_std__string___(__resultCpp)
|
|
137
|
-
} catch (let __error) {
|
|
138
|
-
let __exceptionPtr = __error.toCpp()
|
|
139
|
-
return bridge.create_Result_std__shared_ptr_Promise_std__string___(__exceptionPtr)
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// SilentData.swift
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
import NitroModules
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Represents an instance of `SilentData`, backed by a C++ struct.
|
|
12
|
-
*/
|
|
13
|
-
public typealias SilentData = margelo.nitro.audioconcat.SilentData
|
|
14
|
-
|
|
15
|
-
public extension SilentData {
|
|
16
|
-
private typealias bridge = margelo.nitro.audioconcat.bridge.swift
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Create a new instance of `SilentData`.
|
|
20
|
-
*/
|
|
21
|
-
init(durationMs: Double) {
|
|
22
|
-
self.init(durationMs)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
var durationMs: Double {
|
|
26
|
-
@inline(__always)
|
|
27
|
-
get {
|
|
28
|
-
return self.__durationMs
|
|
29
|
-
}
|
|
30
|
-
@inline(__always)
|
|
31
|
-
set {
|
|
32
|
-
self.__durationMs = newValue
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// AudioData.hpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#pragma once
|
|
9
|
-
|
|
10
|
-
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
-
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
-
#else
|
|
13
|
-
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
-
#endif
|
|
15
|
-
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
-
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
-
#else
|
|
18
|
-
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
-
#endif
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
#include <string>
|
|
24
|
-
|
|
25
|
-
namespace margelo::nitro::audioconcat {
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* A struct which can be represented as a JavaScript object (AudioData).
|
|
29
|
-
*/
|
|
30
|
-
struct AudioData {
|
|
31
|
-
public:
|
|
32
|
-
std::string filePath SWIFT_PRIVATE;
|
|
33
|
-
|
|
34
|
-
public:
|
|
35
|
-
AudioData() = default;
|
|
36
|
-
explicit AudioData(std::string filePath): filePath(filePath) {}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
} // namespace margelo::nitro::audioconcat
|
|
40
|
-
|
|
41
|
-
namespace margelo::nitro {
|
|
42
|
-
|
|
43
|
-
// C++ AudioData <> JS AudioData (object)
|
|
44
|
-
template <>
|
|
45
|
-
struct JSIConverter<margelo::nitro::audioconcat::AudioData> final {
|
|
46
|
-
static inline margelo::nitro::audioconcat::AudioData fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
47
|
-
jsi::Object obj = arg.asObject(runtime);
|
|
48
|
-
return margelo::nitro::audioconcat::AudioData(
|
|
49
|
-
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "filePath"))
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::audioconcat::AudioData& arg) {
|
|
53
|
-
jsi::Object obj(runtime);
|
|
54
|
-
obj.setProperty(runtime, "filePath", JSIConverter<std::string>::toJSI(runtime, arg.filePath));
|
|
55
|
-
return obj;
|
|
56
|
-
}
|
|
57
|
-
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
58
|
-
if (!value.isObject()) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
jsi::Object obj = value.getObject(runtime);
|
|
62
|
-
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "filePath"))) return false;
|
|
63
|
-
return true;
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
} // namespace margelo::nitro
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridAudioConcatSpec.cpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#include "HybridAudioConcatSpec.hpp"
|
|
9
|
-
|
|
10
|
-
namespace margelo::nitro::audioconcat {
|
|
11
|
-
|
|
12
|
-
void HybridAudioConcatSpec::loadHybridMethods() {
|
|
13
|
-
// load base methods/properties
|
|
14
|
-
HybridObject::loadHybridMethods();
|
|
15
|
-
// load custom methods/properties
|
|
16
|
-
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
-
prototype.registerHybridMethod("concatAudioFiles", &HybridAudioConcatSpec::concatAudioFiles);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
} // namespace margelo::nitro::audioconcat
|