diff --git a/src/computer.c b/src/computer.c index 33b0896..11102ef 100644 --- a/src/computer.c +++ b/src/computer.c @@ -143,6 +143,7 @@ void computer_init () { //Called only on start-up ordenador.fuller_box_sound = 0; ordenador.currah_active = 0; ordenador.gui_volume = 3; + ordenador.currah_volume = 4; ordenador.aych_a = 0; ordenador.aych_b = 0; ordenador.aych_c = 0; diff --git a/src/computer.h b/src/computer.h index 08b98f0..e9cc33d 100644 --- a/src/computer.h +++ b/src/computer.h @@ -142,6 +142,7 @@ struct computer { unsigned char fuller_box_sound; // 0: no AY emulation; 1: AY emulation unsigned char audio_mode; //mono, ABC, ACB, BAC unsigned int gui_volume; + unsigned int currah_volume; // microspeech 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 6b9e532..fb71446 100644 --- a/src/emulator.c +++ b/src/emulator.c @@ -781,6 +781,7 @@ int save_config(struct computer *object, char *filename) { fprintf(fconfig,"text=%c%c",48+object->text_mini,10); fprintf(fconfig,"precision=%c%c",48+object->precision,10); fprintf(fconfig,"volume=%c%c",65+(object->volume),10); + fprintf(fconfig,"microspeech_volume=%c%c",65+(object->currah_volume),10); fprintf(fconfig,"bw=%c%c",48+object->bw,10); fprintf(fconfig,"tap_fast=%c%c",48+object->tape_fast_load,10); fprintf(fconfig,"pause_instant_load=%c%c",48+object->pause_instant_load,10); @@ -962,7 +963,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_volume=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, currah_volume = 255; if (filename) strcpy(config_path,filename); else return -2; @@ -1068,6 +1069,10 @@ int load_config(struct computer *object, char *filename) { volume=(line[7]-'A'); continue; } + if (!strncmp(line,"microspeech_volume=",19)) { + currah_volume=(line[19]-'A'); + continue; + } if (!strncmp(line,"bw=",3)) { bw=(line[3]-'0'); continue; @@ -1191,6 +1196,9 @@ int load_config(struct computer *object, char *filename) { object->volume=volume; set_volume(volume); } + if (currah_volume<9) { + object->currah_volume=currah_volume; + } if (tap_fast<2) { object->tape_fast_load=tap_fast; } @@ -1326,7 +1334,7 @@ int main(int argc,char *argv[]) printf("Modo: %d\n",ordenador.mode128k); printf("Set volume\n"); - set_volume(16); + set_volume(8); // load current config strcpy(config_path,getenv("HOME")); diff --git a/src/gui_sdl.c b/src/gui_sdl.c index 6816dd1..c931fda 100644 --- a/src/gui_sdl.c +++ b/src/gui_sdl.c @@ -120,12 +120,14 @@ static const char *audio_messages[] = { /*03*/ "^|on|off", /*04*/ "Fuller Box Audio", /*05*/ "^|on|off", - /*06*/ "Currah microspeech", - /*07*/ "^|on|off", - /*08*/ "Audio mode", - /*09*/ "^|mono|ABC|ACB|BAC", - /*10*/ "Gui Volume", - /*11*/ "^|0|1|2|3|4|5", + /*06*/ "Currah Microspeech", + /*07*/ "^|on|off", + /*08*/ "Currah MS volume", + /*09*/ "^|0|1|2|3|4|5|6|7|max", + /*10*/ "Audio mode", + /*12*/ "^|mono|ABC|ACB|BAC", + /*12*/ "Gui Volume", + /*13*/ "^|0|1|2|3|4|5", NULL }; @@ -710,7 +712,7 @@ static void tape_settings(void) static int audio_settings(void) { - unsigned int submenus[6], old_submenus_3; + unsigned int submenus[7], old_submenus_3; int opt, retorno; retorno = 0; @@ -722,8 +724,9 @@ static int audio_settings(void) submenus[1] = !ordenador.ay_emul; submenus[2] = !ordenador.fuller_box_sound; submenus[3] = !ordenador.currah_active; - submenus[4] = ordenador.audio_mode; - submenus[5] = ordenador.gui_volume; + submenus[4] = ordenador.currah_volume; + submenus[5] = ordenador.audio_mode; + submenus[6] = ordenador.gui_volume; old_submenus_3 = submenus[3]; @@ -738,8 +741,9 @@ static int audio_settings(void) if ((submenus[3]==0)&&(ordenador.mode128k)) {ordenador.currah_active=0; msgInfo("Currah only with 48k model", 3000, NULL);} 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_volume = submenus[5]; + ordenador.currah_volume = submenus[4]; + ordenador.audio_mode = submenus[5]; + ordenador.gui_volume = submenus[6]; if (old_submenus_3 == ordenador.currah_active) {ResetComputer(); retorno = -2;} diff --git a/src/menu_sdl.c b/src/menu_sdl.c index 9398532..d31719c 100644 --- a/src/menu_sdl.c +++ b/src/menu_sdl.c @@ -1347,6 +1347,8 @@ static const char *menu_select_file_internal(char *dir_path, char buf[80]; unsigned int block_pos; + block_pos = 0; + if (!strcmp(dir_path,"browser")) file_list = get_file_list_browser(tape_pos, &block_pos); else if (!strcmp(dir_path,"select_block")) file_list = get_file_list_select_block(); else file_list = get_file_list(dir_path); diff --git a/src/spk_ay.c b/src/spk_ay.c index 7f81feb..86cadd3 100644 --- a/src/spk_ay.c +++ b/src/spk_ay.c @@ -368,8 +368,8 @@ inline void play_sound (unsigned int tstados) { { if ((ordenador.currah_active)&&(!ordenador.turbo_state)) { - *ordenador.current_buffer = ((((int)(rvalue_sum/N_SAMPLES)+((int)allophone_buffer[ordenador.current_allophone][ordenador.allophone_sound_cuantity/INTONATION_INCREASE])*(int)ordenador.volume*4)<<16)&0XFFFF0000) - |(((int)(lvalue_sum/N_SAMPLES)+((int)allophone_buffer[ordenador.current_allophone][ordenador.allophone_sound_cuantity/INTONATION_INCREASE])*(int)ordenador.volume*4)&0X0000FFFF); + *ordenador.current_buffer = ((((int)(rvalue_sum/N_SAMPLES)+((int)allophone_buffer[ordenador.current_allophone][ordenador.allophone_sound_cuantity/INTONATION_INCREASE])*(int)ordenador.currah_volume*16)<<16)&0XFFFF0000) + |(((int)(lvalue_sum/N_SAMPLES)+((int)allophone_buffer[ordenador.current_allophone][ordenador.allophone_sound_cuantity/INTONATION_INCREASE])*(int)ordenador.currah_volume*16)&0X0000FFFF); if(!ordenador.intonation_allophone) ordenador.allophone_sound_cuantity+=INTONATION_INCREASE; else ordenador.allophone_sound_cuantity+=INTONATION_INCREASE+1; //The freq increase should be gradual