Skip to content

Commit

Permalink
cleanup and changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
randaz81 committed Jan 22, 2025
1 parent 11197c1 commit 40a95a3
Show file tree
Hide file tree
Showing 16 changed files with 197 additions and 188 deletions.
9 changes: 9 additions & 0 deletions doc/release/master.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,12 @@ New Features

* added new datatype `yarp::sig::LayeredImage`
* added `yarp::sig::utils::sum()` to transform `yarp::sig::LayeredImage` to `yarp::sig::Image`

#### `libYARP_dev`

* added new class `yarp::dev::ReturnValue`
* modified interfaces `yarp::dev::ISpeechSynthesizer`,`yarp::dev::ISpeechTranscription` to use the new class ReturnValue.

#### `devices`

* modified devices implementing `yarp::dev::ISpeechSynthesizer`,`yarp::dev::ISpeechTranscription` to use the new class ReturnValue.
38 changes: 19 additions & 19 deletions src/devices/fake/fakeSpeechSynthesizer/FakeSpeechSynthesizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,67 +40,67 @@ bool FakeSpeechSynthesizer::close()
return true;
}

yarp_ret_value FakeSpeechSynthesizer::setLanguage(const std::string& language)
ReturnValue FakeSpeechSynthesizer::setLanguage(const std::string& language)
{
m_language=language;
yCInfo(FAKE_SPEECHSYN) << "Language set to" << language;
return yarp_ret_value_ok;
return ReturnValue_ok;
}

yarp_ret_value FakeSpeechSynthesizer::getLanguage(std::string& language)
ReturnValue FakeSpeechSynthesizer::getLanguage(std::string& language)
{
language = m_language;
return yarp_ret_value_ok;
return ReturnValue_ok;
}

yarp_ret_value FakeSpeechSynthesizer::setVoice(const std::string& voice)
ReturnValue FakeSpeechSynthesizer::setVoice(const std::string& voice)
{
m_voice = voice;
yCInfo(FAKE_SPEECHSYN) << "Voice set to" << voice;
return yarp_ret_value_ok;
return ReturnValue_ok;
}

yarp_ret_value FakeSpeechSynthesizer::getVoice(std::string& voice)
ReturnValue FakeSpeechSynthesizer::getVoice(std::string& voice)
{
voice = m_voice;
return yarp_ret_value_ok;
return ReturnValue_ok;
}

yarp_ret_value FakeSpeechSynthesizer::setSpeed(const double speed)
ReturnValue FakeSpeechSynthesizer::setSpeed(const double speed)
{
m_speed = speed;
yCInfo(FAKE_SPEECHSYN) << "Speed set to" << speed;
return yarp_ret_value_ok;
return ReturnValue_ok;
}

yarp_ret_value FakeSpeechSynthesizer::getSpeed(double& speed)
ReturnValue FakeSpeechSynthesizer::getSpeed(double& speed)
{
speed = m_speed;
return yarp_ret_value_ok;
return ReturnValue_ok;
}

yarp_ret_value FakeSpeechSynthesizer::setPitch(const double pitch)
ReturnValue FakeSpeechSynthesizer::setPitch(const double pitch)
{
m_pitch = pitch;
yCInfo(FAKE_SPEECHSYN) << "Pitch set to" << pitch;
return yarp_ret_value_ok;
return ReturnValue_ok;
}

yarp_ret_value FakeSpeechSynthesizer::getPitch(double& pitch)
ReturnValue FakeSpeechSynthesizer::getPitch(double& pitch)
{
pitch = m_pitch;
return yarp_ret_value_ok;
return ReturnValue_ok;
}

yarp_ret_value FakeSpeechSynthesizer::synthesize(const std::string& text, yarp::sig::Sound& sound)
ReturnValue FakeSpeechSynthesizer::synthesize(const std::string& text, yarp::sig::Sound& sound)
{
if (text == "")
{
yCError(FAKE_SPEECHSYN) << "Text is empty";
return yarp_ret_value::return_code::return_value_error_method_failed;
return ReturnValue::return_code::return_value_error_method_failed;
}

sound.resize(100,2);

return yarp_ret_value_ok;
return ReturnValue_ok;
}
18 changes: 9 additions & 9 deletions src/devices/fake/fakeSpeechSynthesizer/FakeSpeechSynthesizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ class FakeSpeechSynthesizer :
bool open(yarp::os::Searchable& config) override;
bool close() override;

