Got rid of explicit game sound info

svn-id: r35727
This commit is contained in:
Filippos Karapetis 2009-01-04 15:44:33 +00:00
parent 7a0b782a3c
commit 80832ffb8f
5 changed files with 19 additions and 105 deletions

View File

@ -51,24 +51,12 @@ struct SAGAGameDescription {
const GameResourceDescription *resourceDescription;
int fontsCount;
const GameFontDescription *fontDescriptions;
const GameSoundInfo *voiceInfo;
const GameSoundInfo *sfxInfo;
const GamePatchDescription *patchDescriptions;
};
bool SagaEngine::isBigEndian() const { return isMacResources() && getGameId() == GID_ITE; }
bool SagaEngine::isMacResources() const { return (getPlatform() == Common::kPlatformMacintosh); }
const GameResourceDescription *SagaEngine::getResourceDescription() { return _gameDescription->resourceDescription; }
const GameSoundInfo *SagaEngine::getVoiceInfo() const { return _gameDescription->voiceInfo; }
const GameSoundInfo *SagaEngine::getSfxInfo() const { return _gameDescription->sfxInfo; }
const GameSoundInfo *SagaEngine::getMusicInfo() const {
static GameSoundInfo musicInfo;
musicInfo.resourceType = kSoundPCM;
musicInfo.sampleBits = 16;
musicInfo.isSigned = true;
return &musicInfo;
}
const GameFontDescription *SagaEngine::getFontDescription(int index) {
assert(index < _gameDescription->fontsCount);

View File

@ -112,14 +112,6 @@ static const GameFontDescription IHNMDEMO_GameFonts[] = { {2}, {3}, {4} };
// Font 6 is kIHNMFont8, font 8 is kIHNMMainFont
static const GameFontDescription IHNMCD_GameFonts[] = { {2}, {3}, {4}, {5}, {6}, {7}, {8} };
// Game sound overrides
// Information for WAV, VOC, AIFF and Shorten audio files is obtained automatically. For other
// audio types, we specify it here
// sampleBits, isSigned
static const GameSoundInfo ITE_GameSound = { kSoundPCM, 16, true };
static const GameSoundInfo ITEWINDEMO1_GameSound = { kSoundPCM, 8, false };
static const GameSoundInfo ITEDEMO_GameVoice = { kSoundVOX, 16, true };
// Patch files. Files not found will be ignored
static const GamePatchDescription ITEPatch_Files[] = {
{ "cave.mid", GAME_RESOURCEFILE, 9},
@ -209,8 +201,6 @@ static const SAGAGameDescription gameDescriptions[] = {
ARRAYSIZE(ITEDEMO_GameFonts),
ITEDEMO_GameFonts,
NULL,
NULL,
NULL,
},
#endif
@ -234,8 +224,6 @@ static const SAGAGameDescription gameDescriptions[] = {
&ITE_Resources,
ARRAYSIZE(ITEWINDEMO_GameFonts),
ITEWINDEMO_GameFonts,
&ITEDEMO_GameVoice,
&ITE_GameSound,
ITEMacPatch_Files,
},
@ -261,8 +249,6 @@ static const SAGAGameDescription gameDescriptions[] = {
&ITE_Resources,
ARRAYSIZE(ITEWINDEMO_GameFonts),
ITEWINDEMO_GameFonts,
&ITEDEMO_GameVoice,
&ITE_GameSound,
ITEMacPatch_Files,
},
@ -288,8 +274,6 @@ static const SAGAGameDescription gameDescriptions[] = {
&ITE_Resources,
ARRAYSIZE(ITEWINDEMO_GameFonts),
ITEWINDEMO_GameFonts,
&ITEDEMO_GameVoice,
&ITE_GameSound,
ITEPatch_Files,
},
@ -310,13 +294,11 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::ADGF_DEMO
},
GID_ITE,
GF_WYRMKEEP | GF_NON_INTERACTIVE,
GF_WYRMKEEP | GF_NON_INTERACTIVE | GF_8BIT_UNSIGNED_PCM,
ITE_DEFAULT_SCENE,
&ITE_Resources,
ARRAYSIZE(ITEWINDEMO_GameFonts),
ITEWINDEMO_GameFonts,
&ITEWINDEMO1_GameSound,
&ITEWINDEMO1_GameSound,
ITEPatch_Files,
},
@ -349,8 +331,6 @@ static const SAGAGameDescription gameDescriptions[] = {
&ITE_Resources,
ARRAYSIZE(ITEWINDEMO_GameFonts),
ITEWINDEMO_GameFonts,
&ITE_GameSound,
&ITE_GameSound,
NULL,
},
@ -374,8 +354,6 @@ static const SAGAGameDescription gameDescriptions[] = {
&ITE_Resources,
ARRAYSIZE(ITEWINDEMO_GameFonts),
ITEWINDEMO_GameFonts,
&ITE_GameSound,
&ITE_GameSound,
ITEMacPatch_Files,
},
@ -407,8 +385,6 @@ static const SAGAGameDescription gameDescriptions[] = {
&ITE_Resources,
ARRAYSIZE(ITE_GameFonts),
ITE_GameFonts,
&ITE_GameSound,
&ITE_GameSound,
NULL,
},
@ -438,8 +414,6 @@ static const SAGAGameDescription gameDescriptions[] = {
&ITE_Resources,
ARRAYSIZE(ITE_GameFonts),
ITE_GameFonts,
&ITE_GameSound,
&ITE_GameSound,
NULL,
},
@ -463,8 +437,6 @@ static const SAGAGameDescription gameDescriptions[] = {
&ITE_Resources,
ARRAYSIZE(ITE_GameFonts),
ITE_GameFonts,
&ITE_GameSound,
&ITE_GameSound,
ITEPatch_Files,
},
@ -488,8 +460,6 @@ static const SAGAGameDescription gameDescriptions[] = {
&ITE_Resources,
ARRAYSIZE(ITE_GameFonts),
ITE_GameFonts,
&ITE_GameSound,
&ITE_GameSound,
ITEPatch_Files,
},
@ -513,8 +483,6 @@ static const SAGAGameDescription gameDescriptions[] = {
&ITE_Resources,
ARRAYSIZE(ITE_GameFonts),
ITE_GameFonts,
&ITE_GameSound,
&ITE_GameSound,
ITEPatch_Files,
},
@ -539,8 +507,6 @@ static const SAGAGameDescription gameDescriptions[] = {
&ITE_Resources,
ARRAYSIZE(ITE_GameFonts),
ITE_GameFonts,
&ITE_GameSound,
&ITE_GameSound,
NULL,
},
@ -568,8 +534,6 @@ static const SAGAGameDescription gameDescriptions[] = {
ARRAYSIZE(ITE_GameFonts),
ITE_GameFonts,
NULL,
NULL,
NULL,
},
// Inherit the earth - Disk version
@ -592,8 +556,6 @@ static const SAGAGameDescription gameDescriptions[] = {
&ITE_Resources,
ARRAYSIZE(ITE_GameFonts),
ITE_GameFonts,
NULL,
NULL,
ITEPatch_Files,
},
@ -617,8 +579,6 @@ static const SAGAGameDescription gameDescriptions[] = {
&ITE_Resources,
ARRAYSIZE(ITE_GameFonts),
ITE_GameFonts,
NULL,
NULL,
ITEPatch_Files,
},
@ -652,8 +612,6 @@ static const SAGAGameDescription gameDescriptions[] = {
ARRAYSIZE(IHNMDEMO_GameFonts),
IHNMDEMO_GameFonts,
NULL,
NULL,
NULL,
},
// I Have No Mouth And I Must Scream - English CD version
@ -685,8 +643,6 @@ static const SAGAGameDescription gameDescriptions[] = {
ARRAYSIZE(IHNMCD_GameFonts),
IHNMCD_GameFonts,
NULL,
NULL,
NULL,
},
// I Have No Mouth And I Must Scream - De CD version
@ -716,8 +672,6 @@ static const SAGAGameDescription gameDescriptions[] = {
ARRAYSIZE(IHNMCD_GameFonts),
IHNMCD_GameFonts,
NULL,
NULL,
NULL,
},
// I Have No Mouth And I Must Scream - Sp CD version
@ -745,8 +699,6 @@ static const SAGAGameDescription gameDescriptions[] = {
ARRAYSIZE(IHNMCD_GameFonts),
IHNMCD_GameFonts,
NULL,
NULL,
NULL,
},
// I Have No Mouth And I Must Scream - Fr CD version
@ -775,8 +727,6 @@ static const SAGAGameDescription gameDescriptions[] = {
ARRAYSIZE(IHNMCD_GameFonts),
IHNMCD_GameFonts,
NULL,
NULL,
NULL,
},
// I Have No Mouth And I Must Scream - Italian fan CD translation
@ -804,8 +754,6 @@ static const SAGAGameDescription gameDescriptions[] = {
ARRAYSIZE(IHNMCD_GameFonts),
IHNMCD_GameFonts,
NULL,
NULL,
NULL,
},
// I Have No Mouth And I Must Scream - Mac English CD
{
@ -830,8 +778,6 @@ static const SAGAGameDescription gameDescriptions[] = {
ARRAYSIZE(IHNMCD_GameFonts),
IHNMCD_GameFonts,
NULL,
NULL,
NULL,
},
#endif
@ -866,14 +812,12 @@ static const SAGAGameDescription gameDescriptions[] = {
NULL, // game resources
0, // number of fonts
NULL, // font array
NULL, // voice info
NULL, // SFX info
NULL,
},
#endif
{ AD_TABLE_END_MARKER, 0, 0, 0, NULL, 0, NULL, NULL, NULL, NULL }
{ AD_TABLE_END_MARKER, 0, 0, 0, NULL, 0, NULL, NULL }
};
} // End of namespace Saga

