|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
47 if(config.
check(
"period"))
51 yCInfo(AUDIOFROMFILE) <<
"Using chosen period of " << period <<
" s";
59 if (config.
check(
"samples"))
63 yCDebug(AUDIOFROMFILE) << m_samples_to_be_copied <<
" will be processed every iteration";
66 if (config.
check(
"file_name"))
69 yCInfo(AUDIOFROMFILE) <<
"Audio will loaded from file:" << m_audio_filename;
73 yCInfo(AUDIOFROMFILE) <<
"No `file_name` option specified. Audio will be loaded from default file:" << m_audio_filename;
80 yCError(AUDIOFROMFILE) <<
"Unable to open file" << m_audio_filename.c_str();
89 constexpr
size_t c_EXTRA_SPACE = 2;
105 bool audioFromFileDevice::threadInit()
111 void audioFromFileDevice::run()
121 size_t fsize_in_samples = m_audioFile.
getSamples();
126 for (
size_t i = 0; i < m_samples_to_be_copied; i++)
128 if (m_bpnt >= fsize_in_samples)
135 #ifdef ADVANCED_DEBUG
136 yCDebug(AUDIOFROMFILE) <<
"b_pnt" << m_bpnt <<
"/" << fsize_in_bytes <<
" bytes";
A base class for nested structures that can be searched.
int getFrequency() const
Get the frequency of the sound (i.e.
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
bool close() override
Close the DeviceDriver.
constexpr double c_DEFAULT_PERIOD
size_t getSamples() const
Get the number of samples contained in the sound.
#define YARP_LOG_COMPONENT(name,...)
~audioFromFileDevice() override
size_t getChannels() const
Get the number of channels of the sound.
An interface for the device drivers.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
AudioDeviceDriverSettings m_audiorecorder_cfg
virtual std::string asString() const
Get string value.
bool start()
Call this to start the thread.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
bool setPeriod(double period)
Set the (new) period of the thread.
virtual Value & find(const std::string &key) const =0
Gets a value corresponding to a given keyword.
An abstraction for a periodic thread.
#define yCError(component,...)
unsigned short int audio_sample_16t
#define yCInfo(component,...)
yarp::dev::CircularAudioBuffer_16t * m_inputBuffer
An interface to the operating system, including Port based communication.
#define yCDebug(component,...)
yarp::dev::CircularAudioBuffer< unsigned short int > CircularAudioBuffer_16t
std::vector< std::reference_wrapper< audio_sample > > getInterleavedAudioRawData() const
Returns a serialized version of the sound, in interleaved format, e.g.
void stop()
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() ca...
size_t getBytesPerSample() const
Get the number of bytes per sample.
virtual yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.