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>
67 lines
2.2 KiB
C++
Generated
67 lines
2.2 KiB
C++
Generated
///
|
|
/// JTtsVoice.hpp
|
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
/// https://github.com/mrousavy/nitro
|
|
/// Copyright © Marc Rousavy @ Margelo
|
|
///
|
|
|
|
#pragma once
|
|
|
|
#include <fbjni/fbjni.h>
|
|
#include "TtsVoice.hpp"
|
|
|
|
#include <optional>
|
|
#include <string>
|
|
|
|
namespace margelo::nitro::nitrotts {
|
|
|
|
using namespace facebook;
|
|
|
|
/**
|
|
* The C++ JNI bridge between the C++ struct "TtsVoice" and the Kotlin data class "TtsVoice".
|
|
*/
|
|
struct JTtsVoice final: public jni::JavaClass<JTtsVoice> {
|
|
public:
|
|
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitrotts/TtsVoice;";
|
|
|
|
public:
|
|
/**
|
|
* Convert this Java/Kotlin-based struct to the C++ struct TtsVoice by copying all values to C++.
|
|
*/
|
|
[[maybe_unused]]
|
|
[[nodiscard]]
|
|
TtsVoice toCpp() const {
|
|
static const auto clazz = javaClassStatic();
|
|
static const auto fieldIdentifier = clazz->getField<jni::JString>("identifier");
|
|
jni::local_ref<jni::JString> identifier = this->getFieldValue(fieldIdentifier);
|
|
static const auto fieldName = clazz->getField<jni::JString>("name");
|
|
jni::local_ref<jni::JString> name = this->getFieldValue(fieldName);
|
|
static const auto fieldLanguage = clazz->getField<jni::JString>("language");
|
|
jni::local_ref<jni::JString> language = this->getFieldValue(fieldLanguage);
|
|
return TtsVoice(
|
|
identifier->toStdString(),
|
|
name->toStdString(),
|
|
language != nullptr ? std::make_optional(language->toStdString()) : std::nullopt
|
|
);
|
|
}
|
|
|
|
public:
|
|
/**
|
|
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
*/
|
|
[[maybe_unused]]
|
|
static jni::local_ref<JTtsVoice::javaobject> fromCpp(const TtsVoice& value) {
|
|
using JSignature = JTtsVoice(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>);
|
|
static const auto clazz = javaClassStatic();
|
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
return create(
|
|
clazz,
|
|
jni::make_jstring(value.identifier),
|
|
jni::make_jstring(value.name),
|
|
value.language.has_value() ? jni::make_jstring(value.language.value()) : nullptr
|
|
);
|
|
}
|
|
};
|
|
|
|
} // namespace margelo::nitro::nitrotts
|