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 
12 namespace yarp {
13  namespace sig{
14  namespace file {
21  bool YARP_sig_API read(Sound& data, const char * filename);
22 
29  bool YARP_sig_API read_bytestream(Sound& data, const char* filename, size_t streamsize, std::string format);
30 
37  bool YARP_sig_API write(const Sound& data, const char * filename);
38 
40  {
41  private:
42  Sound m_sound_data;
43  size_t m_index=0;
44  size_t m_totsize=0;
45 
46  public:
49 
50  bool open(const char *filename);
51  bool close();
52  size_t readBlock(Sound& dest, size_t block_size);
53  bool rewind(size_t sample_offset=0);
54  size_t getIndex();
55  };
56  }
57  }
58 }
59 
60 #endif // YARP_SIG_SOUNDFILE_H
Class for storing sounds See Audio in YARP for additional documentation on YARP audio.
Definition: Sound.h:26
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
Definition: ImageFile.cpp:922
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
Definition: ImageFile.cpp:1098
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
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_sig_API
Definition: api.h:18