29 int size = sample *
sizeof(q15_t);
30 _top = (q15_t*)malloc(size);
31 _bottom = _top + sample;
38 int put(q15_t *buf,
int sample) {
39 if (sample < (_bottom - _wptr)) {
40 arm_copy_q15(buf, _wptr, sample);
43 int part = _bottom - _wptr;
44 arm_copy_q15(buf, _wptr, part);
45 arm_copy_q15(&buf[part], _top, sample - part);
46 _wptr = _top + sample - part;
52 int put(q15_t *buf,
int sample,
int chnum,
int ch) {
54 if (sample < (_bottom - _wptr)) {
55 for (i = 0; i < sample; i++) {
56 _wptr[i] = buf[chnum * i + ch];
60 int part = _bottom - _wptr;
61 for (i = 0; i < part; i++) {
62 _wptr[i] = buf[chnum * i + ch];
64 for (i = part; i < sample; i++) {
65 _top[i - part] = buf[chnum * i + ch];
67 _wptr = _top + sample - part;
73 int get(
float *buf,
int sample) {
74 if ((_rptr + sample) < _bottom) {
75 arm_q15_to_float(_rptr, buf, sample);
78 int part = _bottom - _rptr;
79 arm_q15_to_float(_rptr, buf, part);
80 arm_q15_to_float(_top, &buf[part], sample - part);
81 _rptr = _top + sample - part;
87 int get(q15_t *buf,
int sample) {
88 if ((_rptr + sample) < _bottom) {
89 arm_copy_q15(_rptr, buf,sample);
92 int part = _bottom - _rptr;
93 arm_copy_q15(_rptr, buf,part);
94 arm_copy_q15(_top,&buf[part],sample-part);
95 _rptr = _top + sample - part;
102 return (_bottom - _top) - stored();
105 return (_rptr <= _wptr) ?
106 _wptr - _rptr : (_bottom - _rptr) + (_wptr - _top);
Definition: RingBuff.h:26