LECTURE 11 ´Êñ¤Ê¥Ü¡¼¥«¥ë¥­¥ã¥ó¥»¥é

¡û ¤Ï¤¸¤á¤Ë

²»³Ú CD ¤òʹ¤¤¤Æ¤¤¤ë¤È¡¢¡ÉȼÁÕ¤ÎÉôʬ¤À¤±¤Î¥Ç¡¼¥¿¤Ë¤·¤Æ²Î¤ÎÎý½¬¤ò¤·¤¿¤¤¤Ê¤¢¡É¤Ê¤É¤È»×¤¦¤³¤È¤Ï¤¢¤ê¤Þ¤»¤ó¤«¡© ¤½¤ÎÍͤÊÍÑÅӤ˻Ȥ¨¤ëÍͤˡ¢¤³¤³¤Ç¤Ï¥Ü¡¼¥«¥ë¥­¥ã¥ó¥»¥é¤òºî¤Ã¤Æ¤ß¤¿¤¤¤È»×¤¤¤Þ¤¹¡£¥Ü¡¼¥«¥ë¥­¥ã¥ó¥»¥é¤È¤¤¤Ã¤Æ¤â¡¢¥«¥é¥ª¥±¥Þ¥·¥ó¤ÎÍͤʴ°Á´¤ÊȼÁնʤòºî¤ë¤Î¤Ç¤Ï¤Ê¤¯¡¢¡É¤¦¤Þ¤¯¤¤¤±¤Ð¥Ü¡¼¥«¥ë¤ÎÉôʬ¤¬¤¢¤Þ¤êʹ¤³¤¨¤Ê¤¯¤Ê¤ë¡É¤È¤¤¤Ã¤¿ÄøÅ٤δÊñ¤Ê¤â¤Î¤Ç¤¹¡£

²»³Ú CD ¤Î¶Ê¤ÏÄ̾凉¥Æ¥ì¥ª ( 2 ¥Á¥ã¥ó¥Í¥ë ) ¤Ç¤¹¡£¥¹¥Æ¥ì¥ª¶Ê¤Î¾ì¹ç±¦¤Èº¸¤Ç°Û¤Ê¤ë²»¤¬ºÆÀ¸¤µ¤ì¤Þ¤¹¤¬¡¢Â¿¤¯¤Î¾ì¹ç¥Ü¡¼¥«¥ë¤Ï±¦¤Èº¸¤ËƱ¤¸ÇÈ·Á¤Ç³ÊǼ¤µ¤ì¤Æ¤¤¤Þ¤¹ ( ¤â¤Á¤í¤ó¡¢±¦¤Èº¸¤Î¥Ð¥é¥ó¥¹¤òÊѲ½¤µ¤»¤ë¶Ê¤â¤¿¤¯¤µ¤ó¤¢¤ê¤Þ¤¹¡£¤Ê¤Î¤Ç¡¢¡É¤¦¤Þ¤¯¤¤¤±¤Ð¡É¤Ç¤¹¡£¡£¡£)¡£¤³¤Î¾ì¹ç¡¢º¸±¦¤Î¥Á¥ã¥ó¥Í¥ë¤ËƱ¤¸ÇÈ·Á¤Î PCM ¥Ç¡¼¥¿¤È¤·¤Æ¥Ü¡¼¥«¥ë¤¬³ÊǼ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢ÊÒÊý¤Î¥Á¥ã¥ó¥Í¥ë¤Î°ÌÁê¤òȿž¤·¤Æξ¥Á¥ã¥ó¥Í¥ë¤ò²Ã»»¤¹¤ë ( Íפϡ¢ÊÒÊý¤Î¥Á¥ã¥ó¥Í¥ë¤«¤é¤â¤¦°ìÊý¤Î¥Á¥ã¥ó¥Í¥ë¤ÎÃͤò°ú¤±¤ÐÎɤ¤¤Ç¤¹ )¤È¡¢¥Ü¡¼¥«¥ë¤¬¾Ã¤¨¤ë¤È¤¤¤¦»ÅÁȤߤǤ¹¡£º¸±¦¤Î¥Á¥ã¥ó¥Í¥ë¤ò¹çÀ®¤¹¤ë¤Î¤Ç¡¢·ë²Ì¤È¤·¤ÆÆÀ¤é¤ì¤ë¥Ç¡¼¥¿¤Ï¥â¥Î¥é¥ë¤È¤Ê¤ê¤Þ¤¹¡£

