diff options
| author | 2009-08-09 23:08:40 +0000 | |
|---|---|---|
| committer | 2009-08-09 23:08:40 +0000 | |
| commit | 4720d3349beac3256f61219693b148fee52f43d4 (patch) | |
| tree | 6d45a96b040fbb2402eb65123dd85d13b7122d1d | |
| parent | 060c4654acb165dbffaf22f1202fff8a04ecd3d2 (diff) | |
Discrete sound may nuke performance - timers as well
- Rewrote timer code so that the pitch timer is only used when it produces audible results.
| -rw-r--r-- | src/mame/audio/galaxian.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/mame/audio/galaxian.c b/src/mame/audio/galaxian.c index 8513b864f66..94e9ced582f 100644 --- a/src/mame/audio/galaxian.c +++ b/src/mame/audio/galaxian.c @@ -894,11 +894,16 @@ static TIMER_CALLBACK( pitch_callback ) { const device_config *device = devtag_get_device(machine, GAL_AUDIO); - timer_adjust_oneshot(pitch_timer, ATTOTIME_IN_HZ(SOUND_CLOCK / (256 - pitch_l)), 0); pitch_h++; if (pitch_h > 15) pitch_h = 0; - discrete_sound_w(device, GAL_INP_PITCH_HIGH, pitch_h ); + if (pitch_l < 255) + { + /* performance tweak: The counter is always running, but + * most of the time with a very (unaudible) frequency */ + discrete_sound_w(device, GAL_INP_PITCH_HIGH, pitch_h ); + timer_adjust_oneshot(pitch_timer, ATTOTIME_IN_HZ(SOUND_CLOCK / (256 - pitch_l)), 0); + } } static SOUND_START(galaxian) @@ -910,6 +915,16 @@ static SOUND_START(galaxian) timer_adjust_oneshot(pitch_timer, ATTOTIME_IN_HZ(SOUND_CLOCK/256), 0); } +/* IC 9J */ +WRITE8_DEVICE_HANDLER( galaxian_pitch_w ) +{ + UINT8 old_data; + + old_data = pitch_l; + pitch_l = data; + if (pitch_l < 255 && old_data == 255) /* turn the timer on again */ + timer_adjust_oneshot(pitch_timer, ATTOTIME_IN_HZ(SOUND_CLOCK / (256 - pitch_l)), 0); +} WRITE8_DEVICE_HANDLER( galaxian_lfo_freq_w ) { @@ -943,12 +958,6 @@ WRITE8_DEVICE_HANDLER( galaxian_shoot_enable_w ) discrete_sound_w(device, GAL_INP_FIRE, data & 0x01); } -/* FIXME: use timer ! -- IC 9J */ -WRITE8_DEVICE_HANDLER( galaxian_pitch_w ) -{ - pitch_l = data; -} - /* FIXME: May be replaced by one call! */ WRITE8_DEVICE_HANDLER( galaxian_sound_w ) { |
