Files
Rajarshee Chatterjee 74808f086e feat: Replace Legacy Media Controls with Nitro-Powered Playback (#1896)
* 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>
2026-07-24 23:42:17 +05:30

71 lines
2.5 KiB
C++
Generated

///
/// JTtsSettings.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 "TtsSettings.hpp"
#include <optional>
#include <string>
namespace margelo::nitro::nitrotts {
using namespace facebook;
/**
* The C++ JNI bridge between the C++ struct "TtsSettings" and the Kotlin data class "TtsSettings".
*/
struct JTtsSettings final: public jni::JavaClass<JTtsSettings> {
public:
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitrotts/TtsSettings;";
public:
/**
* Convert this Java/Kotlin-based struct to the C++ struct TtsSettings by copying all values to C++.
*/
[[maybe_unused]]
[[nodiscard]]
TtsSettings toCpp() const {
static const auto clazz = javaClassStatic();
static const auto fieldEngineName = clazz->getField<jni::JString>("engineName");
jni::local_ref<jni::JString> engineName = this->getFieldValue(fieldEngineName);
static const auto fieldVoiceIdentifier = clazz->getField<jni::JString>("voiceIdentifier");
jni::local_ref<jni::JString> voiceIdentifier = this->getFieldValue(fieldVoiceIdentifier);
static const auto fieldRate = clazz->getField<double>("rate");
double rate = this->getFieldValue(fieldRate);
static const auto fieldPitch = clazz->getField<double>("pitch");
double pitch = this->getFieldValue(fieldPitch);
return TtsSettings(
engineName != nullptr ? std::make_optional(engineName->toStdString()) : std::nullopt,
voiceIdentifier != nullptr ? std::make_optional(voiceIdentifier->toStdString()) : std::nullopt,
rate,
pitch
);
}
public:
/**
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
*/
[[maybe_unused]]
static jni::local_ref<JTtsSettings::javaobject> fromCpp(const TtsSettings& value) {
using JSignature = JTtsSettings(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, double, double);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
value.engineName.has_value() ? jni::make_jstring(value.engineName.value()) : nullptr,
value.voiceIdentifier.has_value() ? jni::make_jstring(value.voiceIdentifier.value()) : nullptr,
value.rate,
value.pitch
);
}
};
} // namespace margelo::nitro::nitrotts