39 if (m_streamingPort.
open(
portname +
"/audio:o") ==
false)
65 m_streamingPort.
close();
74 m_dataThread =
nullptr;
78 delete m_statusThread;
79 m_statusThread =
nullptr;
102 if (
nullptr == m_mic)
113 m_dataThread->
start();
114 m_statusThread->
start();
130 m_dataThread->
stop();
134 m_statusThread->
stop();
152 if (
m_ARW->m_debug_enabled)
184 if (
m_ARW->m_mic ==
nullptr)
190#ifdef PRINT_DEBUG_MESSAGES
195 mic->getRecordingAudioBufferCurrentSize(
buf_cur);
216 #ifdef PRINT_DEBUG_MESSAGES
221 mic->getRecordingAudioBufferCurrentSize(
buf_cur);
225 #ifdef PRINT_DEBUG_MESSAGES
245 if (
m_ARW->m_listofsnds.size()>0)
251 for (
auto it=
m_ARW->m_listofsnds.begin();
it!=
m_ARW->m_listofsnds.end();
it++)
259 for (
auto it =
m_ARW->m_listofsnds.begin();
it !=
m_ARW->m_listofsnds.end();
it++)
262 offset+=
it->getSamples();
265 m_ARW->m_listofsnds.clear();
void run() override
Loop function.
AudioRecorder_nws_yarp * m_ARW
bool sendSound(yarp::sig::Sound &s)
AudioRecorder_nws_yarp * m_ARW
void run() override
Loop function.
size_t m_min_samples_over_network
bool m_send_sound_on_stop
size_t m_max_samples_over_network
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
~AudioRecorder_nws_yarp() override
bool close() override
Close the DeviceDriver.
friend class AudioRecorderDataThread
bool detach() override
Detach the object (you must have first called attach).
friend class AudioRecorderStatusThread
bool attach(yarp::dev::PolyDriver *driver) override
Attach to another object.
AudioRecorder_nws_yarp()
Constructor.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
void setInterface(yarp::dev::IAudioGrabberSound *_iaudiograb)
bool view(T *&x)
Get an interface to the device driver.
virtual bool getSound(yarp::sig::Sound &sound, size_t min_number_of_samples, size_t max_number_of_samples, double max_samples_timeout_s)=0
Get a sound from a device.
virtual bool getRecordingAudioBufferCurrentSize(yarp::sig::AudioBufferSize &size)=0
virtual bool getRecordingAudioBufferMaxSize(yarp::sig::AudioBufferSize &size)=0
virtual bool stopRecording()=0
Stop the recording.
virtual bool startRecording()=0
Start the recording.
virtual bool isRecording(bool &recording_enabled)=0
Check if the recording has been enabled (e.g.
A container for a device driver.
bool isValid() const
Check if device is valid.
A mini-server for performing network communication in the background.
An interface for reading from a network connection.
bool setPeriod(double period)
Set the (new) period of the thread.
bool start()
Call this to start the thread.
void stop()
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() ca...
int getOutputCount() override
Determine how many output connections this port has.
bool write(const PortWriter &writer, const PortWriter *callback=nullptr) const override
Write an object to the port.
void setReader(PortReader &reader) override
Set an external reader for port data.
void interrupt() override
Interrupt any current reads or writes attached to the port.
bool setEnvelope(PortWriter &envelope) override
Set an envelope (e.g., a timestamp) to the next message which will be sent.
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 base class for nested structures that can be searched.
void update()
Set the timestamp to the current time, and increment the sequence number (wrapping to 0 if the sequen...
static void delaySystem(double seconds)
AudioRecorderStatus: A class used to describe the status of an audio recorder device.
size_t current_buffer_size
the size of the audio buffer [samples]
size_t max_buffer_size
the max_size of the audio buffer [samples]
bool enabled
true if the playback is currently enabled
Class for storing sounds See Audio in YARP for additional documentation on YARP audio.
void setFrequency(int freq)
Set the frequency of the sound (i.e.
size_t getChannels() const
Get the number of channels of the sound.
void resize(size_t samples, size_t channels=1)
Set the sound size.
int getFrequency() const
Get the frequency of the sound (i.e.
void overwrite(const Sound &alt, size_t offset=0, size_t len=0)
It overwrites the sound with another sound, starting from a specified offset.
size_t getSamples() const
Get the number of samples contained in the sound.
#define yCError(component,...)
#define yCWarning(component,...)
#define yCDebug(component,...)
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.
double now()
Return the current time in seconds, relative to an arbitrary starting point.
An interface to the operating system, including Port based communication.