YARP
Yet Another Robot Platform
audioFromFileDevice.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
10 #include <yarp/sig/Sound.h>
11 #include <yarp/sig/SoundFile.h>
12 
13 #include <string>
14 #include <mutex>
15 
38 {
39 public:
45  ~audioFromFileDevice() override;
46 
47  // Device Driver interface
48  bool open(yarp::os::Searchable &config) override;
49  bool close() override;
50 
51 private:
52  //thread
53  bool threadInit() override;
54  void run() override;
55 
56 public:
57  bool setHWGain(double gain) override;
58 
59 private:
60  yarp::sig::Sound m_audioFile;
61  std::string m_audio_filename = "audio.wav";
62  size_t m_bpnt = 0;
63  size_t m_samples_to_be_copied = 512;
64  size_t m_fsize_in_samples = 0;
65  std::vector<std::reference_wrapper<yarp::sig::Sound::audio_sample>> m_datap;
66 };
audioFromFileDevice : This device driver, wrapped by default by AudioRecorderWrapper,...
audioFromFileDevice & operator=(audioFromFileDevice &&)=delete
audioFromFileDevice(audioFromFileDevice &&)=delete
bool close() override
Close the DeviceDriver.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
audioFromFileDevice(const audioFromFileDevice &)=delete
bool setHWGain(double gain) override
Sets the hardware gain of the grabbing device (if supported by the hardware)
audioFromFileDevice & operator=(const audioFromFileDevice &)=delete
AudioRecorderDeviceBase : a base class for all audio recorder devices
Interface implemented by all device drivers.
Definition: DeviceDriver.h:35
An abstraction for a periodic thread.
A base class for nested structures that can be searched.
Definition: Searchable.h:66
Class for storing sounds See Audio in YARP for additional documentation on YARP audio.
Definition: Sound.h:26