セガサターンのエミュレーターを語ろう 6

このエントリーをはてなブックマークに追加
190名無しさん@お腹いっぱい。
L_in = gLIN * LoadFromLowPassFilterL();
R_in = gRIN * LoadFromLowPassFilterR();

/* Left -> Wall -> Left Reflection */
L_temp = ReadReverbWork(zm_Lsame);
R_temp = ReadReverbWork(zm_Rsame);
L_same = L_in + gWALL * L_temp;
R_same = R_in + gWALL * R_temp;
L_temp = ReadReverbWork(z1_Lsame);
R_temp = ReadReverbWork(z1_Rsame);
L_same = L_temp + gIIR * (L_same - L_temp);
R_same = R_temp + gIIR * (R_same - R_temp);

/* Left -> Wall -> Right Reflection */
L_temp = ReadReverbWork(zm_Rdiff);
R_temp = ReadReverbWork(zm_Ldiff);
L_diff = L_in + gWALL * L_temp;
R_diff = R_in + gWALL * R_temp;
L_temp = ReadReverbWork(z1_Ldiff);
R_temp = ReadReverbWork(z1_Rdiff);
L_diff = L_temp + gIIR * (L_diff - L_temp);
R_diff = R_temp + gIIR * (R_diff - R_temp);

/* Early Echo(Comb Filter) */
L_in = gCOMB1 * ReadReverbWork(m1_Lcomb) + gCOMB2 *ReadReverbWork(m2_Lcomb) + gCOMB3 *ReadReverbWork(m3_Lcomb) + gCOMB4 *ReadReverbWork(m4_Lcomb);
R_in = gCOMB1 * ReadReverbWork(m1_Rcomb) + gCOMB2 *ReadReverbWork(m2_Rcomb) + gCOMB3 *ReadReverbWork(m3_Rcomb) + gCOMB4 *ReadReverbWork(m4_Rcomb);

/* Late Reverb(Two All Pass Filters) */
L_temp = ReadReverbWork(zm_Lapf1);
R_temp = ReadReverbWork(zm_Rapf1);
L_apf1 = L_in - gAPF1 * L_temp;
R_apf1 = R_in - gAPF1 * R_temp;
L_in = L_temp + gAPF1 * L_apf1;
R_in = R_temp + gAPF1 * R_apf1;
L_temp = ReadReverbWork(zm_Lapf2);
R_temp = ReadReverbWork(zm_Rapf2);
L_apf2 = L_in - gAPF2 * L_temp;
R_apf2 = R_in - gAPF2 * R_temp;
L_in = L_temp + gAPF2 * L_apf2;
R_in = R_temp + gAPF2 * R_apf2;

/* Output */
SetOutputL(L_in);
SetOutputR(R_in);

/* Write Buffer */
WriteReverbWork(z0_Lsame, L_same);
WriteReverbWork(z0_Rsame, R_same);
WriteReverbWork(z0_Ldiff, L_diff);
WriteReverbWork(z0_Rdiff, R_diff);
WriteReverbWork(z0_Lapf1, L_apf1);
WriteReverbWork(z0_Rapf1, R_apf1);
WriteReverbWork(z0_Lapf2, L_apf2);
WriteReverbWork(z0_Rapf2, R_apf2);

/* Update Circular Buffer */
UpdateReverbWork();
}