virtual yarp::dev::yarp_ret_value setLanguage(const std::string& language) override;
virtual yarp::dev::yarp_ret_value getLanguage(std::string& language) override;
virtual yarp::dev::yarp_ret_value setVoice(const std::string& voice) override;
virtual yarp::dev::yarp_ret_value getVoice(std::string& voice) override;
virtual yarp::dev::yarp_ret_value setSpeed(const double speed) override;
virtual yarp::dev::yarp_ret_value getSpeed(double& voice) override;
virtual yarp::dev::yarp_ret_value setPitch(const double pitch) override;
virtual yarp::dev::yarp_ret_value getPitch(double& voice) override;
virtual yarp::dev::yarp_ret_value synthesize(const std::string& text, yarp::sig::Sound& sound) override;
virtual yarp::dev::ReturnValue setLanguage(const std::string& language) override;
virtual yarp::dev::ReturnValue getLanguage(std::string& language) override;
virtual yarp::dev::ReturnValue setVoice(const std::string& voice) override;
virtual yarp::dev::ReturnValue getVoice(std::string& voice) override;
virtual yarp::dev::ReturnValue setSpeed(const double speed) override;
virtual yarp::dev::ReturnValue getSpeed(double& voice) override;
virtual yarp::dev::ReturnValue setPitch(const double pitch) override;
virtual yarp::dev::ReturnValue getPitch(double& voice) override;
virtual yarp::dev::ReturnValue synthesize(const std::string& text, yarp::sig::Sound& sound) override;
};

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -40,31 +40,31 @@ bool FakeSpeechTranscription::close()
return true;
}

yarp::dev::yarp_ret_value FakeSpeechTranscription::setLanguage(const std::string& language)
yarp::dev::ReturnValue FakeSpeechTranscription::setLanguage(const std::string& language)
{
m_language=language;
yCInfo(FAKE_SPEECHTR) << "Language set to" << language;
return yarp_ret_value_ok;
return ReturnValue_ok;
}

yarp::dev::yarp_ret_value FakeSpeechTranscription::getLanguage(std::string& language)
yarp::dev::ReturnValue FakeSpeechTranscription::getLanguage(std::string& language)
{
language = m_language;
return yarp_ret_value_ok;
return ReturnValue_ok;
}

yarp::dev::yarp_ret_value FakeSpeechTranscription::transcribe(const yarp::sig::Sound& sound, std::string& transcription, double& score)
yarp::dev::ReturnValue FakeSpeechTranscription::transcribe(const yarp::sig::Sound& sound, std::string& transcription, double& score)
{
if (sound.getSamples() == 0 ||
sound.getChannels() == 0)
{
yCError(FAKE_SPEECHTR) << "Invalid Sound sample received";
transcription = "";
score = 0.0;
return yarp_ret_value::return_code::return_value_error_method_failed;
return ReturnValue::return_code::return_value_error_method_failed;
}

transcription = "hello world";
score = 1.0;
return yarp_ret_value_ok;
return ReturnValue_ok;
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ class FakeSpeechTranscription :
bool open(yarp::os::Searchable& config) override;
bool close() override;

virtual yarp::dev::yarp_ret_value setLanguage(const std::string& language) override;
virtual yarp::dev::yarp_ret_value getLanguage(std::string& language) override;
virtual yarp::dev::yarp_ret_value transcribe(const yarp::sig::Sound& sound, std::string& transcription, double& score) override;
virtual yarp::dev::ReturnValue setLanguage(const std::string& language) override;
virtual yarp::dev::ReturnValue getLanguage(std::string& language) override;
virtual yarp::dev::ReturnValue transcribe(const yarp::sig::Sound& sound, std::string& transcription, double& score) override;
};

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ bool SpeechSynthesizer_nwc_yarp::closeMain()
return true;
}

