YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
audioRecorder_nwc_yarp_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
8#include <yarp/os/Network.h>
9#include <yarp/sig/Image.h>
10#include <yarp/sig/Vector.h>
11#include <yarp/dev/PolyDriver.h>
13#include <yarp/os/Time.h>
14
15#include <string>
16
17#include <catch2/catch_amalgamated.hpp>
18#include <harness.h>
19
20using namespace yarp::os;
21using namespace yarp::dev;
22using namespace yarp::sig;
23
24
25TEST_CASE("dev::audioRecorder_nwc_yarp", "[yarp::dev]")
26{
27 YARP_REQUIRE_PLUGIN("fakeMicrophone", "device");
28 YARP_REQUIRE_PLUGIN("audioRecorder_nws_yarp", "device");
29 YARP_REQUIRE_PLUGIN("audioRecorder_nwc_yarp", "device");
30
31 Network::setLocalMode(true);
32
33 SECTION("Test the audioRecorder_nwc_yarp device with a audioRecorder_nws_yarp device")
34 {
41
42 p_nws.put("device","audioRecorder_nws_yarp");
43 p_nws.put("name", "/audioRecorder_nws");
44 p_fake.put("device","fakeMicrophone");
48
51 bool result_att = ww_nws->attach(&dd_fake);
53
54 p_nwc.put("device", "audioRecorder_nwc_yarp");
55 p_nwc.put("remote", "/audioRecorder_nws");
56 p_nwc.put("local", "/audioRecorder_nwc");
58
59 IAudioGrabberSound* igrab = nullptr;
60 REQUIRE(dd_nwc.view(igrab));
61
63
64 CHECK (igrab->stopRecording());
65 bool isrec = false;
66 CHECK (igrab->isRecording(isrec)); CHECK(isrec == false);
67 CHECK (igrab->startRecording());
68 CHECK (igrab->isRecording(isrec)); CHECK(isrec == true);
69 CHECK (igrab->stopRecording());
70 CHECK (igrab->isRecording(isrec)); CHECK(isrec == false);
71 CHECK (igrab->setHWGain(0.5));
72 CHECK (igrab->setSWGain(0.5));
73
75
79 }
80
81 Network::setLocalMode(false);
82}
contains the definition of a Vector type
TEST_CASE("dev::audioRecorder_nwc_yarp", "[yarp::dev]")
Read a YARP-format sound block from a device.
A container for a device driver.
Definition PolyDriver.h:23
Helper interface for an object that can wrap/or "attach" to a single other device.
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:33
static void delaySystem(double seconds)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.