YARP
Yet Another Robot Platform
AudioRecorderDeviceBase.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
9 #include <vector>
10 
11 #include <yarp/os/Searchable.h>
13 #include <yarp/dev/api.h>
15 #include <mutex>
16 
17 #ifndef YARP_DEV_AUDIORECORDERDEVICETEMPLATE_H
18 #define YARP_DEV_AUDIORECORDERDEVICETEMPLATE_H
19 
20 namespace yarp {
21 namespace dev {
22 
23 
25 {
26  public:
27  size_t numSamples = 0;
28  size_t numChannels = 0;
29  size_t frequency = 0;
30  size_t bytesPerSample = 0;
31 };
32 
34 {
35 protected:
36  bool m_isRecording = false;
37  std::mutex m_mutex;
38  yarp::dev::CircularAudioBuffer_16t* m_inputBuffer = nullptr;
39 
41 
42 public:
43  virtual bool getSound(yarp::sig::Sound& sound, size_t min_number_of_samples, size_t max_number_of_samples, double max_samples_timeout_s) override;
44  virtual bool startRecording() override;
45  virtual bool stopRecording() override;
46  virtual bool getRecordingAudioBufferMaxSize(yarp::dev::AudioBufferSize& size) override;
47  virtual bool getRecordingAudioBufferCurrentSize(yarp::dev::AudioBufferSize& size) override;
48  virtual bool resetRecordingAudioBuffer() override;
49 
50  virtual ~AudioRecorderDeviceBase();
51 };
52 
53 } // namespace dev
54 } // namespace yarp
55 
56 #endif
yarp::dev::AudioDeviceDriverSettings::bytesPerSample
size_t bytesPerSample
Definition: AudioRecorderDeviceBase.h:30
yarp::dev::AudioRecorderDeviceBase::m_mutex
std::mutex m_mutex
Definition: AudioRecorderDeviceBase.h:37
CircularAudioBuffer.h
yarp::dev::AudioBufferSize
Definition: AudioBufferSize.h:26
yarp::dev::AudioDeviceDriverSettings::numChannels
size_t numChannels
Definition: AudioRecorderDeviceBase.h:28
yarp::dev::AudioDeviceDriverSettings::numSamples
size_t numSamples
Definition: AudioRecorderDeviceBase.h:27
AudioGrabberInterfaces.h
yarp::dev::AudioRecorderDeviceBase
Definition: AudioRecorderDeviceBase.h:34
Searchable.h
yarp::dev::AudioDeviceDriverSettings::frequency
size_t frequency
Definition: AudioRecorderDeviceBase.h:29
yarp::dev::CircularAudioBuffer
Definition: CircularAudioBuffer.h:25
yarp::dev::IAudioGrabberSound
Read a YARP-format sound block from a device.
Definition: IAudioGrabberSound.h:26
yarp::dev::AudioRecorderDeviceBase::m_audiorecorder_cfg
AudioDeviceDriverSettings m_audiorecorder_cfg
Definition: AudioRecorderDeviceBase.h:40
YARP_dev_API
#define YARP_dev_API
Definition: api.h:19
yarp::dev::AudioDeviceDriverSettings
Definition: AudioRecorderDeviceBase.h:25
yarp::sig::Sound
Class for storing sounds.
Definition: Sound.h:28
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
api.h