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/fade.c (1 of 93 files). Show all

Unified · Split

src/fade.c+15−20
@@ -29,7 +29,7 @@ static st_effect_t st_fade_effect; · 28 unmodified lines
29/* Private data for fade file */29/* Private data for fade file */
30typedef struct fadestuff30typedef struct fadestuff
31{ /* These are measured as samples */31{ /* These are measured as samples */
32 st_size_t in_start, in_stop, out_start, out_stop, samplesdone;32 st_size_t in_start, in_stop, out_start, out_stop, samplesdone;
33 char *in_stop_str, *out_start_str, *out_stop_str;33 char *in_stop_str, *out_start_str, *out_stop_str;
34 char in_fadetype, out_fadetype;34 char in_fadetype, out_fadetype;
35 char do_out;35 char do_out;
@@ -46,7 +46,7 @@ static double fade_gain(st_size_t index, st_size_t range, char fadetype); · 10 unmodified lines
46 * The 'info' fields are not yet filled in.46 * The 'info' fields are not yet filled in.
47 */47 */
48 48
49int st_fade_getopts(eff_t effp, int n, char **argv)49static int st_fade_getopts(eff_t effp, int n, char **argv)
50{50{
51 51
52 fade_t fade = (fade_t) effp->priv;52 fade_t fade = (fade_t) effp->priv;
@@ -143,7 +143,7 @@ int st_fade_getopts(eff_t effp, int n, char **argv) · 90 unmodified lines
143 * Prepare processing.143 * Prepare processing.
144 * Do all initializations.144 * Do all initializations.
145 */145 */
146int st_fade_start(eff_t effp)146static int st_fade_start(eff_t effp)
147{147{
148 fade_t fade = (fade_t) effp->priv;148 fade_t fade = (fade_t) effp->priv;
149 149
@@ -201,12 +201,11 @@ int st_fade_start(eff_t effp) · 51 unmodified lines
201 return(ST_EOF);201 return(ST_EOF);
202 } /* endif fade time sanity */202 } /* endif fade time sanity */
203 203
204 /* If lead-in is required it is handled as negative sample numbers */204 fade->samplesdone = fade->in_start;
205 fade->samplesdone = (fade->in_start < 0 ? fade->in_start :0);
206 205
207 fade->endpadwarned = 0;206 fade->endpadwarned = 0;
208 207
209 /* st_debug("fade: in_start = %d in_stop = %d out_start = %d out_stop = %d", fade->in_start, fade->in_stop, fade->out_start, fade->out_stop); */208 st_debug("fade: in_start = %d in_stop = %d out_start = %d out_stop = %d", fade->in_start, fade->in_stop, fade->out_start, fade->out_stop);
210 209
211 return(ST_SUCCESS);210 return(ST_SUCCESS);
212}211}
@@ -215,13 +214,14 @@ int st_fade_start(eff_t effp) · 2 unmodified lines
215 * Processed signed long samples from ibuf to obuf.214 * Processed signed long samples from ibuf to obuf.
216 * Return number of samples processed.215 * Return number of samples processed.
217 */216 */
218int st_fade_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, 217static int st_fade_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
219 st_size_t *isamp, st_size_t *osamp)218 st_size_t *isamp, st_size_t *osamp)
220{219{
221 fade_t fade = (fade_t) effp->priv;220 fade_t fade = (fade_t) effp->priv;
222 /* len is total samples, chcnt counts channels */221 /* len is total samples, chcnt counts channels */
223 int len = 0, chcnt = 0, t_output = 1, more_output = 1;222 int len = 0, t_output = 1, more_output = 1;
224 st_sample_t t_ibuf;223 st_sample_t t_ibuf;
224 st_size_t chcnt = 0;
225 225
226 len = ((*isamp > *osamp) ? *osamp : *isamp);226 len = ((*isamp > *osamp) ? *osamp : *isamp);
227 227
@@ -230,7 +230,7 @@ int st_fade_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 2 unmodified lines
230 230
231 for(; len && more_output; len--)231 for(; len && more_output; len--)
232 {232 {
233 t_ibuf = (fade->samplesdone < 0 ? 0 : *ibuf);233 t_ibuf = *ibuf;
234 234
235 if ((fade->samplesdone >= fade->in_start) &&235 if ((fade->samplesdone >= fade->in_start) &&
236 (!fade->do_out || fade->samplesdone < fade->out_stop))236 (!fade->do_out || fade->samplesdone < fade->out_stop))
@@ -265,14 +265,8 @@ int st_fade_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 28 unmodified lines
265 t_output = 0;265 t_output = 0;
266 } /* endif something to output */266 } /* endif something to output */
267 267
268 /* samplesdone < 0 means we are inventing samples right now268 *isamp += 1;
269 * and so not consuming (happens when in_start < 0).269 ibuf++;
270 */
271 if (fade->samplesdone >= 0 )
272 { /* Something to input */
273 *isamp += 1;
274 ibuf++;
275 } /* endif something accepted as input */
276 270
277 if (t_output)271 if (t_output)
278 { /* Output generated, update pointers and counters */272 { /* Output generated, update pointers and counters */
@@ -301,10 +295,11 @@ int st_fade_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 22 unmodified lines
301/*295/*
302 * Drain out remaining samples if the effect generates any.296 * Drain out remaining samples if the effect generates any.
303 */297 */
304int st_fade_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)298static int st_fade_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
305{299{
306 fade_t fade = (fade_t) effp->priv;300 fade_t fade = (fade_t) effp->priv;
307 int len, t_chan = 0;301 int len;
302 st_size_t t_chan = 0;
308 303
309 len = *osamp;304 len = *osamp;
310 *osamp = 0;305 *osamp = 0;
@@ -341,7 +336,7 @@ int st_fade_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 30 unmodified lines
341 * Do anything required when you stop reading samples.336 * Do anything required when you stop reading samples.
342 * (free allocated memory, etc.)337 * (free allocated memory, etc.)
343 */338 */
344int st_fade_stop(eff_t effp)339static int st_fade_stop(eff_t effp)
345{340{
346 fade_t fade = (fade_t) effp->priv;341 fade_t fade = (fade_t) effp->priv;
347 342

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