react-native-audio-concat 0.2.2 → 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 -11
- 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,64 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridAudioConcatSpec.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 <NitroModules/JHybridObject.hpp>
|
|
11
|
-
#include <fbjni/fbjni.h>
|
|
12
|
-
#include "HybridAudioConcatSpec.hpp"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
namespace margelo::nitro::audioconcat {
|
|
18
|
-
|
|
19
|
-
using namespace facebook;
|
|
20
|
-
|
|
21
|
-
class JHybridAudioConcatSpec: public jni::HybridClass<JHybridAudioConcatSpec, JHybridObject>,
|
|
22
|
-
public virtual HybridAudioConcatSpec {
|
|
23
|
-
public:
|
|
24
|
-
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/audioconcat/HybridAudioConcatSpec;";
|
|
25
|
-
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
|
26
|
-
static void registerNatives();
|
|
27
|
-
|
|
28
|
-
protected:
|
|
29
|
-
// C++ constructor (called from Java via `initHybrid()`)
|
|
30
|
-
explicit JHybridAudioConcatSpec(jni::alias_ref<jhybridobject> jThis) :
|
|
31
|
-
HybridObject(HybridAudioConcatSpec::TAG),
|
|
32
|
-
HybridBase(jThis),
|
|
33
|
-
_javaPart(jni::make_global(jThis)) {}
|
|
34
|
-
|
|
35
|
-
public:
|
|
36
|
-
~JHybridAudioConcatSpec() override {
|
|
37
|
-
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
|
38
|
-
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public:
|
|
42
|
-
size_t getExternalMemorySize() noexcept override;
|
|
43
|
-
void dispose() noexcept override;
|
|
44
|
-
|
|
45
|
-
public:
|
|
46
|
-
inline const jni::global_ref<JHybridAudioConcatSpec::javaobject>& getJavaPart() const noexcept {
|
|
47
|
-
return _javaPart;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
public:
|
|
51
|
-
// Properties
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
public:
|
|
55
|
-
// Methods
|
|
56
|
-
std::shared_ptr<Promise<std::string>> concatAudioFiles(const std::vector<std::variant<AudioData, SilentData>>& data, const std::string& outputPath) override;
|
|
57
|
-
|
|
58
|
-
private:
|
|
59
|
-
friend HybridBase;
|
|
60
|
-
using HybridBase::HybridBase;
|
|
61
|
-
jni::global_ref<JHybridAudioConcatSpec::javaobject> _javaPart;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
} // namespace margelo::nitro::audioconcat
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// JSilentData.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 <fbjni/fbjni.h>
|
|
11
|
-
#include "SilentData.hpp"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
namespace margelo::nitro::audioconcat {
|
|
16
|
-
|
|
17
|
-
using namespace facebook;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* The C++ JNI bridge between the C++ struct "SilentData" and the the Kotlin data class "SilentData".
|
|
21
|
-
*/
|
|
22
|
-
struct JSilentData final: public jni::JavaClass<JSilentData> {
|
|
23
|
-
public:
|
|
24
|
-
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/audioconcat/SilentData;";
|
|
25
|
-
|
|
26
|
-
public:
|
|
27
|
-
/**
|
|
28
|
-
* Convert this Java/Kotlin-based struct to the C++ struct SilentData by copying all values to C++.
|
|
29
|
-
*/
|
|
30
|
-
[[maybe_unused]]
|
|
31
|
-
[[nodiscard]]
|
|
32
|
-
SilentData toCpp() const {
|
|
33
|
-
static const auto clazz = javaClassStatic();
|
|
34
|
-
static const auto fieldDurationMs = clazz->getField<double>("durationMs");
|
|
35
|
-
double durationMs = this->getFieldValue(fieldDurationMs);
|
|
36
|
-
return SilentData(
|
|
37
|
-
durationMs
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public:
|
|
42
|
-
/**
|
|
43
|
-
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
44
|
-
*/
|
|
45
|
-
[[maybe_unused]]
|
|
46
|
-
static jni::local_ref<JSilentData::javaobject> fromCpp(const SilentData& value) {
|
|
47
|
-
return newInstance(
|
|
48
|
-
value.durationMs
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
} // namespace margelo::nitro::audioconcat
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// AudioData.kt
|
|
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
|
-
package com.margelo.nitro.audioconcat
|
|
9
|
-
|
|
10
|
-
import androidx.annotation.Keep
|
|
11
|
-
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
-
import com.margelo.nitro.core.*
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Represents the JavaScript object/struct "AudioData".
|
|
17
|
-
*/
|
|
18
|
-
@DoNotStrip
|
|
19
|
-
@Keep
|
|
20
|
-
data class AudioData
|
|
21
|
-
@DoNotStrip
|
|
22
|
-
@Keep
|
|
23
|
-
constructor(
|
|
24
|
-
@DoNotStrip
|
|
25
|
-
@Keep
|
|
26
|
-
val filePath: String
|
|
27
|
-
) {
|
|
28
|
-
/* main constructor */
|
|
29
|
-
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/audioconcat/AudioDataOrSilence.kt
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// AudioDataOrSilence.kt
|
|
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
|
-
package com.margelo.nitro.audioconcat
|
|
9
|
-
|
|
10
|
-
import com.facebook.proguard.annotations.DoNotStrip
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Represents the TypeScript variant "AudioData|SilentData".
|
|
15
|
-
*/
|
|
16
|
-
@Suppress("ClassName")
|
|
17
|
-
@DoNotStrip
|
|
18
|
-
sealed class AudioDataOrSilence {
|
|
19
|
-
@DoNotStrip
|
|
20
|
-
data class First(@DoNotStrip val value: AudioData): AudioDataOrSilence()
|
|
21
|
-
@DoNotStrip
|
|
22
|
-
data class Second(@DoNotStrip val value: SilentData): AudioDataOrSilence()
|
|
23
|
-
|
|
24
|
-
inline fun <reified T> getAs(): T? = when (this) {
|
|
25
|
-
is First -> value as? T
|
|
26
|
-
is Second -> value as? T
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
val isFirst: Boolean
|
|
30
|
-
get() = this is First
|
|
31
|
-
val isSecond: Boolean
|
|
32
|
-
get() = this is Second
|
|
33
|
-
|
|
34
|
-
companion object {
|
|
35
|
-
@JvmStatic
|
|
36
|
-
@DoNotStrip
|
|
37
|
-
fun create(value: AudioData): AudioDataOrSilence = First(value)
|
|
38
|
-
@JvmStatic
|
|
39
|
-
@DoNotStrip
|
|
40
|
-
fun create(value: SilentData): AudioDataOrSilence = Second(value)
|
|
41
|
-
}
|
|
42
|
-
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/audioconcat/HybridAudioConcatSpec.kt
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridAudioConcatSpec.kt
|
|
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
|
-
package com.margelo.nitro.audioconcat
|
|
9
|
-
|
|
10
|
-
import androidx.annotation.Keep
|
|
11
|
-
import com.facebook.jni.HybridData
|
|
12
|
-
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
-
import com.margelo.nitro.core.*
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* A Kotlin class representing the AudioConcat HybridObject.
|
|
17
|
-
* Implement this abstract class to create Kotlin-based instances of AudioConcat.
|
|
18
|
-
*/
|
|
19
|
-
@DoNotStrip
|
|
20
|
-
@Keep
|
|
21
|
-
@Suppress(
|
|
22
|
-
"KotlinJniMissingFunction", "unused",
|
|
23
|
-
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
24
|
-
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
25
|
-
)
|
|
26
|
-
abstract class HybridAudioConcatSpec: HybridObject() {
|
|
27
|
-
@DoNotStrip
|
|
28
|
-
private var mHybridData: HybridData = initHybrid()
|
|
29
|
-
|
|
30
|
-
init {
|
|
31
|
-
super.updateNative(mHybridData)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
override fun updateNative(hybridData: HybridData) {
|
|
35
|
-
mHybridData = hybridData
|
|
36
|
-
super.updateNative(hybridData)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Properties
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// Methods
|
|
43
|
-
@DoNotStrip
|
|
44
|
-
@Keep
|
|
45
|
-
abstract fun concatAudioFiles(data: Array<AudioDataOrSilence>, outputPath: String): Promise<String>
|
|
46
|
-
|
|
47
|
-
private external fun initHybrid(): HybridData
|
|
48
|
-
|
|
49
|
-
companion object {
|
|
50
|
-
private const val TAG = "HybridAudioConcatSpec"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// SilentData.kt
|
|
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
|
-
package com.margelo.nitro.audioconcat
|
|
9
|
-
|
|
10
|
-
import androidx.annotation.Keep
|
|
11
|
-
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
-
import com.margelo.nitro.core.*
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Represents the JavaScript object/struct "SilentData".
|
|
17
|
-
*/
|
|
18
|
-
@DoNotStrip
|
|
19
|
-
@Keep
|
|
20
|
-
data class SilentData
|
|
21
|
-
@DoNotStrip
|
|
22
|
-
@Keep
|
|
23
|
-
constructor(
|
|
24
|
-
@DoNotStrip
|
|
25
|
-
@Keep
|
|
26
|
-
val durationMs: Double
|
|
27
|
-
) {
|
|
28
|
-
/* main constructor */
|
|
29
|
-
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/audioconcat/audioconcatOnLoad.kt
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// audioconcatOnLoad.kt
|
|
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
|
-
package com.margelo.nitro.audioconcat
|
|
9
|
-
|
|
10
|
-
import android.util.Log
|
|
11
|
-
|
|
12
|
-
internal class audioconcatOnLoad {
|
|
13
|
-
companion object {
|
|
14
|
-
private const val TAG = "audioconcatOnLoad"
|
|
15
|
-
private var didLoad = false
|
|
16
|
-
/**
|
|
17
|
-
* Initializes the native part of "audioconcat".
|
|
18
|
-
* This method is idempotent and can be called more than once.
|
|
19
|
-
*/
|
|
20
|
-
@JvmStatic
|
|
21
|
-
fun initializeNative() {
|
|
22
|
-
if (didLoad) return
|
|
23
|
-
try {
|
|
24
|
-
Log.i(TAG, "Loading audioconcat C++ library...")
|
|
25
|
-
System.loadLibrary("audioconcat")
|
|
26
|
-
Log.i(TAG, "Successfully loaded audioconcat C++ library!")
|
|
27
|
-
didLoad = true
|
|
28
|
-
} catch (e: Error) {
|
|
29
|
-
Log.e(TAG, "Failed to load audioconcat C++ library! Is it properly installed and linked? " +
|
|
30
|
-
"Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
|
|
31
|
-
throw e
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# AudioConcat+autolinking.rb
|
|
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
|
-
# 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/AudioConcat+autolinking.rb'
|
|
18
|
-
# add_nitrogen_files(spec)
|
|
19
|
-
# end
|
|
20
|
-
# ```
|
|
21
|
-
|
|
22
|
-
def add_nitrogen_files(spec)
|
|
23
|
-
Pod::UI.puts "[NitroModules] 🔥 AudioConcat 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/AudioConcat-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 C)
|
|
56
|
-
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
|
-
# Enables stricter modular headers
|
|
58
|
-
"DEFINES_MODULE" => "YES",
|
|
59
|
-
})
|
|
60
|
-
end
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// AudioConcat-Swift-Cxx-Bridge.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 "AudioConcat-Swift-Cxx-Bridge.hpp"
|
|
9
|
-
|
|
10
|
-
// Include C++ implementation defined types
|
|
11
|
-
#include "AudioConcat-Swift-Cxx-Umbrella.hpp"
|
|
12
|
-
#include "HybridAudioConcatSpecSwift.hpp"
|
|
13
|
-
|
|
14
|
-
namespace margelo::nitro::audioconcat::bridge::swift {
|
|
15
|
-
|
|
16
|
-
// pragma MARK: std::function<void(const std::string& /* result */)>
|
|
17
|
-
Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
18
|
-
auto swiftClosure = AudioConcat::Func_void_std__string::fromUnsafe(swiftClosureWrapper);
|
|
19
|
-
return [swiftClosure = std::move(swiftClosure)](const std::string& result) mutable -> void {
|
|
20
|
-
swiftClosure.call(result);
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
25
|
-
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
26
|
-
auto swiftClosure = AudioConcat::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
|
|
27
|
-
return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
|
|
28
|
-
swiftClosure.call(error);
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// pragma MARK: std::shared_ptr<HybridAudioConcatSpec>
|
|
33
|
-
std::shared_ptr<HybridAudioConcatSpec> create_std__shared_ptr_HybridAudioConcatSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
34
|
-
AudioConcat::HybridAudioConcatSpec_cxx swiftPart = AudioConcat::HybridAudioConcatSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
35
|
-
return std::make_shared<margelo::nitro::audioconcat::HybridAudioConcatSpecSwift>(swiftPart);
|
|
36
|
-
}
|
|
37
|
-
void* NON_NULL get_std__shared_ptr_HybridAudioConcatSpec_(std__shared_ptr_HybridAudioConcatSpec_ cppType) noexcept {
|
|
38
|
-
std::shared_ptr<margelo::nitro::audioconcat::HybridAudioConcatSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::audioconcat::HybridAudioConcatSpecSwift>(cppType);
|
|
39
|
-
#ifdef NITRO_DEBUG
|
|
40
|
-
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
41
|
-
throw std::runtime_error("Class \"HybridAudioConcatSpec\" is not implemented in Swift!");
|
|
42
|
-
}
|
|
43
|
-
#endif
|
|
44
|
-
AudioConcat::HybridAudioConcatSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
45
|
-
return swiftPart.toUnsafe();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
} // namespace margelo::nitro::audioconcat::bridge::swift
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// AudioConcat-Swift-Cxx-Bridge.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
|
-
// Forward declarations of Swift defined types
|
|
19
|
-
// Forward declaration of `HybridAudioConcatSpec_cxx` to properly resolve imports.
|
|
20
|
-
namespace AudioConcat { class HybridAudioConcatSpec_cxx; }
|
|
21
|
-
|
|
22
|
-
// Include C++ defined types
|
|
23
|
-
#include "AudioData.hpp"
|
|
24
|
-
#include "HybridAudioConcatSpec.hpp"
|
|
25
|
-
#include "SilentData.hpp"
|
|
26
|
-
#include <NitroModules/FastVectorCopy.hpp>
|
|
27
|
-
#include <NitroModules/Promise.hpp>
|
|
28
|
-
#include <NitroModules/PromiseHolder.hpp>
|
|
29
|
-
#include <NitroModules/Result.hpp>
|
|
30
|
-
#include <exception>
|
|
31
|
-
#include <functional>
|
|
32
|
-
#include <memory>
|
|
33
|
-
#include <string>
|
|
34
|
-
#include <variant>
|
|
35
|
-
#include <vector>
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
39
|
-
* as well as helper functions to interact with those C++ types from Swift.
|
|
40
|
-
*/
|
|
41
|
-
namespace margelo::nitro::audioconcat::bridge::swift {
|
|
42
|
-
|
|
43
|
-
// pragma MARK: std::shared_ptr<Promise<std::string>>
|
|
44
|
-
/**
|
|
45
|
-
* Specialized version of `std::shared_ptr<Promise<std::string>>`.
|
|
46
|
-
*/
|
|
47
|
-
using std__shared_ptr_Promise_std__string__ = std::shared_ptr<Promise<std::string>>;
|
|
48
|
-
inline std::shared_ptr<Promise<std::string>> create_std__shared_ptr_Promise_std__string__() noexcept {
|
|
49
|
-
return Promise<std::string>::create();
|
|
50
|
-
}
|
|
51
|
-
inline PromiseHolder<std::string> wrap_std__shared_ptr_Promise_std__string__(std::shared_ptr<Promise<std::string>> promise) noexcept {
|
|
52
|
-
return PromiseHolder<std::string>(std::move(promise));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// pragma MARK: std::function<void(const std::string& /* result */)>
|
|
56
|
-
/**
|
|
57
|
-
* Specialized version of `std::function<void(const std::string&)>`.
|
|
58
|
-
*/
|
|
59
|
-
using Func_void_std__string = std::function<void(const std::string& /* result */)>;
|
|
60
|
-
/**
|
|
61
|
-
* Wrapper class for a `std::function<void(const std::string& / * result * /)>`, this can be used from Swift.
|
|
62
|
-
*/
|
|
63
|
-
class Func_void_std__string_Wrapper final {
|
|
64
|
-
public:
|
|
65
|
-
explicit Func_void_std__string_Wrapper(std::function<void(const std::string& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::string& /* result */)>>(std::move(func))) {}
|
|
66
|
-
inline void call(std::string result) const noexcept {
|
|
67
|
-
_function->operator()(result);
|
|
68
|
-
}
|
|
69
|
-
private:
|
|
70
|
-
std::unique_ptr<std::function<void(const std::string& /* result */)>> _function;
|
|
71
|
-
} SWIFT_NONCOPYABLE;
|
|
72
|
-
Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
73
|
-
inline Func_void_std__string_Wrapper wrap_Func_void_std__string(Func_void_std__string value) noexcept {
|
|
74
|
-
return Func_void_std__string_Wrapper(std::move(value));
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
78
|
-
/**
|
|
79
|
-
* Specialized version of `std::function<void(const std::exception_ptr&)>`.
|
|
80
|
-
*/
|
|
81
|
-
using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
|
|
82
|
-
/**
|
|
83
|
-
* Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
|
|
84
|
-
*/
|
|
85
|
-
class Func_void_std__exception_ptr_Wrapper final {
|
|
86
|
-
public:
|
|
87
|
-
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))) {}
|
|
88
|
-
inline void call(std::exception_ptr error) const noexcept {
|
|
89
|
-
_function->operator()(error);
|
|
90
|
-
}
|
|
91
|
-
private:
|
|
92
|
-
std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
|
|
93
|
-
} SWIFT_NONCOPYABLE;
|
|
94
|
-
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
95
|
-
inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
|
|
96
|
-
return Func_void_std__exception_ptr_Wrapper(std::move(value));
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// pragma MARK: std::variant<AudioData, SilentData>
|
|
100
|
-
/**
|
|
101
|
-
* Wrapper struct for `std::variant<AudioData, SilentData>`.
|
|
102
|
-
* std::variant cannot be used in Swift because of a Swift bug.
|
|
103
|
-
* Not even specializing it works. So we create a wrapper struct.
|
|
104
|
-
*/
|
|
105
|
-
struct std__variant_AudioData__SilentData_ {
|
|
106
|
-
std::variant<AudioData, SilentData> variant;
|
|
107
|
-
std__variant_AudioData__SilentData_(std::variant<AudioData, SilentData> variant): variant(variant) { }
|
|
108
|
-
operator std::variant<AudioData, SilentData>() const noexcept {
|
|
109
|
-
return variant;
|
|
110
|
-
}
|
|
111
|
-
inline size_t index() const noexcept {
|
|
112
|
-
return variant.index();
|
|
113
|
-
}
|
|
114
|
-
inline AudioData get_0() const noexcept {
|
|
115
|
-
return std::get<0>(variant);
|
|
116
|
-
}
|
|
117
|
-
inline SilentData get_1() const noexcept {
|
|
118
|
-
return std::get<1>(variant);
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
inline std__variant_AudioData__SilentData_ create_std__variant_AudioData__SilentData_(const AudioData& value) noexcept {
|
|
122
|
-
return std__variant_AudioData__SilentData_(value);
|
|
123
|
-
}
|
|
124
|
-
inline std__variant_AudioData__SilentData_ create_std__variant_AudioData__SilentData_(const SilentData& value) noexcept {
|
|
125
|
-
return std__variant_AudioData__SilentData_(value);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// pragma MARK: std::vector<std::variant<AudioData, SilentData>>
|
|
129
|
-
/**
|
|
130
|
-
* Specialized version of `std::vector<std::variant<AudioData, SilentData>>`.
|
|
131
|
-
*/
|
|
132
|
-
using std__vector_std__variant_AudioData__SilentData__ = std::vector<std::variant<AudioData, SilentData>>;
|
|
133
|
-
inline std::vector<std::variant<AudioData, SilentData>> create_std__vector_std__variant_AudioData__SilentData__(size_t size) noexcept {
|
|
134
|
-
std::vector<std::variant<AudioData, SilentData>> vector;
|
|
135
|
-
vector.reserve(size);
|
|
136
|
-
return vector;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// pragma MARK: std::shared_ptr<HybridAudioConcatSpec>
|
|
140
|
-
/**
|
|
141
|
-
* Specialized version of `std::shared_ptr<HybridAudioConcatSpec>`.
|
|
142
|
-
*/
|
|
143
|
-
using std__shared_ptr_HybridAudioConcatSpec_ = std::shared_ptr<HybridAudioConcatSpec>;
|
|
144
|
-
std::shared_ptr<HybridAudioConcatSpec> create_std__shared_ptr_HybridAudioConcatSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
145
|
-
void* NON_NULL get_std__shared_ptr_HybridAudioConcatSpec_(std__shared_ptr_HybridAudioConcatSpec_ cppType) noexcept;
|
|
146
|
-
|
|
147
|
-
// pragma MARK: std::weak_ptr<HybridAudioConcatSpec>
|
|
148
|
-
using std__weak_ptr_HybridAudioConcatSpec_ = std::weak_ptr<HybridAudioConcatSpec>;
|
|
149
|
-
inline std__weak_ptr_HybridAudioConcatSpec_ weakify_std__shared_ptr_HybridAudioConcatSpec_(const std::shared_ptr<HybridAudioConcatSpec>& strong) noexcept { return strong; }
|
|
150
|
-
|
|
151
|
-
// pragma MARK: Result<std::shared_ptr<Promise<std::string>>>
|
|
152
|
-
using Result_std__shared_ptr_Promise_std__string___ = Result<std::shared_ptr<Promise<std::string>>>;
|
|
153
|
-
inline Result_std__shared_ptr_Promise_std__string___ create_Result_std__shared_ptr_Promise_std__string___(const std::shared_ptr<Promise<std::string>>& value) noexcept {
|
|
154
|
-
return Result<std::shared_ptr<Promise<std::string>>>::withValue(value);
|
|
155
|
-
}
|
|
156
|
-
inline Result_std__shared_ptr_Promise_std__string___ create_Result_std__shared_ptr_Promise_std__string___(const std::exception_ptr& error) noexcept {
|
|
157
|
-
return Result<std::shared_ptr<Promise<std::string>>>::withError(error);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
} // namespace margelo::nitro::audioconcat::bridge::swift
|
|
@@ -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
|