From 8a73ce38bbc2c205fb67e274d0c3304b460b9a53 Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Sun, 7 Oct 2007 19:18:41 +0000 Subject: Added beep sound to Nippon Safes for Amiga. svn-id: r29171 --- engines/parallaction/sound.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'engines/parallaction/sound.cpp') diff --git a/engines/parallaction/sound.cpp b/engines/parallaction/sound.cpp index 605a71bbdd..4d4386b642 100644 --- a/engines/parallaction/sound.cpp +++ b/engines/parallaction/sound.cpp @@ -318,6 +318,28 @@ AmigaSoundMan::~AmigaSoundMan() { stopSfx(3); } +static byte res_amigaBeep[] = { + 0, 20, 40, 60, 80, 60, 40, 20, 0, 236, 216, 196, 176, 196, 216, 236 +}; + +void AmigaSoundMan::loadChannelData(const char *filename, Channel *ch) { + if (!scumm_stricmp("beep", filename)) { + ch->header.oneShotHiSamples = 0; + ch->header.repeatHiSamples = 0; + ch->header.samplesPerHiCycle = 0; + ch->header.samplesPerSec = 12000; + ch->header.volume = 255; + ch->data = res_amigaBeep; + ch->dataSize = 16; + return; + } + + Common::ReadStream *stream = _vm->_disk->loadSound(filename); + Audio::A8SVXDecoder decoder(*stream, ch->header, ch->data, ch->dataSize); + decoder.decode(); + delete stream; +} + void AmigaSoundMan::playSfx(const char *filename, uint channel, bool looping, int volume, int rate) { if (channel >= NUM_AMIGA_CHANNELS) { warning("unknown sfx channel"); @@ -327,10 +349,7 @@ void AmigaSoundMan::playSfx(const char *filename, uint channel, bool looping, in debugC(1, kDebugAudio, "AmigaSoundMan::playSfx(%s, %i)", filename, channel); Channel *ch = &_channels[channel]; - Common::ReadStream *stream = _vm->_disk->loadSound(filename); - Audio::A8SVXDecoder decoder(*stream, ch->header, ch->data, ch->dataSize); - decoder.decode(); - delete stream; + loadChannelData(filename, ch); uint32 loopStart, loopEnd, flags; if (looping) { -- cgit v1.2.3