YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
fakeSpeechSynthesizer_test.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023-2023 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
7#include <yarp/os/Network.h>
11
12#include <catch2/catch_amalgamated.hpp>
13#include <harness.h>
14
15using namespace yarp::dev;
16using namespace yarp::os;
17
18TEST_CASE("dev::fakeSpeechSynthesizer", "[yarp::dev]")
19{
20 YARP_REQUIRE_PLUGIN("fakeSpeechSynthesizer", "device");
21
22 Network::setLocalMode(true);
23
24 SECTION("Checking fakeSpeechSynthesizer device")
25 {
28
29 //open the device
30 {
32 pdev_cfg.put("device", "fakeSpeechSynthesizer");
35
36 REQUIRE(ddfake.view(istr));
37 }
38
39 std::string lang = "eng";
40 CHECK(istr->getLanguage(lang));
41 CHECK(lang=="auto");
42
43 CHECK(istr->setLanguage("eng"));
44 CHECK(istr->getLanguage(lang));
45 CHECK(lang == "eng");
46
48 CHECK(istr->synthesize("hello world",snd));
49 CHECK(snd.getChannels()==2);
50 CHECK(snd.getSamples()==100);
51
52 yarp::sig::VectorOfString available_voices;
53 CHECK(istr->getAvailableVoices(available_voices));
54 CHECK(available_voices.size() == 3);
55 CHECK(available_voices[0] == "voice1");
56 CHECK(available_voices[1] == "voice2");
57 CHECK(available_voices[2] == "voice3");
58
59 //"Close all polydrivers and check"
60 {
63 }
64 }
65
66 Network::setLocalMode(false);
67}
A generic interface for speech synthesis.
A container for a device driver.
Definition PolyDriver.h:23
A mini-server for performing network communication in the background.
void close() override
Stop port activity.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
A class for storing options and configuration information.
Definition Property.h:32
Class for storing sounds See Audio in YARP for additional documentation on YARP audio.
Definition Sound.h:39
size_t size() const
Returns the number of elements in the vector.
Definition VectorBase.h:167
TEST_CASE("dev::fakeSpeechSynthesizer", "[yarp::dev]")
void exec_params_test(yarp::dev::PolyDriver *pdrv)
For streams capable of holding different kinds of content, check what they actually have.
void delay(double seconds)
Wait for a certain number of seconds.
Definition Time.cpp:111
An interface to the operating system, including Port based communication.