// AUTOGENERATED FILE - DO NOT MODIFY!
// This file was generated by Djinni from tts_backend.djinni

#include "java/jni/AbstractTextToSpeechBackend.hpp"  // my header
#include "java/jni/AudioCallback.hpp"
#include "java/jni/BackendError.hpp"
#include "java/jni/Unit.hpp"
#include "java/support/jni/DataView_jni.hpp"
#include "java/support/jni/Marshal.hpp"
#include "java/support/jni/Outcome_jni.hpp"

namespace prism::jni {

AbstractTextToSpeechBackend::AbstractTextToSpeechBackend() : ::djinni::JniInterface<::prism::java::AbstractTextToSpeechBackend, AbstractTextToSpeechBackend>() {}

AbstractTextToSpeechBackend::~AbstractTextToSpeechBackend() = default;

AbstractTextToSpeechBackend::JavaProxy::JavaProxy(JniType j) : Handle(::djinni::jniGetThreadEnv(), j) { }

AbstractTextToSpeechBackend::JavaProxy::~JavaProxy() = default;

std::string AbstractTextToSpeechBackend::JavaProxy::get_name() {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = (jstring)jniEnv->CallObjectMethod(Handle::get().get(), data.method_getName);
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::String::toCpp(jniEnv, jret);
}
djinni::expected<::prism::java::Unit, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::initialize() {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_initialize);
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::prism::jni::Unit, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<::prism::java::Unit, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::speak(const ::djinni::DataView & c_text, bool c_interrupt) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_speak,
                                         ::djinni::get(::djinni::NativeDataView::fromCpp(jniEnv, c_text)),
                                         ::djinni::get(::djinni::Bool::fromCpp(jniEnv, c_interrupt)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::prism::jni::Unit, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<::prism::java::Unit, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::speak_to_memory(const ::djinni::DataView & c_text, const /*not-null*/ std::shared_ptr<::prism::java::AudioCallback> & c_callback, int64_t c_userdata) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_speakToMemory,
                                         ::djinni::get(::djinni::NativeDataView::fromCpp(jniEnv, c_text)),
                                         ::djinni::get(::prism::jni::AudioCallback::fromCpp(jniEnv, c_callback)),
                                         ::djinni::get(::djinni::I64::fromCpp(jniEnv, c_userdata)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::prism::jni::Unit, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<::prism::java::Unit, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::braille(const ::djinni::DataView & c_text) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_braille,
                                         ::djinni::get(::djinni::NativeDataView::fromCpp(jniEnv, c_text)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::prism::jni::Unit, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<::prism::java::Unit, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::output(const ::djinni::DataView & c_text, bool c_interrupt) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_output,
                                         ::djinni::get(::djinni::NativeDataView::fromCpp(jniEnv, c_text)),
                                         ::djinni::get(::djinni::Bool::fromCpp(jniEnv, c_interrupt)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::prism::jni::Unit, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<bool, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::is_speaking() {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_isSpeaking);
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::djinni::Bool, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<::prism::java::Unit, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::stop() {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_stop);
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::prism::jni::Unit, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<::prism::java::Unit, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::pause() {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_pause);
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::prism::jni::Unit, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<::prism::java::Unit, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::resume() {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_resume);
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::prism::jni::Unit, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<::prism::java::Unit, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::set_volume(float c_volume) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_setVolume,
                                         ::djinni::get(::djinni::F32::fromCpp(jniEnv, c_volume)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::prism::jni::Unit, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<float, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::get_volume() {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_getVolume);
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::djinni::F32, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<::prism::java::Unit, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::set_rate(float c_rate) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_setRate,
                                         ::djinni::get(::djinni::F32::fromCpp(jniEnv, c_rate)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::prism::jni::Unit, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<float, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::get_rate() {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_getRate);
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::djinni::F32, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<::prism::java::Unit, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::set_pitch(float c_pitch) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_setPitch,
                                         ::djinni::get(::djinni::F32::fromCpp(jniEnv, c_pitch)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::prism::jni::Unit, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<float, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::get_pitch() {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_getPitch);
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::djinni::F32, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<::prism::java::Unit, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::refresh_voices() {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_refreshVoices);
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::prism::jni::Unit, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<int64_t, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::count_voices() {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_countVoices);
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::djinni::I64, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<std::string, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::get_voice_name(int64_t c_id) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_getVoiceName,
                                         ::djinni::get(::djinni::I64::fromCpp(jniEnv, c_id)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::djinni::String, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<std::string, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::get_voice_language(int64_t c_id) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_getVoiceLanguage,
                                         ::djinni::get(::djinni::I64::fromCpp(jniEnv, c_id)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::djinni::String, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<::prism::java::Unit, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::set_voice(int64_t c_id) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_setVoice,
                                         ::djinni::get(::djinni::I64::fromCpp(jniEnv, c_id)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::prism::jni::Unit, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<int64_t, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::get_voice() {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_getVoice);
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::djinni::I64, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<int64_t, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::get_channels() {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_getChannels);
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::djinni::I64, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<int64_t, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::get_sample_rate() {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_getSampleRate);
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::djinni::I64, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}
djinni::expected<int64_t, ::prism::java::BackendError> AbstractTextToSpeechBackend::JavaProxy::get_bit_depth() {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::prism::jni::AbstractTextToSpeechBackend>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_getBitDepth);
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Outcome<::djinni::I64, ::prism::jni::BackendError>::toCpp(jniEnv, jret);
}

} // namespace prism::jni
