mirror of
https://github.com/Oibaf66/fbzx-wii.git
synced 2024-11-24 17:16:57 +01:00
Fixed sound bug
This commit is contained in:
parent
ec7e56b438
commit
2023bc539e
@ -553,7 +553,7 @@ void load_snap(struct z80snapshot *snap) {
|
|||||||
break;
|
break;
|
||||||
case 1: // 128k
|
case 1: // 128k
|
||||||
printf("Mode 128K\n");
|
printf("Mode 128K\n");
|
||||||
ordenador.mode128k=2; // +2 mode
|
ordenador.mode128k=1; // 128k mode
|
||||||
ordenador.issue=3;
|
ordenador.issue=3;
|
||||||
ResetComputer();
|
ResetComputer();
|
||||||
printf("Pager: %X\n",snap->pager);
|
printf("Pager: %X\n",snap->pager);
|
||||||
|
@ -860,15 +860,15 @@ inline void read_keyboard () {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SDLK_F11: // lower volume
|
case SDLK_F11: // lower volume
|
||||||
if (ordenador.volume > 3)
|
if (ordenador.volume > 0)
|
||||||
set_volume (ordenador.volume - 4);
|
set_volume (ordenador.volume - 1);
|
||||||
sprintf (ordenador.osd_text, " Volume: %d ",ordenador.volume / 4);
|
sprintf (ordenador.osd_text, " Volume: %d ",ordenador.volume);
|
||||||
ordenador.osd_time = 50;
|
ordenador.osd_time = 50;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDLK_F12: // upper volume
|
case SDLK_F12: // upper volume
|
||||||
set_volume (ordenador.volume + 4);
|
set_volume (ordenador.volume + 1);
|
||||||
sprintf (ordenador.osd_text, " Volume: %d ",ordenador.volume / 4);
|
sprintf (ordenador.osd_text, " Volume: %d ",ordenador.volume);
|
||||||
ordenador.osd_time = 50;
|
ordenador.osd_time = 50;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1420,8 +1420,8 @@ void set_volume (unsigned char volume) {
|
|||||||
unsigned char vol2;
|
unsigned char vol2;
|
||||||
int bucle;
|
int bucle;
|
||||||
|
|
||||||
if (volume > 64)
|
if (volume > 16)
|
||||||
vol2 = 64;
|
vol2 = 16;
|
||||||
else
|
else
|
||||||
vol2 = volume;
|
vol2 = volume;
|
||||||
|
|
||||||
|
@ -414,7 +414,7 @@ void save_config(struct computer *object) {
|
|||||||
fprintf(fconfig,"ay_sound=%c%c",48+object->ay_emul,10);
|
fprintf(fconfig,"ay_sound=%c%c",48+object->ay_emul,10);
|
||||||
fprintf(fconfig,"interface1=%c%c",48+object->mdr_active,10);
|
fprintf(fconfig,"interface1=%c%c",48+object->mdr_active,10);
|
||||||
fprintf(fconfig,"doublescan=%c%c",48+object->dblscan,10);
|
fprintf(fconfig,"doublescan=%c%c",48+object->dblscan,10);
|
||||||
fprintf(fconfig,"volume=%c%c",65+(object->volume/4),10);
|
fprintf(fconfig,"volume=%c%c",65+(object->volume),10);
|
||||||
fprintf(fconfig,"bw=%c%c",48+object->bw,10);
|
fprintf(fconfig,"bw=%c%c",48+object->bw,10);
|
||||||
fprintf(fconfig,"tap_fast=%c%c",48+object->tape_fast_load,10);
|
fprintf(fconfig,"tap_fast=%c%c",48+object->tape_fast_load,10);
|
||||||
fprintf(fconfig,"joypad1=%c%c",48+object->joypad_as_joystick[0],10);
|
fprintf(fconfig,"joypad1=%c%c",48+object->joypad_as_joystick[0],10);
|
||||||
@ -437,7 +437,7 @@ void load_config(struct computer *object) {
|
|||||||
char line[1024],carac,done;
|
char line[1024],carac,done;
|
||||||
int length,pos, key_sdl=0;;
|
int length,pos, key_sdl=0;;
|
||||||
FILE *fconfig;
|
FILE *fconfig;
|
||||||
unsigned char volume=255,mode128k=255,issue=255,joystick1=255,joystick2=255,ay_emul=255,mdr_active=255,
|
unsigned char volume=16,mode128k=255,issue=255,joystick1=255,joystick2=255,ay_emul=255,mdr_active=255,
|
||||||
dblscan=255,bw=255, tap_fast=0, joypad1=0, joypad2=0, rumble1=0, rumble2=0, joy_n=0, key_n=0;
|
dblscan=255,bw=255, tap_fast=0, joypad1=0, joypad2=0, rumble1=0, rumble2=0, joy_n=0, key_n=0;
|
||||||
|
|
||||||
strcpy(config_path,getenv("HOME"));
|
strcpy(config_path,getenv("HOME"));
|
||||||
@ -503,7 +503,7 @@ void load_config(struct computer *object) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strncmp(line,"volume=",7)) {
|
if (!strncmp(line,"volume=",7)) {
|
||||||
volume=4*(line[7]-'A');
|
volume=(line[7]-'A');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strncmp(line,"bw=",3)) {
|
if (!strncmp(line,"bw=",3)) {
|
||||||
@ -562,7 +562,7 @@ void load_config(struct computer *object) {
|
|||||||
if (bw<2) {
|
if (bw<2) {
|
||||||
object->bw=bw;
|
object->bw=bw;
|
||||||
}
|
}
|
||||||
if (volume<255) {
|
if (volume<17) {
|
||||||
object->volume=volume;
|
object->volume=volume;
|
||||||
set_volume(volume);
|
set_volume(volume);
|
||||||
}
|
}
|
||||||
@ -638,7 +638,7 @@ int main(int argc,char *argv[]) {
|
|||||||
printf("Modo: %d\n",ordenador.mode128k);
|
printf("Modo: %d\n",ordenador.mode128k);
|
||||||
|
|
||||||
printf("Set volume\n");
|
printf("Set volume\n");
|
||||||
set_volume(70);
|
set_volume(16);
|
||||||
|
|
||||||
// load current config
|
// load current config
|
||||||
load_config(&ordenador);
|
load_config(&ordenador);
|
||||||
|
@ -333,7 +333,7 @@ static void emulation_settings(void)
|
|||||||
memset(submenus, 0, sizeof(submenus));
|
memset(submenus, 0, sizeof(submenus));
|
||||||
|
|
||||||
submenus[0] = get_machine_model();
|
submenus[0] = get_machine_model();
|
||||||
submenus[1] = (unsigned int) (ordenador.volume/8);
|
submenus[1] = ordenador.volume/2;
|
||||||
submenus[2] = !ordenador.tape_fast_load;
|
submenus[2] = !ordenador.tape_fast_load;
|
||||||
submenus[3] = !ordenador.turbo;
|
submenus[3] = !ordenador.turbo;
|
||||||
submenus[4] = !ordenador.dblscan;
|
submenus[4] = !ordenador.dblscan;
|
||||||
@ -351,7 +351,7 @@ static void emulation_settings(void)
|
|||||||
if (submenus[0] != submenus_old[0]) ResetComputer(); else
|
if (submenus[0] != submenus_old[0]) ResetComputer(); else
|
||||||
ordenador.ay_emul = !submenus[6];
|
ordenador.ay_emul = !submenus[6];
|
||||||
|
|
||||||
ordenador.volume = submenus[1]*8; //I should use set_volume() ?
|
ordenador.volume = submenus[1]*2; //I should use set_volume() ?
|
||||||
ordenador.tape_fast_load = !submenus[2];
|
ordenador.tape_fast_load = !submenus[2];
|
||||||
ordenador.turbo = !submenus[3];
|
ordenador.turbo = !submenus[3];
|
||||||
|
|
||||||
|
@ -293,8 +293,8 @@ inline void play_sound (unsigned int tstados) {
|
|||||||
sample_v = ordenador.sample1b[bucle];
|
sample_v = ordenador.sample1b[bucle];
|
||||||
if ((ordenador.sound_bit) && (sample_v)) {
|
if ((ordenador.sound_bit) && (sample_v)) {
|
||||||
ordenador.sound_current_value+=(ordenador.tst_sample/8);
|
ordenador.sound_current_value+=(ordenador.tst_sample/8);
|
||||||
if(ordenador.sound_current_value>ordenador.volume)
|
if(ordenador.sound_current_value>ordenador.volume*4)
|
||||||
ordenador.sound_current_value = ordenador.volume;
|
ordenador.sound_current_value = ordenador.volume*4;
|
||||||
} else {
|
} else {
|
||||||
if(ordenador.sound_current_value>=(ordenador.tst_sample/8))
|
if(ordenador.sound_current_value>=(ordenador.tst_sample/8))
|
||||||
ordenador.sound_current_value-=((ordenador.tst_sample)/8);
|
ordenador.sound_current_value-=((ordenador.tst_sample)/8);
|
||||||
@ -325,7 +325,7 @@ inline void play_sound (unsigned int tstados) {
|
|||||||
if (value > 255)
|
if (value > 255)
|
||||||
value = 255;
|
value = 255;
|
||||||
sample_v = (char)(value - (unsigned int)ordenador.sign);
|
sample_v = (char)(value - (unsigned int)ordenador.sign);
|
||||||
*ordenador.current_buffer = 2*sample_v;
|
*ordenador.current_buffer = sample_v;
|
||||||
ordenador.current_buffer++;
|
ordenador.current_buffer++;
|
||||||
}
|
}
|
||||||
ordenador.sound_cuantity++;
|
ordenador.sound_cuantity++;
|
||||||
|
Loading…
Reference in New Issue
Block a user