PlatformSpeechSynthesisUtterance.h [plain text]
#pragma once
#if ENABLE(SPEECH_SYNTHESIS)
#include "PlatformSpeechSynthesisVoice.h"
namespace WebCore {
class PlatformSpeechSynthesisUtteranceClient {
};
class PlatformSpeechSynthesisUtterance : public RefCounted<PlatformSpeechSynthesisUtterance> {
public:
static Ref<PlatformSpeechSynthesisUtterance> create(PlatformSpeechSynthesisUtteranceClient&);
const String& text() const { return m_text; }
void setText(const String& text) { m_text = text; }
const String& lang() const { return m_lang; }
void setLang(const String& lang) { m_lang = lang; }
PlatformSpeechSynthesisVoice* voice() const { return m_voice.get(); }
void setVoice(PlatformSpeechSynthesisVoice* voice) { m_voice = voice; }
float volume() const { return m_volume; }
void setVolume(float volume) { m_volume = std::max(std::min(1.0f, volume), 0.0f); }
float rate() const { return m_rate; }
void setRate(float rate) { m_rate = std::max(std::min(10.0f, rate), 0.1f); }
float pitch() const { return m_pitch; }
void setPitch(float pitch) { m_pitch = std::max(std::min(2.0f, pitch), 0.0f); }
double startTime() const { return m_startTime; }
void setStartTime(double startTime) { m_startTime = startTime; }
PlatformSpeechSynthesisUtteranceClient* client() const { return m_client; }
void setClient(PlatformSpeechSynthesisUtteranceClient* client) { m_client = client; }
private:
explicit PlatformSpeechSynthesisUtterance(PlatformSpeechSynthesisUtteranceClient&);
PlatformSpeechSynthesisUtteranceClient* m_client;
String m_text;
String m_lang;
RefPtr<PlatformSpeechSynthesisVoice> m_voice;
float m_volume { 1 };
float m_rate { 1 };
float m_pitch { 1 };
double m_startTime { 0 };
};
}
#endif // ENABLE(SPEECH_SYNTHESIS)