From 5e6e1e8838fe7637ef588e0fb080ad07fc5700aa Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Sun, 17 Mar 2013 13:41:49 +0000 Subject: Winter Speak plugin added (not adopted) git-svn-id: http://svn.miranda-ng.org/main/trunk@4076 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- .../WinterSpeak/speak/config/speech_interface.cpp | 91 ++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 plugins/!NotAdopted/WinterSpeak/speak/config/speech_interface.cpp (limited to 'plugins/!NotAdopted/WinterSpeak/speak/config/speech_interface.cpp') diff --git a/plugins/!NotAdopted/WinterSpeak/speak/config/speech_interface.cpp b/plugins/!NotAdopted/WinterSpeak/speak/config/speech_interface.cpp new file mode 100644 index 0000000000..c80a219165 --- /dev/null +++ b/plugins/!NotAdopted/WinterSpeak/speak/config/speech_interface.cpp @@ -0,0 +1,91 @@ +//============================================================================== +// Miranda Speak Plugin, © 2002 Ryan Winter +//============================================================================== + +#pragma warning(disable:4786) + +#include "speech_interface.h" + +#include "config/config_database.h" + +#include +#include +#include + +//------------------------------------------------------------------------------ +// public: +//------------------------------------------------------------------------------ +SpeechInterface::SpeechInterface() +{ + CLASSCERR("SpeechInterface::SpeechInterface"); +} + +//------------------------------------------------------------------------------ +SpeechInterface::~SpeechInterface() +{ + CLASSCERR("SpeechInterface::~SpeechInterface"); +} + +//------------------------------------------------------------------------------ +TextToSpeech * +SpeechInterface::createTts(std::string &engine) const +{ + CLASSCERR("SpeechInterface::createTts()"); + + TextToSpeech *tts = 0; + + if (SpeechApi40a::getDescription() == engine) + { + tts = new SpeechApi40a(); + } + else if (SpeechApi51::getDescription() == engine) + { + tts = new SpeechApi51(); + } + + CLASSCERR("SpeechInterface::createTts() return " << tts); + return tts; +} + +//------------------------------------------------------------------------------ +void +SpeechInterface::configureTts(TextToSpeech *tts, const VoiceDesc &desc) const +{ + CLASSCERR("SpeechInterface::configureTts(" << tts << ",)"); + + if (!tts) + { + return; + } + + tts->setVoice(desc.voice); + tts->setVolume(desc.volume); + tts->setRate(desc.rate); + tts->setPitch(desc.pitch); + tts->load(); +} + +//------------------------------------------------------------------------------ +std::vector +SpeechInterface::getAvailableEngines() +{ + CLASSCERR("SpeechInterface::getAvailableEngines"); + + std::vector engines; + + SpeechApi40a sapi40a; + if (sapi40a.isAvailable()) + { + engines.push_back(SpeechApi40a::getDescription()); + } + + SpeechApi51 sapi51; + if (sapi51.isAvailable()) + { + engines.push_back(SpeechApi51::getDescription()); + } + + return engines; +} + +//============================================================================== -- cgit v1.2.3