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>
94 lines
3.5 KiB
C++
Generated
94 lines
3.5 KiB
C++
Generated
///
|
|
/// HybridTtsSessionSpec.hpp
|
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
/// https://github.com/mrousavy/nitro
|
|
/// Copyright © Marc Rousavy @ Margelo
|
|
///
|
|
|
|
#pragma once
|
|
|
|
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
#include <NitroModules/HybridObject.hpp>
|
|
#else
|
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
#endif
|
|
|
|
// Forward declaration of `TtsParagraph` to properly resolve imports.
|
|
namespace margelo::nitro::nitrotts { struct TtsParagraph; }
|
|
// Forward declaration of `TtsMetadata` to properly resolve imports.
|
|
namespace margelo::nitro::nitrotts { struct TtsMetadata; }
|
|
// Forward declaration of `TtsSettings` to properly resolve imports.
|
|
namespace margelo::nitro::nitrotts { struct TtsSettings; }
|
|
// Forward declaration of `ListenerSubscription` to properly resolve imports.
|
|
namespace margelo::nitro::nitrotts { struct ListenerSubscription; }
|
|
// Forward declaration of `TtsPlaybackState` to properly resolve imports.
|
|
namespace margelo::nitro::nitrotts { enum class TtsPlaybackState; }
|
|
// Forward declaration of `TtsProgress` to properly resolve imports.
|
|
namespace margelo::nitro::nitrotts { struct TtsProgress; }
|
|
|
|
#include <NitroModules/Promise.hpp>
|
|
#include "TtsParagraph.hpp"
|
|
#include <vector>
|
|
#include "TtsMetadata.hpp"
|
|
#include "TtsSettings.hpp"
|
|
#include "ListenerSubscription.hpp"
|
|
#include "TtsPlaybackState.hpp"
|
|
#include <functional>
|
|
#include "TtsProgress.hpp"
|
|
#include <string>
|
|
|
|
namespace margelo::nitro::nitrotts {
|
|
|
|
using namespace margelo::nitro;
|
|
|
|
/**
|
|
* An abstract base class for `TtsSession`
|
|
* Inherit this class to create instances of `HybridTtsSessionSpec` in C++.
|
|
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
* @example
|
|
* ```cpp
|
|
* class HybridTtsSession: public HybridTtsSessionSpec {
|
|
* public:
|
|
* HybridTtsSession(...): HybridObject(TAG) { ... }
|
|
* // ...
|
|
* };
|
|
* ```
|
|
*/
|
|
class HybridTtsSessionSpec: public virtual HybridObject {
|
|
public:
|
|
// Constructor
|
|
explicit HybridTtsSessionSpec(): HybridObject(TAG) { }
|
|
|
|
// Destructor
|
|
~HybridTtsSessionSpec() override = default;
|
|
|
|
public:
|
|
// Properties
|
|
|
|
|
|
public:
|
|
// Methods
|
|
virtual std::shared_ptr<Promise<void>> load(const std::vector<TtsParagraph>& paragraphs, double initialIndex, const TtsMetadata& metadata, const TtsSettings& settings) = 0;
|
|
virtual std::shared_ptr<Promise<void>> play() = 0;
|
|
virtual std::shared_ptr<Promise<void>> pause() = 0;
|
|
virtual std::shared_ptr<Promise<void>> stop() = 0;
|
|
virtual std::shared_ptr<Promise<void>> skipPrevious() = 0;
|
|
virtual std::shared_ptr<Promise<void>> skipNext() = 0;
|
|
virtual std::shared_ptr<Promise<void>> replayCurrent() = 0;
|
|
virtual std::shared_ptr<Promise<void>> seekTo(double index) = 0;
|
|
virtual std::shared_ptr<Promise<void>> updateSettings(const TtsSettings& settings) = 0;
|
|
virtual ListenerSubscription addOnStateChangedListener(const std::function<void(TtsPlaybackState /* state */)>& listener) = 0;
|
|
virtual ListenerSubscription addOnProgressChangedListener(const std::function<void(const TtsProgress& /* progress */)>& listener) = 0;
|
|
virtual ListenerSubscription addOnErrorListener(const std::function<void(const std::string& /* message */)>& listener) = 0;
|
|
|
|
protected:
|
|
// Hybrid Setup
|
|
void loadHybridMethods() override;
|
|
|
|
protected:
|
|
// Tag for logging
|
|
static constexpr auto TAG = "TtsSession";
|
|
};
|
|
|
|
} // namespace margelo::nitro::nitrotts
|