YARP
Yet Another Robot Platform
AudioBufferSize.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #ifndef YARP_DEV_AUDIOBUFFERSIZE_H
7 #define YARP_DEV_AUDIOBUFFERSIZE_H
8 
9 #include <yarp/os/Portable.h>
10 #include <yarp/os/PortReader.h>
11 #include <yarp/os/PortWriter.h>
12 #include <yarp/dev/api.h>
14 
15 namespace yarp::dev {
16 
17 template <typename SAMPLE>
18 class CircularAudioBuffer;
19 
21  private audioBufferSizeData
22 {
23  template <typename SAMPLE>
24  friend class CircularAudioBuffer;
25 
26 public:
27  size_t getSamples() { return m_samples; }
28  size_t getChannels() { return m_channels; }
29  size_t getBufferElements() { return size; }
30  size_t getBytes() { return size_t(m_samples * m_channels * m_depth); }
31 
32  bool read(yarp::os::idl::WireReader& reader) override { return audioBufferSizeData::read(reader); }
33  bool write(const yarp::os::idl::WireWriter& writer) const override { return audioBufferSizeData::write(writer); }
34  bool read(yarp::os::ConnectionReader& reader) override { return audioBufferSizeData::read(reader); }
35  bool write(yarp::os::ConnectionWriter& writer) const override { return audioBufferSizeData::write(writer); }
36 
38  AudioBufferSize(size_t samples, size_t channels, size_t depth_in_bytes);
39 };
40 
41 } // namespace yarp::dev
42 
43 #endif // YARP_DEV_AUDIOBUFFERSIZE_H
int16_t * samples
bool write(const yarp::os::idl::WireWriter &writer) const override
bool write(yarp::os::ConnectionWriter &writer) const override
Write this object to a network connection.
bool read(yarp::os::idl::WireReader &reader) override
bool read(yarp::os::ConnectionReader &reader) override
Read this object from a network connection.
bool write(const yarp::os::idl::WireWriter &writer) const override
bool read(yarp::os::idl::WireReader &reader) override
An interface for reading from a network connection.
An interface for writing to a network connection.
IDL-friendly connection reader.
Definition: WireReader.h:27
IDL-friendly connection writer.
Definition: WireWriter.h:28
For streams capable of holding different kinds of content, check what they actually have.
#define YARP_dev_API
Definition: api.h:18