Ticket #7968: sound.patch

File sound.patch, 2.0 KB (added by aquadran, 19 years ago)
Line 
191,92c91,92
2< if ((_gameId == GID_DIG) && (data[0] == 12)){
3< uint32 size, rate, tag, chan;
4---
5> if ((_gameId == GID_DIG) && ((data[0] == 12) || (data[0] == 14))){
6> uint32 size, rate, tag, chan, bits;
7100c100,101
8< size = READ_BE_UINT32(ptr); ptr+=16;
9---
10> size = READ_BE_UINT32(ptr); ptr+=12;
11> bits = READ_BE_UINT32(ptr); ptr+=4;
12106a108
13> case MKID_BE('JUMP'):
14119,129c121,136
15< uint32 s_size = (size * 2) / 3;
16< byte * buffer = (byte*)malloc (s_size);
17< uint32 l = 0, r = 0, tmp;
18< memset (buffer, 0, s_size);
19< for (; l < size - 1; l += 3)
20< {
21< tmp = (ptr[l + 1] & 0x0f) << 8;
22< tmp = (tmp | ptr[l + 0]) << 4;
23< tmp -= 0x8000;
24< // buffer[r++] = (uint8)(tmp & 0xff);
25< buffer[r++] = (uint8)((tmp >> 8) & 0xff);
26---
27> if (bits == 8) {
28> byte * buffer = (byte*)malloc (size);
29> memcpy(buffer, ptr, size);
30> _mixer->play_raw(NULL, buffer, size, rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED);
31> }
32> if (bits == 12) {
33> uint32 s_size = (size * 2) / 3;
34> byte * buffer = (byte*)malloc (s_size);
35> uint32 l = 0, r = 0, tmp;
36> for (; l < size; l += 3)
37> {
38> tmp = (ptr[l + 1] & 0x0f) << 8;
39> tmp = (tmp | ptr[l + 0]) << 4;
40> tmp -= 0x8000;
41> // buffer[r++] = (uint8)(tmp & 0xff);
42> buffer[r++] = (uint8)((tmp >> 8) & 0xff);
43131,137c138,145
44< tmp = (ptr[l + 1] & 0xf0) << 4;
45< tmp = (tmp | ptr[l + 2]) << 4;
46< tmp -= 0x8000;
47< // buffer[r++] = (uint8)(tmp & 0xff);
48< buffer[r++] = (uint8)((tmp >> 8) & 0xff);
49< }
50< _mixer->play_raw(NULL, buffer, s_size, rate, SoundMixer::FLAG_AUTOFREE);
51---
52> tmp = (ptr[l + 1] & 0xf0) << 4;
53> tmp = (tmp | ptr[l + 2]) << 4;
54> tmp -= 0x8000;
55> // buffer[r++] = (uint8)(tmp & 0xff);
56> buffer[r++] = (uint8)((tmp >> 8) & 0xff);
57> }
58> _mixer->play_raw(NULL, buffer, s_size, rate, SoundMixer::FLAG_AUTOFREE);
59> }