aboutsummaryrefslogtreecommitdiff
path: root/scumm/sound.cpp
diff options
context:
space:
mode:
authorJames Brown2002-10-28 12:56:42 +0000
committerJames Brown2002-10-28 12:56:42 +0000
commit63ee97b1ee6af5db94603b4971329c8f34346f39 (patch)
tree166de04aed932a3e7000d39db86aea782e27a12c /scumm/sound.cpp
parent0e0701ade40f3e61a4e4d7a2bc2db4f62e709819 (diff)
downloadscummvm-rg350-63ee97b1ee6af5db94603b4971329c8f34346f39.tar.gz
scummvm-rg350-63ee97b1ee6af5db94603b4971329c8f34346f39.tar.bz2
scummvm-rg350-63ee97b1ee6af5db94603b4971329c8f34346f39.zip
Fix using MAD -without- Vorbis, and remove COMPRESSED_SOUND_FILE define.
Please keep in mind that if you put an 'else' statement in an if clause, keep in mind that if the code it's supposed to 'else' is in another define.... and that isn't set... the NEXT statement of code will be used as the 'if..else' condition. svn-id: r5344
Diffstat (limited to 'scumm/sound.cpp')
-rw-r--r--scumm/sound.cpp50
1 files changed, 16 insertions, 34 deletions
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index acd7bf9165..8cbd8e673b 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -453,13 +453,11 @@ void Sound::processSfxQueues() {
}
}
-#ifdef COMPRESSED_SOUND_FILE
static int compar(const void *a, const void *b)
{
return ((MP3OffsetTable *) a)->org_offset -
((MP3OffsetTable *) b)->org_offset;
}
-#endif
int Sound::startTalkSound(uint32 offset, uint32 b, int mode) {
int num = 0, i;
@@ -491,7 +489,7 @@ int Sound::startTalkSound(uint32 offset, uint32 b, int mode) {
if (b > 8) {
num = (b - 8) >> 1;
}
-#ifdef COMPRESSED_SOUND_FILE
+
if (offset_table != NULL) {
MP3OffsetTable *result = NULL, key;
@@ -510,9 +508,7 @@ int Sound::startTalkSound(uint32 offset, uint32 b, int mode) {
}
offset = result->new_offset;
size = result->compressed_size;
- } else
-#endif
- {
+ } else {
offset += 8;
size = -1;
}
@@ -738,11 +734,10 @@ int Sound::startSfxSound(File *file, int file_size) {
int rate, comp;
byte *data;
-#ifdef COMPRESSED_SOUND_FILE
if (file_size > 0) {
int alloc_size = file_size;
#ifdef USE_MAD
- if (! _vorbis_mode)
+ if (!_vorbis_mode)
alloc_size += MAD_BUFFER_GUARD;
#endif
data = (byte *)calloc(alloc_size, 1);
@@ -757,7 +752,7 @@ int Sound::startSfxSound(File *file, int file_size) {
else
return playSfxSound_MP3(data, file_size);
}
-#endif
+
if (file->read(ident, 8) != 8)
goto invalid;
@@ -810,7 +805,6 @@ File * Sound::openSfxFile() {
/* Try opening the file <_exe_name>.sou first, eg tentacle.sou.
* That way, you can keep .sou files for multiple games in the
* same directory */
-#ifdef COMPRESSED_SOUND_FILE
offset_table = NULL;
#ifdef USE_MAD
@@ -820,19 +814,19 @@ File * Sound::openSfxFile() {
}
if (file->isOpen())
_vorbis_mode = false;
- else
#endif
+
#ifdef USE_VORBIS
- {
- sprintf(buf, "%s.sog", _scumm->_exe_name);
- if (!file->open(buf, _scumm->getGameDataPath()))
- file->open("monster.sog", _scumm->getGameDataPath());
- if (file->isOpen())
- _vorbis_mode = true;
- }
+ if (!file->isOpen()) {
+ sprintf(buf, "%s.sog", _scumm->_exe_name);
+ if (!file->open(buf, _scumm->getGameDataPath()))
+ file->open("monster.sog", _scumm->getGameDataPath());
+ if (file->isOpen())
+ _vorbis_mode = true;
+ }
#endif
- if (file->isOpen() == true) {
+ if (file->isOpen()) {
/* Now load the 'offset' index in memory to be able to find the MP3 data
The format of the .SO3 file is easy :
@@ -849,7 +843,6 @@ File * Sound::openSfxFile() {
*/
int size, compressed_offset;
MP3OffsetTable *cur;
-
compressed_offset = file->readUint32BE();
offset_table = (MP3OffsetTable *) malloc(compressed_offset);
num_sound_effects = compressed_offset / 16;
@@ -866,7 +859,7 @@ File * Sound::openSfxFile() {
}
return file;
}
-#endif
+
sprintf(buf, "%s.sou", _scumm->_exe_name);
if (!file->open(buf, _scumm->getGameDataPath())) {
file->open("monster.sou", _scumm->getGameDataPath());
@@ -1286,9 +1279,7 @@ void Sound::stopCDTimer()
void Sound::playCDTrack(int track, int num_loops, int start, int delay)
{
-#ifdef COMPRESSED_SOUND_FILE
if (playMP3CDTrack(track, num_loops, start, delay) == -1)
-#endif
_scumm->_system->play_cdrom(track, num_loops, start, delay);
// Start the timer after starting the track. Starting an MP3 track is
@@ -1301,31 +1292,24 @@ void Sound::playCDTrack(int track, int num_loops, int start, int delay)
void Sound::stopCD()
{
stopCDTimer();
-#ifdef COMPRESSED_SOUND_FILE
if (stopMP3CD() == -1)
-#endif
_scumm->_system->stop_cdrom();
}
int Sound::pollCD()
{
-#ifdef COMPRESSED_SOUND_FILE
if (pollMP3CD())
return 1;
-#endif
+
return _scumm->_system->poll_cdrom();
}
void Sound::updateCD()
{
-#ifdef COMPRESSED_SOUND_FILE
if (updateMP3CD() == -1)
-#endif
_scumm->_system->update_cdrom();
}
-#ifdef COMPRESSED_SOUND_FILE
-
int Sound::getCachedTrack(int track) {
int i;
char track_name[1024];
@@ -1381,7 +1365,7 @@ int Sound::getCachedTrack(int track) {
}
#endif
- debug(1, "Track %d not available in compressed format", track);
+ debug(2, "Track %d not available in compressed format", track);
return -1;
}
@@ -1651,5 +1635,3 @@ Sound::VorbisTrackInfo::~VorbisTrackInfo() {
}
#endif
-
-#endif