[Scummvm-cvs-logs] CVS: scummvm/scumm imuse_digi.cpp,1.110,1.111 imuse_digi.h,1.29,1.30 sound.cpp,1.305,1.306
Max Horn
fingolfin at users.sourceforge.net
Fri Jan 2 16:56:44 CET 2004
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv2363/scumm
Modified Files:
imuse_digi.cpp imuse_digi.h sound.cpp
Log Message:
re-enabled .sog and .so3 support for FT
Index: imuse_digi.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi.cpp,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- imuse_digi.cpp 2 Jan 2004 03:20:07 -0000 1.110
+++ imuse_digi.cpp 3 Jan 2004 00:55:40 -0000 1.111
@@ -746,27 +746,23 @@
}
}
-void IMuseDigital::startSound(int sound, byte *voc_src, int voc_size, int voc_rate) {
+void IMuseDigital::startSound(int sound, byte *voiceBundleData, AudioInputStream *input) {
debug(5, "IMuseDigital::startSound(%d)", sound);
int l, r;
for (l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
if (!_channel[l].used && !_channel[l].handle.isActive()) {
byte *ptr, *s_ptr;
- byte *_voiceVocData = (voc_src && voc_size > 0) ? voc_src : 0;
- byte *_voiceBundleData = (voc_src && voc_size <= 0) ? voc_src : 0;
- if ((sound == kTalkSoundID) && (_voiceBundleData)) {
- s_ptr = ptr = _voiceBundleData;
- } else if ((sound == kTalkSoundID) && (_voiceVocData)) {
- //
- s_ptr = ptr = 0;
- } else if (sound != kTalkSoundID) {
- ptr = _scumm->getResourceAddress(rtSound, sound);
- s_ptr = ptr;
+ if (sound != kTalkSoundID) {
+ s_ptr = ptr = _scumm->getResourceAddress(rtSound, sound);
if (ptr == NULL) {
warning("IMuseDigital::startSound(%d) NULL resource pointer", sound);
return;
}
+ } else if (voiceBundleData) {
+ s_ptr = ptr = voiceBundleData;
+ } else if (input) {
+ s_ptr = ptr = 0;
} else {
error("IMuseDigital::startSound() unknown condition");
}
@@ -782,26 +778,20 @@
_channel[l].numMarkers = 0;
_channel[l].idSound = sound;
-
- uint32 tag;
- int32 size = 0;
-
- int freq, channels, bits;
- int mixerFlags;
- byte *data;
- if ((sound == kTalkSoundID) && (_voiceVocData) || (READ_UINT32(ptr) == MKID('Crea'))) {
- if (ptr && READ_UINT32(ptr) == MKID('Crea')) {
- int loops = 0;
- voc_src = readVOCFromMemory(ptr, voc_size, voc_rate, loops);
- }
- freq = voc_rate;
- size = voc_size;
- bits = 8;
- channels = 1;
- mixerFlags = SoundMixer::FLAG_UNSIGNED;
- data = voc_src;
+ if (input) {
+ // Do nothing here, we already have an audio stream
+ } else if (READ_UINT32(ptr) == MKID('Crea')) {
+ // Create an AudioInputStream
+ input = makeVOCStream(ptr);
} else if (READ_UINT32(ptr) == MKID('iMUS')) {
+ uint32 tag;
+ int32 size = 0;
+
+ int freq, channels, bits;
+ int mixerFlags;
+ byte *data;
+
ptr += 16;
freq = channels = bits = 0;
do {
@@ -863,7 +853,7 @@
}
} while (tag != MKID_BE('DATA'));
- if ((sound == kTalkSoundID) && (_voiceBundleData)) {
+ if ((sound == kTalkSoundID) && voiceBundleData) {
if (_scumm->_actorToPrintStrFor != 0xFF && _scumm->_actorToPrintStrFor != 0) {
Actor *a = _scumm->derefActor(_scumm->_actorToPrintStrFor, "playBundleSound");
freq = (freq * a->talkFrequency) / 256;
@@ -931,12 +921,15 @@
memcpy(data, ptr, size);
} else
error("IMuseDigital::startSound(): Can't handle %d bit samples", bits);
+
+ // Create an AudioInputStream
+ input = makeLinearInputStream(freq, mixerFlags | SoundMixer::FLAG_AUTOFREE, data, size, 0, 0);
} else {
error("IMuseDigital::startSound(): Unknown sound format");
}
- // Create an AudioInputStream and hook it to the mixer.
- _channel[l].stream = makeLinearInputStream(freq, mixerFlags | SoundMixer::FLAG_AUTOFREE, data, size, 0, 0);
+ // Set the audio stream for this new channel
+ _channel[l].stream = input;
_channel[l].started = false;
_channel[l].used = true;
@@ -1424,7 +1417,7 @@
if (ptr) {
stopSound(kTalkSoundID);
- startSound(kTalkSoundID, ptr);
+ startSound(kTalkSoundID, ptr, 0);
free(ptr);
}
}
Index: imuse_digi.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- imuse_digi.h 27 Dec 2003 21:14:57 -0000 1.29
+++ imuse_digi.h 3 Jan 2004 00:55:40 -0000 1.30
@@ -128,7 +128,7 @@
void stopBundleMusic();
void playBundleSound(const char *sound);
- void startSound(int sound, byte *src, int size = 0, int rate = 0);
+ void startSound(int sound, byte *voiceBundleData, AudioInputStream *input);
public:
IMuseDigital(ScummEngine *scumm);
@@ -136,7 +136,7 @@
void setMasterVolume(int vol) {}
- void startSound(int sound) { startSound(sound, 0, 0, 0); }
+ void startSound(int sound) { startSound(sound, 0, 0); }
void stopSound(int sound);
void stopAllSounds();
void pause(bool pause);
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.305
retrieving revision 1.306
diff -u -d -r1.305 -r1.306
--- sound.cpp 29 Dec 2003 08:19:57 -0000 1.305
+++ sound.cpp 3 Jan 2004 00:55:40 -0000 1.306
@@ -34,7 +34,9 @@
#include "sound/audiocd.h"
#include "sound/mididrv.h"
#include "sound/mixer.h"
+#include "sound/mp3.h"
#include "sound/voc.h"
+#include "sound/vorbis.h"
namespace Scumm {
@@ -811,27 +813,27 @@
void Sound::startSfxSound(File *file, int file_size, PlayingSoundHandle *handle, int id) {
+ AudioInputStream *input;
+
+
if (file_size > 0) {
if (_vorbis_mode) {
#ifdef USE_VORBIS
- _scumm->_mixer->playVorbis(handle, file, file_size, 255, 0, id);
+ input = makeVorbisStream(file, file_size);
#endif
} else {
#ifdef USE_MAD
- _scumm->_mixer->playMP3(handle, file, file_size, 255, 0, id);
+ input = makeMP3Stream(file, file_size);
#endif
}
- return;
+ } else {
+ input = makeVOCStream(_sfxFile);
}
- int size;
- int rate;
- byte *data = loadVOCFile(_sfxFile, size, rate);
-
if (_scumm->_imuseDigital) {
- _scumm->_imuseDigital->startSound(kTalkSoundID, data, size, rate);
+ _scumm->_imuseDigital->startSound(kTalkSoundID, 0, input);
} else {
- _scumm->_mixer->playRaw(handle, data, size, rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED, id);
+ _scumm->_mixer->playInputStream(handle, input, false, 255, 0, id);
}
}
@@ -843,16 +845,6 @@
* That way, you can keep .sou files for multiple games in the
* same directory */
offset_table = NULL;
-
- // FIXME / TODO / HACK: for FT voice can only be loaded from original .sou
- // files, not .so3 or .sog. This will be so until IMuseDigital gets fixed.
- if (_scumm->_imuseDigital) {
- sprintf(buf, "%s.sou", _scumm->getGameName());
- if (!file->open(buf, _scumm->getGameDataPath())) {
- file->open("monster.sou", _scumm->getGameDataPath());
- }
- return file;
- }
#ifdef USE_MAD
sprintf(buf, "%s.so3", _scumm->getGameName());
More information about the Scummvm-git-logs
mailing list