[Scummvm-cvs-logs] SF.net SVN: scummvm:[33995] scummvm/branches/branch-0-12-0/engines/kyra
athrxx at users.sourceforge.net
athrxx at users.sourceforge.net
Mon Aug 18 19:53:30 CEST 2008
Revision: 33995
http://scummvm.svn.sourceforge.net/scummvm/?rev=33995&view=rev
Author: athrxx
Date: 2008-08-18 17:53:26 +0000 (Mon, 18 Aug 2008)
Log Message:
-----------
KYRA: some files missing in last commit
Modified Paths:
--------------
scummvm/branches/branch-0-12-0/engines/kyra/sound.cpp
scummvm/branches/branch-0-12-0/engines/kyra/sound.h
scummvm/branches/branch-0-12-0/engines/kyra/sound_adlib.cpp
Modified: scummvm/branches/branch-0-12-0/engines/kyra/sound.cpp
===================================================================
--- scummvm/branches/branch-0-12-0/engines/kyra/sound.cpp 2008-08-18 17:48:02 UTC (rev 33994)
+++ scummvm/branches/branch-0-12-0/engines/kyra/sound.cpp 2008-08-18 17:53:26 UTC (rev 33995)
@@ -104,6 +104,11 @@
fileSize = 0;
}
+ if (!audioStream) {
+ warning("Couldn't load sound file '%s'", file);
+ return 0;
+ }
+
_soundChannels[h].file = file;
_mixer->playInputStream(isSfx ? Audio::Mixer::kSFXSoundType : Audio::Mixer::kSpeechSoundType, &_soundChannels[h].channelHandle, audioStream);
@@ -323,7 +328,17 @@
void SoundMidiPC::loadSoundFile(uint file) {
Common::StackLock lock(_mutex);
- Common::String filename = fileListEntry(file);
+ internalLoadFile(fileListEntry(file));
+}
+
+void SoundMidiPC::loadSoundFile(Common::String file) {
+ Common::StackLock lock(_mutex);
+
+ internalLoadFile(file);
+}
+
+void SoundMidiPC::internalLoadFile(Common::String file) {
+ Common::String filename = file;
filename += ".";
filename += _useC55 ? "C55" : "XMI";
Modified: scummvm/branches/branch-0-12-0/engines/kyra/sound.h
===================================================================
--- scummvm/branches/branch-0-12-0/engines/kyra/sound.h 2008-08-18 17:48:02 UTC (rev 33994)
+++ scummvm/branches/branch-0-12-0/engines/kyra/sound.h 2008-08-18 17:53:26 UTC (rev 33995)
@@ -120,6 +120,12 @@
virtual void loadSoundFile(uint file) = 0;
/**
+ * Load a sound file for playing music
+ * and sound effects from.
+ */
+ virtual void loadSoundFile(Common::String file) = 0;
+
+ /**
* Plays the specified track.
*
* @param track track number
@@ -215,8 +221,6 @@
int _musicEnabled;
bool _sfxEnabled;
- int _currentTheme;
-
KyraEngine_v1 *_vm;
Audio::Mixer *_mixer;
@@ -260,6 +264,7 @@
void process();
void loadSoundFile(uint file);
+ void loadSoundFile(Common::String file);
void playTrack(uint8 track);
void haltTrack();
@@ -269,6 +274,8 @@
void beginFadeOut();
private:
+ void internalLoadFile(Common::String file);
+
void play(uint8 track);
void unk1();
@@ -280,8 +287,9 @@
uint8 _trackEntries[500];
uint8 *_soundDataPtr;
int _sfxPlayingSound;
- uint _soundFileLoaded;
+ Common::String _soundFileLoaded;
+
uint8 _sfxPriority;
uint8 _sfxFourthByteOfSong;
@@ -316,6 +324,7 @@
void updateVolumeSettings();
void loadSoundFile(uint file);
+ void loadSoundFile(Common::String file);
void playTrack(uint8 track);
void haltTrack();
@@ -343,6 +352,7 @@
bool isMT32() const { return _nativeMT32; }
private:
+ void internalLoadFile(Common::String file);
void updateChannelVolume(uint8 vol);
static void onTimer(void *data);
@@ -397,6 +407,7 @@
void process();
void loadSoundFile(uint file);
+ void loadSoundFile(Common::String) {}
void playTrack(uint8 track);
void haltTrack();
@@ -418,7 +429,7 @@
MidiChannel *allocateChannel() { return 0; }
MidiChannel *getPercussionChannel() { return 0; }
- static float semitoneAndSampleRate_to_sampleStep(int8 semiTone, int8 semiToneRootkey,
+ static float calculatePhaseStep(int8 semiTone, int8 semiToneRootkey,
uint32 sampleRate, uint32 outputRate, int32 pitchWheel);
private:
@@ -454,6 +465,7 @@
void process() {}
void loadSoundFile(uint file) {}
+ void loadSoundFile(Common::String) {}
void playTrack(uint8 track);
void haltTrack();
@@ -480,6 +492,7 @@
void process();
void loadSoundFile(uint file) {}
+ void loadSoundFile(Common::String file);
void playTrack(uint8 track);
void haltTrack();
@@ -494,6 +507,7 @@
bool _useFmSfx;
uint8 *_musicTrackData;
+ uint8 *_sfxTrackData;
TownsPC98_OpnDriver *_driver;
};
@@ -513,6 +527,7 @@
void setSoundList(const AudioDataStruct * list) { _music->setSoundList(list); _sfx->setSoundList(list); }
bool hasSoundFile(uint file) const { return _music->hasSoundFile(file) && _sfx->hasSoundFile(file); }
void loadSoundFile(uint file) { _music->loadSoundFile(file); _sfx->loadSoundFile(file); }
+ void loadSoundFile(Common::String file) { _music->loadSoundFile(file); _sfx->loadSoundFile(file); }
void playTrack(uint8 track) { _music->playTrack(track); }
void haltTrack() { _music->haltTrack(); }
Modified: scummvm/branches/branch-0-12-0/engines/kyra/sound_adlib.cpp
===================================================================
--- scummvm/branches/branch-0-12-0/engines/kyra/sound_adlib.cpp 2008-08-18 17:48:02 UTC (rev 33994)
+++ scummvm/branches/branch-0-12-0/engines/kyra/sound_adlib.cpp 2008-08-18 17:53:26 UTC (rev 33995)
@@ -235,6 +235,10 @@
// * One for instruments, starting at offset 500.
uint8 *getProgram(int progId) {
+ uint16 offset = READ_LE_UINT16(_soundData + 2 * progId);
+ //TODO: Check in LoL CD Adlib driver
+ if (offset == 0xFFFF)
+ return 0;
return _soundData + READ_LE_UINT16(_soundData + 2 * progId);
}
@@ -1282,6 +1286,9 @@
return 0;
uint8 *ptr = getProgram(value);
+ //TODO: Check in LoL CD Adlib driver
+ if (!ptr)
+ return 0;
uint8 chan = *ptr++;
uint8 priority = *ptr++;
@@ -2213,12 +2220,12 @@
SoundAdlibPC::SoundAdlibPC(KyraEngine_v1 *vm, Audio::Mixer *mixer)
: Sound(vm, mixer), _driver(0), _trackEntries(), _soundDataPtr(0) {
memset(_trackEntries, 0, sizeof(_trackEntries));
- _v2 = (_vm->gameFlags().gameID == GI_KYRA2);
+ _v2 = (_vm->gameFlags().gameID == GI_KYRA2) || (_vm->gameFlags().gameID == GI_LOL);
_driver = new AdlibDriver(mixer, _v2);
assert(_driver);
_sfxPlayingSound = -1;
- _soundFileLoaded = (uint)-1;
+ _soundFileLoaded.clear();
if (_v2) {
// TODO: Figure out if Kyra 2 uses sound triggers at all.
@@ -2262,7 +2269,7 @@
// sync for each loop. To avoid that, we declare that all four
// of the song channels have to jump "in sync".
- if (track == 4 && scumm_stricmp(fileListEntry(_soundFileLoaded), "KYRA1B") == 0)
+ if (track == 4 && _soundFileLoaded.equalsIgnoreCase("KYRA1B.ADL"))
_driver->setSyncJumpMask(0x000F);
else
_driver->setSyncJumpMask(0);
@@ -2341,6 +2348,15 @@
}
void SoundAdlibPC::loadSoundFile(uint file) {
+ internalLoadFile(fileListEntry(file));
+}
+
+void SoundAdlibPC::loadSoundFile(Common::String file) {
+ internalLoadFile(file);
+}
+
+void SoundAdlibPC::internalLoadFile(Common::String file) {
+ file += ".ADL";
if (_soundFileLoaded == file)
return;
@@ -2349,12 +2365,9 @@
uint8 *file_data = 0; uint32 file_size = 0;
- char filename[25];
- sprintf(filename, "%s.ADL", fileListEntry(file));
-
- file_data = _vm->resource()->fileData(filename, &file_size);
+ file_data = _vm->resource()->fileData(file.c_str(), &file_size);
if (!file_data) {
- warning("Couldn't find music file: '%s'", filename);
+ warning("Couldn't find music file: '%s'", file.c_str());
return;
}
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