[Scummvm-cvs-logs] CVS: scummvm/sound audiostream.cpp,1.11,1.12
Max Horn
fingolfin at users.sourceforge.net
Wed Jul 30 12:44:09 CEST 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm Makefile,1.38,1.39 Makefile.common,1.52,1.53 Makefile.mingw,1.17,1.18 configure,1.33,1.34
- Next message: [Scummvm-cvs-logs] CVS: scummvm Makefile.common,1.53,1.54
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1:/tmp/cvs-serv15835
Modified Files:
audiostream.cpp
Log Message:
fixed incorrect MSVC fixes; simplified readSample code (bugs #780167 and #780420)
Index: audiostream.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/audiostream.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- audiostream.cpp 30 Jul 2003 18:40:28 -0000 1.11
+++ audiostream.cpp 30 Jul 2003 19:43:51 -0000 1.12
@@ -28,17 +28,10 @@
template<bool is16Bit, bool isUnsigned>
static inline int16 readSample(const byte *ptr) {
- if (is16Bit) {
- if (isUnsigned)
- return (int16)(READ_BE_UINT16(ptr) ^ 0x8000);
- else
- return (int16)READ_BE_UINT16(ptr);
- } else {
- if (isUnsigned)
- return (int8)(*ptr ^ 0x80) << 8;
- else
- return (int8)*ptr << 8;
- }
+ uint16 sample = is16Bit ? READ_BE_UINT16(ptr) : (*ptr << 8);
+ if (isUnsigned)
+ sample ^= 0x8000;
+ return (int16)sample;
}
#pragma mark -
@@ -308,7 +301,7 @@
template<bool stereo>
-static AudioInputStream *makeLinearInputStream(const byte *ptr, uint32 len, bool isUnsigned, bool is16Bit) {
+static AudioInputStream *makeLinearInputStream(const byte *ptr, uint32 len, bool is16Bit, bool isUnsigned) {
if (isUnsigned) {
if (is16Bit)
return new LinearMemoryStream<stereo, true, true>(ptr, len);
@@ -324,7 +317,7 @@
template<bool stereo>
-static WrappedAudioInputStream *makeWrappedInputStream(uint32 len, bool isUnsigned, bool is16Bit) {
+static WrappedAudioInputStream *makeWrappedInputStream(uint32 len, bool is16Bit, bool isUnsigned) {
if (isUnsigned) {
if (is16Bit)
return new WrappedMemoryStream<stereo, true, true>(len);
@@ -340,17 +333,21 @@
AudioInputStream *makeLinearInputStream(byte _flags, const byte *ptr, uint32 len) {
+ const bool is16Bit = (_flags & SoundMixer::FLAG_16BITS) != 0;
+ const bool isUnsigned = (_flags & SoundMixer::FLAG_UNSIGNED) != 0;
if (_flags & SoundMixer::FLAG_STEREO) {
- return makeLinearInputStream<true>(ptr, len, _flags & SoundMixer::FLAG_UNSIGNED, _flags & SoundMixer::FLAG_16BITS != 0);
+ return makeLinearInputStream<true>(ptr, len, is16Bit, isUnsigned);
} else {
- return makeLinearInputStream<false>(ptr, len, _flags & SoundMixer::FLAG_UNSIGNED, _flags & SoundMixer::FLAG_16BITS != 0);
+ return makeLinearInputStream<false>(ptr, len, is16Bit, isUnsigned);
}
}
WrappedAudioInputStream *makeWrappedInputStream(byte _flags, uint32 len) {
+ const bool is16Bit = (_flags & SoundMixer::FLAG_16BITS) != 0;
+ const bool isUnsigned = (_flags & SoundMixer::FLAG_UNSIGNED) != 0;
if (_flags & SoundMixer::FLAG_STEREO) {
- return makeWrappedInputStream<true>(len, _flags & SoundMixer::FLAG_UNSIGNED, _flags & SoundMixer::FLAG_16BITS != 0);
+ return makeWrappedInputStream<true>(len, is16Bit, isUnsigned);
} else {
- return makeWrappedInputStream<false>(len, _flags & SoundMixer::FLAG_UNSIGNED, _flags & SoundMixer::FLAG_16BITS != 0);
+ return makeWrappedInputStream<false>(len, is16Bit, isUnsigned);
}
}
- Previous message: [Scummvm-cvs-logs] CVS: scummvm Makefile,1.38,1.39 Makefile.common,1.52,1.53 Makefile.mingw,1.17,1.18 configure,1.33,1.34
- Next message: [Scummvm-cvs-logs] CVS: scummvm Makefile.common,1.53,1.54
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list