static void MP3MixAudio (char * dst, u8 * src, int len) { s16 *s, *d; int i; double lsample; double rsample; s = (s16 *) src; d = (s16 *) dst; for (i = 0; i < len >> 1; i += 2) { lsample = ((int) ((double) d[i] * mp3volume) + (int)((double) s[i] * fxvolume)); rsample = ((int) ((double) d[i + 1] * mp3volume) + (int)((double) s[i + 1] * fxvolume)); // lsample = (int)((double) s[i] * fxvolume); // rsample = (int)((double) s[i + 1] * fxvolume); lsample = do_3band (&eqs, lsample); rsample = do_3band (&eqs, rsample); if (lsample < -32768) lsample = -32768; else { if (lsample > 32767) lsample = 32767; } if (rsample < -32768) rsample = -32768; else { if (rsample > 32767) rsample = 32767; } d[i] = (s16) lsample; d[i + 1] = (s16) rsample; } }
float nixecho::do_right(float in) { if (!std::isnan(feedback_right) && feedback_right > -1 && feedback_right < 1) { buffer_right[play_head] = feedback_right; } delay_right++; if (delay_right >= echo_speed) {delay_right = 0; } feedback_right = in + do_3band(eq2, buffer_right[delay_right] * echo_decay); return feedback_right; }
float nixecho::do_left(float in) { if (!std::isnan(feedback_left) && feedback_left > -1 && feedback_left < 1) { buffer_left[play_head] = feedback_left; } play_head++; if (play_head >= echo_speed) {play_head = 0; } delay_left++; if (delay_left >= echo_speed) {delay_left = 0; } feedback_left = in + do_3band(eq, buffer_left[delay_left] * echo_decay); return feedback_left; }