[Scummvm-cvs-logs] CVS: scummvm/sound voc.cpp,1.13.2.2,1.13.2.3 voc.h,1.10.2.2,1.10.2.3
Max Horn
fingolfin at users.sourceforge.net
Sun Apr 11 05:46:01 CEST 2004
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/dists/msvc7 kyra.vcproj,1.1,1.2 queen.vcproj,1.19,1.20 saga.vcproj,1.1,1.2 scumm.vcproj,1.21,1.22 scummvm.vcproj,1.25,1.26 simon.vcproj,1.7,1.8 sky.vcproj,1.6,1.7 sword1.vcproj,1.6,1.7 sword2.vcproj,1.11,1.12
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.326,1.327
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4026
Modified Files:
Tag: branch-0-6-0
voc.cpp voc.h
Log Message:
Backported recent VOC changes
Index: voc.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/voc.cpp,v
retrieving revision 1.13.2.2
retrieving revision 1.13.2.3
diff -u -d -r1.13.2.2 -r1.13.2.3
--- voc.cpp 10 Apr 2004 21:08:46 -0000 1.13.2.2
+++ voc.cpp 11 Apr 2004 12:31:22 -0000 1.13.2.3
@@ -50,24 +50,22 @@
assert(version == 0x010A || version == 0x0114);
assert(code == ~version + 0x1234);
- bool quit = false;
+ int len;
byte *ret_sound = 0;
size = 0;
begin_loop = 0;
end_loop = 0;
+
+ ptr += offset;
+ while ((code = *ptr++)) {
+ len = *ptr++;
+ len |= *ptr++ << 8;
+ len |= *ptr++ << 16;
- while (!quit) {
- int len = READ_LE_UINT32(ptr + offset);
- offset += 4;
- code = len & 0xFF;
- len >>= 8;
switch(code) {
- case 0:
- quit = true;
- break;
case 1: {
- int time_constant = ptr[offset++];
- int packing = ptr[offset++];
+ int time_constant = *ptr++;
+ int packing = *ptr++;
len -= 2;
rate = getSampleRateFromVOCRate(time_constant);
debug(9, "VOC Data Block: %d, %d, %d", rate, packing, len);
@@ -77,7 +75,7 @@
} else {
ret_sound = (byte *)malloc(len);
}
- memcpy(ret_sound + size, ptr + offset, len);
+ memcpy(ret_sound + size, ptr, len);
begin_loop = size;
size += len;
end_loop = size;
@@ -86,17 +84,16 @@
}
} break;
case 6: // begin of loop
- loops = (uint16)READ_LE_UINT16(ptr + offset);
+ loops = (uint16)READ_LE_UINT16(ptr);
break;
case 7: // end of loop
break;
default:
warning("Invalid code in VOC file : %d", code);
- quit = true;
- break;
+ return ret_sound;
}
// FIXME some FT samples (ex. 362) has bad length, 2 bytes too short
- offset += len;
+ ptr += len;
}
debug(4, "VOC Data Size : %d", size);
return ret_sound;
@@ -132,18 +129,16 @@
assert(version == 0x010A || version == 0x0114);
assert(code == ~version + 0x1234);
- bool quit = false;
+ int len;
byte *ret_sound = 0;
size = 0;
- while (!quit) {
- int len = file->readUint32LE();
- code = len & 0xFF;
- len >>= 8;
+ while ((code = file->readByte())) {
+ len = file->readByte();
+ len |= file->readByte() << 8;
+ len |= file->readByte() << 16;
+
switch(code) {
- case 0:
- quit = true;
- break;
case 1: {
int time_constant = file->readByte();
int packing = file->readByte();
@@ -164,8 +159,7 @@
} break;
default:
warning("Invalid code in VOC file : %d", code);
- quit = true;
- break;
+ return ret_sound;
}
}
debug(4, "VOC Data Size : %d", size);
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/dists/msvc7 kyra.vcproj,1.1,1.2 queen.vcproj,1.19,1.20 saga.vcproj,1.1,1.2 scumm.vcproj,1.21,1.22 scummvm.vcproj,1.25,1.26 simon.vcproj,1.7,1.8 sky.vcproj,1.6,1.7 sword1.vcproj,1.6,1.7 sword2.vcproj,1.11,1.12
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.326,1.327
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list