6#ifndef YARP_DEV_CIRCULARAUDIOBUFFER_H
7#define YARP_DEV_CIRCULARAUDIOBUFFER_H
19template <
typename SAMPLE>
31 return (end + 1) % maxsize.size == start;
47 end = (end + 1) % maxsize.size;
50 printf (
"ERROR: %s buffer overrun!\n", name.c_str());
51 start = (start + 1) % maxsize.size;
60 }
else if (end == start) {
63 i = maxsize.size - start + end;
72 printf (
"ERROR: %s buffer underrun!\n", name.c_str());
74 SAMPLE elem = elems[start];
75 start = (start + 1) % maxsize.size;
97 static_assert (std::is_same<unsigned char, SAMPLE>::value ||
98 std::is_same<unsigned short int, SAMPLE>::value ||
99 std::is_same<unsigned int, SAMPLE>::value,
100 "CircularAudioBuffer can be specialized only as <unsigned char>, <unsigned short int>, <unsigned int>");
const SAMPLE * getRawData()
CircularAudioBuffer(std::string buffer_name, yarp::dev::AudioBufferSize bufferSize)
yarp::dev::AudioBufferSize getMaxSize()
For streams capable of holding different kinds of content, check what they actually have.
yarp::dev::CircularAudioBuffer< unsigned char > CircularAudioBuffer_8t
yarp::dev::CircularAudioBuffer< unsigned int > CircularAudioBuffer_32t
yarp::dev::CircularAudioBuffer< unsigned short int > CircularAudioBuffer_16t