⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 musicin.c

📁 ISO mp3 sources (distribution 10) Layer 1/2/3, C Source, 512 k Sources of the Mpeg 1,2 layer 1,2
💻 C
📖 第 1 页 / 共 5 页
字号:
		    info->surround = 1; 		    fr_ps->config = 310;		    fr_ps->lfe_pos = 3;		    printf (">>> Using 3/1 configuration.\n"); 		    break;	    case '2': 		    info->center = 0; 		    info->surround = 2; 		    fr_ps->config = 220;		    fr_ps->lfe_pos = 2;		    printf (">>> Using 2/2 configuration.\n"); 		    break;	    case '3': 		    info->center = 0; 		    info->surround = 3; 		    fr_ps->config = 202;		    fr_ps->lfe_pos = 2;		    printf (">>> Using 2/0 + 2/0 configuration.\n"); 		    break;	    default:  		    info->center = 1; 		    info->surround = 1; 		    fr_ps->config = 310;		    fr_ps->lfe_pos = 3;		    printf (">>> Using default 3/1 configuration.\n"); 		    break;	    }	}	else if (tot_channels - info->lfe == 3) 	{	    fr_ps->stereoaug = 0;	    printf ("Which configuration do you want to use?\n");	    printf ("Available: 3/0 (<1>), 2/1 (2), 1/0 + 2/0 (3): ");	    gets (configuration);	    switch (*configuration)    	    {	    case '1': 		    info->center = 1; 		    info->surround = 0; 		    fr_ps->config = 300;		    fr_ps->stereomc = 1;		    fr_ps->lfe_pos = 3;		    printf (">>> Using 3/0 configuration.\n"); 		    break;	    case '2': 		    info->center = 0; 		    info->surround = 1; 		    fr_ps->config = 210;		    fr_ps->stereomc = 1;		    fr_ps->lfe_pos = 2;		    printf (">>> Using 2/1 configuration.\n"); 		    break;	    case '3': 		    info->center = 0; 		    info->surround = 3; 		    fr_ps->config = 102;		    fr_ps->stereomc = 2;		    fr_ps->lfe_pos = 1;		    printf (">>> Using 1/0 + 2/0 configuration.\n"); 		    break;	    default:  		    info->center = 1; 		    info->surround = 0; 		    fr_ps->config = 300;		    fr_ps->stereomc = 1;		    fr_ps->lfe_pos = 3;		    printf (">>> Using default 3/0 configuration.\n"); 		    break;	    }	}	else if (tot_channels - info->lfe == 2) 	{	    fr_ps->config = 200;	    fr_ps->stereomc = 0;	    fr_ps->stereoaug = 0;	    fr_ps->lfe_pos = 2;	}	else if (tot_channels - info->lfe == 1) 	{	    if (info->lfe)	    {		printf ("single channel plus LFE not supported.\n");		exit (1);	    }	    fr_ps->config = 100;	    fr_ps->stereomc = 0;	    fr_ps->stereoaug = 0;	}	else	{	    printf ("Channels = %d not supported.\n", tot_channels);	    exit (1);	}	aiff_check (original_file_name, pcm_aiff_data);/* 21/03/1995 JMZ Multimode *//**********************************************************/        info->sampling_frequency = SmpFrqIndex ((long) pcm_aiff_data->sampleRate);        printf (">>> %.f Hz sampling frequency selected\n", pcm_aiff_data->sampleRate);        /* Determine number of samples in sound file */        *num_samples = pcm_aiff_data->numChannels * pcm_aiff_data->numSampleFrames;	if (info->multiling_ch > 0)	{	    switch (SmpFrqIndex ((long) pcm_aiff_data_ml->sampleRate) - info->sampling_frequency)	    {	    case 16 : printf ("MultiLingual is LSF coded.\n");		      info->multiling_fs = 1;		      break;	    case  0 : printf ("MultiLingual sample rate equals that of Audio.\n");		      info->multiling_fs = 0;		      break;	    default : printf ("***WARNING: MultiLingual sample rate does not equal (half) mc sample rate.\n");	    	      printf ("            No MultiLingual coding!!!\n");		      info->multiling_ch = 0;		      break;	    } /*switch*/	} /*if (ml_ch>0)*/    }    else    {    /* Not using Audio IFF sound file headers. */	printf("no multichannel coding!!\n");	fr_ps->stereomc = 0;	fr_ps->stereoaug = 0;	info->multiling_ch = 0;        printf ("What is the sampling frequency? <48000>[Hz]: ");        gets (t);        i = atol(t);        switch (i)	{        case 48000 : info->sampling_frequency = 1;	             printf (">>> %ld Hz sampling freq selected\n", i);		     break;        case 44100 : info->sampling_frequency = 0;		     printf (">>> %ld Hz sampling freq selected\n", i);		     break;        case 32000 : info->sampling_frequency = 2;		     printf (">>> %ld Hz sampling freq selected\n", i);		     break;        default:     info->sampling_frequency = 1;		     printf (">>> Default 48 kHz samp freq selected\n");        }         if (fseek (musicin, 0, SEEK_SET) != 0)	{          printf ("Could not seek to PCM sound data in \"%s\".\n",                  original_file_name);          exit (1);        }         /* Declare sound file to have "infinite" number of samples. */        *num_samples = MAX_U_32_NUM;    }    printf ("Which layer do you want to use?\n");    printf ("Available: Layer (1), Layer (<2>): ");    gets (t);    switch (*t)    {    case '1': info->lay = 1; printf (">>> Using Layer %s\n", t); break;    case '2': info->lay = 2; printf (">>> Using Layer %s\n", t); break;    default : info->lay = 2; printf (">>> Using default Layer 2\n"); break;    }    printf ("Which mode do you want for the two front channels?\n");    printf ("Available: (<s>)tereo, (j)oint stereo, ");    printf ("(d)ual channel, s(i)ngle Channel, n(o)ne: ");    gets (t);    if (fr_ps->config < 200) /* compatible is mono */    {	info->mode = MPG_MD_MONO;	info->mode_ext = 0;	printf (">>> Using default mono mode\n");    }    else	switch (*t)	{	case 's':	case 'S': info->mode = MPG_MD_STEREO; info->mode_ext = 0;		  printf (">>> Using mode %s\n",t);		  break;	case 'j':	case 'J': info->mode = MPG_MD_JOINT_STEREO;		  printf (">>> Using mode %s\n",t);		  break;	case 'd':	case 'D': info->mode = MPG_MD_DUAL_CHANNEL; info->mode_ext = 0;		  printf (">>> Using mode %s\n",t);		  break;	case 'i':	case 'I': info->mode = MPG_MD_MONO; info->mode_ext = 0;		  printf (">>> Using mode %s\n",t);		  break;	case 'o':	case 'O': info->mode = MPG_MD_NONE; info->mode_ext = 0;		  printf (">>> Using mode %s\n",t);		  break;	default:  info->mode = MPG_MD_STEREO; info->mode_ext = 0;		  printf (">>> Using default stereo mode\n");		  break;	}    *psy = DFLT_PSY;    if (info->mode == MPG_MD_MONO)	max_rate_index = 10;    else	max_rate_index = 14;/*    max_rate_index = 6; */ /* 48 kHz => 96 kbps for multiple table testing */     max_rate = bitrate[info->lay-1][max_rate_index];    printf ("What is the total bitrate? <%u>[kbps]: ", DFLT_BRT);    gets (t);    i = atol (t);    if (i == 0) i = -10;    j = 0;    while (j <= max_rate_index)     {	if (bitrate[info->lay-1][j] == (int) i)	    break;	j++;    }    if (j > max_rate_index)     {        if (i < max_rate)        {	    if (DFLT_BRT <= max_rate)	    {	    	i = DFLT_BRT;		printf (">>> Using default %u kbps\n", DFLT_BRT);	    }	    else	    {	       	i = max_rate;		printf (">>> Using max. bitrate %u kbps\n", max_rate);	    }	    for (j = 0; j < 15; j++)		if (bitrate[info->lay-1][j] == (int) i) 		{		    info->bitrate_index = j;		    break;		}	}	else	{	    info->ext_bit_stream_present = 1;	    *bit_rate = i;	    if (DFLT_BRT <= max_rate)	    	i = DFLT_BRT;	    else	       	i = max_rate;	    for (j = 0; j < 15; j++)		if (bitrate[info->lay-1][j] == (int) i) 		{		    info->bitrate_index = j;		    break;		}	    info->ext_length = ((*bit_rate - i) * 144) / s_freq[info->sampling_frequency];	    printf (">>> Bitrate = %d kbps\n", *bit_rate);	}			       }    else    {        info->bitrate_index = j;        printf (">>> Bitrate = %d kbps\n", bitrate[info->lay-1][j]);    }    printf ("What type of de-emphasis should the decoder use?\n");    printf ("Available: (<n>)one, (5)0/15 microseconds, (c)citt j.17: ");    gets (t);    if (*t != 'n' && *t != '5' && *t != 'c')    {        printf (">>> Using default no de-emphasis\n");        info->emphasis = 0;    }    else    {        if (*t == 'n')      info->emphasis = 0;        else if (*t == '5') info->emphasis = 1;        else if (*t == 'c') info->emphasis = 3;        printf (">>> Using de-emphasis %c\n", *t);    } /*  Start 2. Part changes for CD Ver 3.2; jsp; 22-Aug-1991 */     printf ("Do you want to set the private bit? (y/<n>): ");    gets (t);    if (*t == 'y' || *t == 'Y') info->extension = 1;    else                        info->extension = 0;    if (info->extension) printf (">>> Private bit set\n");    else                 printf (">>> Private bit not set\n"); /*  End changes for CD Ver 3.2; jsp; 22-Aug-1991 */	    printf ("Do you want error protection? (y/<n>): ");    gets (t);    if (*t == 'y' || *t == 'Y') info->error_protection = TRUE;    else                        info->error_protection = FALSE;    if (info->error_protection) printf (">>> Error protection used\n");    else			printf (">>> Error protection not used\n");	    printf ("Is the material copyrighted? (y/<n>): ");    gets (t);    if (*t == 'y' || *t == 'Y') info->copyright = 1;    else                        info->copyright = 0;    if (info->copyright) printf (">>> Copyrighted material\n");    else                 printf (">>> Material not copyrighted\n");     printf ("Is this the original? (y/<n>): ");    gets (t);    if (*t == 'y' || *t == 'Y') info->original = 1;    else                        info->original = 0;    if (info->original) printf (">>> Original material\n");    else	        printf (">>> Material not original\n");        /* Option for multichannel for matricing, 7/12/93,SR*/    if (*aiff == 1)    {        printf ("which kind of matrix do you want(<(-3, -3) = 0>;(-xx, -3) = 1;");	printf (" (-oo, -3) = 2; (-oo, -oo) = 3)  ");	gets (t);	if (strcmp (t,"") == 0) info->matrix = 0;	else			info->matrix = atoi (t);	printf ("The matrix %d is chosen\n", info->matrix);	*mat_mode = info->matrix;#ifdef Augmentation_7ch	if (fr_ps->stereoaug == 2)  /* 7.1 channel mode */	{	    printf ("which kind of aug matrix do you want? (<0>; 1; 3) ");	    gets (t);	    if (strcmp (t, "") == 0) info->aug_mtx_proc = 0;	    else		     info->aug_mtx_proc = atoi (t);	    printf ("The aug matrix %d is chosen\n", info->aug_mtx_proc);	    *aug_mat_mode = info->aug_mtx_proc;	}#endif	printf ("Do you want to have Channel-switching?(<y>/n) ");	gets (t);	if (*t == 'y' || *t == 'Y')	    *cha_sw = *aug_cha_sw = 1;	if (*cha_sw == 0 || info->matrix == 3)	{	    *cha_sw = 0;	    printf ("Channel-switching is not used!\n");	    printf ("Which mode of Channel-switching do you want? (not used) ");	    gets (t);	    printf("CHA mode: %d\n", *cha_sw);	}	else	{	    *cha_sw = 1;	    printf ("Channel-switching is used\n");	 	    do	    {		printf ("Which mode of Channel-switching do you want? (-2 ... 7) ");		gets (t);		*cha_sw = atoi (t);		printf ("CHA mode: %d\n", *cha_sw);		if (fr_ps->config == 320)		    bool = *cha_sw > 7;		else if (fr_ps->config == 310 && info->matrix == 2)		    bool = *cha_sw > 5;		else if (fr_ps->config == 310)		    bool = *cha_sw > 4;		else if (fr_ps->config == 220)		    bool = *cha_sw > 3;		else if (fr_ps->config == 300 || fr_ps->config == 302 || fr_ps->config == 210)		    bool = *cha_sw > 2;		else		    bool = *cha_sw > 0;		if (bool)		    printf ("!!! Channel-switching mode %d cannot be used together with Configuration: %d !!!\n", *cha_sw, fr_ps->config);	    } while (bool);	}#ifdef Augmentation_7ch	if (fr_ps->stereoaug == 2)  /* 7.1 channel mode */	{	    if (*aug_cha_sw == 0 || info->aug_mtx_proc == 3)	    {		*aug_cha_sw = 0;		printf ("Aug Channel-switching is not used!\n");		printf ("Which mode of Aug Channel-switching do you want? (not used) ");		gets (t);		printf("Aug CHA mode: %d\n", *aug_cha_sw);	    }	    else	    {		*aug_cha_sw = 1;		printf ("Aug Channel-switching is used\n");	 		do		{		    printf ("Which mode of Aug Channel-switching do you want? (-1 ... 7) ");		    gets (t);		    *aug_cha_sw = atoi (t);		    printf ("Aug CHA mode: %d\n", *aug_cha_sw);		    if (info->aug_mtx_proc == 0 || info->aug_mtx_proc == -1)			bool = *aug_cha_sw > 7;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -