From fb061f73d4ffa77818a8922d61bfae9089a18f33 Mon Sep 17 00:00:00 2001 From: "fabio.olimpieri" Date: Sun, 27 May 2012 17:15:01 +0000 Subject: [PATCH] No computer reset between issue 2 and 3, fixed bug in sound and increased sound volume --- src/computer.c | 2 +- src/gui_sdl.c | 10 ++++++---- src/sound.c | 2 +- src/spk_ay.c | 14 +++++++------- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/computer.c b/src/computer.c index 1c19ff4..469c936 100644 --- a/src/computer.c +++ b/src/computer.c @@ -1344,7 +1344,7 @@ void Z80free_Out (register word Port, register byte Value) { if (((Port|maskport) == 0xBFFD)&&(ordenador.ay_emul)) { ordenador.ay_registers[ordenador.ay_latch] = (unsigned char) Value; - if (ordenador.ay_latch == 13) + if (ordenador.ay_latch == 13) //Envelope shape ordenador.ay_envel_way = 2; // start cycle } } diff --git a/src/gui_sdl.c b/src/gui_sdl.c index c2bb719..a78188d 100644 --- a/src/gui_sdl.c +++ b/src/gui_sdl.c @@ -369,6 +369,7 @@ static void emulation_settings(void) { unsigned int submenus[7],submenus_old[7]; int opt, i; + unsigned char old_mode; memset(submenus, 0, sizeof(submenus)); @@ -381,6 +382,7 @@ static void emulation_settings(void) submenus[6] = !ordenador.ay_emul; for (i=0; i<7; i++) submenus_old[i] = submenus[i]; + old_mode=ordenador.mode128k; opt = menu_select_title("Emulation settings menu", emulation_messages, submenus); @@ -388,7 +390,7 @@ static void emulation_settings(void) return; set_machine_model(submenus[0]); - if (submenus[0] != submenus_old[0]) ResetComputer(); else + if (old_mode!=ordenador.mode128k) ResetComputer(); else ordenador.ay_emul = !submenus[6]; ordenador.volume = submenus[1]*2; //I should use set_volume() ? @@ -982,7 +984,7 @@ static void save_load_general_configurations(int which) { int retorno; - unsigned char old_bw,old_model; + unsigned char old_bw,old_mode; char config_path[1024]; int length; FILE *fconfig; @@ -1009,10 +1011,10 @@ static void save_load_general_configurations(int which) if (which == 0) // Load config file { old_bw = ordenador.bw; - old_model= get_machine_model(); + old_mode= ordenador.mode128k; if (!load_config(&ordenador,config_path)) msgInfo("General confs loaded",3000,NULL); if (old_bw!=ordenador.bw) computer_set_palete(); - if (old_model != get_machine_model()) ResetComputer(); + if (old_mode != ordenador.mode128k) ResetComputer(); break; } else // Delete config file diff --git a/src/sound.c b/src/sound.c index bc74df3..8baf60e 100644 --- a/src/sound.c +++ b/src/sound.c @@ -495,7 +495,7 @@ void sound_play() { #ifdef GEKKO case SOUND_ASND: // ASND if (!started_sound_asnd) { - ASND_SetVoice(1,VOICE_MONO_8BIT,48000,0,sound[0],ordenador.buffer_len, + ASND_SetVoice(1,VOICE_MONO_8BIT_U,48000,0,sound[0],ordenador.buffer_len, MID_VOLUME, MID_VOLUME, callback); started_sound_asnd = 1; } diff --git a/src/spk_ay.c b/src/spk_ay.c index 8769481..509408d 100644 --- a/src/spk_ay.c +++ b/src/spk_ay.c @@ -230,7 +230,7 @@ inline void play_ay (unsigned int tstados) { (unsigned char) ((((unsigned int) ordenador. ay_envel_value)) * - (unsigned int) ordenador.volume) / 15; + (unsigned int) ordenador.volume) / 10; else ordenador.vol_a = (unsigned @@ -238,14 +238,14 @@ inline void play_ay (unsigned int tstados) { ay_registers[8] & 0x0F)) * (unsigned int) ordenador.volume) / - 15); + 10); if (ordenador.ay_registers[10] & 0x10) ordenador.vol_c = (unsigned char) ((((unsigned int) ordenador. ay_envel_value)) * - (unsigned int) ordenador.volume) / 15; + (unsigned int) ordenador.volume) / 10; else ordenador.vol_c = (unsigned @@ -253,14 +253,14 @@ inline void play_ay (unsigned int tstados) { ay_registers[10] & 0x0F)) * (unsigned int) ordenador.volume) / - 15); + 10); if (ordenador.ay_registers[9] & 0x10) ordenador.vol_b = (unsigned char) ((((unsigned int) ordenador. ay_envel_value)) * - (unsigned int) ordenador.volume) / 15; + (unsigned int) ordenador.volume) / 10; else ordenador.vol_b = (unsigned @@ -268,7 +268,7 @@ inline void play_ay (unsigned int tstados) { ay_registers[9] & 0x0F)) * (unsigned int) ordenador.volume) / - 15); + 10); } } @@ -292,7 +292,7 @@ inline void play_sound (unsigned int tstados) { for (bucle = 0; bucle < ordenador.increment; bucle++) { sample_v = ordenador.sample1b[bucle]; if ((ordenador.sound_bit) && (sample_v)) - ordenador.sound_current_value=ordenador.volume*4; + ordenador.sound_current_value=ordenador.volume*6; else ordenador.sound_current_value=0; value = ordenador.sound_current_value;