📄 musicout.c.patch
字号:
---> out_audio(audiodev, *pcm_sample, 1, &fr_ps, &sample_frames);282d367< if(clip > 0) printf("%d output samples clipped\n", clip);309,315d393< if(Arguments.topSb>0) /* debug : clear channels to 0 */< for(j=Arguments.topSb; j<fr_ps.sblimit; ++j)< for(k=0; k<stereo; ++k)< (*fraction)[k][0][j] =< (*fraction)[k][1][j] =< (*fraction)[k][2][j] = 0;< 320,321c398< out_fifo(*pcm_sample, 3, &fr_ps, done, musicout,< &sample_frames);---> out_audio(audiodev, *pcm_sample, 3, &fr_ps, &sample_frames);323d399< if(clip > 0) printf("%d samples clipped\n", clip);339a416> 347a425> 357,358c435< printf("Not enough main data to decode frame %d. Frame discarded.\n", < frameNum - 1); break;---> break;419,420c496< out_fifo(*pcm_sample, 18, &fr_ps, done, musicout,< &sample_frames);---> out_audio(audiodev, *pcm_sample, 18, &fr_ps, &sample_frames);422d497< if(clip > 0) printf("%d samples clipped.\n", clip);425c500< }---> } /* switch */427c502< /* skip ancillary data HP 22-nov-95 */---> /* skip ancillary data HP 22-nov-95 */444,486c519,529< if (Arguments.need_aiff) {< pcm_aiff_data.numChannels = stereo;< pcm_aiff_data.numSampleFrames = sample_frames;< pcm_aiff_data.sampleSize = 16;< pcm_aiff_data.sampleRate = s_freq[info.version][info.sampling_frequency]*1000;< pcm_aiff_data.sampleType = IFF_ID_SSND;< pcm_aiff_data.blkAlgn.offset = 0;< pcm_aiff_data.blkAlgn.blockSize = 0;< < if (aiff_write_headers(musicout, &pcm_aiff_data) == -1) {< printf("Could not write AIFF headers to \"%s\"\n",< Arguments.decoded_file_name);< exit(2);< }< }< < printf("Avg slots/frame = %.3f; b/smp = %.2f; br = %.3f kbps\n",< (FLOAT) gotBits / (frameNum * bitsPerSlot),< (FLOAT) gotBits / (frameNum * samplesPerFrame),< (FLOAT) gotBits / (frameNum * samplesPerFrame) *< s_freq[info.version][info.sampling_frequency]);< < close_bit_stream_r(&bs);< fclose(musicout);< < /* for the correct AIFF header information */< /* on the Macintosh */< /* the file type and the file creator for */< /* Macintosh compatible Digidesign is set */< < #ifdef MACINTOSH< if (Arguments.need_aiff)< set_mac_file_attr(Arguments.decoded_file_name, VOL_REF_NUM,< CREATR_DEC_AIFF, FILTYP_DEC_AIFF);< else set_mac_file_attr(Arguments.decoded_file_name, VOL_REF_NUM,< CREATR_DEC_BNRY, FILTYP_DEC_BNRY);< #endif< < printf("Decoding of \"%s\" is finished\n", Arguments.encoded_file_name);< printf("The decoded PCM output file name is \"%s\"\n", Arguments.decoded_file_name);< if (Arguments.need_aiff)< printf("\"%s\" has been written with AIFF header information\n",< Arguments.decoded_file_name);---> /*> * Flush last audio.> */> out_audio(audiodev, NULL, -1, NULL, NULL);> > free(pcm_sample);> free(sample);> free(fraction);> free(w);> free(bs.buf);> return OK;488d530< exit( 0 );493,503d534< fprintf(stderr,< "usage: %s queries for all arguments, or\n",< programName);< fprintf(stderr,< " %s [-A][-s sb] inputBS [outPCM]\n", programName);< fprintf(stderr,"where\n");< fprintf(stderr," -A write an AIFF output PCM sound file\n");< fprintf(stderr," -s sb resynth only up to this sb (debugging only)\n");< fprintf(stderr," inputBS input bit stream of encoded audio\n");< fprintf(stderr," outPCM output PCM sound file (dflt inName+%s)\n",< DFLT_OPEXT);507,629d537< < static void GetArguments(argc, argv,Arguments) < int argc;< char **argv;< Arguments_t *Arguments;< < {< char t[50];< < programName = argv[0];< if(argc==1) { /* no command line args -> interact */< do {< printf ("Enter encoded file name <required>: ");< gets (Arguments->encoded_file_name);< if (Arguments->encoded_file_name[0] == NULL_CHAR)< printf ("Encoded file name is required. \n");< } while (Arguments->encoded_file_name[0] == NULL_CHAR);< printf (">>> Encoded file name is: %s \n", Arguments->encoded_file_name);< #ifdef MS_DOS< printf ("Enter MPEG decoded file name <%s>: ",< new_ext(Arguments->encoded_file_name, DFLT_OPEXT)); /* 92-08-19 shn */< #else< printf ("Enter MPEG decoded file name <%s%s>: ",< Arguments->encoded_file_name,< DFLT_OPEXT);< #endif< gets (Arguments->decoded_file_name);< if (Arguments->decoded_file_name[0] == NULL_CHAR) {< #ifdef MS_DOS< /* replace old extension with new one, 92-08-19 shn */< strcpy(Arguments->decoded_file_name,< new_ext(Arguments->encoded_file_name, DFLT_OPEXT));< #else< strcat (strcpy(Arguments->decoded_file_name, < Arguments->encoded_file_name), DFLT_OPEXT);< #endif< }< printf (">>> MPEG decoded file name is: %s \n", < Arguments->decoded_file_name);< < printf(< "Do you wish to write an AIFF compatible sound file ? (y/<n>) : ");< gets(t);< if (*t == 'y' || *t == 'Y') Arguments->need_aiff = TRUE;< else Arguments->need_aiff = FALSE;< if (Arguments->need_aiff)< printf(">>> An AIFF compatible sound file will be written\n");< else printf(">>> A non-headered PCM sound file will be written\n");< < printf(< "Do you wish to exit (last chance before decoding) ? (y/<n>) : ");< gets(t);< if (*t == 'y' || *t == 'Y') exit(0);< }< else { /* interpret CL Args */< int i=0, err=0;< < Arguments->need_aiff = FALSE;< Arguments->need_esps = FALSE; /* MI */< Arguments->encoded_file_name[0] = '\0';< Arguments->decoded_file_name[0] = '\0';< < while(++i<argc && err == 0) {< char c, *token, *arg, *nextArg;< int argUsed;< < token = argv[i];< if(*token++ == '-') {< if(i+1 < argc) nextArg = argv[i+1];< else nextArg = "";< argUsed = 0;< while(c = *token++) {< if(*token /* NumericQ(token) */) arg = token;< else arg = nextArg;< switch(c) {< case 's': Arguments->topSb = atoi(arg); argUsed = 1;< if(Arguments->topSb<1 || Arguments->topSb>SBLIMIT) {< fprintf(stderr, "%s: -s band %s not %d..%d\n",< programName, arg, 1, SBLIMIT);< err = 1;< }< break;< case 'A': Arguments->need_aiff = TRUE; break;< case 'E': Arguments->need_esps = TRUE; break; /* MI */< default: fprintf(stderr,"%s: unrecognized option %c\n",< programName, c);< err = 1; break;< }< if(argUsed) {< if(arg == token) token = ""; /* no more from token */< else ++i; /* skip arg we used */< arg = ""; argUsed = 0;< }< }< }< else {< if(Arguments->encoded_file_name[0] == '\0')< strcpy(Arguments->encoded_file_name, argv[i]);< else< if(Arguments->decoded_file_name[0] == '\0')< strcpy(Arguments->decoded_file_name, argv[i]);< else {< fprintf(stderr,< "%s: excess arg %s\n", programName, argv[i]);< err = 1;< }< }< }< < if(err || Arguments->encoded_file_name[0] == '\0') usage(); /* never returns */< < if(Arguments->decoded_file_name[0] == '\0') {< strcpy(Arguments->decoded_file_name, Arguments->encoded_file_name);< strcat(Arguments->decoded_file_name, DFLT_OPEXT);< }< < }< /* report results of dialog / command line */< printf("Input file = '%s' output file = '%s'\n",< Arguments->encoded_file_name, Arguments->decoded_file_name);< if(Arguments->need_aiff) printf("Output file written in AIFF format\n");< if(Arguments->need_esps) printf("Output file written in ESPS format\n"); /* MI */< }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -