| 219 | // Support for sampled sound effects in Monkey1 and Monkey2 |
| 220 | else if (ptr != NULL && READ_UINT32_UNALIGNED(ptr) == MKID('SBL ')) { |
| 221 | debug(2, "Using SBL sound effect"); |
| 222 | |
| 223 | // TODO - Figuring out how the SBL chunk works. Here's an |
| 224 | // example: |
| 225 | // |
| 226 | // 53 42 4c 20 00 00 11 ae |SBL ....| |
| 227 | // 41 55 68 64 00 00 00 03 |AUhd....| |
| 228 | // 00 00 80 41 55 64 74 00 |...AUdt.| |
| 229 | // 00 11 9b 01 96 11 00 a6 |........| |
| 230 | // 00 7f 7f 7e 7e 7e 7e 7e |...~~~~~| |
| 231 | // 7e 7f 7f 80 80 7f 7f 7f |~.......| |
| 232 | // 7f 80 80 7f 7e 7d 7d 7e |....~}}~| |
| 233 | // 7e 7e 7e 7e 7e 7e 7e 7f |~~~~~~~.| |
| 234 | // 7f 7f 7f 80 80 80 80 80 |........| |
| 235 | // 80 81 80 80 7f 7f 80 85 |........| |
| 236 | // 8b 8b 83 78 72 6d 6f 75 |...xrmou| |
| 237 | // 7a 78 77 7d 83 84 83 81 |zxw}....| |
| 238 | // |
| 239 | // The length of the AUhd chunk always seems to be 3 bytes. |
| 240 | // Let's skip that for now. |
| 241 | // |
| 242 | // The starting offset, length and sample rate is all pure |
| 243 | // guesswork. The result sounds reasonable to me, but I've |
| 244 | // never heard the original. |
| 245 | |
| 246 | int size = READ_BE_UINT32_UNALIGNED(ptr + 4) - 27; |
| 247 | int rate = 8000; |
| 248 | |
| 249 | // Allocate a sound buffer, copy the data into it, and play |
| 250 | char *sound = (char*)malloc(size); |
| 251 | memcpy(sound, ptr + 33, size); |
| 252 | _scumm->_mixer->play_raw(NULL, sound, size, rate, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE); |
| 253 | return; |
| 254 | } |