¤¦¤Þ¤¯¤¤¤±¤Ð¡¢¥Ü¡¼¥«¥ë¤¬¤«¤Ê¤ê¾®¤µ¤¯¤Ê¤ê¤Û¤È¤ó¤Éʹ¤³¤¨¤Ê¤¯¤Ê¤ë¤È»×¤¤¤Þ¤¹¡£¤¿¤À¤·¡¢¥Ü¡¼¥«¥ë°Ê³°¤Ëº¸±¦¤ËƱ¤¸ÇÈ·Á¤Ç³ÊǼ¤µ¤ì¤Æ¤¤¤ë ²»¤¬¤¢¤ë¾ì¹ç ( Äã²»°è¤Î²»¤¬Â¿¤¤ ) ¤Ï¡¢¤½¤ì¤é¤Î²»¤â¾®¤µ¤¯¤Ê¤Ã¤Æ¤·¤Þ¤¤¤Þ¤¹¤Î¤Ç¤¢¤·¤«¤é¤º¡£¡£¡£

¡û ¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à

»ØÄꤵ¤ì¤¿¥¹¥Æ¥ì¥ª WAVE ¥Õ¥¡¥¤¥ë¤«¤é¥Ü¡¼¥«¥ë¤ò¾Ã¤¹¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à vocancel.c ¤Ç¤¹¡£¤Ï¤¸¤á¤Ë ¤Î¥Ú¡¼¥¸¤«¤é¡¢Á´¤Æ¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤ò¸Ç¤á¤¿ tar ¥Ü¡¼¥ë¤ò¥À¥¦¥ó¥í¡¼¥É¤¹¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡£

gcc -o vocancel vocancel.c

¤È¤·¤Æ¥³¥ó¥Ñ¥¤¥ë¤·¤Þ¤¹¡£¥³¥ó¥Ñ¥¤¥ë¥ª¥×¥·¥ç¥ó¤Ï³Æ¼«¤Î´Ä¶­¤Ê¤É¤Ë±þ¤¸¤Æ½¤Àµ¤·¤Æ²¼¤µ¤¤¡£

°ú¿ô¤ËÆþÎÏ WAVE ¥Õ¥¡¥¤¥ë¤Î¥Ñ¥¹¤È½ÐÎÏ WAVE ¥Õ¥¡¥¤¥ë¤Î¥Ñ¥¹¤ò»ØÄꤷ¤Æ¼Â¹Ô¤·¤Þ¤¹¡£vocancel.c ¤Ç¤Ï¡¢16¥Ó¥Ã¥È¥¹¥Æ¥ì¥ª¤Î WAVE ¥Õ¥¡¥¤¥ë¤Î¤ß¤ò½èÍýÂоݤȤ·¤Þ¤¹¡£·ë²Ì¤È¤·¤ÆÆÀ¤é¤ì¤ë WAVE ¥Õ¥¡¥¤¥ë¤Ï 16¥Ó¥Ã¥È¥â¥Î¥é¥ë¤È¤Ê¤ê¤Þ¤¹¡£¤½¤ì°Ê³°¤Î WAVE ¥Õ¥¡¥¤¥ë¤òÆþÎϤ˻ØÄꤷ¤¿¾ì¹ç¤Ï¡¢¥¨¥é¡¼¤òɽ¼¨¤·¤Æ½ªÎ»¤·¤Þ¤¹¡£¤Þ¤¿¡¢ÆþÎÏ¥Õ¥¡¥¤¥ë¤Î²¿ % ¤ò½èÍý¤·¤¿¤«¤Îɽ¼¨¤Ï¿ï»þ¹¹¿·¤µ¤ì¤Þ¤¹¡£