View File

@ -56,7 +56,6 @@ private:
int16 _buf[BUFFER_SIZE];
const int16 *_bufferEnd;
const int16 *_pos;
const GameSoundInfo *_musicInfo;
MemoryReadStream *_memoryStream;
SagaEngine *_vm;
@ -88,11 +87,6 @@ DigitalMusicInputStream::DigitalMusicInputStream(SagaEngine *vm, ResourceContext
resourceData = context->getResourceData(resourceId);
_file = context->getFile(resourceData);
_musicInfo = _vm->getMusicInfo();
if (_musicInfo == NULL) {
error("DigitalMusicInputStream() wrong musicInfo");
}
_compressedStream = NULL;

View File

@ -123,7 +123,8 @@ enum GameFeatures {
GF_MONO_MUSIC = 1 << 5,
GF_EXTRA_ITE_CREDITS = 1 << 6,
GF_IHNM_DEMO = 1 << 7,
GF_LE_VOICES = 1 << 8
GF_LE_VOICES = 1 << 8,
GF_8BIT_UNSIGNED_PCM = 1 << 9
};
enum VerbTypeIds {
@ -288,12 +289,6 @@ struct GameFontDescription {
struct GameDisplayInfo;
struct GameSoundInfo {
GameSoundTypes resourceType;
int sampleBits;
bool isSigned;
};
struct GamePatchDescription {
const char *fileName;
uint16 fileType;
@ -594,9 +589,6 @@ public:
bool isMacResources() const;
bool isSaga2() const { return getGameId() == GID_DINO || getGameId() == GID_FTA2; }
const GameResourceDescription *getResourceDescription();
const GameSoundInfo *getVoiceInfo() const;
const GameSoundInfo *getSfxInfo() const;
const GameSoundInfo *getMusicInfo() const;
const GameFontDescription *getFontDescription(int index);
int getFontsCount() const;

View File

@ -189,13 +189,11 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
Audio::AudioStream *voxStream;
size_t soundResourceLength;
bool result = false;
GameSoundTypes resourceType;
GameSoundTypes resourceType = kSoundPCM;
byte *data = 0;
int rate;
int size;
byte flags = 0;
size_t voxSize;
const GameSoundInfo *soundInfo = 0;
Common::File* file;
if (resourceId == (uint32)-1) {
@ -234,12 +232,6 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
Common::SeekableReadStream& readS = *file;
if (context->fileType & GAME_VOICEFILE) {
soundInfo = _vm->getVoiceInfo();
} else {
soundInfo = _vm->getSfxInfo();
}
if (soundResourceLength >= 8) {
byte header[8];
@ -254,8 +246,6 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
resourceType = kSoundAIFF;
} else if (!memcmp(header, "ajkg", 4) != 0) {
resourceType = kSoundShorten;
} else if (soundInfo) {
resourceType = soundInfo->resourceType;
}
bool uncompressedSound = false;
@ -280,6 +270,7 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
}
// Default sound type is 16-bit PCM (used in ITE)
buffer.isBigEndian = context->isBigEndian;
if ((context->fileType & GAME_VOICEFILE) && (_vm->getFeatures() & GF_LE_VOICES))
buffer.isBigEndian = false;
@ -287,7 +278,19 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
buffer.soundType = resourceType;
buffer.originalSize = 0;
buffer.stereo = false;
buffer.isSigned = true; // default for PCM and VOX
buffer.frequency = 22050; // default for PCM and VOX
buffer.sampleBits = 16; // default for PCM and VOX
if (_vm->getGameId() == GID_ITE) {
if (_vm->getFeatures() & GF_8BIT_UNSIGNED_PCM) { // older ITE demos
buffer.isSigned = false;
buffer.sampleBits = 8;
} else {
// Voice files in newer ITE demo versions are OKI ADPCM (VOX) encoded
if (!scumm_stricmp(context->fileName, "voicesd.rsc"))
resourceType = kSoundVOX;
}
}
buffer.buffer = NULL;
// Older Mac versions of ITE were Macbinary packed
@ -295,8 +298,6 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
switch (resourceType) {
case kSoundPCM:
buffer.isSigned = soundInfo->isSigned;
buffer.sampleBits = soundInfo->sampleBits;
buffer.size = soundResourceLength - soundOffset;
if (!onlyHeader) {
buffer.buffer = (byte *) malloc(buffer.size);
@ -307,16 +308,11 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
result = true;
break;
case kSoundVOX:
buffer.isSigned = soundInfo->isSigned;
buffer.sampleBits = soundInfo->sampleBits;
buffer.size = soundResourceLength * 4;
if (!onlyHeader) {
voxStream = Audio::makeADPCMStream(&readS, false, soundResourceLength, Audio::kADPCMOki);
buffer.buffer = (byte *)malloc(buffer.size);
voxSize = voxStream->readBuffer((int16*)buffer.buffer, soundResourceLength * 2);
if (voxSize != soundResourceLength * 2) {
error("SndRes::load() wrong VOX output size");
}
voxStream->readBuffer((int16*)buffer.buffer, soundResourceLength * 2);
delete voxStream;
}
result = true;