Ticket #8707: SoC Tools Update.patch
File SoC Tools Update.patch, 60.8 KB (added by , 17 years ago) |
---|
-
compress.c
35 35 int nominalBitr; 36 36 int minBitr; 37 37 int maxBitr; 38 int quality;38 float quality; 39 39 bool silent; 40 40 } oggencparams; 41 41 42 /* FIXME: This is an evil way to pass on the params to FLAC.43 It makes it near impossible to reliably pass default params to the44 encoder.45 */46 42 typedef struct { 47 char * const* argv; 48 int numArgs; 43 int compressionLevel; 44 int blocksize; 45 bool verify; 46 bool silent; 49 47 } flaccparams; 50 48 51 49 typedef struct { 52 bool isLittleEndian; 53 bool isStereo; 54 bool isUnsigned; 50 bool isLittleEndian, isStereo; 55 51 uint8 bitsPerSample; 56 52 } rawtype; 57 53 58 54 lameparams encparms = { minBitrDef, maxBitrDef, false, algqualDef, vbrqualDef, 0 }; 59 55 oggencparams oggparms = { -1, -1, -1, oggqualDef, 0 }; 60 flaccparams flacparms ;61 rawtype rawAudioType = { false, false, false,8 };56 flaccparams flacparms = { flacCompressDef, flacBlocksizeDef, false, false }; 57 rawtype rawAudioType = { false, false, 8 }; 62 58 63 59 const char *tempEncoded = TEMP_MP3; 64 60 65 void setRawAudioType(bool isLittleEndian, bool isStereo, bool isUnsigned,uint8 bitsPerSample) {61 void setRawAudioType(bool isLittleEndian, bool isStereo, uint8 bitsPerSample) { 66 62 rawAudioType.isLittleEndian = isLittleEndian; 67 63 rawAudioType.isStereo = isStereo; 68 rawAudioType.isUnsigned = isUnsigned;69 64 rawAudioType.bitsPerSample = bitsPerSample; 70 65 } 71 66 … … 105 100 } 106 101 107 102 void encodeAudio(const char *inname, bool rawInput, int rawSamplerate, const char *outname, CompressMode compmode) { 108 char fbuf[2048]; 109 char *tmp = fbuf; 110 int i; 111 bool err = false; 103 if ((compmode == kVorbisMode) || (compmode == kFlacMode)) { 104 if (rawInput) { 105 FILE *inputRaw; 106 long length; 107 char *rawData; 112 108 113 switch (compmode) { 114 case kVorbisMode: 115 tmp += sprintf(tmp, "oggenc "); 116 if (rawInput) { 117 tmp += sprintf(tmp, "--raw "); 118 tmp += sprintf(tmp, "--raw-chan=%d ", (rawAudioType.isStereo ? 2 : 1)); 119 tmp += sprintf(tmp, "--raw-bits=%d ", rawAudioType.bitsPerSample); 120 tmp += sprintf(tmp, "--raw-rate=%d ", rawSamplerate); 121 tmp += sprintf(tmp, "--raw-endianness=%d ", (rawAudioType.isLittleEndian ? 0 : 1)); 109 inputRaw = fopen(inname, "rb"); 110 length = fileSize(inputRaw); 111 rawData = (char *)malloc(length); 112 fread(rawData, 1, length, inputRaw); 113 114 encodeRaw(rawData, length, rawSamplerate, outname, compmode); 115 116 fclose(inputRaw); 117 free(rawData); 118 } else { 119 FILE *inputWav; 120 int fmtHeaderSize, length, numChannels, sampleRate, bitsPerSample; 121 char *wavData; 122 123 inputWav = fopen(inname, "rb"); 124 125 /* Standard PCM fmt header is 16 bits, but at least Simon 1 and 2 use 18 bits */ 126 fseek(inputWav, 16, SEEK_SET); 127 fmtHeaderSize = readUint32LE(inputWav); 128 129 fseek(inputWav, 22, SEEK_SET); 130 numChannels = readUint16LE(inputWav); 131 sampleRate = readUint32LE(inputWav); 132 133 fseek(inputWav, 34, SEEK_SET); 134 bitsPerSample = readUint16LE(inputWav); 135 136 /* The size of the raw audio is after the RIFF chunk (12 bytes), fmt chunk (8 + fmtHeaderSize bytes), and data chunk id (4 bytes) */ 137 fseek(inputWav, 24 + fmtHeaderSize, SEEK_SET); 138 length = readUint32LE(inputWav); 139 140 wavData = (char *)malloc(length); 141 fread(wavData, 1, length, inputWav); 142 143 printf(" - length = %d\n", length); 144 printf(" - channels = %d\n", numChannels); 145 printf(" - sample rate = %d\n", sampleRate); 146 printf(" - compression = %dbits\n", bitsPerSample); 147 148 setRawAudioType(true, numChannels == 2, bitsPerSample); 149 encodeRaw(wavData, length, sampleRate, outname, compmode); 150 151 fclose(inputWav); 152 free (wavData); 122 153 } 154 } else if (compmode == kMP3Mode) { 155 bool err = false; 156 char fbuf[2048]; 157 char *tmp = fbuf; 123 158 124 if (oggparms.nominalBitr != -1)125 tmp += sprintf(tmp, "--bitrate=%d ", oggparms.nominalBitr);126 if (oggparms.minBitr != -1)127 tmp += sprintf(tmp, "--min-bitrate=%d ", oggparms.minBitr);128 if (oggparms.maxBitr != -1)129 tmp += sprintf(tmp, "--max-bitrate=%d ", oggparms.maxBitr);130 if (oggparms.silent)131 tmp += sprintf(tmp, "--quiet ");132 tmp += sprintf(tmp, "--quality=%d ", oggparms.quality);133 tmp += sprintf(tmp, "--output=\"%s\" ", outname);134 tmp += sprintf(tmp, "\"%s\" ", inname);135 err = system(fbuf) != 0;136 break;137 138 case kMP3Mode:139 159 tmp += sprintf(tmp, "lame -t "); 140 160 if (rawInput) { 141 161 tmp += sprintf(tmp, "-r "); 142 162 tmp += sprintf(tmp, "--bitwidth %d ", rawAudioType.bitsPerSample); 143 if (rawAudioType.isLittleEndian) 163 if (rawAudioType.isLittleEndian) { 144 164 tmp += sprintf(tmp, "-x "); 165 } 145 166 tmp += sprintf(tmp, (rawAudioType.isStereo ? "-m j " : "-m m ")); 146 167 tmp += sprintf(tmp, "-s %d ", rawSamplerate); 147 168 } 148 169 149 if (encparms.abr) 170 if (encparms.abr) { 150 171 tmp += sprintf(tmp, "--abr %d ", encparms.minBitr); 151 else172 } else { 152 173 tmp += sprintf(tmp, "--vbr-new -b %d ", encparms.minBitr); 174 } 153 175 154 176 /* Explicitly specify a target sample rate, to work around a bug (?) 155 156 157 158 159 160 161 if (rawSamplerate != -1) 177 * in newer lame versions (>= 3.95) which causes it to malfunction 178 * for odd sample rates when in VBR mode. See also bug #934026. 179 * We essentially duplicate the old behaviour of lame (found in e.g. 180 * version 3.93.1): we round the input sample rate up to the next 181 * higher valid MP3 sample rate, with a margin of 3%. 182 */ 183 if (rawSamplerate != -1) { 162 184 tmp += sprintf(tmp, "--resample %d ", map2MP3Frequency(97 * rawSamplerate / 100)); 185 } 163 186 164 if (encparms.silent) 187 if (encparms.silent) { 165 188 tmp += sprintf(tmp, " --silent "); 189 } 190 166 191 tmp += sprintf(tmp, "-q %d ", encparms.algqual); 167 192 tmp += sprintf(tmp, "-V %d ", encparms.vbrqual); 168 193 tmp += sprintf(tmp, "-B %d ", encparms.maxBitr); 169 194 tmp += sprintf(tmp, "\"%s\" \"%s\" ", inname, outname); 195 170 196 err = system(fbuf) != 0; 171 break;172 197 173 case kFlacMode: 174 /* --lax is needed to allow 11kHz, we dont need place for meta-tags, and no seektable */ 175 /* -f is reqired to force override of unremoved temp file. See bug #1294648 */ 176 tmp += sprintf(tmp, "flac --best -b 1152 -f --lax --no-padding --no-seektable --no-ogg "); 198 if (err) { 199 printf("Got error from encoder. (check your parameters)\n"); 200 printf("Encoder Commandline: %s\n", fbuf ); 201 exit(-1); 202 } 203 } 204 } 177 205 178 if (rawInput) { 179 tmp += sprintf(tmp, "--force-raw-format "); 180 tmp += sprintf(tmp, "--sign=%s ", (rawAudioType.isUnsigned ? "unsigned" : "signed")); 181 tmp += sprintf(tmp, "--channels=%d ", (rawAudioType.isStereo ? 2 : 1)); 182 tmp += sprintf(tmp, "--bps=%d ", rawAudioType.bitsPerSample); 183 tmp += sprintf(tmp, "--sample-rate=%d ", rawSamplerate); 184 tmp += sprintf(tmp, "--endian=%s ", (rawAudioType.isLittleEndian ? "little" : "big")); 206 void encodeRaw(char *rawData, int length, int samplerate, const char *outname, CompressMode compmode) { 207 if (compmode == kVorbisMode) { 208 FILE *outputOgg; 209 char outputString[256] = ""; 210 int numChannels = (rawAudioType.isStereo ? 2 : 1); 211 int totalSamples = length / ((rawAudioType.bitsPerSample / 8) * numChannels); 212 int samplesLeft = totalSamples; 213 int eos = 0; 214 int totalBytes = 0; 215 216 vorbis_info vi; 217 vorbis_comment vc; 218 vorbis_dsp_state vd; 219 vorbis_block vb; 220 221 ogg_stream_state os; 222 ogg_page og; 223 ogg_packet op; 224 225 ogg_packet header; 226 ogg_packet header_comm; 227 ogg_packet header_code; 228 229 outputOgg = fopen(outname,"wb"); 230 231 vorbis_info_init(&vi); 232 233 if (oggparms.nominalBitr > 0) { 234 int result = 0; 235 236 /* Input is in kbps, function takes bps */ 237 result = vorbis_encode_setup_managed(&vi, numChannels, samplerate, (oggparms.maxBitr > 0 ? 1000 * oggparms.maxBitr : -1), (1000 * oggparms.nominalBitr), (oggparms.minBitr > 0 ? 1000 * oggparms.minBitr : -1)); 238 239 if (result == OV_EFAULT) { 240 printf("Error: Internal Logic Fault.\n\n"); 241 vorbis_info_clear(&vi); 242 exit(-1); 243 } else if ((result == OV_EINVAL) || (result == OV_EIMPL)) { 244 printf("Error: Invalid bitrate parameters.\n\n"); 245 vorbis_info_clear(&vi); 246 exit(-1); 247 } 248 249 if (!oggparms.silent) { 250 sprintf(outputString, "Encoding to\n \"%s\"\nat average bitrate %i kbps (", outname, oggparms.nominalBitr); 251 252 if (oggparms.minBitr > 0) { 253 sprintf(outputString + strlen(outputString), "min %i kbps, ", oggparms.minBitr); 254 } else { 255 sprintf(outputString + strlen(outputString), "no min, "); 256 } 257 258 if (oggparms.maxBitr > 0) { 259 sprintf(outputString + strlen(outputString), "max %i kbps),\nusing full bitrate management engine\nSet optional hard quality restrictions\n", oggparms.maxBitr); 260 } else { 261 sprintf(outputString + strlen(outputString), "no max),\nusing full bitrate management engine\nSet optional hard quality restrictions\n"); 262 } 263 } 264 } else { 265 int result = 0; 266 267 /* Quality input is 1 - 10, function takes -0.1 through 1.0 */ 268 result = vorbis_encode_setup_vbr(&vi, numChannels, samplerate, oggparms.quality * 0.1); 269 270 if (result == OV_EFAULT) { 271 printf("Error: Internal Logic Fault.\n\n"); 272 vorbis_info_clear(&vi); 273 exit(-1); 274 } else if ((result == OV_EINVAL) || (result == OV_EIMPL)) { 275 printf("Error: Invalid bitrate parameters.\n\n"); 276 vorbis_info_clear(&vi); 277 exit(-1); 278 } 279 280 if (!oggparms.silent) { 281 sprintf(outputString, "Encoding to\n \"%s\"\nat quality %2.2f", outname, oggparms.quality); 282 } 283 284 if ((oggparms.minBitr > 0) || (oggparms.maxBitr > 0)) { 285 struct ovectl_ratemanage_arg extraParam; 286 vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE_GET, &extraParam); 287 288 extraParam.bitrate_hard_min = (oggparms.minBitr > 0 ? (1000 * oggparms.minBitr) : -1); 289 extraParam.bitrate_hard_max = (oggparms.maxBitr > 0 ? (1000 * oggparms.maxBitr) : -1); 290 extraParam.management_active = 1; 291 292 vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE_SET, &extraParam); 293 294 if (!oggparms.silent) { 295 sprintf(outputString + strlen(outputString), " using constrained VBR ("); 296 297 if (oggparms.minBitr != -1) { 298 sprintf(outputString + strlen(outputString), "min %i kbps, ", oggparms.minBitr); 299 } else { 300 sprintf(outputString + strlen(outputString), "no min, "); 301 } 302 303 if (oggparms.maxBitr != -1) { 304 sprintf(outputString + strlen(outputString), "max %i kbps)\nSet optional hard quality restrictions\n", oggparms.maxBitr); 305 } else { 306 sprintf(outputString + strlen(outputString), "no max)\nSet optional hard quality restrictions\n"); 307 } 308 } 309 } else { 310 sprintf(outputString + strlen(outputString), "\n"); 311 } 185 312 } 186 313 187 for (i = 0; i < flacparms.numArgs; i++) { 188 /* Append optional encoder arguments */ 189 tmp += sprintf(tmp, "%s ", flacparms.argv[i]); 314 printf(outputString); 315 316 vorbis_encode_setup_init(&vi); 317 vorbis_comment_init(&vc); 318 vorbis_analysis_init(&vd, &vi); 319 vorbis_block_init(&vd, &vb); 320 ogg_stream_init(&os, 0); 321 vorbis_analysis_headerout(&vd, &vc, &header, &header_comm, &header_code); 322 323 ogg_stream_packetin(&os, &header); 324 ogg_stream_packetin(&os, &header_comm); 325 ogg_stream_packetin(&os, &header_code); 326 327 while (!eos) { 328 int result = ogg_stream_flush(&os,&og); 329 330 if (result == 0) { 331 break; 332 } 333 334 fwrite(og.header, 1, og.header_len, outputOgg); 335 fwrite(og.body, 1, og.body_len, outputOgg); 190 336 } 191 337 192 tmp += sprintf(tmp, "-o \"%s\" ", outname); 193 tmp += sprintf(tmp, "\"%s\" ", inname); 338 while (!eos) { 339 int i, j; 340 int numSamples = ((samplesLeft < 2048) ? samplesLeft : 2048); 341 float **buffer = vorbis_analysis_buffer(&vd, numSamples); 194 342 195 err = system(fbuf) != 0; 196 break; 197 } 343 /* We must tell the encoder that we have reached the end of the stream */ 344 if (numSamples == 0) { 345 vorbis_analysis_wrote(&vd, 0); 346 } else { 347 /* Adapted from oggenc 1.1.1 */ 348 if (rawAudioType.bitsPerSample == 8) { 349 unsigned char *rawDataUnsigned = (unsigned char *)rawData; 350 for (i = 0; i < numSamples; i++) { 351 for (j = 0; j < numChannels; j++) { 352 buffer[j][i] = ((int)(rawDataUnsigned[i * numChannels + j]) - 128) / 128.0f; 353 } 354 } 355 } else if(rawAudioType.bitsPerSample == 16) { 356 if(rawAudioType.isLittleEndian) { 357 for(i = 0; i < numSamples; i++) { 358 for(j = 0; j < numChannels; j++) { 359 buffer[j][i] = ((rawData[(i * 2 * numChannels) + (2 * j) + 1] << 8) | (rawData[(i * 2 * numChannels) + (2 * j)] & 0xff)) / 32768.0f; 360 } 361 } 362 } 363 else { 364 for(i = 0; i < numSamples; i++) { 365 for(j = 0; j < numChannels; j++) { 366 buffer[j][i] = ((rawData[(i * 2 * numChannels) + (2 * j)] << 8) | (rawData[(i * 2 * numChannels) + (2 * j) + 1] & 0xff)) / 32768.0f; 367 } 368 } 369 } 370 } 198 371 199 if (err) { 200 printf("Got error from encoder. (check your parameters)\n"); 201 printf("Encoder Commandline: %s\n", fbuf ); 202 exit(-1); 372 vorbis_analysis_wrote(&vd, numSamples); 373 } 374 375 while (vorbis_analysis_blockout(&vd, &vb) == 1) { 376 vorbis_analysis(&vb, NULL); 377 vorbis_bitrate_addblock(&vb); 378 379 while (vorbis_bitrate_flushpacket(&vd, &op)) { 380 ogg_stream_packetin(&os, &op); 381 382 while (!eos) { 383 int result = ogg_stream_pageout(&os, &og); 384 385 if(result == 0) { 386 break; 387 } 388 389 totalBytes += fwrite(og.header, 1, og.header_len, outputOgg); 390 totalBytes += fwrite(og.body, 1, og.body_len, outputOgg); 391 392 if(ogg_page_eos(&og)) { 393 eos = 1; 394 } 395 } 396 } 397 } 398 399 rawData += 2048 * (rawAudioType.bitsPerSample / 8) * numChannels; 400 samplesLeft -= 2048; 401 } 402 403 ogg_stream_clear(&os); 404 vorbis_block_clear(&vb); 405 vorbis_dsp_clear(&vd); 406 vorbis_info_clear(&vi); 407 408 fclose(outputOgg); 409 410 if (!oggparms.silent) { 411 printf("\nDone encoding file \"%s\"\n", outname); 412 printf("\n\tFile length: %dm %ds\n", (int)(totalSamples / samplerate / 60), (totalSamples / samplerate % 60)); 413 printf("\tAverage bitrate: %.1f kb/s\n\n", (8.0 * (double)totalBytes / 1000.0) / ((double)totalSamples / (double)samplerate)); 414 } 415 } else if (compmode == kFlacMode) { 416 int i; 417 int numChannels = (rawAudioType.isStereo ? 2 : 1); 418 int samplesPerChannel = length / ((rawAudioType.bitsPerSample / 8) * numChannels); 419 FLAC__StreamEncoder *encoder; 420 FLAC__StreamEncoderInitStatus initStatus; 421 FLAC__int32 *flacData; 422 423 flacData = (FLAC__int32 *)malloc(samplesPerChannel * numChannels * sizeof(FLAC__int32)); 424 if (rawAudioType.bitsPerSample == 8) { 425 for (i = 0; i < samplesPerChannel * numChannels; i++) { 426 FLAC__uint8 *rawDataUnsigned; 427 rawDataUnsigned = (FLAC__uint8 *)rawData; 428 flacData[i] = (FLAC__int32)rawDataUnsigned[i] - 0x80; 429 } 430 } else if (rawAudioType.bitsPerSample == 16) { 431 /* The rawData pointer is an 8-bit char so we must create a new pointer to access 16-bit samples */ 432 FLAC__int16 *rawData16; 433 rawData16 = (FLAC__int16 *)rawData; 434 for (i = 0; i < samplesPerChannel * numChannels; i++) { 435 flacData[i] = (FLAC__int32)rawData16[i]; 436 } 437 } 438 439 if (!flacparms.silent) { 440 printf("Encoding to\n \"%s\"\nat compression level %d using blocksize %d\n\n", outname, flacparms.compressionLevel, flacparms.blocksize); 441 } 442 443 encoder = FLAC__stream_encoder_new(); 444 445 FLAC__stream_encoder_set_bits_per_sample(encoder, rawAudioType.bitsPerSample); 446 FLAC__stream_encoder_set_blocksize(encoder, flacparms.blocksize); 447 FLAC__stream_encoder_set_channels(encoder, numChannels); 448 FLAC__stream_encoder_set_compression_level(encoder, flacparms.compressionLevel); 449 FLAC__stream_encoder_set_sample_rate(encoder, samplerate); 450 FLAC__stream_encoder_set_streamable_subset(encoder, false); 451 FLAC__stream_encoder_set_total_samples_estimate(encoder, samplesPerChannel); 452 FLAC__stream_encoder_set_verify(encoder, flacparms.verify); 453 454 initStatus = FLAC__stream_encoder_init_file(encoder, outname, NULL, NULL); 455 456 if (initStatus != FLAC__STREAM_ENCODER_INIT_STATUS_OK) { 457 printf("Got error from encoder. (check your paramters)\n"); 458 printf("FLAC error: %s\n\n", FLAC__StreamEncoderInitStatusString[initStatus]); 459 exit(-1); 460 } else { 461 FLAC__stream_encoder_process_interleaved(encoder, flacData, samplesPerChannel); 462 } 463 464 FLAC__stream_encoder_finish(encoder); 465 FLAC__stream_encoder_delete(encoder); 466 467 free(flacData); 468 469 if (!flacparms.silent) { 470 printf("\nDone encoding file \"%s\"\n", outname); 471 printf("\n\tFile length: %dm %ds\n\n", (int)(samplesPerChannel / samplerate / 60), (samplesPerChannel / samplerate % 60)); 472 } 473 203 474 } 204 475 } 205 476 206 477 void extractAndEncodeWAV(const char *outName, FILE *input, CompressMode compMode) { 207 478 int length; 208 FILE *f;209 char fbuf[2048];210 size_t size;211 479 212 480 fseek(input, -4, SEEK_CUR); 213 481 length = readUint32LE(input); 214 482 length += 8; 215 483 fseek(input, -8, SEEK_CUR); 216 484 217 /* Copy the WAV data to a temporary file */ 218 f = fopen(outName, "wb"); 219 while (length > 0) { 220 size = fread(fbuf, 1, length > sizeof(fbuf) ? sizeof(fbuf) : length, input); 221 if (size <= 0) 222 break; 223 length -= (int)size; 224 fwrite(fbuf, 1, size, f); 485 if (compMode == kVorbisMode || compMode == kFlacMode) { 486 char *rawData; 487 int fmtHeaderSize, rawLength, numChannels, sampleRate, bitsPerSample; 488 489 /* Standard PCM fmt header is 16 bits, but at least Simon 1 and 2 use 18 bits */ 490 fseek(input, 16, SEEK_CUR); 491 fmtHeaderSize = readUint32LE(input); 492 493 fseek(input, 2, SEEK_CUR); 494 numChannels = readUint16LE(input); 495 sampleRate = readUint32LE(input); 496 497 fseek(input, 6, SEEK_CUR); 498 bitsPerSample = readUint16LE(input); 499 500 /* The size of the raw audio is 4 bytes after SEEK_CUR 501 * plus the difference between fmtHeaderSizer and 502 * the standard size of 16 bytes. 503 */ 504 fseek(input, fmtHeaderSize - 12, SEEK_CUR); 505 rawLength = readUint32LE(input); 506 507 rawData = (char *)malloc(rawLength); 508 fread(rawData, 1, rawLength, input); 509 510 printf(" - length = %d\n", rawLength); 511 printf(" - channels = %d\n", numChannels); 512 printf(" - sample rate = %d\n", sampleRate); 513 printf(" - compression = %dbits\n", bitsPerSample); 514 515 setRawAudioType(true, numChannels == 2, bitsPerSample); 516 encodeRaw(rawData, rawLength, sampleRate, tempEncoded, compMode); 517 518 free(rawData); 519 } else { 520 FILE *f; 521 char fbuf[2048]; 522 size_t size; 523 524 /* Copy the WAV data to a temporary file */ 525 f = fopen(outName, "wb"); 526 while (length > 0) { 527 size = fread(fbuf, 1, length > sizeof(fbuf) ? sizeof(fbuf) : length, input); 528 if (size <= 0) 529 break; 530 length -= (int)size; 531 fwrite(fbuf, 1, size, f); 532 } 533 fclose(f); 534 535 /* Convert the WAV temp file to OGG/MP3 */ 536 encodeAudio(outName, false, -1, tempEncoded, compMode); 225 537 } 226 fclose(f);227 228 /* Convert the WAV temp file to OGG/MP3 */229 encodeAudio(outName, false, -1, tempEncoded, compMode);230 538 } 231 539 232 540 void extractAndEncodeVOC(const char *outName, FILE *input, CompressMode compMode) { … … 261 569 length = fgetc(input); 262 570 length |= fgetc(input) << 8; 263 571 length |= fgetc(input) << 16; 572 264 573 if (blocktype == 1) { 265 574 length -= 2; 266 575 sample_rate = fgetc(input); … … 287 596 (comp == 3 ? "2bits" : 288 597 "Multi")))), comp); 289 598 290 if (comp != 0) 599 if (comp != 0) { 291 600 error("Cannot handle compressed VOC data"); 601 } 292 602 293 603 /* Copy the raw data to a temporary file */ 294 604 while (length > 0) { 295 605 size = fread(fbuf, 1, length > sizeof(fbuf) ? sizeof(fbuf) : (uint32)length, input); 296 if (size <= 0) 606 607 if (size <= 0) { 297 608 break; 609 } 610 298 611 length -= (int)size; 299 612 fwrite(fbuf, 1, size, f); 300 613 } … … 304 617 305 618 assert(real_samplerate != -1); 306 619 307 setRawAudioType(false, false, true,8);620 setRawAudioType(false, false, 8); 308 621 309 622 /* Convert the raw temp file to OGG/MP3 */ 310 623 encodeAudio(outName, true, real_samplerate, tempEncoded, compMode); … … 318 631 encparms.abr=1; 319 632 } else if (strcmp(argv[i], "-b") == 0) { 320 633 encparms.minBitr = atoi(argv[i + 1]); 321 if ((encparms.minBitr % 8) != 0) 634 635 if ((encparms.minBitr % 8) != 0) { 322 636 encparms.minBitr -= encparms.minBitr % 8; 323 if (encparms.minBitr >160) 637 } 638 639 if (encparms.minBitr >160) { 324 640 encparms.minBitr = 160; 325 if (encparms.minBitr < 8) 326 encparms.minBitr=8; 641 } 642 643 if (encparms.minBitr < 8) { 644 encparms.minBitr = 8; 645 } 646 327 647 i++; 328 648 } else if (strcmp(argv[i], "-B") == 0) { 329 649 encparms.maxBitr = atoi(argv[i + 1]); 330 if ((encparms.maxBitr % 8) != 0) 650 651 if ((encparms.maxBitr % 8) != 0) { 331 652 encparms.maxBitr -= encparms.maxBitr % 8; 332 if (encparms.maxBitr > 160) 653 } 654 655 if (encparms.maxBitr > 160) { 333 656 encparms.maxBitr = 160; 334 if (encparms.maxBitr < 8) 657 } 658 659 if (encparms.maxBitr < 8) { 335 660 encparms.maxBitr = 8; 661 } 662 336 663 i++; 337 664 } else if (strcmp(argv[i], "-V") == 0) { 338 665 encparms.vbrqual = atoi(argv[i + 1]); 339 if(encparms.vbrqual < 0) 666 667 if(encparms.vbrqual < 0) { 340 668 encparms.vbrqual = 0; 341 if(encparms.vbrqual > 9) 669 } 670 671 if(encparms.vbrqual > 9) { 342 672 encparms.vbrqual = 9; 673 } 674 343 675 i++; 344 676 } else if (strcmp(argv[i], "-q") == 0) { 345 677 encparms.algqual = atoi(argv[i + 1]); 346 if (encparms.algqual < 0) 678 679 if (encparms.algqual < 0) { 347 680 encparms.algqual = 0; 348 if (encparms.algqual > 9) 681 } 682 683 if (encparms.algqual > 9) { 349 684 encparms.algqual = 9; 685 } 686 350 687 i++; 351 688 } else if (strcmp(argv[i], "--silent") == 0) { 352 689 encparms.silent = 1; … … 358 695 break; 359 696 } 360 697 } 698 361 699 if (i != (argc - 1)) { 362 700 return 0; 363 701 } 702 364 703 return 1; 365 704 } 366 705 … … 368 707 for (; i < argc; i++) { 369 708 if (strcmp(argv[i], "-b") == 0) { 370 709 oggparms.nominalBitr = atoi(argv[i + 1]); 710 711 if ((oggparms.nominalBitr % 8) != 0) { 712 oggparms.nominalBitr -= oggparms.nominalBitr % 8; 713 } 714 715 if (oggparms.nominalBitr >160) { 716 oggparms.nominalBitr = 160; 717 } 718 719 if (oggparms.nominalBitr < 8) { 720 oggparms.nominalBitr = 8; 721 } 722 371 723 i++; 372 } 373 else if (strcmp(argv[i], "-m") == 0) { 724 } else if (strcmp(argv[i], "-m") == 0) { 374 725 oggparms.minBitr = atoi(argv[i + 1]); 726 727 if ((oggparms.minBitr % 8) != 0) { 728 oggparms.minBitr -= oggparms.minBitr % 8; 729 } 730 731 if (oggparms.minBitr >160) { 732 oggparms.minBitr = 160; 733 } 734 735 if (oggparms.minBitr < 8) { 736 oggparms.minBitr = 8; 737 } 738 375 739 i++; 376 740 } 377 741 else if (strcmp(argv[i], "-M") == 0) { 378 742 oggparms.maxBitr = atoi(argv[i + 1]); 743 744 if ((oggparms.maxBitr % 8) != 0) { 745 oggparms.maxBitr -= encparms.minBitr % 8; 746 } 747 748 if (oggparms.maxBitr >160) { 749 oggparms.maxBitr = 160; 750 } 751 752 if (oggparms.maxBitr < 8) { 753 oggparms.maxBitr = 8; 754 } 755 379 756 i++; 380 757 } 381 758 else if (strcmp(argv[i], "-q") == 0) { … … 391 768 else if (argv[i][0] == '-') { 392 769 return 0; 393 770 } 394 else 771 else { 395 772 break; 773 } 396 774 } 397 if (i != argc - 1) 775 776 if (i != argc - 1) { 398 777 return 0; 778 } 779 399 780 return 1; 400 781 } 401 782 402 783 int process_flac_parms(int argc, char *argv[], int i){ 403 flacparms.argv = &argv[i]; 404 flacparms.numArgs = argc - 1 - i; 784 for (; i < argc; i++) { 785 if (strcmp(argv[i], "-b") == 0) { 786 flacparms.blocksize = atoi(argv[i + 1]); 787 i++; 788 } 789 else if (strcmp(argv[i], "--fast") == 0) { 790 flacparms.compressionLevel = 0; 791 } 792 else if (strcmp(argv[i], "--best") == 0) { 793 flacparms.compressionLevel = 8; 794 } 795 else if (strcmp(argv[i], "-0") == 0) { 796 flacparms.compressionLevel = 0; 797 } 798 else if (strcmp(argv[i], "-1") == 0) { 799 flacparms.compressionLevel = 1; 800 } 801 else if (strcmp(argv[i], "-2") == 0) { 802 flacparms.compressionLevel = 2; 803 } 804 else if (strcmp(argv[i], "-3") == 0) { 805 flacparms.compressionLevel = 3; 806 } 807 else if (strcmp(argv[i], "-4") == 0) { 808 flacparms.compressionLevel = 4; 809 } 810 else if (strcmp(argv[i], "-5") == 0) { 811 flacparms.compressionLevel = 5; 812 } 813 else if (strcmp(argv[i], "-6") == 0) { 814 flacparms.compressionLevel = 6; 815 } 816 else if (strcmp(argv[i], "-7") == 0) { 817 flacparms.compressionLevel = 7; 818 } 819 else if (strcmp(argv[i], "-8") == 0) { 820 flacparms.compressionLevel = 8; 821 } 822 else if (strcmp(argv[i], "--verify") == 0) { 823 flacparms.verify = true; 824 } 825 else if (strcmp(argv[i], "--silent") == 0) { 826 flacparms.silent = true; 827 } 828 else if (strcmp(argv[i], "--help") == 0) { 829 return 0; 830 } 831 else if (argv[i][0] == '-') { 832 return 0; 833 } 834 else { 835 break; 836 } 837 } 405 838 406 if (i >= argc)839 if (i != argc - 1) { 407 840 return 0; 841 } 842 408 843 return 1; 409 844 } -
compress.h
24 24 #define EXTRACT_H 25 25 26 26 #include "util.h" 27 #include <vorbis/vorbisenc.h> 28 #include <FLAC/stream_encoder.h> 27 29 28 30 #if defined(__cplusplus) 29 31 extern "C" { … … 38 40 /* The default for oggenc invocation is to use the --quality option only */ 39 41 #define oggqualDef 3 40 42 43 /* These are the default parameters for the FLAC invocation */ 44 #define flacCompressDef 8 45 #define flacBlocksizeDef 1152 46 41 47 #define TEMP_WAV "tempfile.wav" 42 48 #define TEMP_RAW "tempfile.raw" 43 49 #define TEMP_MP3 "tempfile.mp3" … … 60 66 extern void extractAndEncodeWAV(const char *outName, FILE *input, CompressMode compMode); 61 67 62 68 extern void encodeAudio(const char *inname, bool rawInput, int rawSamplerate, const char *outname, CompressMode compmode); 63 extern void setRawAudioType(bool isLittleEndian, bool isStereo, bool isUnSigned, uint8 bitsPerSample); 69 extern void encodeRaw(char *rawData, int length, int samplerate, const char *outname, CompressMode compmode); 70 extern void setRawAudioType(bool isLittleEndian, bool isStereo, uint8 bitsPerSample); 64 71 65 72 #if defined(__cplusplus) 66 73 } -
compress_agos.c
74 74 unlink(TEMP_RAW); 75 75 unlink(tempEncoded); 76 76 unlink(TEMP_WAV); 77 77 78 78 exit(0); 79 79 } 80 80 81 81 82 82 static int get_offsets(uint32 filenums[], uint32 offsets[]) 83 83 { 84 84 int i; … … 173 173 printf(" --silent the output of oggenc is hidden (default:disabled)\n"); 174 174 175 175 printf("\nFlac mode params:\n"); 176 printf(" [params] optional arguments passed directly to the encoder\n"); 177 printf(" recommended is: --best -b 1152\n"); 176 printf(" --fast FLAC uses compresion level 0\n"); 177 printf(" --best FLAC uses compresion level 8\n"); 178 printf(" -<value> specifies the value (0 - 8) of compresion (8=best)(default:%d)\n", flacCompressDef); 179 printf(" -b <value> specifies a blocksize of <value> samples (default:%d)\n", flacBlocksizeDef); 180 printf(" --verify files are encoded and then decoded to check accuracy\n"); 181 printf(" --silent the output of FLAC is hidden (default:disabled)\n"); 178 182 179 183 printf("\n --help this help message\n"); 180 184 … … 253 257 char tmp[256]; 254 258 uint32 filenums[32768]; 255 259 uint32 offsets[32768]; 256 260 257 261 sprintf(infile_base, "simon2"); 258 262 259 263 input = fopen("voices.idx", "rb"); … … 295 299 sprintf(tmp, "voices%d.dat", filenums[i]); 296 300 if (input) 297 301 fclose(input); 298 input = fopen(tmp, "rb"); 302 input = fopen(tmp, "rb"); 299 303 if (!input) { 300 304 printf("Cannot open file: %s\n", tmp); 301 305 exit(-1); … … 311 315 int main(int argc, char *argv[]) 312 316 { 313 317 int i; 314 318 315 319 if (argc < 2) 316 320 showhelp(argv[0]); 317 321 -
compress_kyra.cpp
39 39 if (argc < 3) 40 40 showhelp(argv[0]); 41 41 42 char inputFile[256]; 43 char outputFile[256]; 42 44 int i = 0; 45 43 46 /* Compression mode */ 44 47 gCompMode = kMP3Mode; 45 48 i = 1; 49 46 50 if (strcmp(argv[1], "--mp3") == 0) { 47 51 gCompMode = kMP3Mode; 48 52 i++; … … 60 64 case kMP3Mode: 61 65 outputExt = OUTPUT_MP3; 62 66 tempEncoded = TEMP_MP3; 63 if (!process_mp3_parms(argc - 1, argv, i))67 if (!process_mp3_parms(argc - 2, argv, i)) 64 68 showhelp(argv[0]); 65 69 break; 66 70 case kVorbisMode: 67 71 outputExt = OUTPUT_OGG; 68 72 tempEncoded = TEMP_OGG; 69 if (!process_ogg_parms(argc - 1, argv, i))73 if (!process_ogg_parms(argc - 2, argv, i)) 70 74 showhelp(argv[0]); 71 75 break; 72 76 case kFlacMode: 73 77 outputExt = OUTPUT_FLAC; 74 78 tempEncoded = TEMP_FLAC; 75 if (!process_flac_parms(argc - 1, argv, i))79 if (!process_flac_parms(argc - 2, argv, i)) 76 80 showhelp(argv[0]); 77 81 break; 78 82 } 79 80 if (scumm_stricmp(argv[argc - 2], argv[argc - 1]) == 0) 83 84 sprintf(inputFile, "%s/%s", argv[argc - 2], argv[argc - 3]); 85 sprintf(outputFile, "%s/%s", argv[argc - 1], argv[argc - 3]); 86 87 if (scumm_stricmp(inputFile, outputFile) == 0) 81 88 error("infile and outfile are the same file"); 82 process( argv[argc - 2], argv[argc - 1]);89 process(inputFile, outputFile); 83 90 return 0; 84 91 } 85 92 86 93 static void showhelp(const char *exename) { 87 printf("\nUsage: %s <params> infile outfile\n", exename);94 printf("\nUsage: %s [params] <inputfile> <inputdir> <outputdir>\n", exename); 88 95 89 96 printf("\nParams:\n"); 90 97 printf(" --mp3 encode to MP3 format (default)\n"); … … 109 116 printf(" --silent the output of oggenc is hidden (default:disabled)\n"); 110 117 111 118 printf("\nFlac mode params:\n"); 112 printf(" [params] optional arguments passed directly to the encoder\n"); 113 printf(" recommended is: --best -b 1152\n"); 119 printf(" --fast FLAC uses compresion level 0\n"); 120 printf(" --best FLAC uses compresion level 8\n"); 121 printf(" -<value> specifies the value (0 - 8) of compresion (8=best)(default:%d)\n", flacCompressDef); 122 printf(" -b <value> specifies a blocksize of <value> samples (default:%d)\n", flacBlocksizeDef); 123 printf(" --verify files are encoded and then decoded to check accuracy\n"); 124 printf(" --silent the output of FLAC is hidden (default:disabled)\n"); 114 125 115 126 printf("\n --help this help message\n"); 116 127 … … 136 147 return; 137 148 if (!output.loadFile(0, false)) 138 149 return; 139 150 140 151 PAKFile::cFileList *list = input.getFileList(); 141 152 char outputName[32]; 142 153 for (; list; list = list->next) { … … 150 161 151 162 input.outputFileAs(list->filename, TEMPFILE); 152 163 strncpy(outputName, list->filename, 32); 153 164 154 165 FILE *tempFile = fopen(TEMPFILE, "rb"); 155 166 fseek(tempFile, 26, SEEK_CUR); 156 167 extractAndEncodeVOC(TEMP_RAW, tempFile, gCompMode); 157 168 fclose(tempFile); 158 169 159 170 char *vocStart = strstr(outputName, ".VOC"); 160 171 for (unsigned int i = 0; i < strlen(outputExt); ++i) 161 172 vocStart[i] = outputExt[i]; 162 173 output.addFile(outputName, tempEncoded); 163 174 164 175 unlink(TEMPFILE); 165 176 unlink(TEMP_RAW); 166 177 unlink(tempEncoded); 167 178 } 168 179 169 180 if (output.getFileList()) { 170 181 output.saveFile(outfile); 171 182 } else { -
compress_queen.c
20 20 * 21 21 */ 22 22 23 #include " util.h"23 #include "compress.h" 24 24 25 25 static const uint32 QTBL = 'QTBL'; 26 static CompressMode gCompMode = kMP3Mode; 26 27 27 28 #define INPUT_TBL "queen.tbl" 28 29 #define FINAL_OUT "queen.1c" … … 31 32 #define TEMP_TBL "tempfile.tbl" 32 33 #define TEMP_SB "tempfile.sb" 33 34 34 #define TEMP_MP3 "tempfile.mp3"35 #define TEMP_OGG "tempfile.ogg"36 #define TEMP_FLAC "tempfile.fla"37 38 const char *tempEncoded;39 40 35 #define CURRENT_TBL_VERSION 2 41 36 #define EXTRA_TBL_HEADER 8 42 37 #define SB_HEADER_SIZE_V104 110 … … 126 121 127 122 void showhelp(char *exename) 128 123 { 129 printf("\nUsage: %s [--mp3/--vorbis/--flac <args>] queen.1\n", exename); 124 printf("\nUsage: %s <params> queen.1\n", exename); 125 130 126 printf("\nParams:\n"); 131 printf(" --mp3 <args> encode to MP3 format\n"); 132 printf(" --vorbis <args> encode to Ogg Vorbis Format\n"); 133 printf(" --flac <args> encode to Flac Format\n"); 134 printf(" (Optional: <args> are passed on to the encoder)\n"); 135 printf("\nExample: %s --mp3 -q 5 queen.1\n", exename); 127 128 printf(" --mp3 encode to MP3 format (default)\n"); 129 printf(" --vorbis encode to Ogg Vorbis format\n"); 130 printf(" --flac encode to Flac format\n"); 131 printf("(If one of these is specified, it must be the first parameter.)\n"); 132 133 printf("\nMP3 mode params:\n"); 134 printf(" -b <rate> <rate> is the target bitrate(ABR)/minimal bitrate(VBR) (default:%d)\n", minBitrDef); 135 printf(" -B <rate> <rate> is the maximum VBR/ABR bitrate (default:%d)\n", maxBitrDef); 136 printf(" --vbr LAME uses the VBR mode (default)\n"); 137 printf(" --abr LAME uses the ABR mode\n"); 138 printf(" -V <value> specifies the value (0 - 9) of VBR quality (0=best) (default:%d)\n", vbrqualDef); 139 printf(" -q <value> specifies the MPEG algorithm quality (0-9; 0=best) (default:%d)\n", algqualDef); 140 printf(" --silent the output of LAME is hidden (default:disabled)\n"); 141 142 printf("\nVorbis mode params:\n"); 143 printf(" -b <rate> <rate> is the nominal bitrate (default:unset)\n"); 144 printf(" -m <rate> <rate> is the minimum bitrate (default:unset)\n"); 145 printf(" -M <rate> <rate> is the maximum bitrate (default:unset)\n"); 146 printf(" -q <value> specifies the value (0 - 10) of VBR quality (10=best) (default:%d)\n", oggqualDef); 147 printf(" --silent the output of oggenc is hidden (default:disabled)\n"); 148 149 printf("\nFlac mode params:\n"); 150 printf(" --fast FLAC uses compresion level 0\n"); 151 printf(" --best FLAC uses compresion level 8\n"); 152 printf(" -<value> specifies the value (0 - 8) of compresion (8=best)(default:%d)\n", flacCompressDef); 153 printf(" -b <value> specifies a blocksize of <value> samples (default:%d)\n", flacBlocksizeDef); 154 printf(" --verify files are encoded and then decoded to check accuracy\n"); 155 printf(" --silent the output of FLAC is hidden (default:disabled)\n"); 156 157 printf("\n --help this help message\n"); 158 159 printf("\n\nIf a parameter is not given the default value is used\n"); 160 printf("If using VBR mode for MP3 -b and -B must be multiples of 8; the maximum is 160!\n"); 136 161 exit(2); 137 162 } 138 163 … … 219 244 FILE *inputData, *inputTbl, *outputTbl, *outputData, *tmpFile, *compFile; 220 245 uint8 compressionType = COMPRESSION_NONE; 221 246 char tmp[5]; 222 char sysBuf[1024];223 char *ptr = sysBuf;224 247 int size, i = 1; 225 248 uint32 prevOffset; 226 249 … … 228 251 if (argc < 2) 229 252 showhelp(argv[0]); 230 253 254 /* compression mode */ 255 compressionType = COMPRESSION_MP3; 256 gCompMode = kMP3Mode; 257 231 258 if (strcmp(argv[1], "--mp3") == 0) { 232 259 compressionType = COMPRESSION_MP3; 233 tempEncoded = TEMP_MP3;260 gCompMode = kMP3Mode; 234 261 i++; 235 ptr += sprintf(ptr, "lame -r -h -s 11 --bitwidth 8 -m m ");236 for (; i < (argc - 1); i++) {237 /* Append optional encoder arguments */238 ptr += sprintf(ptr, "%s ", argv[i]);239 }240 ptr += sprintf(ptr, "%s %s", TEMP_SB, tempEncoded);241 262 } else if (strcmp(argv[1], "--vorbis") == 0) { 242 263 compressionType = COMPRESSION_OGG; 243 tempEncoded = TEMP_OGG;264 gCompMode = kVorbisMode; 244 265 i++; 245 ptr += sprintf(ptr, "oggenc -r -B 8 -C 1 -R 11025 %s -o %s ", TEMP_SB, tempEncoded);246 for (; i < (argc - 1); i++) {247 /* Append optional encoder arguments */248 ptr += sprintf(ptr, "%s ", argv[i]);249 }250 266 } else if (strcmp(argv[1], "--flac") == 0) { 251 267 compressionType = COMPRESSION_FLAC; 252 tempEncoded = TEMP_FLAC;268 gCompMode = kFlacMode; 253 269 i++; 254 ptr += sprintf(ptr, "flac --force-raw-format --endian=little --sign=unsigned --bps=8 --channels=1 --sample-rate=11025 " ); 255 ptr += sprintf(ptr, "--no-padding --lax --no-seektable --no-ogg " ); 256 for (; i < (argc - 1); i++) { 257 /* Append optional encoder arguments */ 258 ptr += sprintf(ptr, "%s ", argv[i]); 259 } 270 } 260 271 261 ptr += sprintf(ptr, "-o %s %s", tempEncoded, TEMP_SB ); 262 } else { 263 showhelp(argv[0]); 272 switch (gCompMode) { 273 case kMP3Mode: 274 tempEncoded = TEMP_MP3; 275 if (!process_mp3_parms(argc, argv, i)) 276 showhelp(argv[0]); 277 break; 278 case kVorbisMode: 279 tempEncoded = TEMP_OGG; 280 if (!process_ogg_parms(argc, argv, i)) 281 showhelp(argv[0]); 282 break; 283 case kFlacMode: 284 tempEncoded = TEMP_FLAC; 285 if (!process_flac_parms(argc, argv, i)) 286 showhelp(argv[0]); 287 break; 264 288 } 265 289 266 290 /* Open input file (QUEEN.1) */ … … 342 366 fclose(tmpFile); 343 367 344 368 /* Invoke encoder */ 345 if (system(sysBuf)) { 346 printf("Got error from encoder. (check your parameters)\n"); 347 unlink(TEMP_SB); 348 exit(-1); 349 } 369 setRawAudioType(false, false, 8); 370 encodeAudio(TEMP_SB, true, 11025, tempEncoded, gCompMode); 350 371 351 372 /* Append MP3/OGG to data file */ 352 373 compFile = fopen(tempEncoded, "rb"); -
compress_saga.cpp
19 19 * 20 20 * $URL$ 21 21 * $Id$ 22 * 22 * 23 23 */ 24 24 25 25 #include "compress.h" … … 150 150 151 151 GameDescription *currentGameDescription = NULL; 152 152 GameFileDescription *currentFileDescription = NULL; 153 bool isSigned = true;154 153 155 154 uint16 sampleRate; 156 155 uint32 sampleSize; … … 194 193 uint32 size; 195 194 char fbuf[2048]; 196 195 FILE * tempf; 197 196 198 197 tempf = fopen(fromFileName, "rb"); 199 198 if (tempf == NULL) 200 199 error("Unable to open %s", fromFileName); … … 211 210 uint32 size; 212 211 char fbuf[2048]; 213 212 FILE * tempf; 214 213 215 214 tempf = fopen(toFileName, "wb"); 216 215 if (tempf == NULL) 217 216 error("Unable to open %s", toFileName); … … 228 227 229 228 void writeBufferToFile(uint8* data, uint32 inputSize, const char* toFileName) { 230 229 FILE * tempf; 231 230 232 231 tempf = fopen(toFileName, "wb"); 233 232 if (tempf == NULL) 234 233 error("Unable to open %s", toFileName); … … 248 247 Common::File inputFileStream(inputFile); 249 248 int rate, size; 250 249 byte flags; 251 250 252 251 if (currentFileDescription->resourceType == kSoundVOC) { 253 252 inputData = Audio::loadVOCFromStream(inputFileStream, size, rate); 254 253 sampleSize = size; … … 259 258 free(inputData); 260 259 writeHeader(outputFile); 261 260 262 setRawAudioType( true, false, !isSigned,8);261 setRawAudioType( true, false, 8); 263 262 encodeAudio(TEMP_RAW, true, sampleRate, tempEncoded, gCompMode); 264 263 return copyFile(tempEncoded, outputFile) + HEADER_SIZE; 265 264 } … … 271 270 sampleStereo = currentFileDescription->stereo; 272 271 writeHeader(outputFile); 273 272 274 setRawAudioType( !currentFileDescription->swapEndian, currentFileDescription->stereo, !isSigned,sampleBits);273 setRawAudioType( !currentFileDescription->swapEndian, currentFileDescription->stereo, sampleBits); 275 274 encodeAudio(TEMP_RAW, true, currentFileDescription->frequency, tempEncoded, gCompMode); 276 275 return copyFile(tempEncoded, outputFile) + HEADER_SIZE; 277 276 } … … 287 286 288 287 copyFile(inputFile, size, TEMP_RAW); 289 288 290 setRawAudioType( true, sampleStereo != 0, !isSigned,sampleBits);289 setRawAudioType( true, sampleStereo != 0, sampleBits); 291 290 encodeAudio(TEMP_RAW, true, sampleRate, tempEncoded, gCompMode); 292 291 return copyFile(tempEncoded, outputFile) + HEADER_SIZE; 293 292 } … … 302 301 sampleStereo = currentFileDescription->stereo; 303 302 writeHeader(outputFile); 304 303 305 setRawAudioType( !currentFileDescription->swapEndian, currentFileDescription->stereo, !isSigned,sampleBits);304 setRawAudioType( !currentFileDescription->swapEndian, currentFileDescription->stereo, sampleBits); 306 305 encodeAudio(TEMP_RAW, true, currentFileDescription->frequency, tempEncoded, gCompMode); 307 306 return copyFile(tempEncoded, outputFile) + HEADER_SIZE; 308 307 */ … … 348 347 error("Something's wrong with your resource file"); 349 348 } 350 349 351 // Go to beginning of the table 350 // Go to beginning of the table 352 351 fseek(inputFile, resTableOffset, SEEK_SET); 353 352 354 353 inputTable = (Record*)malloc(resTableCount * sizeof(Record)); 355 354 356 // Put offsets of all the records in a table 355 // Put offsets of all the records in a table 357 356 for (i = 0; i < resTableCount; i++) { 358 357 359 358 if (!currentFileDescription->swapEndian) { … … 365 364 } 366 365 367 366 printf("Record: %ul, offset: %ul, size: %ul\n", i, inputTable[i].offset, inputTable[i].size); 368 367 369 368 if ((inputTable[i].offset > inputFileSize) || 370 369 (inputTable[i].offset + inputTable[i].size > inputFileSize)) { 371 370 error("The offset points outside the file"); … … 374 373 } 375 374 outputTable = (Record*)malloc(resTableCount * sizeof(Record)); 376 375 377 sprintf(outputFileNameWithExt, "%s.cmp", inputFileName); 376 sprintf(outputFileNameWithExt, "%s.cmp", inputFileName); 378 377 outputFile = fopen(outputFileNameWithExt, "wb"); 379 378 380 379 for (i = 0; i < resTableCount; i++) { 381 380 fseek(inputFile, inputTable[i].offset, SEEK_SET); 382 381 outputTable[i].offset = ftell(outputFile); 383 382 384 383 outputTable[i].size = encodeEntry(inputFile, inputTable[i].size, outputFile); 385 384 } 386 385 fclose(inputFile); … … 391 390 writeUint32LE(outputFile, outputTable[i].size); 392 391 } 393 392 writeUint32LE(outputFile, resTableOffset); 394 writeUint32LE(outputFile, resTableCount); // Should be the same number of entries 393 writeUint32LE(outputFile, resTableCount); // Should be the same number of entries 395 394 396 395 fclose(outputFile); 397 396 398 397 free(inputTable); 399 398 free(outputTable); 400 399 401 400 // Cleanup 402 401 unlink(TEMP_RAW); 403 402 unlink(tempEncoded); … … 406 405 } 407 406 408 407 void showhelp(char *exename) { 409 printf("\nUsage: %s <params> [<file> | mac]\n", exename);408 printf("\nUsage: %s <params> <file>\n", exename); 410 409 411 410 printf("\nParams:\n"); 412 411 … … 432 431 printf("--silent the output of oggenc is hidden (default:disabled)\n"); 433 432 434 433 printf("\nFlac mode params:\n"); 435 printf("[params] optional Arguments passed to the Encoder\n"); 436 printf(" recommended is: --best -b 1152\n"); 434 printf(" --fast FLAC uses compresion level 0\n"); 435 printf(" --best FLAC uses compresion level 8\n"); 436 printf(" -<value> specifies the value (0 - 8) of compresion (8=best)(default:%d)\n", flacCompressDef); 437 printf(" -b <value> specifies a blocksize of <value> samples (default:%d)\n", flacBlocksizeDef); 438 printf(" --verify files are encoded and then decoded to check accuracy\n"); 439 printf(" --silent the output of FLAC is hidden (default:disabled)\n"); 437 440 438 441 printf("\n--help this help message\n"); 439 442 … … 501 504 // Check for MacBinary 502 505 sprintf(inputFileNameWithExt, "%s.bin", inputFileName); 503 506 if (detectFile(inputFileNameWithExt)) { 504 isSigned = false;505 507 sagaEncode(inputFileName); 506 508 } 507 509 } -
compress_scumm_bun.cpp
614 614 } 615 615 616 616 void showhelp(char *exename) { 617 printf("\nUsage: %s <inputfile> <inputdir> <outputdir> [--ogg] [encoder params]\n", exename);617 printf("\nUsage: %s [--vorbis] [encoder params] <inputfile> <inputdir> <outputdir>\n", exename); 618 618 printf("\nMP3 mode params:\n"); 619 619 printf(" -b <rate> <rate> is the target bitrate(ABR)/minimal bitrate(VBR) (default:%d)\n", minBitrDef); 620 620 printf(" -B <rate> <rate> is the maximum VBR/ABR bitrate (default:%d)\n", maxBitrDef); … … 1064 1064 uint32 tag; 1065 1065 int32 numFiles, offset, i; 1066 1066 1067 strcpy(inputFilename, argv[ 1]);1068 strcpy(inputDir, argv[ 2]);1069 strcpy(outputDir, argv[ 3]);1067 strcpy(inputFilename, argv[argc - 3]); 1068 strcpy(inputDir, argv[argc - 2]); 1069 strcpy(outputDir, argv[argc - 1]); 1070 1070 1071 1071 if (argc > 4) { 1072 i = 4; 1072 int result; 1073 i = 1; 1073 1074 1074 if (strcmp(argv[i], "-- ogg") == 0) {1075 if (strcmp(argv[i], "--vorbis") == 0) { 1075 1076 _oggMode = true; 1076 1077 i++; 1077 1078 } 1078 1079 1079 if (argc > i) { 1080 // HACK: The functions in compress.c expect the last 1081 // argument to be a filename. As we don't expect one, 1082 // we simply add a dummy argument to the list. 1083 char **args = (char **)malloc((argc + 1) * sizeof(char *)); 1084 char dummyName[] = "dummy"; 1085 int j; 1080 if (_oggMode) 1081 result = process_ogg_parms(argc - 2, argv, i); 1082 else 1083 result = process_mp3_parms(argc - 2, argv, i); 1086 1084 1087 for (j = 0; j < argc; j++) 1088 args[j] = argv[j]; 1089 args[j] = dummyName; 1090 1091 int result; 1092 1093 if (_oggMode) 1094 result = process_ogg_parms(argc + 1, args, i); 1095 else 1096 result = process_mp3_parms(argc + 1, args, i); 1097 1098 if (!result) 1099 showhelp(argv[0]); 1100 1101 free(args); 1102 } 1085 if (!result) 1086 showhelp(argv[0]); 1103 1087 } 1104 1088 1105 1089 char *index = strrchr(inputFilename, '.'); … … 1141 1125 char filename[13], c; 1142 1126 int z = 0; 1143 1127 int z2; 1144 1128 1145 1129 for (z2 = 0; z2 < 8; z2++) 1146 1130 if ((c = readByte(input)) != 0) 1147 1131 filename[z++] = c; … … 1181 1165 fclose(input); 1182 1166 1183 1167 printf("compression done.\n"); 1184 1168 1185 1169 return 0; 1186 1170 } -
compress_scumm_san.cpp
24 24 #include "zlib.h" 25 25 26 26 void showhelp(char *exename) { 27 printf("\nUsage: %s <inputfile> <inputdir> <outputdir> [--ogg] [encoder params]\n", exename);27 printf("\nUsage: %s [--vorbis] [encoder params] <inputfile> <inputdir> <outputdir>\n", exename); 28 28 printf("\nMP3 mode params:\n"); 29 29 printf(" -b <rate> <rate> is the target bitrate(ABR)/minimal bitrate(VBR) (default:%d)\n", minBitrDef); 30 30 printf(" -B <rate> <rate> is the maximum VBR/ABR bitrate (default:%d)\n", maxBitrDef); … … 643 643 char inputFilename[200]; 644 644 char tmpPath[200]; 645 645 646 strcpy(inputFilename, argv[ 1]);647 strcpy(inputDir, argv[ 2]);648 strcpy(outputDir, argv[ 3]);646 strcpy(inputFilename, argv[argc - 3]); 647 strcpy(inputDir, argv[argc - 2]); 648 strcpy(outputDir, argv[argc - 1]); 649 649 650 650 if (argc > 4) { 651 int i = 4;651 int i = 1; 652 652 653 if (strcmp(argv[ i], "--ogg") == 0) {653 if (strcmp(argv[1], "--vorbis") == 0) { 654 654 _oggMode = true; 655 655 i++; 656 656 } 657 657 658 if (argc > i) { 659 // HACK: The functions in compress.c expect the last 660 // argument to be a filename. As we don't expect one, 661 // we simply add a dummy argument to the list. 662 char **args = (char **)malloc((argc + 1) * sizeof(char *)); 663 char dummyName[] = "dummy"; 664 int j; 658 int result; 665 659 666 for (j = 0; j < argc; j++) 667 args[j] = argv[j]; 668 args[j] = dummyName; 669 670 int result; 660 if (_oggMode) 661 result = process_ogg_parms(argc - 2, argv, i); 662 else 663 result = process_mp3_parms(argc - 2, argv, i); 671 664 672 if (_oggMode) 673 result = process_ogg_parms(argc + 1, args, i); 674 else 675 result = process_mp3_parms(argc + 1, args, i); 676 677 if (!result) 678 showhelp(argv[0]); 679 680 free(args); 681 } 665 if (!result) 666 showhelp(argv[0]); 682 667 } 683 668 684 669 char *index = strrchr(inputFilename, '.'); -
compress_scumm_sou.c
72 72 unlink(TEMP_DAT); 73 73 unlink(TEMP_RAW); 74 74 unlink(tempEncoded); 75 75 76 76 exit(-1); 77 77 } 78 78 … … 130 130 131 131 /* Conver the VOC data */ 132 132 extractAndEncodeVOC(TEMP_RAW, input, gCompMode); 133 133 134 134 /* Append the converted data to the master output file */ 135 135 sprintf(outname, tempEncoded); 136 136 f = fopen(outname, "rb"); … … 171 171 printf(" --silent the output of oggenc is hidden (default:disabled)\n"); 172 172 173 173 printf("\nFlac mode params:\n"); 174 printf(" [params] optional arguments passed directly to the encoder\n"); 175 printf(" recommended is: --best -b 1152\n"); 174 printf(" --fast FLAC uses compresion level 0\n"); 175 printf(" --best FLAC uses compresion level 8\n"); 176 printf(" -<value> specifies the value (0 - 8) of compresion (8=best)(default:%d)\n", flacCompressDef); 177 printf(" -b <value> specifies a blocksize of <value> samples (default:%d)\n", flacBlocksizeDef); 178 printf(" --verify files are encoded and then decoded to check accuracy\n"); 179 printf(" --silent the output of FLAC is hidden (default:disabled)\n"); 176 180 177 181 printf("\n --help this help message\n"); 178 182 … … 242 246 printf("Can't open file " TEMP_DAT " for write!\n"); 243 247 exit(-1); 244 248 } 245 249 246 250 /* Get the 'SOU ....' header */ 247 251 fread(buf, 1, 8, input); 248 252 if (strncmp(buf, f_hdr, 8)) { -
compress_sword1.c
116 116 { "2M26", false }, 117 117 { "3M7", false }, 118 118 { "3M8", false }, 119 { "3M9", true }, 119 { "3M9", true }, 120 120 { "3M10", false }, 121 121 { "2M13", false }, 122 122 { "3M12", false }, … … 163 163 { "4M31", false }, 164 164 { "4M32", false }, 165 165 { "5M1", false }, 166 { "5M2", true }, 166 { "5M2", true }, 167 167 { "5M3", false }, 168 168 { "5M4", false }, 169 169 { "5M5", false }, … … 275 275 { "11M4", false }, 276 276 { "11M7", false }, 277 277 { "11M8", false }, 278 { "11M9", true }, 278 { "11M9", true }, 279 279 { "12M1", false }, 280 280 { "11M2", false }, 281 281 { "SPM2", false }, … … 337 337 printf(" (default:%d)\n", oggqualDef); 338 338 printf(" --silent the output of oggenc is hidden (default:disabled)\n"); 339 339 340 printf("\nFlac mode params:\n"); 341 printf(" --fast FLAC uses compresion level 0\n"); 342 printf(" --best FLAC uses compresion level 8\n"); 343 printf(" -<value> specifies the value (0 - 8) of compresion (8=best)(default:%d)\n", flacCompressDef); 344 printf(" -b <value> specifies a blocksize of <value> samples (default:%d)\n", flacBlocksizeDef); 345 printf(" --verify files are encoded and then decoded to check accuracy\n"); 346 printf(" --silent the output of FLAC is hidden (default:disabled)\n"); 347 340 348 printf("\n --help this help message\n"); 341 349 342 350 printf("\nIf a parameter is not given the default value is used\n"); … … 438 446 } 439 447 cl3Index = (uint32*)malloc(numSamples * 8); 440 448 memset(cl3Index, 0, numSamples * 8); 441 449 442 450 sampleIndex = cowHeader + numRooms + 1; 443 451 /* This points to the sample index table. 8 bytes each (4 bytes size and then 4 bytes file index) */ 444 452 … … 446 454 447 455 for (cnt = 0; cnt < numSamples; cnt++) { 448 456 if (sampleIndex[cnt << 1] | sampleIndex[(cnt << 1) | 1]) { 449 printf("sample %5d: ", cnt);457 printf("sample %5d: \n", cnt); 450 458 smpData = (uint8*)uncompressSpeech(clu, sampleIndex[cnt << 1] + headerSize, sampleIndex[(cnt << 1) | 1], &smpSize); 451 459 if ((!smpData) || (!smpSize)) 452 460 error("unable to handle speech sample %d!\n", cnt); … … 475 483 int i; 476 484 char cluName[256], outName[256]; 477 485 478 setRawAudioType(true, false, false,16);486 setRawAudioType(true, false, 16); 479 487 for (i = 1; i <= 2; i++) { 480 488 sprintf(cluName, "SPEECH/SPEECH%d.CLU", i); 481 489 clu = fopen(cluName, "rb"); … … 670 678 compressSpeech(compMode); 671 679 if (compMusic) 672 680 compressMusic(compMode); 673 681 674 682 return EXIT_SUCCESS; 675 683 } 676 684 -
compress_sword2.c
31 31 32 32 void showhelp(char *exename) 33 33 { 34 printf("\nUsage: %s <params> file.clu\n", exename);34 printf("\nUsage: %s <params> <file>\n", exename); 35 35 36 36 printf("\nParams:\n"); 37 37 printf(" --mp3 encode to MP3 format (default)\n"); … … 56 56 printf(" --silent the output of oggenc is hidden (default:disabled)\n"); 57 57 58 58 printf("\nFlac mode params:\n"); 59 printf(" [params] optional arguments passed directly to the encoder\n"); 60 printf(" recommended is: --best -b 1152\n"); 59 printf(" --fast FLAC uses compresion level 0\n"); 60 printf(" --best FLAC uses compresion level 8\n"); 61 printf(" -<value> specifies the value (0 - 8) of compresion (8=best)(default:%d)\n", flacCompressDef); 62 printf(" -b <value> specifies a blocksize of <value> samples (default:%d)\n", flacBlocksizeDef); 63 printf(" --verify files are encoded and then decoded to check accuracy\n"); 64 printf(" --silent the output of FLAC is hidden (default:disabled)\n"); 61 65 62 66 printf("\n --help this help message\n"); 63 67 … … 104 108 uint32 indexSize; 105 109 uint32 totalSize; 106 110 uint32 length; 107 111 108 112 if (argc < 2) 109 113 showhelp(argv[0]); 110 114 i = 1; -
compress_touche.c
161 161 printf("\nUsage: %s <params> input_directory\n", exename); 162 162 163 163 printf("\nParams:\n"); 164 164 165 printf(" --mp3 encode to MP3 format (default)\n"); 165 166 printf(" --vorbis encode to Vorbis format\n"); 166 167 printf(" --flac encode to Flac format\n"); … … 183 184 printf(" --silent the output of oggenc is hidden (default:disabled)\n"); 184 185 185 186 printf("\nFlac mode params:\n"); 186 printf(" [params] optional arguments passed directly to the encoder\n"); 187 printf(" recommended is: --best -b 1152\n"); 187 printf(" --fast FLAC uses compresion level 0\n"); 188 printf(" --best FLAC uses compresion level 8\n"); 189 printf(" -<value> specifies the value (0 - 8) of compresion (8=best)(default:%d)\n", flacCompressDef); 190 printf(" -b <value> specifies a blocksize of <value> samples (default:%d)\n", flacBlocksizeDef); 191 printf(" --verify files are encoded and then decoded to check accuracy\n"); 192 printf(" --silent the output of FLAC is hidden (default:disabled)\n"); 188 193 189 194 printf("\n --help this help message\n"); 190 195 -
encode_dxa.cpp
699 699 } 700 700 701 701 void showhelp(char *exename) { 702 printf("\nUsage: %s < inputfile>\n", exename);702 printf("\nUsage: %s <params> <file>\n", exename); 703 703 704 704 printf("\nParams:\n"); 705 705 printf(" --mp3 encode to MP3 format (default)\n"); … … 724 724 printf(" --silent the output of oggenc is hidden (default:disabled)\n"); 725 725 726 726 printf("\nFlac mode params:\n"); 727 printf(" [params] optional arguments passed directly to the encoder\n"); 728 printf(" recommended is: --best -b 1152\n"); 727 printf(" --fast FLAC uses compresion level 0\n"); 728 printf(" --best FLAC uses compresion level 8\n"); 729 printf(" -<value> specifies the value (0 - 8) of compresion (8=best)(default:%d)\n", flacCompressDef); 730 printf(" -b <value> specifies a blocksize of <value> samples (default:%d)\n", flacBlocksizeDef); 731 printf(" --verify files are encoded and then decoded to check accuracy\n"); 732 printf(" --silent the output of FLAC is hidden (default:disabled)\n"); 729 733 730 734 printf("\n --help this help message\n"); 731 735 732 736 printf("\n\nIf a parameter is not given the default value is used\n"); 733 737 printf("If using VBR mode for MP3 -b and -B must be multiples of 8; the maximum is 160!\n"); 734 printf("Use the `mac' option instead of a filename if converting simon2mac sounds\n");735 738 exit(2); 736 739 } 737 740 -
kyra_pak.h
24 24 #define KYRA_PAK_H 25 25 26 26 #include "util.h" 27 #include <string.h>28 27 29 28 class PAKFile { 30 29 public: … … 34 33 bool loadFile(const char *file, const bool isAmiga); 35 34 bool saveFile(const char *file); 36 35 void clearFile() { delete _fileList; _fileList = 0; } 37 36 38 37 const uint32 getFileSize() const { return _fileList->getTableSize()+5+4+_fileList->getFileSize(); } 39 38 40 39 void drawFileList(); … … 47 46 48 47 bool addFile(const char *name, const char *file); 49 48 bool addFile(const char *name, uint8 *data, uint32 size); 50 49 51 50 bool removeFile(const char *name); 52 51 public: 53 52 struct FileList { … … 57 56 delete [] data; 58 57 delete next; 59 58 } 60 59 61 60 FileList *findEntry(const char *f) { 62 61 for (FileList *cur = this; cur; cur = cur->next) { 63 62 if (scumm_stricmp(cur->filename, f) != 0) … … 66 65 } 67 66 return 0; 68 67 } 69 68 70 69 const FileList *findEntry(const char *f) const { 71 70 for (const FileList *cur = this; cur; cur = cur->next) { 72 71 if (scumm_stricmp(cur->filename, f) != 0) … … 92 91 char *filename; 93 92 uint32 size; 94 93 uint8 *data; 95 94 96 95 FileList *next; 97 96 }; 98 97 99 98 typedef const FileList cFileList; 100 99 101 100 cFileList *getFileList() const { return _fileList; } 102 101 private: 103 102 FileList *_fileList; -
Makefile
51 51 all: $(TARGETS) 52 52 53 53 compress_agos$(EXEEXT): compress_agos.o compress.o util.o 54 $(CC) $(LDFLAGS) -o $@ $+ 54 $(CC) $(LDFLAGS) -o $@ $+ -lvorbis -logg -lvorbisenc -lFLAC 55 55 56 56 compress_kyra$(EXEEXT): compress_kyra.o kyra_pak.o compress.o util.o 57 $(CXX) $(LDFLAGS) -o $@ $+ 57 $(CXX) $(LDFLAGS) -o $@ $+ -lvorbis -logg -lvorbisenc -lFLAC 58 58 59 compress_queen$(EXEEXT): compress_queen.o util.o60 $(CC) $(LDFLAGS) -o $@ $+ 59 compress_queen$(EXEEXT): compress_queen.o compress.o util.o 60 $(CC) $(LDFLAGS) -o $@ $+ -lvorbis -logg -lvorbisenc -lFLAC 61 61 62 62 compress_saga$(EXEEXT): compress_saga.o compress.o util.o $(UTILS) 63 $(CXX) $(LDFLAGS) -o $@ $+ 63 $(CXX) $(LDFLAGS) -o $@ $+ -lvorbis -logg -lvorbisenc -lFLAC 64 64 65 65 compress_scumm_bun$(EXEEXT): compress_scumm_bun.o compress.o util.o 66 $(CXX) $(LDFLAGS) -o $@ $+ 66 $(CXX) $(LDFLAGS) -o $@ $+ -lvorbis -logg -lvorbisenc -lFLAC 67 67 68 68 compress_scumm_san$(EXEEXT): compress_scumm_san.o compress.o util.o 69 $(CXX) $(LDFLAGS) -o $@ $+ -lz 69 $(CXX) $(LDFLAGS) -o $@ $+ -lz -lvorbis -logg -lvorbisenc -lFLAC 70 70 71 71 compress_scumm_sou$(EXEEXT): compress_scumm_sou.o compress.o util.o 72 $(CC) $(LDFLAGS) -o $@ $+ 72 $(CC) $(LDFLAGS) -o $@ $+ -lvorbis -logg -lvorbisenc -lFLAC 73 73 74 74 compress_sword1$(EXEEXT): compress_sword1.o compress.o util.o 75 $(CC) $(LDFLAGS) -o $@ $+ 75 $(CC) $(LDFLAGS) -o $@ $+ -lvorbis -logg -lvorbisenc -lFLAC 76 76 77 77 compress_sword2$(EXEEXT): compress_sword2.o compress.o util.o 78 $(CC) $(LDFLAGS) -o $@ $+ 78 $(CC) $(LDFLAGS) -o $@ $+ -lvorbis -logg -lvorbisenc -lFLAC 79 79 80 80 compress_touche$(EXEEXT): compress_touche.o compress.o util.o 81 $(CC) $(LDFLAGS) -o $@ $+ 81 $(CC) $(LDFLAGS) -o $@ $+ -lvorbis -logg -lvorbisenc -lFLAC 82 82 83 83 dekyra$(EXEEXT): dekyra.o dekyra_v1.o util.o 84 84 $(CXX) $(LDFLAGS) -o $@ $+ … … 90 90 $(CXX) $(LDFLAGS) -o $@ $+ 91 91 92 92 encode_dxa$(EXEEXT): encode_dxa.o compress.o util.o 93 $(CXX) $(LDFLAGS) -o $@ $+ -lpng -lz 93 $(CXX) $(LDFLAGS) -o $@ $+ -lpng -lz -lvorbis -logg -lvorbisenc -lFLAC 94 94 95 95 extract_agos$(EXEEXT): extract_agos.o 96 96 $(CC) $(LDFLAGS) -o $@ $+ … … 122 122 123 123 descumm.o descumm6.o descumm-common.o descumm-tool.o: descumm.h 124 124 125 # Most compress_* tools (except for compress_queen)use compress.h125 # All compress_* tools use compress.h 126 126 compress_agos.o compress_saga.o compress_scumm_sou.o \ 127 127 compress_scumm_bun.o compress_sword1.o compress_sword2.o \ 128 compress_kyra.o compress .o encode_dxa.o: compress.h128 compress_kyra.o compress_queen.o compress.o encode_dxa.o: compress.h 129 129 130 130 # extract_parallaction.h 131 131 extract_parallaction.o: extract_parallaction.h -
README
84 84 for compressed sounds in I have no mouth yet. 85 85 86 86 compress_sword1 87 Used to compress Broken Sword 1's music and speech files to88 MP3 or Vorbis or FLAC.87 Used to compress Broken Sword 1's music and speech .clu 88 files to .cl3 (MP3), .clg (Vorbis) or .clf (FLAC). 89 89 90 Please note that FLAC compression will produce a larger file 91 than the original! This is because the original files already 92 use lossy compression. 93 90 94 compress_sword2 91 95 Used to compress Broken Sword 2's music and speech .clu 92 96 files to .cl3 (MP3), .clg (Vorbis) or .clf (FLAC). … … 98 102 compress_touche 99 103 Used to compress and pack Touche speech files ('Vxxx' and 100 104 'OBJ') to MP3, Vorbis or FLAC to a single file named 101 TOUCHE.SO3 /.SOG/.SOF depending on the sound compression. Once102 compressed, only TOUCHE.DAT and TOUCHE.SOx files are required103 to play the game under ScummVM.105 TOUCHE.SO3 (MP3), TOUCHE.SOG (Vorbis), or TOUCHE.SOF (FLAC). 106 107 Once compressed, only TOUCHE.DAT and TOUCHE.SOx files are 104 108 105 compress_scumm_san <inputfile> <inputdir> <outputdir> [--ogg]109 compress_scumm_san 106 110 Compresses '.san' smush animation files. It uses lossless 107 111 zlib for compressing FOBJ gfx chunks inside a san file. 108 112 It also can create a separate Ogg file with the audio track. 109 113 110 Example of usage:111 compress_scumm_san opening.san uncomp comp112 113 114 In order to use such compressed files, your ScummVM binary 114 115 must have been built with zlib support enabled (you can find 115 116 out whether that's the case by looking at the About dialog). … … 124 125 move the '.san' files before compressing them, make sure to 125 126 move the '.flu' files, too! 126 127 127 compress_scumm_bun <inputfile> <inputdir> <outputdir> [--ogg]128 compress_scumm_bun 128 129 129 130 Compresses '.bun' music/voice files. 130 131 131 Example of usage:132 compress_scumm.bun digmusic.bun uncomp comp133 134 132 For the Ogg or MP3 compression feature, your ScummVM binary 135 133 naturally must have been built with Ogg or MP3 support enabled. 136 134 … … 138 136 Used to compress The Legend of Kyrandia's speech files with 139 137 MP3, Vorbis or FLAC. 140 138 141 Example of usage:142 compress_kyra <flags here> input/GEMCUT.VRM output/GEMCUT.VRM143 144 139 Note: You have to keep the VRM extension, else it will NOT work. 145 Use it like shown above, copy all *.VRM files to a directory146 and let the tool put the output file in another directory.147 148 140 Script Tools: 149 141 descumm 150 142 Decompiles SCUMM scripts