Sound Blaster volume balancing and filter changes. Patch from James-F.

This commit is contained in:
SarahW 2017-06-02 19:46:00 +01:00
commit 71055ef19c
3 changed files with 16 additions and 16 deletions

View file

@ -132,11 +132,11 @@ static inline float high_cut_iir(int i, float NewSample) {
#undef NCoef #undef NCoef
#define NCoef 1 #define NCoef 2
//fc=3.2kHz //fc=3.2kHz
static inline float sb_iir(int i, float NewSample) { static inline float sb_iir(int i, float NewSample) {
/* float ACoef[NCoef+1] = { float ACoef[NCoef+1] = {
0.03356837051492005100, 0.03356837051492005100,
0.06713674102984010200, 0.06713674102984010200,
0.03356837051492005100 0.03356837051492005100
@ -146,9 +146,9 @@ static inline float sb_iir(int i, float NewSample) {
1.00000000000000000000, 1.00000000000000000000,
-1.41898265221812010000, -1.41898265221812010000,
0.55326988968868285000 0.55326988968868285000
};*/ };
float ACoef[NCoef+1] = { /* float ACoef[NCoef+1] = {
0.17529642630084405000, 0.17529642630084405000,
0.17529642630084405000 0.17529642630084405000
}; };
@ -156,7 +156,7 @@ static inline float sb_iir(int i, float NewSample) {
float BCoef[NCoef+1] = { float BCoef[NCoef+1] = {
1.00000000000000000000, 1.00000000000000000000,
-0.64940759319751051000 -0.64940759319751051000
}; };*/
static float y[2][NCoef+1]; //output samples static float y[2][NCoef+1]; //output samples
static float x[2][NCoef+1]; //input samples static float x[2][NCoef+1]; //input samples
int n; int n;

View file

@ -83,8 +83,8 @@ void opl2_update2(opl_t *opl)
opl2_update(1, &opl->buffer[opl->pos*2 + 1], sound_pos_global - opl->pos); opl2_update(1, &opl->buffer[opl->pos*2 + 1], sound_pos_global - opl->pos);
for (; opl->pos < sound_pos_global; opl->pos++) for (; opl->pos < sound_pos_global; opl->pos++)
{ {
opl->filtbuf[0] = opl->buffer[opl->pos*2] = (opl->buffer[opl->pos*2] / 4) + ((opl->filtbuf[0] * 11) / 16); opl->filtbuf[0] = opl->buffer[opl->pos*2] = (opl->buffer[opl->pos*2] / 2);
opl->filtbuf[1] = opl->buffer[opl->pos*2+1] = (opl->buffer[opl->pos*2+1] / 4) + ((opl->filtbuf[1] * 11) / 16); opl->filtbuf[1] = opl->buffer[opl->pos*2+1] = (opl->buffer[opl->pos*2+1] / 2);
} }
} }
} }
@ -96,8 +96,8 @@ void opl3_update2(opl_t *opl)
opl3_update(0, &opl->buffer[opl->pos*2], sound_pos_global - opl->pos); opl3_update(0, &opl->buffer[opl->pos*2], sound_pos_global - opl->pos);
for (; opl->pos < sound_pos_global; opl->pos++) for (; opl->pos < sound_pos_global; opl->pos++)
{ {
opl->filtbuf[0] = opl->buffer[opl->pos*2] = (opl->buffer[opl->pos*2] / 4) + ((opl->filtbuf[0] * 11) / 16); opl->filtbuf[0] = opl->buffer[opl->pos*2] = (opl->buffer[opl->pos*2] / 2);
opl->filtbuf[1] = opl->buffer[opl->pos*2+1] = (opl->buffer[opl->pos*2+1] / 4) + ((opl->filtbuf[1] * 11) / 16); opl->filtbuf[1] = opl->buffer[opl->pos*2+1] = (opl->buffer[opl->pos*2+1] / 2);
} }
} }
} }

View file

@ -43,9 +43,9 @@ typedef struct sb_t
static int sb_att[]= static int sb_att[]=
{ {
310,368,437,520,618,735,873,1038,1234,1467,1743,2072,2463,2927,3479, 50,65,82,103,130,164,207,260,328,413,520,655,825,1038,1307,
4134,4914,5840,6941,8250,9805,11653,13850,16461,19564,23252,27635,32845, 1645,2072,2608,3283,4134,5205,6553,8250,10385,13075,16461,20724,26089,
39036,46395,55140,65535 32845,41349,52055,65535
}; };
static void sb_get_buffer_opl2(int32_t *buffer, int len, void *p) static void sb_get_buffer_opl2(int32_t *buffer, int len, void *p)
@ -61,8 +61,8 @@ static void sb_get_buffer_opl2(int32_t *buffer, int len, void *p)
{ {
int32_t out_l, out_r; int32_t out_l, out_r;
out_l = ((sb->opl.buffer[c] * mixer->fm_l) >> 16); out_l = ((((sb->opl.buffer[c] * mixer->fm_l) >> 16) * 55000) >> 16);
out_r = ((sb->opl.buffer[c + 1] * mixer->fm_r) >> 16); out_r = ((((sb->opl.buffer[c + 1] * mixer->fm_r) >> 16) * 55000) >> 16);
if (sb->mixer.filter) if (sb->mixer.filter)
{ {
@ -112,8 +112,8 @@ static void sb_get_buffer_opl3(int32_t *buffer, int len, void *p)
{ {
int32_t out_l, out_r; int32_t out_l, out_r;
out_l = ((sb->opl.buffer[c] * mixer->fm_l) >> 16); out_l = ((((sb->opl.buffer[c] * mixer->fm_l) >> 16) * 55000) >> 16);
out_r = ((sb->opl.buffer[c + 1] * mixer->fm_r) >> 16); out_r = ((((sb->opl.buffer[c + 1] * mixer->fm_r) >> 16) * 55000) >> 16);
if (sb->mixer.filter) if (sb->mixer.filter)
{ {