yarp_ret_value SpeechSynthesizer_nwc_yarp::setLanguage(const std::string& language)
ReturnValue SpeechSynthesizer_nwc_yarp::setLanguage(const std::string& language)
{
auto result = m_thriftClient.set_language(language);
if(!result.ret)
Expand All @@ -76,7 +76,7 @@ yarp_ret_value SpeechSynthesizer_nwc_yarp::setLanguage(const std::string& langua
return result.ret;
}

yarp_ret_value SpeechSynthesizer_nwc_yarp::getLanguage(std::string& language)
ReturnValue SpeechSynthesizer_nwc_yarp::getLanguage(std::string& language)
{
auto result = m_thriftClient.get_language();
if(!result.ret)
Expand All @@ -90,7 +90,7 @@ yarp_ret_value SpeechSynthesizer_nwc_yarp::getLanguage(std::string& language)
return result.ret;
}

yarp_ret_value SpeechSynthesizer_nwc_yarp::setVoice(const std::string& voice_name)
ReturnValue SpeechSynthesizer_nwc_yarp::setVoice(const std::string& voice_name)
{
auto result = m_thriftClient.set_voice(voice_name);
if(!result.ret)
Expand All @@ -102,7 +102,7 @@ yarp_ret_value SpeechSynthesizer_nwc_yarp::setVoice(const std::string& voice_nam
return result.ret;
}

yarp_ret_value SpeechSynthesizer_nwc_yarp::getVoice(std::string& voice_name)
ReturnValue SpeechSynthesizer_nwc_yarp::getVoice(std::string& voice_name)
{
auto result = m_thriftClient.get_voice();
if(!result.ret)
Expand All @@ -116,7 +116,7 @@ yarp_ret_value SpeechSynthesizer_nwc_yarp::getVoice(std::string& voice_name)
return result.ret;
}

yarp_ret_value SpeechSynthesizer_nwc_yarp::setSpeed(const double speed)
ReturnValue SpeechSynthesizer_nwc_yarp::setSpeed(const double speed)
{
auto result = m_thriftClient.set_speed(speed);
if(!result.ret)
Expand All @@ -128,7 +128,7 @@ yarp_ret_value SpeechSynthesizer_nwc_yarp::setSpeed(const double speed)
return result.ret;
}

yarp_ret_value SpeechSynthesizer_nwc_yarp::getSpeed(double& speed)
ReturnValue SpeechSynthesizer_nwc_yarp::getSpeed(double& speed)
{
auto result = m_thriftClient.get_speed();
if(!result.ret)
Expand All @@ -142,7 +142,7 @@ yarp_ret_value SpeechSynthesizer_nwc_yarp::getSpeed(double& speed)
return result.ret;
}

yarp_ret_value SpeechSynthesizer_nwc_yarp::setPitch(const double pitch)
ReturnValue SpeechSynthesizer_nwc_yarp::setPitch(const double pitch)
{
auto result = m_thriftClient.set_pitch(pitch);
if(!result.ret)
Expand All @@ -154,7 +154,7 @@ yarp_ret_value SpeechSynthesizer_nwc_yarp::setPitch(const double pitch)
return result.ret;
}

yarp_ret_value SpeechSynthesizer_nwc_yarp::getPitch(double& pitch)
ReturnValue SpeechSynthesizer_nwc_yarp::getPitch(double& pitch)
{
auto result = m_thriftClient.get_pitch();
if(!result.ret)
Expand All @@ -168,7 +168,7 @@ yarp_ret_value SpeechSynthesizer_nwc_yarp::getPitch(double& pitch)
return result.ret;
}

yarp_ret_value SpeechSynthesizer_nwc_yarp::synthesize(const std::string& text, yarp::sig::Sound& sound)
ReturnValue SpeechSynthesizer_nwc_yarp::synthesize(const std::string& text, yarp::sig::Sound& sound)
{
auto result = m_thriftClient.synthesize(text);
if(!result.ret)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ class SpeechSynthesizer_nwc_yarp :
bool close() override;

// yarp::dev::ISpeechSynthesizer
yarp::dev::yarp_ret_value setLanguage(const std::string& language="auto") override;
yarp::dev::yarp_ret_value getLanguage(std::string& language) override;
yarp::dev::yarp_ret_value setVoice(const std::string& voice_name = "auto") override;
yarp::dev::yarp_ret_value getVoice(std::string& voice_name) override;
yarp::dev::yarp_ret_value setSpeed(const double speed=0) override;
yarp::dev::yarp_ret_value getSpeed(double& speed) override;
yarp::dev::yarp_ret_value setPitch(const double pitch) override;
yarp::dev::yarp_ret_value getPitch(double& pitch) override;
yarp::dev::yarp_ret_value synthesize(const std::string& text, yarp::sig::Sound& sound) override;
yarp::dev::ReturnValue setLanguage(const std::string& language="auto") override;
yarp::dev::ReturnValue getLanguage(std::string& language) override;
yarp::dev::ReturnValue setVoice(const std::string& voice_name = "auto") override;
yarp::dev::ReturnValue getVoice(std::string& voice_name) override;
yarp::dev::ReturnValue setSpeed(const double speed=0) override;
yarp::dev::ReturnValue getSpeed(double& speed) override;
yarp::dev::ReturnValue setPitch(const double pitch) override;
yarp::dev::ReturnValue getPitch(double& pitch) override;
yarp::dev::ReturnValue synthesize(const std::string& text, yarp::sig::Sound& sound) override;

// Parameters
private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ return_set_language ISpeechSynthesizerMsgsd::set_language(const std::string& lan
return m_isptr->setLanguage(language);
}
yCError(SPEECHSYNTH_NWS, "ISpeechSynthesizer interface was not set");
ret.ret = yarp_ret_value::return_code::return_value_error_generic;
ret.ret = ReturnValue::return_code::return_value_error_generic;
return ret;
}

Expand All @@ -133,13 +133,13 @@ return_get_language ISpeechSynthesizerMsgsd::get_language()
if (m_isptr)
{
std::string language;
yarp_ret_value b = m_isptr->getLanguage(language);
ReturnValue b = m_isptr->getLanguage(language);
ret.ret = b;
ret.language = language;
return ret;
}
yCError(SPEECHSYNTH_NWS, "ISpeechSynthesizer interface was not set");
ret.ret = yarp_ret_value::return_code::return_value_error_generic;
ret.ret = ReturnValue::return_code::return_value_error_generic;
return ret;
}

Expand All @@ -162,13 +162,13 @@ return_get_voice ISpeechSynthesizerMsgsd::get_voice()
if (m_isptr)
{
std::string voice;
yarp_ret_value b = m_isptr->getVoice(voice);
ReturnValue b = m_isptr->getVoice(voice);
ret.ret = b;
ret.voice = voice;
return ret;
}
yCError(SPEECHSYNTH_NWS, "ISpeechSynthesizer interface was not set");
ret.ret = yarp_ret_value::return_code::return_value_error_generic;
ret.ret = ReturnValue::return_code::return_value_error_generic;
return ret;
}

