Changeset 522

Show
Ignore:
Timestamp:
11/12/07 18:44:49 (10 months ago)
Author:
kickback
Message:

sweep: patch from Frank Neumann to fix problems with the fade plugin.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sweep/trunk/plugins/fade/fade.c

    r124 r522  
    3737  sw_audio_t * d; 
    3838  gfloat factor = start; 
    39   sw_framecount_t op_total, run_total
    40   glong i
     39  sw_framecount_t op_total, run_total, frames_total
     40  glong i, j
    4141  sw_framecount_t offset, remaining, n; 
    4242 
     
    4747 
    4848  op_total = sounddata_selection_nr_frames (sounddata) / 100; 
     49  frames_total = sounddata_selection_nr_frames (sounddata); 
     50 
    4951  if (op_total == 0) op_total = 1; 
    5052  run_total = 0; 
     
    105107        n = MIN(remaining, 1024); 
    106108 
    107         factor = start + (end - start) * 0.01 * 
    108           (gfloat)run_total / (gfloat)op_total; 
    109  
    110         for (i=0; i < n * f->channels; i++) { 
    111           d[i] = (sw_audio_t)((gfloat)d[i] * factor); 
     109        for (i = 0; i < n; i++) 
     110        { 
     111                factor = start + (end - start) *  
     112                  (gfloat)run_total++ / (gfloat)frames_total; 
     113 
     114                for (j = 0; j < f->channels; j++) 
     115                { 
     116                        d[i*f->channels+j] = (sw_audio_t)((gfloat)d[i*f->channels+j] * factor); 
     117                } 
    112118        } 
    113119 
     
    115121        offset += n; 
    116122 
    117         run_total += n; 
    118         sample_set_progress_percent (sample, run_total * 100 / op_total); 
     123        sample_set_progress_percent (sample, run_total * frames_total); 
    119124      } 
    120125