react-native-audio-concat 0.2.3 → 0.4.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/audioconcat/AudioConcatModule.kt +1178 -0
- 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/AudioConcat.kt +0 -349
- 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
|
-
/// JAudioData.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 "AudioData.hpp"
|
|
12
|
-
|
|
13
|
-
#include <string>
|
|
14
|
-
|
|
15
|
-
namespace margelo::nitro::audioconcat {
|
|
16
|
-
|
|
17
|
-
using namespace facebook;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* The C++ JNI bridge between the C++ struct "AudioData" and the the Kotlin data class "AudioData".
|
|
21
|
-
*/
|
|
22
|
-
struct JAudioData final: public jni::JavaClass<JAudioData> {
|
|
23
|
-
public:
|
|
24
|
-
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/audioconcat/AudioData;";
|
|
25
|
-
|
|
26
|
-
public:
|
|
27
|
-
/**
|
|
28
|
-
* Convert this Java/Kotlin-based struct to the C++ struct AudioData by copying all values to C++.
|
|
29
|
-
*/
|
|
30
|
-
[[maybe_unused]]
|
|
31
|
-
[[nodiscard]]
|
|
32
|
-
AudioData toCpp() const {
|
|
33
|
-
static const auto clazz = javaClassStatic();
|
|
34
|
-
static const auto fieldFilePath = clazz->getField<jni::JString>("filePath");
|
|
35
|
-
jni::local_ref<jni::JString> filePath = this->getFieldValue(fieldFilePath);
|
|
36
|
-
return AudioData(
|
|
37
|
-
filePath->toStdString()
|
|
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<JAudioData::javaobject> fromCpp(const AudioData& value) {
|
|
47
|
-
return newInstance(
|
|
48
|
-
jni::make_jstring(value.filePath)
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
} // namespace margelo::nitro::audioconcat
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// JAudioDataOrSilence.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 "JAudioDataOrSilence.hpp"
|
|
9
|
-
|
|
10
|
-
namespace margelo::nitro::audioconcat {
|
|
11
|
-
/**
|
|
12
|
-
* Converts JAudioDataOrSilence to std::variant<AudioData, SilentData>
|
|
13
|
-
*/
|
|
14
|
-
std::variant<AudioData, SilentData> JAudioDataOrSilence::toCpp() const {
|
|
15
|
-
if (isInstanceOf(JAudioDataOrSilence_impl::First::javaClassStatic())) {
|
|
16
|
-
// It's a `AudioData`
|
|
17
|
-
auto jniValue = static_cast<const JAudioDataOrSilence_impl::First*>(this)->getValue();
|
|
18
|
-
return jniValue->toCpp();
|
|
19
|
-
} else if (isInstanceOf(JAudioDataOrSilence_impl::Second::javaClassStatic())) {
|
|
20
|
-
// It's a `SilentData`
|
|
21
|
-
auto jniValue = static_cast<const JAudioDataOrSilence_impl::Second*>(this)->getValue();
|
|
22
|
-
return jniValue->toCpp();
|
|
23
|
-
}
|
|
24
|
-
throw std::invalid_argument("Variant is unknown Kotlin instance!");
|
|
25
|
-
}
|
|
26
|
-
} // namespace margelo::nitro::audioconcat
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// JAudioDataOrSilence.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 <variant>
|
|
12
|
-
|
|
13
|
-
#include "AudioData.hpp"
|
|
14
|
-
#include "SilentData.hpp"
|
|
15
|
-
#include <variant>
|
|
16
|
-
#include "JAudioData.hpp"
|
|
17
|
-
#include <string>
|
|
18
|
-
#include "JSilentData.hpp"
|
|
19
|
-
|
|
20
|
-
namespace margelo::nitro::audioconcat {
|
|
21
|
-
|
|
22
|
-
using namespace facebook;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* The C++ JNI bridge between the C++ std::variant and the Java class "AudioDataOrSilence".
|
|
26
|
-
*/
|
|
27
|
-
class JAudioDataOrSilence: public jni::JavaClass<JAudioDataOrSilence> {
|
|
28
|
-
public:
|
|
29
|
-
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/audioconcat/AudioDataOrSilence;";
|
|
30
|
-
|
|
31
|
-
static jni::local_ref<JAudioDataOrSilence> create_0(jni::alias_ref<JAudioData> value) {
|
|
32
|
-
static const auto method = javaClassStatic()->getStaticMethod<JAudioDataOrSilence(jni::alias_ref<JAudioData>)>("create");
|
|
33
|
-
return method(javaClassStatic(), value);
|
|
34
|
-
}
|
|
35
|
-
static jni::local_ref<JAudioDataOrSilence> create_1(jni::alias_ref<JSilentData> value) {
|
|
36
|
-
static const auto method = javaClassStatic()->getStaticMethod<JAudioDataOrSilence(jni::alias_ref<JSilentData>)>("create");
|
|
37
|
-
return method(javaClassStatic(), value);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
static jni::local_ref<JAudioDataOrSilence> fromCpp(const std::variant<AudioData, SilentData>& variant) {
|
|
41
|
-
switch (variant.index()) {
|
|
42
|
-
case 0: return create_0(JAudioData::fromCpp(std::get<0>(variant)));
|
|
43
|
-
case 1: return create_1(JSilentData::fromCpp(std::get<1>(variant)));
|
|
44
|
-
default: throw std::invalid_argument("Variant holds unknown index! (" + std::to_string(variant.index()) + ")");
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
[[nodiscard]] std::variant<AudioData, SilentData> toCpp() const;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
namespace JAudioDataOrSilence_impl {
|
|
52
|
-
class First: public jni::JavaClass<First, JAudioDataOrSilence> {
|
|
53
|
-
public:
|
|
54
|
-
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/audioconcat/AudioDataOrSilence$First;";
|
|
55
|
-
|
|
56
|
-
[[nodiscard]] jni::local_ref<JAudioData> getValue() const {
|
|
57
|
-
static const auto field = javaClassStatic()->getField<JAudioData>("value");
|
|
58
|
-
return getFieldValue(field);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
class Second: public jni::JavaClass<Second, JAudioDataOrSilence> {
|
|
63
|
-
public:
|
|
64
|
-
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/audioconcat/AudioDataOrSilence$Second;";
|
|
65
|
-
|
|
66
|
-
[[nodiscard]] jni::local_ref<JSilentData> getValue() const {
|
|
67
|
-
static const auto field = javaClassStatic()->getField<JSilentData>("value");
|
|
68
|
-
return getFieldValue(field);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
} // namespace JAudioDataOrSilence_impl
|
|
72
|
-
} // namespace margelo::nitro::audioconcat
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// JHybridAudioConcatSpec.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 "JHybridAudioConcatSpec.hpp"
|
|
9
|
-
|
|
10
|
-
// Forward declaration of `AudioData` to properly resolve imports.
|
|
11
|
-
namespace margelo::nitro::audioconcat { struct AudioData; }
|
|
12
|
-
// Forward declaration of `SilentData` to properly resolve imports.
|
|
13
|
-
namespace margelo::nitro::audioconcat { struct SilentData; }
|
|
14
|
-
|
|
15
|
-
#include <string>
|
|
16
|
-
#include <NitroModules/Promise.hpp>
|
|
17
|
-
#include <NitroModules/JPromise.hpp>
|
|
18
|
-
#include "AudioData.hpp"
|
|
19
|
-
#include "SilentData.hpp"
|
|
20
|
-
#include <variant>
|
|
21
|
-
#include <vector>
|
|
22
|
-
#include "JAudioDataOrSilence.hpp"
|
|
23
|
-
#include "JAudioData.hpp"
|
|
24
|
-
#include "JSilentData.hpp"
|
|
25
|
-
|
|
26
|
-
namespace margelo::nitro::audioconcat {
|
|
27
|
-
|
|
28
|
-
jni::local_ref<JHybridAudioConcatSpec::jhybriddata> JHybridAudioConcatSpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
29
|
-
return makeCxxInstance(jThis);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
void JHybridAudioConcatSpec::registerNatives() {
|
|
33
|
-
registerHybrid({
|
|
34
|
-
makeNativeMethod("initHybrid", JHybridAudioConcatSpec::initHybrid),
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
size_t JHybridAudioConcatSpec::getExternalMemorySize() noexcept {
|
|
39
|
-
static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
|
|
40
|
-
return method(_javaPart);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
void JHybridAudioConcatSpec::dispose() noexcept {
|
|
44
|
-
static const auto method = javaClassStatic()->getMethod<void()>("dispose");
|
|
45
|
-
method(_javaPart);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Properties
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
// Methods
|
|
52
|
-
std::shared_ptr<Promise<std::string>> JHybridAudioConcatSpec::concatAudioFiles(const std::vector<std::variant<AudioData, SilentData>>& data, const std::string& outputPath) {
|
|
53
|
-
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JArrayClass<JAudioDataOrSilence>> /* data */, jni::alias_ref<jni::JString> /* outputPath */)>("concatAudioFiles");
|
|
54
|
-
auto __result = method(_javaPart, [&]() {
|
|
55
|
-
size_t __size = data.size();
|
|
56
|
-
jni::local_ref<jni::JArrayClass<JAudioDataOrSilence>> __array = jni::JArrayClass<JAudioDataOrSilence>::newArray(__size);
|
|
57
|
-
for (size_t __i = 0; __i < __size; __i++) {
|
|
58
|
-
const auto& __element = data[__i];
|
|
59
|
-
__array->setElement(__i, *JAudioDataOrSilence::fromCpp(__element));
|
|
60
|
-
}
|
|
61
|
-
return __array;
|
|
62
|
-
}(), jni::make_jstring(outputPath));
|
|
63
|
-
return [&]() {
|
|
64
|
-
auto __promise = Promise<std::string>::create();
|
|
65
|
-
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
66
|
-
auto __result = jni::static_ref_cast<jni::JString>(__boxedResult);
|
|
67
|
-
__promise->resolve(__result->toStdString());
|
|
68
|
-
});
|
|
69
|
-
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
70
|
-
jni::JniException __jniError(__throwable);
|
|
71
|
-
__promise->reject(std::make_exception_ptr(__jniError));
|
|
72
|
-
});
|
|
73
|
-
return __promise;
|
|
74
|
-
}();
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
} // namespace margelo::nitro::audioconcat
|
|
@@ -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
|