[Scummvm-cvs-logs] SF.net SVN: scummvm:[47124] scummvm/trunk/engines/parallaction
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Thu Jan 7 16:38:29 CET 2010
Revision: 47124
http://scummvm.svn.sourceforge.net/scummvm/?rev=47124&view=rev
Author: peres001
Date: 2010-01-07 15:38:29 +0000 (Thu, 07 Jan 2010)
Log Message:
-----------
Moved creation of 'beep' sound buffer to sound manager constructor.
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/sound.h
scummvm/trunk/engines/parallaction/sound_ns.cpp
Modified: scummvm/trunk/engines/parallaction/sound.h
===================================================================
--- scummvm/trunk/engines/parallaction/sound.h 2010-01-07 15:28:58 UTC (rev 47123)
+++ scummvm/trunk/engines/parallaction/sound.h 2010-01-07 15:38:29 UTC (rev 47124)
@@ -156,6 +156,9 @@
Audio::AudioStream *_musicStream;
Audio::SoundHandle _musicHandle;
+ uint32 beepSoundBufferSize;
+ int8 *beepSoundBuffer;
+
Channel _channels[NUM_SFX_CHANNELS];
Audio::AudioStream *loadChannelData(const char *filename, Channel *ch, bool looping);
Modified: scummvm/trunk/engines/parallaction/sound_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/sound_ns.cpp 2010-01-07 15:28:58 UTC (rev 47123)
+++ scummvm/trunk/engines/parallaction/sound_ns.cpp 2010-01-07 15:38:29 UTC (rev 47124)
@@ -333,8 +333,31 @@
}
}
+
+
+
+#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 @@
stopSfx(1);
stopSfx(2);
stopSfx(3);
+
+ delete []beepSoundBuffer;
}
-#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
-};
-
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);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list