load_voc.c
changeset 310 77e72cff08e7
parent 241 503416fca921
child 339 30996c5fd448
equal deleted inserted replaced
309:e1c0ccfd16b6 310:77e72cff08e7
   242                  * Some silence-packed files have gratuitously
   242                  * Some silence-packed files have gratuitously
   243                  * different sample rate codes in silence.
   243                  * different sample rate codes in silence.
   244                  * Adjust period.
   244                  * Adjust period.
   245                  */
   245                  */
   246                 if ((v->rate != -1) && (uc != v->rate))
   246                 if ((v->rate != -1) && (uc != v->rate))
   247                     period = (period * (256 - uc))/(256 - v->rate);
   247                     period = (Uint16)((period * (256 - uc))/(256 - v->rate));
   248                 else
   248                 else
   249                     v->rate = uc;
   249                     v->rate = uc;
   250                 v->rest = period;
   250                 v->rest = period;
   251                 v->silent = 1;
   251                 v->silent = 1;
   252                 return 1;
   252                 return 1;
   432 
   432 
   433         *audio_buf = ptr;
   433         *audio_buf = ptr;
   434         fillptr = ((Uint8 *) ptr) + (*audio_len - v.rest);
   434         fillptr = ((Uint8 *) ptr) + (*audio_len - v.rest);
   435     }
   435     }
   436 
   436 
   437     spec->samples = (*audio_len / v.size);
   437     spec->samples = (Uint16)(*audio_len / v.size);
   438 
   438 
   439     was_error = 0;  /* success, baby! */
   439     was_error = 0;  /* success, baby! */
   440 
   440 
   441     /* Don't return a buffer that isn't a multiple of samplesize */
   441     /* Don't return a buffer that isn't a multiple of samplesize */
   442     samplesize = ((spec->format & 0xFF)/8)*spec->channels;
   442     samplesize = ((spec->format & 0xFF)/8)*spec->channels;