[Scummvm-git-logs] scummvm master -> 9ee81ad12718a355b210df838436dbd4f4384253
yinsimei
roseline.yin at gmail.com
Fri Aug 18 05:17:35 CEST 2017
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
0993264ba3 SLUDGE: Play mod music
cc84534871 SLUDGE: Fix load&save sound bug
9ee81ad127 SLUDGE: Fix zBuffer problem when credit scrolling
Commit: 0993264ba30382c67d950c2f8be7d2fbff34c5ed
https://github.com/scummvm/scummvm/commit/0993264ba30382c67d950c2f8be7d2fbff34c5ed
Author: Simei Yin (roseline.yin at gmail.com)
Date: 2017-08-18T05:17:03+02:00
Commit Message:
SLUDGE: Play mod music
Changed paths:
engines/sludge/sound.cpp
engines/sludge/sound.h
diff --git a/engines/sludge/sound.cpp b/engines/sludge/sound.cpp
index 79b9ab7..297d013 100644
--- a/engines/sludge/sound.cpp
+++ b/engines/sludge/sound.cpp
@@ -52,10 +52,9 @@ SoundManager::SoundManager() {
_soundCache = nullptr;
_soundCache = new SoundThing[MAX_SAMPLES];
- #if 0
+
_modCache = nullptr;
_modCache = new SoundThing[MAX_MODS];
- #endif
_defVol = 128;
_defSoundVol = 255;
@@ -70,10 +69,8 @@ SoundManager::~SoundManager() {
delete []_soundCache;
_soundCache = nullptr;
- #if 0
delete []_modCache;
_modCache = nullptr;
- #endif
}
bool SoundManager::initSoundStuff() {
@@ -82,12 +79,13 @@ bool SoundManager::initSoundStuff() {
_soundCache[a].looping = false;
_soundCache[a].inSoundList = false;
}
-#if 0
+
for (int a = 0; a < MAX_MODS; a ++) {
- _modCache[a].stream = NULL;
- _modCache[a].playing = false;
+ _soundCache[a].fileLoaded = -1;
+ _soundCache[a].looping = false;
+ _soundCache[a].inSoundList = false;
}
-#endif
+
return _soundOK = true;
}
@@ -132,11 +130,11 @@ void SoundManager::killSoundStuff() {
void SoundManager::setMusicVolume(int a, int v) {
if (!_soundOK)
return;
-#if 0
- if (_modCache[a].playing) {
- alSourcef(modCache[a].playingOnSource, AL_GAIN, (float) _modLoudness * v / 256);
+
+ if (g_sludge->_mixer->isSoundHandleActive(_modCache[a].handle)) {
+ _modCache[a].vol = v;
+ g_sludge->_mixer->setChannelVolume(_modCache[a].handle, _modLoudness * v / 256);
}
-#endif
}
void SoundManager::setDefaultMusicVolume(int v) {
@@ -176,14 +174,11 @@ int SoundManager::findInSoundCache(int a) {
void SoundManager::stopMOD(int i) {
if (!_soundOK)
return;
-#if 0
- alGetError();
- if (modCache[i].playing) {
- if (! alureStopSource(modCache[i].playingOnSource, AL_TRUE)) {
- debugOut("Failed to stop source: %s\n", alureGetErrorString());
- }
+
+ if (g_sludge->_mixer->isSoundHandleActive(_modCache[i].handle)) {
+ g_sludge->_mixer->stopHandle(_modCache[i].handle);
}
-#endif
+ _modCache[i].fileLoaded = -1;
}
void SoundManager::huntKillSound(int filenum) {
@@ -233,69 +228,33 @@ void SoundManager::huntKillFreeSound(int filenum) {
*/
bool SoundManager::playMOD(int f, int a, int fromTrack) {
#if 0
+ if (!_soundOK)
+ return true;
+ stopMOD(a);
+
// load sound
setResourceForFatal(f);
- uint32 length = openFileFromNum(f);
+ uint length = g_sludge->_resMan->openFileFromNum(f);
if (length == 0) {
- finishAccess();
+ g_sludge->_resMan->finishAccess();
setResourceForFatal(-1);
return false;
}
- Common::SeekableReadStream *memImage = bigDataFile->readStream(length);
- if (memImage->size() != length || bigDataFile->err())
+ // make audio stream
+ Common::SeekableReadStream *readStream = g_sludge->_resMan->getData();
+ Common::SeekableReadStream *memImage = readStream->readStream(length);
+ if (memImage->size() != (int)length || readStream->err())
debug("Sound reading failed");
Audio::AudioStream *stream = Audio::makeProtrackerStream(memImage);
- //TODO: replace by xm file decoders
+
if (!stream)
return false;
// play sound
- Audio::SoundHandle soundHandle;
- g_sludge->_mixer->playStream(Audio::Mixer::kSFXSoundType, &soundHandle,
+ g_sludge->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_modCache[a].handle,
stream, -1, Audio::Mixer::kMaxChannelVolume);
- if (!_soundOK)
- return true;
- stopMOD(a);
-
- setResourceForFatal(f);
- uint32 length = openFileFromNum(f);
- if (length == 0) {
- finishAccess();
- setResourceForFatal(-1);
- return false;
- }
-
- byte *memImage;
- memImage = (byte *) loadEntireFileToMemory(bigDataFile, length);
- if (! memImage) return fatal(ERROR_MUSIC_MEMORY_LOW);
-
- _modCache[a].stream = alureCreateStreamFromMemory(memImage, length, 19200, 0, NULL);
-
- delete memImage;
-
- if (_modCache[a].stream != NULL) {
- setMusicVolume(a, defVol);
-
- if (! alureSetStreamOrder(modCache[a].stream, fromTrack)) {
- debugOut("Failed to set stream order: %s\n",
- alureGetErrorString());
- }
-
- playStream(a, true, true);
-
- } else {
-
- debugOut("Failed to create stream from MOD: %s\n",
- alureGetErrorString());
-
- warning(ERROR_MUSIC_ODDNESS);
- _soundCache[a].stream = NULL;
- _soundCache[a].playing = false;
- _soundCache[a].playingOnSource = 0;
- }
- setResourceForFatal(-1);
#endif
return true;
}
diff --git a/engines/sludge/sound.h b/engines/sludge/sound.h
index cdd76b3..1e1a2a4 100644
--- a/engines/sludge/sound.h
+++ b/engines/sludge/sound.h
@@ -83,9 +83,9 @@ private:
struct SoundThing {
Audio::SoundHandle handle;
- int fileLoaded, vol; //Used for sounds only. (sound saving/loading)
- bool looping; //Used for sounds only. (sound saving/loading)
- bool inSoundList;
+ int fileLoaded, vol; //Used for wav/ogg sounds only. (sound saving/loading)
+ bool looping; //Used for wav/ogg sounds only. (sound saving/loading)
+ bool inSoundList; //Used for wav/ogg sounds only
};
typedef Common::List<SoundList *> SoundListHandles;
@@ -97,9 +97,7 @@ private:
bool _isHandlingSoundList;
SoundThing *_soundCache;
- #if 0
SoundThing *_modCache;
- #endif
int _defVol;
int _defSoundVol;
Commit: cc84534871ef8d609ffd87a8b7ad1219f8ff5935
https://github.com/scummvm/scummvm/commit/cc84534871ef8d609ffd87a8b7ad1219f8ff5935
Author: Simei Yin (roseline.yin at gmail.com)
Date: 2017-08-18T05:17:03+02:00
Commit Message:
SLUDGE: Fix load&save sound bug
Changed paths:
engines/sludge/sound.cpp
diff --git a/engines/sludge/sound.cpp b/engines/sludge/sound.cpp
index 297d013..6820ae1 100644
--- a/engines/sludge/sound.cpp
+++ b/engines/sludge/sound.cpp
@@ -93,40 +93,16 @@ void SoundManager::killSoundStuff() {
if (!_soundOK)
return;
- _silenceIKillYou = true;
- for (int i = 0; i < MAX_SAMPLES; i ++) {
- if (g_sludge->_mixer->isSoundHandleActive(_soundCache[i].handle)) {
- g_sludge->_mixer->stopHandle(_soundCache[i].handle);
- }
- }
-#if 0
- for (int i = 0; i < MAX_MODS; i ++) {
- if (_modCache[i].playing) {
-
- if (! alureStopSource(modCache[i].playingOnSource, AL_TRUE)) {
- debugOut("Failed to stop source: %s\n",
- alureGetErrorString());
- }
-
- }
-
- if (_modCache[i].stream != NULL) {
-
- if (! alureDestroyStream(modCache[i].stream, 0, NULL)) {
- debugOut("Failed to destroy stream: %s\n",
- alureGetErrorString());
- }
+ for (int i = 0; i < MAX_SAMPLES; ++i)
+ freeSound(i);
- }
- }
-#endif
- _silenceIKillYou = false;
+ for (int i = 0; i < MAX_MODS; ++i)
+ stopMOD(i);
}
/*
* Some setters:
*/
-
void SoundManager::setMusicVolume(int a, int v) {
if (!_soundOK)
return;
@@ -186,15 +162,10 @@ void SoundManager::huntKillSound(int filenum) {
return;
int gotSlot = findInSoundCache(filenum);
- if (gotSlot == -1) return;
-
- _silenceIKillYou = true;
-
- if (g_sludge->_mixer->isSoundHandleActive(_soundCache[gotSlot].handle)) {
- g_sludge->_mixer->stopHandle(_soundCache[gotSlot].handle);
- }
+ if (gotSlot == -1)
+ return;
- _silenceIKillYou = false;
+ freeSound(gotSlot);
}
void SoundManager::freeSound(int a) {
@@ -209,6 +180,8 @@ void SoundManager::freeSound(int a) {
handleSoundLists();
}
+ _soundCache[a].inSoundList = false;
+ _soundCache[a].looping = false;
_soundCache[a].fileLoaded = -1;
_silenceIKillYou = false;
@@ -322,20 +295,12 @@ int SoundManager::makeSoundAudioStream(int f, Audio::AudioStream *&audiostream,
return -1;
int a = findInSoundCache(f);
- if (a != -1) { // if this sound has been loaded before
- // still playing
- if (g_sludge->_mixer->isSoundHandleActive(_soundCache[a].handle)) {
- g_sludge->_mixer->stopHandle(_soundCache[a].handle); // stop it
- if (_soundCache[a].inSoundList) {
- handleSoundLists();
- }
- }
- } else {
+ if (a == -1) {
if (f == -2)
return -1;
a = findEmptySoundSlot();
- freeSound(a);
}
+ freeSound(a);
setResourceForFatal(f);
uint32 length = g_sludge->_resMan->openFileFromNum(f);
@@ -357,6 +322,7 @@ int SoundManager::makeSoundAudioStream(int f, Audio::AudioStream *&audiostream,
if (stream) {
audiostream = Audio::makeLoopingAudioStream(stream, loopy ? 0 : 1);
_soundCache[a].fileLoaded = f;
+ _soundCache[a].looping = loopy;
setResourceForFatal(-1);
} else {
audiostream = nullptr;
Commit: 9ee81ad12718a355b210df838436dbd4f4384253
https://github.com/scummvm/scummvm/commit/9ee81ad12718a355b210df838436dbd4f4384253
Author: Simei Yin (roseline.yin at gmail.com)
Date: 2017-08-18T05:17:03+02:00
Commit Message:
SLUDGE: Fix zBuffer problem when credit scrolling
Changed paths:
engines/sludge/sprites.cpp
diff --git a/engines/sludge/sprites.cpp b/engines/sludge/sprites.cpp
index 98d88a8..c37c4a1 100644
--- a/engines/sludge/sprites.cpp
+++ b/engines/sludge/sprites.cpp
@@ -271,6 +271,13 @@ bool GraphicsManager::loadSpriteBank(int fileNum, SpriteBank &loadhere, bool isF
// pasteSpriteToBackDrop uses the colour specified by the setPasteColour (or setPasteColor)
void GraphicsManager::pasteSpriteToBackDrop(int x1, int y1, Sprite &single, const SpritePalette &fontPal) {
+ // kill zBuffer
+ if (_zBuffer->originalNum >= 0 && _zBuffer->sprites) {
+ int num = _zBuffer->originalNum;
+ killZBuffer();
+ _zBuffer->originalNum = num;
+ }
+
//TODO: shader: useLightTexture
x1 -= single.xhot;
y1 -= single.yhot;
@@ -282,6 +289,13 @@ void GraphicsManager::pasteSpriteToBackDrop(int x1, int y1, Sprite &single, cons
// burnSpriteToBackDrop adds text in the colour specified by setBurnColour
// using the differing brightness levels of the font to achieve an anti-aliasing effect.
void GraphicsManager::burnSpriteToBackDrop(int x1, int y1, Sprite &single, const SpritePalette &fontPal) {
+ // kill zBuffer
+ if (_zBuffer->originalNum >= 0 && _zBuffer->sprites) {
+ int num = _zBuffer->originalNum;
+ killZBuffer();
+ _zBuffer->originalNum = num;
+ }
+
//TODO: shader: useLightTexture
x1 -= single.xhot;
y1 -= single.yhot - 1;
More information about the Scummvm-git-logs
mailing list