+ samplefrac += fracstep;
+ }
+ }
+ // 8 bit samples
+ else // if (format->width == 1)
+ {
+ const unsigned char* in_ptr_byte;
+
+ // Convert up to 1 sec of sound
+ for (i = 0; i < interpolation_limit; i++)
+ {
+ srcsample = (samplefrac >> FRACTIONAL_BITS) * format->channels;
+ in_ptr_byte = &((const unsigned char*)in_ptr)[srcsample];
+
+ for (j = 0; j < format->channels; j++)
+ {
+ int a, b;
+
+ a = *in_ptr_byte - 128;
+ b = *(in_ptr_byte + format->channels) - 128;
+ *((signed char*)out_ptr) = (((b - a) * (samplefrac & FRACTIONAL_MASK)) >> FRACTIONAL_BITS) + a;
+
+ in_ptr_byte++;
+ out_ptr += sizeof (signed char);
+ }
+
+ samplefrac += fracstep;
+ }
+
+ // Non-interpolated part
+ for (/* nothing */; i < tmpcount; i++)
+ {
+ srcsample = (samplefrac >> FRACTIONAL_BITS) * format->channels;
+ in_ptr_byte = &((const unsigned char*)in_ptr)[srcsample];
+
+ for (j = 0; j < format->channels; j++)
+ {
+ *((signed char*)out_ptr) = *in_ptr_byte - 128;
+
+ in_ptr_byte++;
+ out_ptr += sizeof (signed char);
+ }
+
+ samplefrac += fracstep;
+ }
+ }
+
+ // Update the counters and the buffer position
+ remain_in -= format->speed * format->channels;
+ in_ptr += format->speed * format->channels * format->width;
+ total_out += tmpcount;