Fixed sound bug

This commit is contained in:
fabio.olimpieri 2012-05-11 18:07:17 +00:00
parent ec7e56b438
commit 2023bc539e
5 changed files with 18 additions and 18 deletions

View File

@ -553,7 +553,7 @@ void load_snap(struct z80snapshot *snap) {
break;
case 1: // 128k
printf("Mode 128K\n");
ordenador.mode128k=2; // +2 mode
ordenador.mode128k=1; // 128k mode
ordenador.issue=3;
ResetComputer();
printf("Pager: %X\n",snap->pager);

View File

@ -860,15 +860,15 @@ inline void read_keyboard () {
break;
case SDLK_F11: // lower volume
if (ordenador.volume > 3)
set_volume (ordenador.volume - 4);
sprintf (ordenador.osd_text, " Volume: %d ",ordenador.volume / 4);
if (ordenador.volume > 0)
set_volume (ordenador.volume - 1);
sprintf (ordenador.osd_text, " Volume: %d ",ordenador.volume);
ordenador.osd_time = 50;
break;
case SDLK_F12: // upper volume
set_volume (ordenador.volume + 4);
sprintf (ordenador.osd_text, " Volume: %d ",ordenador.volume / 4);
set_volume (ordenador.volume + 1);
sprintf (ordenador.osd_text, " Volume: %d ",ordenador.volume);
ordenador.osd_time = 50;
break;
}
@ -1420,8 +1420,8 @@ void set_volume (unsigned char volume) {
unsigned char vol2;
int bucle;
if (volume > 64)
vol2 = 64;
if (volume > 16)
vol2 = 16;
else
vol2 = volume;

View File

@ -414,7 +414,7 @@ void save_config(struct computer *object) {
fprintf(fconfig,"ay_sound=%c%c",48+object->ay_emul,10);
fprintf(fconfig,"interface1=%c%c",48+object->mdr_active,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,"tap_fast=%c%c",48+object->tape_fast_load,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;
int length,pos, key_sdl=0;;
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;
strcpy(config_path,getenv("HOME"));
@ -503,7 +503,7 @@ void load_config(struct computer *object) {
continue;
}
if (!strncmp(line,"volume=",7)) {
volume=4*(line[7]-'A');
volume=(line[7]-'A');
continue;
}
if (!strncmp(line,"bw=",3)) {
@ -562,7 +562,7 @@ void load_config(struct computer *object) {
if (bw<2) {
object->bw=bw;
}
if (volume<255) {
if (volume<17) {
object->volume=volume;
set_volume(volume);
}
@ -638,7 +638,7 @@ int main(int argc,char *argv[]) {
printf("Modo: %d\n",ordenador.mode128k);
printf("Set volume\n");
set_volume(70);
set_volume(16);
// load current config
load_config(&ordenador);

View File

@ -333,7 +333,7 @@ static void emulation_settings(void)
memset(submenus, 0, sizeof(submenus));
submenus[0] = get_machine_model();
submenus[1] = (unsigned int) (ordenador.volume/8);
submenus[1] = ordenador.volume/2;
submenus[2] = !ordenador.tape_fast_load;
submenus[3] = !ordenador.turbo;
submenus[4] = !ordenador.dblscan;
@ -351,7 +351,7 @@ static void emulation_settings(void)
if (submenus[0] != submenus_old[0]) ResetComputer(); else
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.turbo = !submenus[3];

View File

@ -293,8 +293,8 @@ inline void play_sound (unsigned int tstados) {
sample_v = ordenador.sample1b[bucle];
if ((ordenador.sound_bit) && (sample_v)) {
ordenador.sound_current_value+=(ordenador.tst_sample/8);
if(ordenador.sound_current_value>ordenador.volume)
ordenador.sound_current_value = ordenador.volume;
if(ordenador.sound_current_value>ordenador.volume*4)
ordenador.sound_current_value = ordenador.volume*4;
} else {
if(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)
value = 255;
sample_v = (char)(value - (unsigned int)ordenador.sign);
*ordenador.current_buffer = 2*sample_v;
*ordenador.current_buffer = sample_v;
ordenador.current_buffer++;
}
ordenador.sound_cuantity++;