|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
10 #ifndef YARP_SIG_SOUND_H
11 #define YARP_SIG_SOUND_H
32 Sound(
size_t bytesPerSample = 2);
55 bool operator==(
const Sound& alt)
const;
69 Sound subSound(
size_t first_sample,
size_t last_sample);
76 void resize(
size_t samples,
size_t channels = 1);
78 audio_sample get(
size_t sample,
size_t channel = 0)
const;
80 void set(
audio_sample value,
size_t sample,
size_t channel = 0);
83 if (isSample(sample,channel)) {
84 return get(sample,channel);
89 void setSafe(audio_sample value,
size_t sample,
size_t channel = 0);
97 bool isSample(
size_t sample,
size_t channel = 0)
const;
109 bool clearChannel(
size_t channel);
115 int getFrequency()
const;
120 void setFrequency(
int freq);
126 size_t getBytesPerSample()
const;
132 size_t getSamples()
const;
138 double getDuration()
const;
144 size_t getChannels()
const;
150 Sound extractChannelAsSound(
size_t channel_id)
const;
152 std::vector<std::reference_wrapper<audio_sample>> getChannel(
size_t channel_id);
160 bool replaceChannel(
size_t id,
Sound channel);
168 std::vector<std::reference_wrapper<audio_sample>> getInterleavedAudioRawData()
const;
176 std::vector<std::reference_wrapper<audio_sample>> getNonInterleavedAudioRawData()
const;
191 unsigned char *getRawData()
const;
197 size_t getRawDataSize()
const;
205 void init(
size_t bytesPerSample);
211 size_t m_bytesPerSample;
218 #endif // YARP_SIG_SOUND_H
This is a base class for objects that can be both read from and be written to the YARP network.
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
Vector & operator+=(Vector &a, const double &s)
Addition operator between a scalar and a vector (defined in Math.h).
An interface for writing to a network connection.
audio_sample getSafe(size_t sample, size_t channel=0) const
An interface for reading from a network connection.
Class for storing sounds.
std::string toString(const T &value)
convert an arbitrary type to string.
The main, catch-all namespace for YARP.
RandScalar * implementation(void *t)
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)