--- vocancel.c ---

    1	#include <fcntl.h> 
    2	#include <stdio.h>
    3	#include <stdlib.h>
    4	#include <string.h>
    5	#include <sys/ioctl.h>
    6	#include <unistd.h>
    7	#include <linux/soundcard.h>
    8	#include <limits.h>
    9	
   10	
   11	/* WAVE ¥Õ¥¡¥¤¥ë¤Î¾ðÊó¤ò³ÊǼ¤¹¤ë¹½Â¤ÂÎ */
   12	typedef struct {
   13		FILE* fp;        /* ¥Õ¥¡¥¤¥ë¹½Â¤ÂÎ */
   14		short is_pcm;    /* PCM ¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¾ì¹ç¤Ï 1¡¢¤½¤ì°Ê³°¤Ï 0 */
   15		short channel;   /* ¥â¥Î¥é¥ë¤Î¾ì¹ç¤Ï 1¡¢¥¹¥Æ¥ì¥ª¤Î¾ì¹ç¤Ï 2 */
   16		int   rate;      /* ¥µ¥ó¥×¥ê¥ó¥°¼þÇÈ¿ô */
   17		short bits;      /* Î̻Ҳ½¥Ó¥Ã¥È¿ô */
   18		long  offset;    /* ¥Õ¥¡¥¤¥ëÀèƬ¤«¤é PCM ¥Ç¡¼¥¿¤Þ¤Ç¤Î¥ª¥Õ¥»¥Ã¥È */
   19		int   len;       /* PCM ¥Ç¡¼¥¿Éô¤ÎŤµ */
   20	}
   21	WAVE;
   22	
   23	
   24	/* ´Ø¿ô¥×¥í¥È¥¿¥¤¥× */
   25	static int vocancel_read_file( char* fname, WAVE* wave );
   26	static int vocancel_mix_and_write( char* fname, WAVE* inwave );
   27	static void vocancel_progress( int* processed, int current, WAVE* wave );
   28	
   29	
   30	int 
   31	main( int argc, char** argv )
   32	{
   33		WAVE wave;
   34	
   35		if ( argc != 3 ) {
   36			fprintf( stderr, "usage : vocancel filetoread filetowrite\n" );
   37			return 1;
   38		}
   39	
   40		/* WAVE ¥Õ¥¡¥¤¥ë¥Ø¥Ã¥À¤ÎÆɤ߹þ¤ß */
   41		if ( vocancel_read_file( argv[1], &wave ) != 0 ) {
   42			fprintf( stderr, "Failed to read specified WAVE file"
   43				 ": %s\n", argv[1] );
   44			return 1;
   45		}
   46	
   47	
   48		/* ¥¹¥Æ¥ì¥ª => ¥â¥Î¥é¥ëÊÑ´¹ */
   49		printf( "Now canceling center sound ...\n" );
   50	
   51		if ( vocancel_mix_and_write( argv[2], &wave ) != 0 ) {
   52			fprintf( stderr, "Failed to write monoral WAVE file"
   53				 ": %s\n", argv[2] );
   54			fclose( wave.fp );
   55			return 1;
   56		}
   57	
   58		fclose( wave.fp );
   59		printf( "\ndone.\n" );
   60		return 0;
   61	}
   62	
   63	
   64	/*
   65	 * WAVE ¥Õ¥¡¥¤¥ë¾ðÊó¤òÆɤ߹þ¤à
   66	 */
   67	static int 
   68	vocancel_read_file( char* fname, WAVE* wave )
   69	{
   70		char   buf[32];
   71		int    len;
   72	
   73		if ( ( wave->fp = fopen( fname, "r" ) ) == NULL ) {
   74			fprintf( stderr, "Failed to open %s\n", fname );
   75			return -1;
   76		}
   77	
   78		/* 
   79		 * ÀèƬ 4 ¥Ð¥¤¥È¤¬ "RIFF" ¤Ç¤¢¤ë¤³¤È¤ò³Îǧ
   80		 * ¹¹¤Ë 4 ¥Ð¥¤¥È¥¹¥­¥Ã¥×¤·¤Æ¤ª¤¯
   81		 */
   82		fread( buf, 8, 1, wave->fp );
   83	
   84		if ( strncmp( buf, "RIFF", 4 ) != 0 ) {
   85			fprintf( stderr, "Specified file is not RIFF file.\n" );
   86			fclose( wave->fp );
   87			return -1;
   88		}
   89	
   90	
   91		/* ¼¡¤Î 4 ¥Ð¥¤¥È¤¬ "WAVE" ¤Ç¤¢¤ë¤³¤È¤ò³Îǧ */
   92		fread( buf, 4, 1, wave->fp );
   93	
   94		if ( strncmp( buf, "WAVE", 4 ) != 0 ) {
   95			fprintf( stderr, "Specified file is not WAVE file.\n" );
   96			fclose( wave->fp );
   97			return -1;
   98		}
   99	
  100		/* fmt ¥Á¥ã¥ó¥¯¤òõ¤¹ */
  101		while ( 1 ) {
  102			fread( buf, 8, 1, wave->fp );
  103			len = *( int* )( &buf[4] );
  104	
  105			if ( strncmp( buf, "fmt ", 4 ) != 0 ) {
  106				if ( fseek( wave->fp, len, SEEK_CUR ) == -1 ) {
  107					fprintf( stderr, "Failed to find fmt chunk.\n" );
  108					fclose( wave->fp );
  109					return -1;
  110				}
  111			}
  112			else {
  113				break;
  114			}
  115		}
  116	
  117	
  118		/* WAVE ¥Õ¥©¡¼¥Þ¥Ã¥È¤òÆɤ߹þ¤à */
  119		fread( buf, len, 1, wave->fp );
  120	
  121		wave->is_pcm  = *( ( short* )( &buf[0]  ) );
  122		wave->channel = *( ( short* )( &buf[2]  ) );
  123		wave->rate    = *( ( int*   )( &buf[4]  ) );
  124		wave->bits    = *( ( short* )( &buf[14] ) );
  125	
  126		if ( wave->is_pcm != 1 ) {
  127			wave->is_pcm = 0;
  128		}
  129	
  130		/* data ¥Á¥ã¥ó¥¯¤òõ¤¹ */
  131		while ( 1 ) {
  132			fread( buf, 8, 1, wave->fp );
  133			len = *( int* )( &buf[4] );
  134	
  135			if ( strncmp( buf, "data", 4 ) != 0 ) {
  136				if ( fseek( wave->fp, len, SEEK_CUR ) == -1 ) {
  137					fprintf( stderr, "Failed to find data chunk.\n" );
  138					fclose( wave->fp );
  139					return -1;
  140				}
  141			}
  142			else {
  143				break;
  144			}
  145		}
  146	
  147		wave->len = len;
  148	
  149		if ( ( wave->offset = ftell( wave->fp ) ) == -1 ) {
  150			fprintf( stderr, "Failed to find offset of PCM data.\n" );
  151			fclose( wave->fp );
  152			return -1;
  153		}
  154	
  155		return 0;
  156	}
  157	
  158	
  159	#define BUFSIZE 128000
  160	
  161	/*
  162	 * »ØÄê¥Õ¥¡¥¤¥ë¤Ë¡¢º¸±¦¤Î¥Á¥ã¥ó¥Í¥ë¤ò¹çÀ®¤·¤¿¥â¥Î¥é¥ë WAVE ¥Ç¡¼¥¿¤ò½ÐÎϤ¹¤ë¡£
  163	 */
  164	static int 
  165	vocancel_mix_and_write( char* fname, WAVE* in )
  166	{
  167		/*
  168		 * wave_len ¤Ï WAVE ¥Õ¥¡¥¤¥ë¤ÎÀèƬ¤«¤é  4 ¥Ð¥¤¥ÈÌܤΥǡ¼¥¿
  169		 * head_len ¤Ï WAVE ¥Õ¥¡¥¤¥ë¤ÎÀèƬ¤«¤é 16 ¥Ð¥¤¥ÈÌܤΥǡ¼¥¿
  170		 * data_len ¤Ï PCM ¥Ç¡¼¥¿Éô¤Î¥Ç¡¼¥¿Ä¹
  171		 */
  172		int wave_len;
  173		int head_len;
  174		int data_len;
  175		int byte_sec;
  176		int byte_dat;
  177	
  178		int tmpval;
  179		int processed = 0;
  180		int len = 0;
  181		int i;
  182	
  183		char ibuf[ BUFSIZE ];
  184		char obuf[ BUFSIZE ];
  185	
  186		short channel = 1;
  187		short out;
  188		short in_l;
  189		short in_r;
  190	
  191		FILE* fp;
  192	
  193		if ( ( fp = fopen( fname, "w" ) ) == NULL ) {
  194			fprintf( stderr, "Failed to open %s\n", fname );
  195			return -1;
  196		}
  197	
  198	
  199		/* ¥¹¥Æ¥ì¥ª¤Ç¤Ê¤¤¾ì¹ç¤Ï¡¢º¸±¦¤Î¥Á¥ã¥ó¥Í¥ë¤Î¹çÀ®½èÍý¤¬½ÐÍè¤Ê¤¤¤¿¤á½ªÎ» */
  200		if ( in->channel != 2 ) {
  201			fprintf( stderr, "Specified WAVE file is not stereo.\n" );
  202			fclose( fp );
  203			return -1;
  204		}
  205	
  206	
  207		/* 16 ¥Ó¥Ã¥È¤Î¥Ç¡¼¥¿¤«¤É¤¦¤«³Îǧ */
  208		if ( in->bits != 16 ) {
  209			fprintf( stderr, "Specified WAVE file is not 16 bits data.\n" );
  210			fclose( fp );
  211			return -1;
  212		}
  213	
  214		data_len = in->len / 2;
  215		head_len = 18;
  216		wave_len = ( data_len + 8 ) + head_len + 12;
  217		byte_sec = in->rate * in->bits / 8;
  218		byte_dat = in->bits / 8;
  219	
  220	
  221		/* PCM ¥Ç¡¼¥¿¤ÎľÁ°¤Þ¤Ç¤Î¥Ç¡¼¥¿¤ò½ñ¤­¹þ¤à */
  222		fwrite( "RIFF", strlen( "RIFF" ), 1, fp );
  223		fwrite( &wave_len,    4, 1, fp );
  224		fwrite( "WAVE", strlen( "WAVE" ), 1, fp );
  225		fwrite( "fmt ", strlen( "fmt " ), 1, fp );
  226		fwrite( &head_len,    4, 1, fp );
  227		fwrite( &in->is_pcm,  2, 1, fp );
  228		fwrite( &channel,     2, 1, fp );
  229		fwrite( &in->rate,    4, 1, fp );
  230		fwrite( &byte_sec,    4, 1, fp );
  231		fwrite( &byte_dat,    2, 1, fp );
  232		fwrite( &in->bits,    2, 1, fp );
  233		tmpval = ( short )head_len;
  234		fwrite( &tmpval,      2, 1, fp );
  235		fwrite( "data", strlen( "data" ), 1, fp );
  236		fwrite( &data_len,    4, 1, fp );
  237	
  238	
  239		/* PCM ¥Ç¡¼¥¿¤ò¹çÀ®¤·¤Ê¤¬¤é½ñ¤­¹þ¤à */
  240		fflush( stdout );
  241		vocancel_progress( &processed, 0, in );
  242	
  243		while ( 1 ) {
  244			len = fread( ibuf, 1, BUFSIZE, in->fp );
  245	
  246			if ( len < BUFSIZE && ferror( in->fp ) ) {
  247				fprintf( stderr, "Error occured.\n" );
  248				fclose( fp );
  249				return -1;
  250			}
  251	
  252			for ( i = 0; i < len; i += 4 ) {
  253				memcpy( &in_l, &ibuf[i], 2 );
  254				memcpy( &in_r, &ibuf[i + 2], 2 );
  255	
  256				tmpval = in_l - in_r;
  257	
  258				if ( tmpval > 0 && tmpval > SHRT_MAX ) {
  259					out = SHRT_MAX;
  260				}
  261				else if ( tmpval < 0 && tmpval < SHRT_MIN ) {
  262					out = SHRT_MIN;
  263				}
  264				else {
  265					out = tmpval;
  266				}
  267	
  268				memcpy( &obuf[ i / 2 ], &out, 2 );
  269			}
  270	
  271			fwrite( &obuf, len / 2, 1, fp );
  272			vocancel_progress( &processed, len, in );
  273	
  274			if ( len < BUFSIZE ) {
  275				break;
  276			}
  277		}
  278	
  279		fclose( fp );
  280		return 0;
  281	}
  282	
  283	
  284	/*
  285	 * ¿ÊĽΨ¤Îɽ¼¨
  286	 */
  287	static void 
  288	vocancel_progress( int* processed, int current, WAVE* wave )
  289	{
  290		int progress;
  291	
  292		*processed += current;
  293		progress = (int)( ( ( double )*processed / ( double )wave->len ) * 100 );
  294		printf( "\r%3d%% processed.", progress );
  295		fflush( stdout );
  296	}
  297	
  298	
  299	/* End of vocancel.c */


