[Scummvm-cvs-logs] CVS: scummvm/sword1 music.cpp,1.11,1.12 music.h,1.4,1.5
Robert G?ffringmann
lavosspawn at users.sourceforge.net
Thu Jan 1 08:57:01 CET 2004
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/sword1 control.cpp,1.17,1.18 music.cpp,1.10,1.11 music.h,1.3,1.4 sword1.cpp,1.25,1.26
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sword1 logic.cpp,1.27,1.28
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1:/tmp/cvs-serv30390/sword1
Modified Files:
music.cpp music.h
Log Message:
changed music fading duration and made music system fade down the tracks on startMusic(0)
Index: music.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/music.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- music.cpp 1 Jan 2004 15:22:15 -0000 1.11
+++ music.cpp 1 Jan 2004 16:56:00 -0000 1.12
@@ -25,8 +25,8 @@
#include "common/util.h"
#include "common/file.h"
-// This means fading takes about half a second. This may need some tuning...
-#define FADE_SAMPLES 5512
+// This means fading takes 3 seconds.
+#define FADE_LENGTH 3
// These functions are only called from SwordMusic, so I'm just going to
// assume that if locking is needed it has already been taken care of.
@@ -35,14 +35,16 @@
if (_fading < 0)
_fading = -_fading;
else if (_fading == 0)
- _fading = FADE_SAMPLES;
+ _fading = FADE_LENGTH * getRate();
+ _fadeSamples = FADE_LENGTH * getRate();
}
void SwordMusicHandle::fadeUp() {
if (_fading > 0)
_fading = -_fading;
else if (_fading == 0)
- _fading = -FADE_SAMPLES;
+ _fading = -(FADE_LENGTH * getRate());
+ _fadeSamples = FADE_LENGTH * getRate();
}
bool SwordMusicHandle::endOfData() const {
@@ -74,10 +76,10 @@
_looping = false;
_file.close();
}
- sample = (sample * _fading) / FADE_SAMPLES;
+ sample = (sample * _fading) / _fadeSamples;
} else if (_fading < 0) {
_fading++;
- sample = (sample * (FADE_SAMPLES + _fading)) / FADE_SAMPLES;
+ sample = (sample * (_fadeSamples + _fading)) / _fadeSamples;
}
return sample;
}
@@ -153,9 +155,14 @@
}
char fName[20];
sprintf(fName, "music/%s.wav", _tuneList[tuneId]);
- _handles[newStream].play(fName, loopFlag);
+ _handles[newStream].play(fName, loopFlag != 0);
delete _converter[newStream];
_converter[newStream] = makeRateConverter(_handles[newStream].getRate(), _mixer->getOutputRate(), _handles[newStream].isStereo(), false);
+ } else {
+ if (_handles[0].streaming())
+ _handles[0].fadeDown();
+ if (_handles[1].streaming())
+ _handles[1].fadeDown();
}
}
Index: music.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/music.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- music.h 1 Jan 2004 15:22:15 -0000 1.4
+++ music.h 1 Jan 2004 16:56:00 -0000 1.5
@@ -39,6 +39,7 @@
File _file;
bool _looping;
int32 _fading;
+ int32 _fadeSamples;
int _rate;
bool _stereo;
public:
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/sword1 control.cpp,1.17,1.18 music.cpp,1.10,1.11 music.h,1.3,1.4 sword1.cpp,1.25,1.26
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sword1 logic.cpp,1.27,1.28
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list