History

Fix read and write return types: now st_size_t, like the size inputs.

To support this change, turn on lots more compiler warnings, and fix all the warnings generated.

rrt committed 19 years ago

Commit 4d743c41 parent ce1f8f393 files · +875 −1236Browse files

Showing the changes to src/stretch.c (1 of 93 files). Show all

Unified · Split

src/stretch.c+19−27
@@ -55,36 +55,24 @@ typedef struct · 54 unmodified lines
55 */55 */
56 stretch_status_t state; /* automaton status */56 stretch_status_t state; /* automaton status */
57 57
58 int size; /* buffer size */58 st_size_t size; /* buffer size */
59 int index; /* next available element */59 st_size_t index; /* next available element */
60 st_sample_t *ibuf; /* input buffer */60 st_sample_t *ibuf; /* input buffer */
61 int ishift; /* input shift */61 int ishift; /* input shift */
62 62
63 int oindex; /* next evailable element */63 st_size_t oindex; /* next evailable element */
64 double * obuf; /* output buffer */64 double * obuf; /* output buffer */
65 int oshift; /* output shift */65 st_size_t oshift; /* output shift */
66 66
67 int fsize; /* fading size */67 st_size_t fsize; /* fading size */
68 double * fbuf; /* fading, 1.0 -> 0.0 */68 double * fbuf; /* fading, 1.0 -> 0.0 */
69 69
70} * stretch_t;70} * stretch_t;
71 71
72/*
73static void debug(stretch_t s, char * where)
74{
75 st_debug(
76 "%s: (f=%.2f w=%.2f r=%.2f f=%.2f)"
77 " st=%d s=%d ii=%d is=%d oi=%d os=%d fs=%d\n",
78 where, s->factor, s->window, s->shift, s->fading,
79 s->state, s->size, s->index, s->ishift,
80 s->oindex, s->oshift, s->fsize);
81}
82*/
83
84/*72/*
85 * Process options73 * Process options
86 */74 */
87int st_stretch_getopts(eff_t effp, int n, char **argv) 75static int st_stretch_getopts(eff_t effp, int n, char **argv)
88{76{
89 char usage[1024];77 char usage[1024];
90 stretch_t stretch = (stretch_t) effp->priv; 78 stretch_t stretch = (stretch_t) effp->priv;
@@ -170,10 +158,10 @@ int st_stretch_getopts(eff_t effp, int n, char **argv) · 79 unmodified lines
170/*158/*
171 * Start processing159 * Start processing
172 */160 */
173int st_stretch_start(eff_t effp)161static int st_stretch_start(eff_t effp)
174{162{
175 stretch_t stretch = (stretch_t) effp->priv;163 stretch_t stretch = (stretch_t) effp->priv;
176 register int i;164 st_size_t i;
177 165
178 /* not necessary. taken care by effect processing? */166 /* not necessary. taken care by effect processing? */
179 if (effp->outinfo.channels != effp->ininfo.channels)167 if (effp->outinfo.channels != effp->ininfo.channels)
@@ -199,7 +187,7 @@ int st_stretch_start(eff_t effp) · 19 unmodified lines
199 sizeof(st_sample_t));187 sizeof(st_sample_t));
200 188
201 /* the shift ratio deal with the longest of ishift/oshift189 /* the shift ratio deal with the longest of ishift/oshift
202 hence ishift<=size and oshift<=size. should be asserted.190 hence ishift<=size and oshift<=size. FIXME: should be asserted.
203 */191 */
204 if (stretch->factor < 1.0)192 if (stretch->factor < 1.0)
205 {193 {
@@ -246,7 +234,11 @@ int st_stretch_start(eff_t effp) · 40 unmodified lines
246 } else if (stretch->fsize==1)234 } else if (stretch->fsize==1)
247 stretch->fbuf[0] = 1.0;235 stretch->fbuf[0] = 1.0;
248 236
249 /* debug(stretch, "start"); */237 st_debug("start: (f=%.2f w=%.2f r=%.2f f=%.2f)"
238 " st=%d s=%d ii=%d is=%d oi=%d os=%d fs=%d\n",
239 stretch->factor, stretch->window, stretch->shift, stretch->fading,
240 stretch->state, stretch->size, stretch->index, stretch->ishift,
241 stretch->oindex, stretch->oshift, stretch->fsize);
250 242
251 return ST_SUCCESS;243 return ST_SUCCESS;
252}244}
@@ -276,12 +268,12 @@ static void combine(stretch_t stretch) · 23 unmodified lines
276/*268/*
277 * Processes flow.269 * Processes flow.
278 */270 */
279int st_stretch_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, 271static int st_stretch_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
280 st_size_t *isamp, st_size_t *osamp)272 st_size_t *isamp, st_size_t *osamp)
281{273{
282 stretch_t stretch = (stretch_t) effp->priv;274 stretch_t stretch = (stretch_t) effp->priv;
283 st_size_t iindex, oindex;275 st_size_t iindex, oindex;
284 int i;276 st_size_t i;
285 277
286 iindex = 0;278 iindex = 0;
287 oindex = 0;279 oindex = 0;
@@ -353,10 +345,10 @@ int st_stretch_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 65 unmodified lines
353 * Drain buffer at the end345 * Drain buffer at the end
354 * maybe not correct ? end might be artificially faded?346 * maybe not correct ? end might be artificially faded?
355 */347 */
356int st_stretch_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)348static int st_stretch_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
357{349{
358 stretch_t stretch = (stretch_t) effp->priv;350 stretch_t stretch = (stretch_t) effp->priv;
359 register int i;351 st_size_t i;
360 st_size_t oindex;352 st_size_t oindex;
361 353
362 oindex = 0;354 oindex = 0;
@@ -393,7 +385,7 @@ int st_stretch_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 30 unmodified lines
393 * Do anything required when you stop reading samples. 385 * Do anything required when you stop reading samples.
394 * Don't close input file! 386 * Don't close input file!
395 */387 */
396int st_stretch_stop(eff_t effp)388static int st_stretch_stop(eff_t effp)
397{389{
398 stretch_t stretch = (stretch_t) effp->priv;390 stretch_t stretch = (stretch_t) effp->priv;
399 391

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t