74808f086e
* feat: Replace Legacy Media Controls with Nitro-Powered Playback * feat: Add TTS Engine Selection * chore: Remove User-Facing Error Reporting * refactor: Combine `Tts` and `TtsSession` Imports from `nitro-tts` Module --------- Co-authored-by: Claude <noreply@anthropic.com>
115 lines
5.8 KiB
C++
Generated
115 lines
5.8 KiB
C++
Generated
///
|
|
/// NitroTts-Swift-Cxx-Bridge.cpp
|
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
/// https://github.com/mrousavy/nitro
|
|
/// Copyright © Marc Rousavy @ Margelo
|
|
///
|
|
|
|
#include "NitroTts-Swift-Cxx-Bridge.hpp"
|
|
|
|
// Include C++ implementation defined types
|
|
#include "HybridTtsFactorySpecSwift.hpp"
|
|
#include "HybridTtsSessionSpecSwift.hpp"
|
|
#include "NitroTts-Swift-Cxx-Umbrella.hpp"
|
|
#include <NitroModules/NitroDefines.hpp>
|
|
|
|
namespace margelo::nitro::nitrotts::bridge::swift {
|
|
|
|
// pragma MARK: std::shared_ptr<HybridTtsSessionSpec>
|
|
std::shared_ptr<HybridTtsSessionSpec> create_std__shared_ptr_HybridTtsSessionSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
NitroTts::HybridTtsSessionSpec_cxx swiftPart = NitroTts::HybridTtsSessionSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
return std::make_shared<margelo::nitro::nitrotts::HybridTtsSessionSpecSwift>(swiftPart);
|
|
}
|
|
void* NON_NULL get_std__shared_ptr_HybridTtsSessionSpec_(std__shared_ptr_HybridTtsSessionSpec_ cppType) {
|
|
std::shared_ptr<margelo::nitro::nitrotts::HybridTtsSessionSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::nitrotts::HybridTtsSessionSpecSwift>(cppType);
|
|
#ifdef NITRO_DEBUG
|
|
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
throw std::runtime_error("Class \"HybridTtsSessionSpec\" is not implemented in Swift!");
|
|
}
|
|
#endif
|
|
NitroTts::HybridTtsSessionSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
return swiftPart.toUnsafe();
|
|
}
|
|
|
|
// pragma MARK: std::function<void(const std::shared_ptr<HybridTtsSessionSpec>& /* result */)>
|
|
Func_void_std__shared_ptr_HybridTtsSessionSpec_ create_Func_void_std__shared_ptr_HybridTtsSessionSpec_(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
auto swiftClosure = NitroTts::Func_void_std__shared_ptr_HybridTtsSessionSpec_::fromUnsafe(swiftClosureWrapper);
|
|
return [swiftClosure = std::move(swiftClosure)](const std::shared_ptr<HybridTtsSessionSpec>& result) mutable -> void {
|
|
swiftClosure.call(result);
|
|
};
|
|
}
|
|
|
|
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
auto swiftClosure = NitroTts::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
|
|
return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
|
|
swiftClosure.call(error);
|
|
};
|
|
}
|
|
|
|
// pragma MARK: std::function<void(const std::vector<TtsEngine>& /* result */)>
|
|
Func_void_std__vector_TtsEngine_ create_Func_void_std__vector_TtsEngine_(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
auto swiftClosure = NitroTts::Func_void_std__vector_TtsEngine_::fromUnsafe(swiftClosureWrapper);
|
|
return [swiftClosure = std::move(swiftClosure)](const std::vector<TtsEngine>& result) mutable -> void {
|
|
swiftClosure.call(result);
|
|
};
|
|
}
|
|
|
|
// pragma MARK: std::function<void(const std::vector<TtsVoice>& /* result */)>
|
|
Func_void_std__vector_TtsVoice_ create_Func_void_std__vector_TtsVoice_(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
auto swiftClosure = NitroTts::Func_void_std__vector_TtsVoice_::fromUnsafe(swiftClosureWrapper);
|
|
return [swiftClosure = std::move(swiftClosure)](const std::vector<TtsVoice>& result) mutable -> void {
|
|
swiftClosure.call(result);
|
|
};
|
|
}
|
|
|
|
// pragma MARK: std::shared_ptr<HybridTtsFactorySpec>
|
|
std::shared_ptr<HybridTtsFactorySpec> create_std__shared_ptr_HybridTtsFactorySpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
NitroTts::HybridTtsFactorySpec_cxx swiftPart = NitroTts::HybridTtsFactorySpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
return std::make_shared<margelo::nitro::nitrotts::HybridTtsFactorySpecSwift>(swiftPart);
|
|
}
|
|
void* NON_NULL get_std__shared_ptr_HybridTtsFactorySpec_(std__shared_ptr_HybridTtsFactorySpec_ cppType) {
|
|
std::shared_ptr<margelo::nitro::nitrotts::HybridTtsFactorySpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::nitrotts::HybridTtsFactorySpecSwift>(cppType);
|
|
#ifdef NITRO_DEBUG
|
|
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
throw std::runtime_error("Class \"HybridTtsFactorySpec\" is not implemented in Swift!");
|
|
}
|
|
#endif
|
|
NitroTts::HybridTtsFactorySpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
return swiftPart.toUnsafe();
|
|
}
|
|
|
|
// pragma MARK: std::function<void()>
|
|
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
auto swiftClosure = NitroTts::Func_void::fromUnsafe(swiftClosureWrapper);
|
|
return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
|
|
swiftClosure.call();
|
|
};
|
|
}
|
|
|
|
// pragma MARK: std::function<void(TtsPlaybackState /* state */)>
|
|
Func_void_TtsPlaybackState create_Func_void_TtsPlaybackState(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
auto swiftClosure = NitroTts::Func_void_TtsPlaybackState::fromUnsafe(swiftClosureWrapper);
|
|
return [swiftClosure = std::move(swiftClosure)](TtsPlaybackState state) mutable -> void {
|
|
swiftClosure.call(static_cast<int>(state));
|
|
};
|
|
}
|
|
|
|
// pragma MARK: std::function<void(const TtsProgress& /* progress */)>
|
|
Func_void_TtsProgress create_Func_void_TtsProgress(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
auto swiftClosure = NitroTts::Func_void_TtsProgress::fromUnsafe(swiftClosureWrapper);
|
|
return [swiftClosure = std::move(swiftClosure)](const TtsProgress& progress) mutable -> void {
|
|
swiftClosure.call(progress);
|
|
};
|
|
}
|
|
|
|
// pragma MARK: std::function<void(const std::string& /* message */)>
|
|
Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
auto swiftClosure = NitroTts::Func_void_std__string::fromUnsafe(swiftClosureWrapper);
|
|
return [swiftClosure = std::move(swiftClosure)](const std::string& message) mutable -> void {
|
|
swiftClosure.call(message);
|
|
};
|
|
}
|
|
|
|
} // namespace margelo::nitro::nitrotts::bridge::swift
|