From 91da875796bba523cb5793b435a6dd7240bdfd46 Mon Sep 17 00:00:00 2001 From: "fabio.olimpieri" Date: Thu, 25 Dec 2014 10:14:47 +0000 Subject: [PATCH] Added GUI volume setting --- src/computer.c | 2 +- src/computer.h | 2 +- src/emulator.c | 12 ++++++------ src/gui_sdl.c | 8 ++++---- src/menu_sdl.c | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/computer.c b/src/computer.c index 6015c22..b728dda 100644 --- a/src/computer.c +++ b/src/computer.c @@ -142,7 +142,7 @@ void computer_init () { //Called only on start-up ordenador.ay_emul = 0; ordenador.fuller_box_sound = 0; ordenador.currah_active = 0; - ordenador.gui_sound = 1; + ordenador.gui_volume = 3; ordenador.aych_a = 0; ordenador.aych_b = 0; ordenador.aych_c = 0; diff --git a/src/computer.h b/src/computer.h index c2add64..08b98f0 100644 --- a/src/computer.h +++ b/src/computer.h @@ -141,7 +141,7 @@ struct computer { unsigned char ay_emul; // 0: no AY emulation; 1: AY emulation unsigned char fuller_box_sound; // 0: no AY emulation; 1: AY emulation unsigned char audio_mode; //mono, ABC, ACB, BAC - unsigned char gui_sound; + unsigned int gui_volume; unsigned int vol_a,vol_b,vol_c; unsigned int tst_ay; unsigned int ay_latch; diff --git a/src/emulator.c b/src/emulator.c index c8e536c..6b9e532 100644 --- a/src/emulator.c +++ b/src/emulator.c @@ -773,7 +773,7 @@ int save_config(struct computer *object, char *filename) { fprintf(fconfig,"fuller_box_sound=%c%c",48+object->fuller_box_sound,10); fprintf(fconfig,"currah_microspeech=%c%c",48+object->currah_active,10); fprintf(fconfig,"audio_mode=%c%c",48+object->audio_mode,10); - fprintf(fconfig,"gui_sound=%c%c",48+object->gui_sound,10); + fprintf(fconfig,"gui_volume=%c%c",48+object->gui_volume,10); fprintf(fconfig,"interface1=%c%c",48+object->mdr_active,10); fprintf(fconfig,"doublescan=%c%c",48+object->dblscan,10); fprintf(fconfig,"framerate=%c%c",48+jump_frames,10); @@ -962,7 +962,7 @@ int load_config(struct computer *object, char *filename) { unsigned char volume=255,mode128k=255,issue=255,ntsc=255, joystick1=255,joystick2=255,ay_emul=255,mdr_active=255, dblscan=255,framerate =255, screen =255, text=255, precision=255, bw=255, tap_fast=255, audio_mode=255, joypad1=255, joypad2=255, rumble1=255, rumble2=255, joy_n=255, key_n=255, port=255, autoconf=255, turbo=225, vk_auto=255, vk_rumble=255, - rewind_on_reset=255, pause_instant_load =255, ignore_z80_joy_conf=255, gui_sound=255, fuller_box_sound=255, currah_active = 255, se_basic =255; + rewind_on_reset=255, pause_instant_load =255, ignore_z80_joy_conf=255, gui_volume=255, fuller_box_sound=255, currah_active = 255, se_basic =255; if (filename) strcpy(config_path,filename); else return -2; @@ -1036,8 +1036,8 @@ int load_config(struct computer *object, char *filename) { audio_mode=line[11]-'0'; continue; } - if (!strncmp(line,"gui_sound=",10)) { - gui_sound=line[10]-'0'; + if (!strncmp(line,"gui_volume=",11)) { + gui_volume=line[11]-'0'; continue; } if (!strncmp(line,"interface1=",11)) { @@ -1162,8 +1162,8 @@ int load_config(struct computer *object, char *filename) { if (audio_mode<4) { object->audio_mode=audio_mode; } - if (gui_sound<2) { - object->gui_sound=gui_sound; + if (gui_volume<6) { + object->gui_volume=gui_volume; } if (mdr_active<2) { object->mdr_active=mdr_active; diff --git a/src/gui_sdl.c b/src/gui_sdl.c index 93b695b..6816dd1 100644 --- a/src/gui_sdl.c +++ b/src/gui_sdl.c @@ -124,8 +124,8 @@ static const char *audio_messages[] = { /*07*/ "^|on|off", /*08*/ "Audio mode", /*09*/ "^|mono|ABC|ACB|BAC", - /*10*/ "Gui sound", - /*11*/ "^|on|off", + /*10*/ "Gui Volume", + /*11*/ "^|0|1|2|3|4|5", NULL }; @@ -723,7 +723,7 @@ static int audio_settings(void) submenus[2] = !ordenador.fuller_box_sound; submenus[3] = !ordenador.currah_active; submenus[4] = ordenador.audio_mode; - submenus[5] = !ordenador.gui_sound; + submenus[5] = ordenador.gui_volume; old_submenus_3 = submenus[3]; @@ -739,7 +739,7 @@ static int audio_settings(void) else if (ordenador.currah_rom_unavailable) {ordenador.currah_active=0; msgInfo("currah.rom not present", 3000, NULL);} else ordenador.currah_active = !submenus[3]; ordenador.audio_mode = submenus[4]; - ordenador.gui_sound = !submenus[5]; + ordenador.gui_volume = submenus[5]; if (old_submenus_3 == ordenador.currah_active) {ResetComputer(); retorno = -2;} diff --git a/src/menu_sdl.c b/src/menu_sdl.c index 4d774a9..13d2a1e 100644 --- a/src/menu_sdl.c +++ b/src/menu_sdl.c @@ -1620,12 +1620,12 @@ int menu_is_inited(void) //Sound must be reseted before calling this function (except for ASND) void play_click(int sound) { - if (!ordenador.gui_sound) return; + if (!ordenador.gui_volume) return; #ifdef GEKKO if (sound_type == SOUND_ASND) { ASND_SetVoice(2,VOICE_STEREO_16BIT_BE,ordenador.freq,0, click_buffer_pointer[sound],len_click_buffer[sound], - 255, 255, NULL); + ordenador.gui_volume*51, ordenador.gui_volume*51, NULL); return; } #endif