From: notaz Date: Sat, 30 Jul 2011 20:30:26 +0000 (+0300) Subject: spu: change volume control, default it to 3/4 instead of 1/2 X-Git-Tag: r9~24 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e7a735287d03149ccf7d0db6c0193cc565c3fff;p=pcsx_rearmed.git spu: change volume control, default it to 3/4 instead of 1/2 because some complain default volume is too low --- diff --git a/frontend/common/menu.h b/frontend/common/menu.h index f34d5a86..79b82783 100644 --- a/frontend/common/menu.h +++ b/frontend/common/menu.h @@ -61,8 +61,11 @@ typedef struct #define mee_onoff(name, id, var, mask) \ mee_onoff_h(name, id, var, mask, NULL) +#define mee_range_h(name, id, var, min, max, help) \ + { name, MB_OPT_RANGE, id, &(var), 0, min, max, 1, 1, 1, NULL, NULL, NULL, help } + #define mee_range(name, id, var, min, max) \ - { name, MB_OPT_RANGE, id, &(var), 0, min, max, 1, 1, 1, NULL, NULL, NULL, NULL } + mee_range_h(name, id, var, min, max, NULL) #define mee_range_hide(name, id, var, min, max) \ { name, MB_OPT_RANGE, id, &(var), 0, min, max, 0, 1, 0, NULL, NULL, NULL, NULL } diff --git a/frontend/menu.c b/frontend/menu.c index 1bfac1d4..6a07c8cc 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -70,7 +70,7 @@ enum { }; static int last_psx_w, last_psx_h, last_psx_bpp; -static int scaling, filter, cpu_clock, cpu_clock_st; +static int scaling, filter, cpu_clock, cpu_clock_st, volume_boost; static char rom_fname_reload[MAXPATHLEN]; static char last_selected_fname[MAXPATHLEN]; static int warned_about_bios, region, in_type_sel; @@ -83,6 +83,7 @@ extern int iUseInterpolation; extern int iXAPitch; extern int iSPUIRQWait; extern int iUseTimer; +extern int iVolume; static const char *bioses[24]; static const char *gpu_plugins[16]; @@ -153,12 +154,15 @@ static void menu_sync_config(void) pl_rearmed_cbs.gpu_peops.fFrameRateHz = Config.PsxType ? 50.0f : 59.94f; pl_rearmed_cbs.gpu_peops.dwFrameRateTicks = (100000*100 / (unsigned long)(pl_rearmed_cbs.gpu_peops.fFrameRateHz*100)); + + iVolume = 768 + 128 * volume_boost; } static void menu_set_defconfig(void) { g_opts = 0; scaling = SCALE_4_3; + volume_boost = 0; region = 0; in_type_sel = 0; @@ -240,6 +244,7 @@ static const struct { CE_INTVAL(iUseTimer), CE_INTVAL(warned_about_bios), CE_INTVAL(in_evdev_allow_abs_only), + CE_INTVAL(volume_boost), }; static char *get_cd_label(void) @@ -1084,11 +1089,13 @@ static int menu_loop_plugin_gpu(int id, int keys) } static const char *men_spu_interp[] = { "None", "Simple", "Gaussian", "Cubic", NULL }; +static const char h_spu_volboost[] = "Large values cause distortion"; static const char h_spu_irq_wait[] = "Wait for CPU (recommended set to ON)"; static const char h_spu_thread[] = "Run sound emulation in main thread (recommended)"; static menu_entry e_menu_plugin_spu[] = { + mee_range_h ("Volume boost", 0, volume_boost, -5, 30, h_spu_volboost), mee_onoff ("Reverb", 0, iUseReverb, 2), mee_enum ("Interpolation", 0, iUseInterpolation, men_spu_interp), mee_onoff ("Adjust XA pitch", 0, iXAPitch, 1), diff --git a/plugins/dfsound/spu.c b/plugins/dfsound/spu.c index 7b435ac6..b94fe90a 100644 --- a/plugins/dfsound/spu.c +++ b/plugins/dfsound/spu.c @@ -79,7 +79,7 @@ unsigned char * pMixIrq=0; // user settings -int iVolume=3; +int iVolume=768; // 1024 is 1.0 int iXAPitch=1; int iUseTimer=2; int iSPUIRQWait=1; @@ -661,12 +661,8 @@ static int do_samples_noise(int ch, int ns, int ns_to) static void *MAINThread(void *arg) { + int volmult = iVolume; int ns,ns_from,ns_to; -#if !defined(_MACOSX) && !defined(__arm__) - int voldiv = iVolume; -#else - const int voldiv = 2; -#endif int ch,d; int bIRQReturn=0; @@ -837,12 +833,14 @@ static void *MAINThread(void *arg) else for (ns = 0; ns < NSSIZE*2; ) { - d = SSumLR[ns] / voldiv; SSumLR[ns] = 0; + d = SSumLR[ns]; SSumLR[ns] = 0; + d = d * volmult >> 10; ssat32_to_16(d); *pS++ = d; ns++; - d = SSumLR[ns] / voldiv; SSumLR[ns] = 0; + d = SSumLR[ns]; SSumLR[ns] = 0; + d = d * volmult >> 10; ssat32_to_16(d); *pS++ = d; ns++; @@ -1056,7 +1054,6 @@ long CALLBACK SPUinit(void) memset((void *)&rvb, 0, sizeof(REVERBInfo)); InitADSR(); - iVolume = 3; spuIrq = 0; spuAddr = 0xffffffff; bEndThread = 0;