comparison ym2612.c @ 522:6a14c5a95648

Adjust PSG and YM-2612 volume to be closer to the real console
author Michael Pavone <pavone@retrodev.com>
date Tue, 11 Feb 2014 12:52:28 -0800
parents 7565ec2ac652
children 7df7f493b3b6
comparison
equal deleted inserted replaced
521:7565ec2ac652 522:6a14c5a95648
230 } 230 }
231 } 231 }
232 } 232 }
233 } 233 }
234 234
235 #define YM_VOLUME_DIVIDER 2 235 #define YM_VOLUME_MULTIPLIER 2
236 #define YM_VOLUME_DIVIDER 3
236 #define YM_MOD_SHIFT 1 237 #define YM_MOD_SHIFT 1
237 238
238 #define TIMER_A_MAX 1023 239 #define TIMER_A_MAX 1023
239 #define TIMER_B_MAX (255*16) 240 #define TIMER_B_MAX (255*16)
240 241
453 if (first_key_on) { 454 if (first_key_on) {
454 int16_t value = context->channels[channel].output & 0x3FE0; 455 int16_t value = context->channels[channel].output & 0x3FE0;
455 if (value & 0x2000) { 456 if (value & 0x2000) {
456 value |= 0xC000; 457 value |= 0xC000;
457 } 458 }
458 dfprintf(debug_file, "channel %d output: %d\n", channel, value / YM_VOLUME_DIVIDER); 459 dfprintf(debug_file, "channel %d output: %d\n", channel, (value * YM_VOLUME_MULTIPLIER) / YM_VOLUME_DIVIDER);
459 } 460 }
460 } 461 }
461 //puts("operator update done"); 462 //puts("operator update done");
462 } 463 }
463 context->current_op++; 464 context->current_op++;
483 } 484 }
484 if (context->channels[i].logfile) { 485 if (context->channels[i].logfile) {
485 fwrite(&value, sizeof(value), 1, context->channels[i].logfile); 486 fwrite(&value, sizeof(value), 1, context->channels[i].logfile);
486 } 487 }
487 if (context->channels[i].lr & 0x80) { 488 if (context->channels[i].lr & 0x80) {
488 context->audio_buffer[context->buffer_pos] += value / YM_VOLUME_DIVIDER; 489 context->audio_buffer[context->buffer_pos] += (value * YM_VOLUME_MULTIPLIER) / YM_VOLUME_DIVIDER;
489 } 490 }
490 if (context->channels[i].lr & 0x40) { 491 if (context->channels[i].lr & 0x40) {
491 context->audio_buffer[context->buffer_pos+1] += value / YM_VOLUME_DIVIDER; 492 context->audio_buffer[context->buffer_pos+1] += (value * YM_VOLUME_MULTIPLIER) / YM_VOLUME_DIVIDER;
492 } 493 }
493 } 494 }
494 context->buffer_pos += 2; 495 context->buffer_pos += 2;
495 if (context->buffer_pos == context->sample_limit) { 496 if (context->buffer_pos == context->sample_limit) {
496 if (!headless) { 497 if (!headless) {