added code for ms track position

svn-id: r12204
This commit is contained in:
Paweł Kołodziejski 2004-01-07 05:17:51 +00:00
parent 5f665202d1
commit 761371cc66
2 changed files with 23 additions and 6 deletions

View File

@ -223,6 +223,7 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType,
int bits = 0, freq = 0, channels = 0, mixerFlags = 0; int bits = 0, freq = 0, channels = 0, mixerFlags = 0;
if (input) { if (input) {
_track[l].iteration = 1; // ?
// Do nothing here, we already have an audio stream // Do nothing here, we already have an audio stream
} else { } else {
if (soundName == NULL) if (soundName == NULL)
@ -236,6 +237,9 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType,
bits = _sound->getBits(_track[l].soundHandle); bits = _sound->getBits(_track[l].soundHandle);
channels = _sound->getChannels(_track[l].soundHandle); channels = _sound->getChannels(_track[l].soundHandle);
freq = _sound->getFreq(_track[l].soundHandle); freq = _sound->getFreq(_track[l].soundHandle);
_track[l].iteration = freq * channels;
if ((bits == 12) || (bits == 16))
_track[l].iteration *= 2;
if (channels == 2) { if (channels == 2) {
mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO; mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO;
@ -548,28 +552,39 @@ void IMuseDigital::closeBundleFiles() {
// TODO // TODO
} }
int32 IMuseDigital::getCurMusicPosInMs() { int32 IMuseDigital::getPosInMs(int soundId) {
// TODO debug(5, "IMuseDigital::getPosInMs(%d)", soundId);
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if ((_track[l].idSound == soundId) && _track[l].used) {
int32 pos = 1000 * _track[l].trackOffset / _track[l].iteration;
return pos;
}
}
return 0; return 0;
} }
int32 IMuseDigital::getCurMusicPosInMs() {
return getPosInMs(_curMusicId);
}
int32 IMuseDigital::getCurVoiceLipSyncWidth() { int32 IMuseDigital::getCurVoiceLipSyncWidth() {
// TODO int32 pos = getPosInMs(kTalkSoundID);
return _scumm->_rnd.getRandomNumber(255); return _scumm->_rnd.getRandomNumber(255);
} }
int32 IMuseDigital::getCurVoiceLipSyncHeight() { int32 IMuseDigital::getCurVoiceLipSyncHeight() {
// TODO int32 pos = getPosInMs(kTalkSoundID);
return _scumm->_rnd.getRandomNumber(255); return _scumm->_rnd.getRandomNumber(255);
} }
int32 IMuseDigital::getCurMusicLipSyncWidth() { int32 IMuseDigital::getCurMusicLipSyncWidth() {
// TODO int32 pos = getPosInMs(_curMusicId);
return _scumm->_rnd.getRandomNumber(255); return _scumm->_rnd.getRandomNumber(255);
} }
int32 IMuseDigital::getCurMusicLipSyncHeight() { int32 IMuseDigital::getCurMusicLipSyncHeight() {
// TODO int32 pos = getPosInMs(_curMusicId);
return _scumm->_rnd.getRandomNumber(255); return _scumm->_rnd.getRandomNumber(255);
} }

View File

@ -55,6 +55,7 @@ private:
int curRegion; int curRegion;
int curHookId; int curHookId;
int soundGroup; int soundGroup;
int iteration;
void *soundHandle; void *soundHandle;
int32 pullSize; int32 pullSize;
int mod; int mod;
@ -103,6 +104,7 @@ public:
void pause(bool pause); void pause(bool pause);
void parseScriptCmds(int a, int b, int c, int d, int e, int f, int g, int h); void parseScriptCmds(int a, int b, int c, int d, int e, int f, int g, int h);
int getSoundStatus(int sound) const; int getSoundStatus(int sound) const;
int32 getPosInMs(int soundId);
int32 getCurMusicPosInMs(); int32 getCurMusicPosInMs();
int32 getCurVoiceLipSyncWidth(); int32 getCurVoiceLipSyncWidth();
int32 getCurVoiceLipSyncHeight(); int32 getCurVoiceLipSyncHeight();