¡û ¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤ÎÀâÌÀ

¤Ç¤Ï¡¢¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤Ë¤Ä¤¤¤ÆÀâÌÀ¤·¤Æ¤¤¤­¤Þ¤¹¡£

  • 11 ¹ÔÌÜ ¡Á 21 ¹ÔÌÜ

    WAVE ¹½Â¤ÂΤÎÄêµÁ¤Ë¤Ä¤¤¤Æ¤Ï¡¢LECTURE 10 WAVE ¥Õ¥¡¥¤¥ë¤òºÆÀ¸¤¹¤ë ¤ÈƱ¤¸¤Ç¤¹¡£

  • 24 ¡Á 27 ¹ÔÌÜ

    ÆâÉô´Ø¿ô¤Î¥×¥í¥È¥¿¥¤¥×Àë¸À¤Ç¤¹¡£vocancel_read_file() ¤ÇÆþÎÏ WAVE ¥Õ¥¡¥¤¥ë¤Î¥Ø¥Ã¥À¤òÆɤ߹þ¤ß¤Þ¤¹¡£ vocancel_mix_and_write() ¤Ç¡¢ÆþÎÏ WAVE ¥Õ¥¡¥¤¥ë¤Îº¸±¦¤Î¥Á¥ã¥ó¥Í¥ë¤ò¹çÀ®¤·¤Ä¤Ä½ÐÎÏ WAVE ¥Õ¥¡¥¤¥ë¤Ë¥Ç¡¼¥¿¤ò½ñ¤­¹þ¤ß¤Þ¤¹¡£vocancel_progress() ¤Ç WAVE ¥Õ¥¡¥¤¥ë½èÍýÃæ¤Ë¿ÊĽΨ¤òɽ¼¨¤·¤Þ¤¹¡£

  • 30 ¡Á 61 ¹ÔÌÜ ( main() )

    main() ´Ø¿ô¤Ç¤Ï¡¢¤Þ¤º vocancel_read_file() ¤Ç»ØÄꤵ¤ì¤¿ WAVE ¥Õ¥¡¥¤¥ë¤Î¾ðÊó¤òÆɤ߹þ¤ß¡¢WAVE ·¿ÊÑ¿ô¤ËÊݸ¤·¤Æ¤ª¤­¤Þ¤¹¡£

    ¼¡¤Ë vocancel_mix_and_write() ¤Ç¤Ï¡¢Æɤ߹þ¤ó¤À WAVE ¥Õ¥¡¥¤¥ë¤Î¾ðÊó¤ò»ÈÍѤ·¤Æ¡¢ ¥Ü¡¼¥«¥ë¥­¥ã¥ó¥»¥ë½èÍý¤·¤¿ WAVE ¥Ç¡¼¥¿¤ò½ÐÎÏ¥Õ¥¡¥¤¥ë¤Ë½ñ¤­¤³¤ß¤Þ¤¹¡£

  • 64 ¡Á 156 ¹ÔÌÜ ( vocancel_read_file() )

    WAVE ¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤ó¤Ç¡¢WAVE ·¿ÊÑ¿ô¤Ë¾ðÊó¤ò³ÊǼ¤¹¤ë´Ø¿ô¤Ç¤¹¡£LECTURE 10 WAVE ¥Õ¥¡¥¤¥ë¤òºÆÀ¸¤¹¤ë ¤ÈƱ¤¸¤Ç¤¹¡£

  • 159 ¹ÔÌÜ

    ÆþÎÏ¥Õ¥¡¥¤¥ë¤«¤é°ìÅÙ¤ËÆɤ߹þ¤ó¤Ç½èÍý¤¹¤ë¥Ç¡¼¥¿¥µ¥¤¥º¤òÄêµÁ¤·¤Æ¤¤¤Þ¤¹¡£

  • 161 ¡Á 281 ¹ÔÌÜ ( vocancel_mix_and_write() )

    ÆþÎÏ¥Õ¥¡¥¤¥ë¤«¤é¥Ç¡¼¥¿¤òÆɤ߹þ¤ß¡¢º¸±¦¤Î¥Á¥ã¥ó¥Í¥ë¤ò¹çÀ®¤·¤Æ¥â¥Î¥é¥ë¥Ç¡¼¥¿¤ò½ÐÎϤ¹¤ë´Ø¿ô¤Ç¤¹¡£

    • 167 ¡Á 176 ¹ÔÌÜ

      ½ÐÎÏ WAVE ¥Õ¥¡¥¤¥ë¤Î¥Ø¥Ã¥À¤ò½ñ¤­¹þ¤à¤¿¤á¤Ë»ÈÍѤ¹¤ëÊÑ¿ô¤òÀë¸À¤·¤Æ¤¤¤Þ¤¹¡£

    • 183 ¡Á 184 ¹ÔÌÜ

      ibuf ¤ËÆþÎÏ WAVE ¥Õ¥¡¥¤¥ë¤«¤éÆɤ߹þ¤ó¤À¥Ç¡¼¥¿¤ò³ÊǼ¤·¡¢obuf ¤Ë½ÐÎÏ WAVE ¥Õ¥¡¥¤¥ë¤Î¥Ç¡¼¥¿¤ò³ÊǼ¤·¤Þ¤¹¡£

    • 199 ¡Á 212 ¹ÔÌÜ

      ÆþÎÏ WAVE ¥Õ¥¡¥¤¥ë¤¬¡¢16¥Ó¥Ã¥È¥¹¥Æ¥ì¥ª¤«¤É¤¦¤«¤ò³Îǧ¤·¤Æ¤¤¤Þ¤¹¡£¤â¤· 16¥Ó¥Ã¥È¥¹¥Æ¥ì¥ª¤Ç¤Ê¤¤¾ì¹ç¤Ï¡¢ ¥¨¥é¡¼½ªÎ»¤·¤Þ¤¹¡£

    • 214 ¡Á 218 ¹ÔÌÜ

      ½ÐÎÏ WAVE ¥Õ¥¡¥¤¥ë¤Î¥Ø¥Ã¥À¹½ÃÛ¤ËɬÍפÊÃͤò·×»»¤·¤Æ¤¤¤Þ¤¹¡£data_len ¤Ï½ÐÎÏ WAVE ¥Õ¥¡¥¤¥ë¤Î PCM ¥Ç¡¼¥¿Ä¹¤Ç¤¢¤ê¡¢ ÆþÎÏ WAVE ¥Õ¥¡¥¤¥ë¤ÎȾʬ¤Ë¤Ê¤ê¤Þ¤¹ ( º¸±¦¤Î¥Á¥ã¥ó¥Í¥ë¤ò¹çÀ®¤¹¤ë¤¿¤á )¡£head_len ¤Ï WAVE ¥Õ¥¡¥¤¥ë¤ÎÀèƬ 20 ¥Ð¥¤¥È¤Ë³¤¯¥Ø¥Ã¥ÀÉô¤Î¥Ç¡¼¥¿Ä¹¤Ç¡¢wave_len ¤Ï WAVE ¥Õ¥¡¥¤¥ë¤«¤éÀèƬ 8 ¥Ð¥¤¥È¤ò½ü¤¤¤¿Éôʬ¤Î¥Ç¡¼¥¿Ä¹¤Ç¤¹¡£ byte_sec ¤Ï 1 Éô֤˻ÈÍѤ¹¤ë¥Ð¥¤¥È¿ô¤Ç¤¢¤ê¡¢¥µ¥ó¥×¥ê¥ó¥°¼þÇÈ¿ô * byte_dat ( 1¥µ¥ó¥×¥ë¤Î¥Ð¥¤¥È¿ô ) ¤Ç·×»»¤Ç¤­¤Þ¤¹¡£¤³¤ì¤é¤ÎÃͤϡ¢221 ¡Á 236 ¹ÔÌܤΠPCM ¥Ç¡¼¥¿Ä¾Á°¤Þ¤Ç¤Î¥Ç¡¼¥¿¤ò½ñ¤­¹þ¤àºÝ¤Ë»ÈÍѤ·¤Þ¤¹¡£

    • 221 ¡Á 236 ¹ÔÌÜ

      PCM ¥Ç¡¼¥¿Ä¾Á°¤Þ¤Ç¤Î¥Ç¡¼¥¿¤ò½ñ¤­¹þ¤ß¤Þ¤¹¡£LECTURE 10 WAVE ¥Õ¥¡¥¤¥ë¤òºÆÀ¸¤¹¤ë ¤Ë½ñ¤¤¤Æ¤¢¤ë WAVE ¥Õ¥¡¥¤¥ë¤Î·Á¼°¤ÈÈæ³Ó¤·¤Ê¤¬¤é¡¢¤É¤ÎÊÑ¿ô¤¬¤É¤¦¤¤¤¦¥Ç¡¼¥¿¤Ê¤Î¤«³Îǧ¤·¤Æ¤ß¤Æ²¼¤µ¤¤¡£

    • 243 ¡Á 277 ¹ÔÌÜ

      ½ÐÎϥǡ¼¥¿¤òºîÀ®¤¹¤ë while ¥ë¡¼¥×¤Ç¤¹¡£¤Þ¤º¡¢ÆþÎÏ WAVE ¥Õ¥¡¥¤¥ë¤«¤é°ìÄêĹ¤Î¥Ç¡¼¥¿¤ò¥Ð¥Ã¥Õ¥¡¤ËÆɤ߹þ¤ß¤Þ¤¹¡£ ¥Ð¥Ã¥Õ¥¡¤Î¥Ç¡¼¥¿¤«¤éº¸±¦¤Î¥Á¥ã¥ó¥Í¥ë¤ò 1 ¥µ¥ó¥×¥ë¤º¤Ä¼è¤ê½Ð¤·¡¢º¸¤Î¥µ¥ó¥×¥ëÃͤ«¤é±¦¤Î¥µ¥ó¥×¥ëÃͤò°ú¤¤¤¿Ãͤò ½ÐÎÏÍѥХåե¡¤Ë½ñ¤­¹þ¤ß¤Þ¤¹ ( ±¦¤Î¥µ¥ó¥×¥ëÃͤ«¤éº¸¤Î¥µ¥ó¥×¥ëÃͤò°ú¤¤¤Æ¤âÎɤ¤ )¡£¤½¤ÎºÝ¡¢Éä¹æÉÕ¤­ 16 ¥Ó¥Ã¥ÈÃͤÎÈϰϤò±Û¤¨¤Æ¤¤¤Ê¤¤¤«¤É¤¦¤«¥Á¥§¥Ã¥¯¤·¡¢±Û¤¨¤Æ¤¤¤ë¾ì¹ç¤Ï¸Â³¦ÃͤòÀßÄꤷ¤Þ¤¹¡£

      ÆþÎϥХåե¡¤ÎÁ´¥Ç¡¼¥¿¤ò½èÍý¤·¤¿¤È¤³¤í¤Ç¡¢½ÐÎϥХåե¡¤ÎÆâÍƤò¥Õ¥¡¥¤¥ë¤Ë½ñ¤­¹þ¤à¤È¶¦¤Ë¿ÊĽΨ¤Îɽ¼¨¤ò¹¹¿·¤·¤Þ¤¹¡£

  • 284 ¡Á 296 ¹ÔÌÜ ( vocancel_progress() )

    WAVE ¥Õ¥¡¥¤¥ë¤Î½èÍýÃæ¤Ë¡¢¥³¥ó¥½¡¼¥ë²èÌ̤˸½ºß¤Î¿ÊĽΨ¤òɽ¼¨¤·¤Þ¤¹¡£½èÍýÆâÍÆ¤Ï LECTURE 10 WAVE ¥Õ¥¡¥¤¥ë¤òºÆÀ¸¤¹¤ë ¤Î wave_progress() ¤ÈƱ¤¸¤Ç¤¹¡£


°Ê¾å¤Ç vocancel.c ¤ÎÀâÌÀ¤Ï½ª¤ï¤ê¤Ç¤¹¡£vocancel.c ¤ÎÊýË¡¤Ç¤Ïɬ¤º¥Ü¡¼¥«¥ë¤ò¥­¥ã¥ó¥»¥ë½ÐÍè¤ë¤ï¤±¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¤¬¡¢¤½¤ì¤Ç¤â¤¤¤í¤ó¤Ê¥Ç¡¼¥¿¤ÇÍ·¤ó¤Ç¤ß¤ë¤È·ë¹½ÌÌÇò¤¤¤È»×¤¤¤Þ¤¹¡£¤¼¤Ò»î¤·¤Æ¤ß¤Æ²¼¤µ¤¤¡£