Home | History | Annotate | Download | only in libspeex

Lines Matching refs:st

53    SpeexBuffer *st = speex_alloc(sizeof(SpeexBuffer));
54 st->data = speex_alloc(size);
55 st->size = size;
56 st->read_ptr = 0;
57 st->write_ptr = 0;
58 st->available = 0;
59 return st;
62 EXPORT void speex_buffer_destroy(SpeexBuffer *st)
64 speex_free(st->data);
65 speex_free(st);
68 EXPORT int speex_buffer_write(SpeexBuffer *st, void *_data, int len)
73 if (len > st->size)
75 data += len-st->size;
76 len = st->size;
78 end = st->write_ptr + len;
80 if (end1 > st->size)
81 end1 = st->size;
82 SPEEX_COPY(st->data + st->write_ptr, data, end1 - st->write_ptr);
83 if (end > st->size)
85 end -= st->size;
86 SPEEX_COPY(st->data, data+end1 - st->write_ptr, end);
88 st->available += len;
89 if (st->available > st->size)
91 st->available = st->size;
92 st->read_ptr = st->write_ptr;
94 st->write_ptr += len;
95 if (st->write_ptr > st->size)
96 st->write_ptr -= st->size;
100 EXPORT int speex_buffer_writezeros(SpeexBuffer *st, int len)
106 if (len > st->size)
108 len = st->size;
110 end = st->write_ptr + len;
112 if (end1 > st->size)
113 end1 = st->size;
114 SPEEX_MEMSET(st->data + st->write_ptr, 0, end1 - st->write_ptr);
115 if (end > st->size)
117 end -= st->size;
118 SPEEX_MEMSET(st->data, 0, end);
120 st->available += len;
121 if (st->available > st->size)
123 st->available = st->size;
124 st->read_ptr = st->write_ptr;
126 st->write_ptr += len;
127 if (st->write_ptr > st->size)
128 st->write_ptr -= st->size;
132 EXPORT int speex_buffer_read(SpeexBuffer *st, void *_data, int len)
136 if (len > st->available)
138 SPEEX_MEMSET(data+st->available, 0, st->size-st->available);
139 len = st->available;
141 end = st->read_ptr + len;
143 if (end1 > st->size)
144 end1 = st->size;
145 SPEEX_COPY(data, st->data + st->read_ptr, end1 - st->read_ptr);
147 if (end > st->size)
149 end -= st->size;
150 SPEEX_COPY(data+end1 - st->read_ptr, st->data, end);
152 st->available -= len;
153 st->read_ptr += len;
154 if (st->read_ptr > st->size)
155 st->read_ptr -= st->size;
159 EXPORT int speex_buffer_get_available(SpeexBuffer *st)
161 return st->available;
164 EXPORT int speex_buffer_resize(SpeexBuffer *st, int len)
166 int old_len = st->size;
169 st->data = speex_realloc(st->data, len);
173 st->data = speex_realloc(st->data, len);