aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction/sound_ns.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/parallaction/sound_ns.cpp')
-rw-r--r--engines/parallaction/sound_ns.cpp42
1 files changed, 26 insertions, 16 deletions
diff --git a/engines/parallaction/sound_ns.cpp b/engines/parallaction/sound_ns.cpp
index 1fd627ce4b..b2336c55d9 100644
--- a/engines/parallaction/sound_ns.cpp
+++ b/engines/parallaction/sound_ns.cpp
@@ -333,8 +333,31 @@ void DosSoundMan_ns::playLocationMusic(const char *location) {
}
}
+
+
+
+#pragma mark Amiga sound manager code
+
+
+#define AMIGABEEP_SIZE 16
+#define NUM_REPEATS 60
+
+static int8 res_amigaBeep[AMIGABEEP_SIZE] = {
+ 0, 20, 40, 60, 80, 60, 40, 20, 0, -20, -40, -60, -80, -60, -40, -20
+};
+
AmigaSoundMan_ns::AmigaSoundMan_ns(Parallaction_ns *vm) : SoundMan_ns(vm) {
_musicStream = 0;
+
+ // initialize the waveform for the 'beep' sound
+ beepSoundBufferSize = AMIGABEEP_SIZE * NUM_REPEATS;
+ beepSoundBuffer = new int8[beepSoundBufferSize];
+ int8 *odata = beepSoundBuffer;
+ for (int i = 0; i < NUM_REPEATS; i++) {
+ memcpy(odata, res_amigaBeep, AMIGABEEP_SIZE);
+ odata += AMIGABEEP_SIZE;
+ }
+
}
AmigaSoundMan_ns::~AmigaSoundMan_ns() {
@@ -343,30 +366,17 @@ AmigaSoundMan_ns::~AmigaSoundMan_ns() {
stopSfx(1);
stopSfx(2);
stopSfx(3);
-}
-
-#define AMIGABEEP_SIZE 16
-#define NUM_REPEATS 60
-static int8 res_amigaBeep[AMIGABEEP_SIZE] = {
- 0, 20, 40, 60, 80, 60, 40, 20, 0, -20, -40, -60, -80, -60, -40, -20
-};
+ delete []beepSoundBuffer;
+}
Audio::AudioStream *AmigaSoundMan_ns::loadChannelData(const char *filename, Channel *ch, bool looping) {
Audio::AudioStream *input = 0;
if (!scumm_stricmp("beep", filename)) {
- // TODO: make a permanent stream out of this
- uint32 dataSize = AMIGABEEP_SIZE * NUM_REPEATS;
- int8 *data = (int8*)malloc(dataSize);
- int8 *odata = data;
- for (uint i = 0; i < NUM_REPEATS; i++) {
- memcpy(odata, res_amigaBeep, AMIGABEEP_SIZE);
- odata += AMIGABEEP_SIZE;
- }
int rate = 11934;
ch->volume = 160;
- input = Audio::makeLinearInputStream((byte *)data, dataSize, rate, Audio::Mixer::FLAG_AUTOFREE, 0, 0);
+ input = Audio::makeLinearInputStream((byte *)beepSoundBuffer, beepSoundBufferSize, rate, 0, 0, 0);
} else {
Common::SeekableReadStream *stream = _vm->_disk->loadSound(filename);
input = Audio::make8SVXStream(*stream, looping);