YARP
Yet Another Robot Platform
SoundFile.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef YARP_SIG_SOUNDFILE_H
8#define YARP_SIG_SOUNDFILE_H
9
10#include <yarp/sig/Sound.h>
11
12namespace yarp::sig::file {
19bool YARP_sig_API read(Sound& data, const char* filename);
20
27bool YARP_sig_API read_bytestream(Sound& data, const char* filename, size_t streamsize, std::string format);
28
35bool YARP_sig_API write(const Sound& data, const char* filename);
36
38{
39private:
40 Sound m_sound_data;
41 size_t m_index = 0;
42 size_t m_totsize = 0;
43
44public:
45 soundStreamReader() = default;
46 ~soundStreamReader() = default;
47
48 bool open(const char* filename);
49 bool close();
50 size_t readBlock(Sound& dest, size_t block_size);
51 bool rewind(size_t sample_offset = 0);
52 size_t getIndex();
53};
54} // namespace yarp::sig::file
55
56#endif // YARP_SIG_SOUNDFILE_H
Class for storing sounds See Audio in YARP for additional documentation on YARP audio.
Definition: Sound.h:25
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
Definition: ImageFile.cpp:915
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
Definition: ImageFile.cpp:1091
bool read_bytestream(Sound &data, const char *filename, size_t streamsize, std::string format)
Read a sound from a byte array.
Definition: SoundFile.cpp:56
#define YARP_sig_API
Definition: api.h:18