Expand All @@ -181,7 +181,7 @@ return_set_pitch ISpeechSynthesizerMsgsd::set_pitch(double pitch)
return m_isptr->setPitch(pitch);
}
yCError(SPEECHSYNTH_NWS, "ISpeechSynthesizer interface was not set");
ret.ret = yarp_ret_value::return_code::return_value_error_generic;
ret.ret = ReturnValue::return_code::return_value_error_generic;
return ret;
}

Expand All @@ -192,7 +192,7 @@ return_get_pitch ISpeechSynthesizerMsgsd::get_pitch()
if (m_isptr)
{
double pitch;
yarp_ret_value b = m_isptr->getPitch(pitch);
ReturnValue b = m_isptr->getPitch(pitch);
ret.ret = b;
ret.pitch = pitch;
return ret;
Expand All @@ -210,7 +210,7 @@ return_set_speed ISpeechSynthesizerMsgsd::set_speed(double speed)
return m_isptr->setSpeed(speed);
}
yCError(SPEECHSYNTH_NWS, "ISpeechSynthesizer interface was not set");
ret.ret = yarp_ret_value::return_code::return_value_error_generic;
ret.ret = ReturnValue::return_code::return_value_error_generic;
return ret;
}

Expand All @@ -221,13 +221,13 @@ return_get_speed ISpeechSynthesizerMsgsd::get_speed()
if (m_isptr)
{
double speed;
yarp_ret_value b = m_isptr->getSpeed(speed);
ReturnValue b = m_isptr->getSpeed(speed);
ret.ret = b;
ret.speed = speed;
return ret;
}
yCError(SPEECHSYNTH_NWS, "ISpeechSynthesizer interface was not set");
ret.ret = yarp_ret_value::return_code::return_value_error_generic;
ret.ret = ReturnValue::return_code::return_value_error_generic;
return ret;
}

Expand All @@ -239,7 +239,7 @@ return_synthesize ISpeechSynthesizerMsgsd::synthesize(const std::string& text)
{
yarp::sig::Sound snd;
double score;
yarp_ret_value b = m_isptr->synthesize(text, snd);
ReturnValue b = m_isptr->synthesize(text, snd);
ret.ret = b;
ret.sound = snd;

Expand All @@ -251,7 +251,7 @@ return_synthesize ISpeechSynthesizerMsgsd::synthesize(const std::string& text)
return ret;
}
yCError(SPEECHSYNTH_NWS, "ISpeechSynthesizer interface was not set");
ret.ret = yarp_ret_value::return_code::return_value_error_generic;
ret.ret = ReturnValue::return_code::return_value_error_generic;
return ret;
}

Expand Down
Loading

0 comments on commit 40a95a3

Please sign in to comment.