diff options
Diffstat (limited to 'trunk/src/mame/audio/gotya.c')
-rw-r--r-- | trunk/src/mame/audio/gotya.c | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/trunk/src/mame/audio/gotya.c b/trunk/src/mame/audio/gotya.c new file mode 100644 index 00000000000..c189063c6ed --- /dev/null +++ b/trunk/src/mame/audio/gotya.c @@ -0,0 +1,74 @@ +#include "emu.h" +#include "sound/samples.h" +#include "includes/gotya.h" + + +struct gotya_sample +{ + int sound_command; + int channel; + int looping; +}; + + +static const struct gotya_sample gotya_samples[] = +{ + { 0x01, 0, 0 }, + { 0x02, 1, 0 }, + { 0x03, 2, 0 }, + { 0x05, 2, 0 }, + { 0x06, 3, 0 }, + { 0x07, 3, 0 }, + { 0x08, 0, 1 }, + { 0x0a, 0, 0 }, + { 0x0b, 0, 0 }, + +/* all the speech can go to one channel? */ + + { 0x10, 3, 0 }, + { 0x11, 3, 0 }, + { 0x12, 0, 0 }, /* this should stop the main tune */ + { 0x13, 3, 0 }, + { 0x14, 3, 0 }, + { 0x15, 3, 0 }, + { 0x16, 3, 0 }, + { 0x17, 3, 0 }, + { 0x18, 3, 0 }, + { 0x19, 3, 0 }, + { 0x1a, 3, 0 }, + { -1, 0, 0 } /* end of array */ +}; + +WRITE8_HANDLER( gotya_soundlatch_w ) +{ + gotya_state *state = space->machine().driver_data<gotya_state>(); + int sample_number; + + if (data == 0) + { + sample_stop(state->m_samples, 0); + state->m_theme_playing = 0; + return; + } + + /* search for sample to play */ + for (sample_number = 0; gotya_samples[sample_number].sound_command != -1; sample_number++) + { + if (gotya_samples[sample_number].sound_command == data) + { + if (gotya_samples[sample_number].looping && state->m_theme_playing) + { + /* don't restart main theme */ + return; + } + + sample_start(state->m_samples, gotya_samples[sample_number].channel, sample_number, gotya_samples[sample_number].looping); + + if (gotya_samples[sample_number].channel == 0) + { + state->m_theme_playing = gotya_samples[sample_number].looping; + } + return; + } + } +} |