|
¡û ¤Ï¤¸¤á¤Ë
/dev/mixer ¤Ï¤½¤Î̾¤ÎÄ̤ê¥ß¥¥µ¡¼µ¡Ç½¤òôÅö¤¹¤ë¥Ç¥Ð¥¤¥¹¤Ç¤¹¡£Æþ½ÐÎϲ»¸»¤Î¥Ü¥ê¥å¡¼¥à¤Î¾å¤²²¼¤²¤ò¹Ô¤Ã¤¿¤ê¡¢ÆþÎϲ»¸»¤òÁªÂò¤·¤¿¤ê¤¹¤ë¤Ë¤Ï /dev/mixer ¤òÁàºî¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹ ( ¤Á¤Ê¤ß¤Ë¤³¤³¤Ç¾Ò²ð¤¹¤ëÁàºî¤ò /dev/dsp ¤ËÂФ·¤Æ¹Ô¤Ã¤Æ¤âÀµ¤·¤¯Æ°ºî¤·¤Þ¤¹¡£/dev/dsp ¤ò»ÈÍѤ·¤Æ¤¤¤ëºÝ¤Ë¤ï¤¶¤ï¤¶ /dev/mixer ¤òÊÌ¤Ë open() ¤¹¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó )¡£
¤³¤³¤Ç¤Ï¡¢/dev/mixer ¤«¤é¤¤¤í¤¤¤í¤Ê¾ðÊó¤ò»²¾È¤¹¤ëÊýË¡¤Ë¤Ä¤¤¤ÆÀâÌÀ¤·¤Æ¤¤¤¤Þ¤¹¡£/dev/mixer ¤ËÂФ·¤Æ¥Ñ¥é¥á¡¼¥¿¤òÀßÄꤹ¤ëÊýË¡¤Ë¤Ä¤¤¤Æ¤Ï¡¢¼¡¤Î LECTURE ¤ÇÀâÌÀ¤·¤Þ¤¹¡£
¡û ¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à
/dev/mixer ¤Ç°·¤¦¤³¤È¤Î¤Ç¤¤ë¥Á¥ã¥ó¥Í¥ë¾ðÊ󡢤ª¤è¤Ó¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ëµ¡Ç½¾ðÊó¤ò¼èÆÀ¤·¤Æɽ¼¨¤¹¤ë¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à mixer_test.c ¤Ç¤¹¡£¤Ï¤¸¤á¤Ë ¤Î¥Ú¡¼¥¸¤«¤é¡¢Á´¤Æ¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤ò¸Ç¤á¤¿ tar ¥Ü¡¼¥ë¤ò¥À¥¦¥ó¥í¡¼¥É¤¹¤ë¤³¤È¤â¤Ç¤¤Þ¤¹¡£
gcc -o mixer_test mixer_test.c
¤È¤·¤Æ¥³¥ó¥Ñ¥¤¥ë¤·¤Þ¤¹¡£¥³¥ó¥Ñ¥¤¥ë¥ª¥×¥·¥ç¥ó¤Ï³Æ¼«¤Î´Ä¶¤Ê¤É¤Ë±þ¤¸¤Æ½¤Àµ¤·¤Æ²¼¤µ¤¤¡£¤Ê¤ª¡¢¼«Ê¬¤Î´Ä¶ ( AU8820B2 ¥Á¥Ã¥×¤Î¥µ¥¦¥ó¥É¥«¡¼¥É + Vortex of Sound Ä󶡤ΠLinux® Íѥɥ饤¥Ð¡£LECTURE 3 ¤Î dsptest.c ¤Î»þ¤È¤ÏÊѤï¤ê¤Þ¤·¤¿(^_^) ) ¤Ç¼Â¹Ô¤¹¤ë¤È°Ê²¼¤Îɽ¼¨¤Ë¤Ê¤ê¤Þ¤·¤¿¡£
Îó¤Î°ÕÌ£¤Ïº¸¤«¤é
- ¥Á¥ã¥ó¥Í¥ë̾¾Î
- ¥Á¥ã¥ó¥Í¥ë¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¤«
- ¸½ºß¤Î¥Á¥ã¥ó¥Í¥ë¤Î¥Ü¥ê¥å¡¼¥à¥ì¥Ù¥ë
- ¥Á¥ã¥ó¥Í¥ë¤¬Ï¿²»¸»¤È¤·¤Æ»ÈÍѤǤ¤ë¤«
- ¸½ºß¤ÎÏ¿²»¸»¤È¤·¤ÆÁªÂò¤µ¤ì¤Æ¤¤¤ë¤«
- ¥¹¥Æ¥ì¥ª¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¤«
¤È¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
Channel Support Channel Rec Current Stereo Name Level Source Input -------- ------- ------- ------ ------- ------ vol ¡û 80%,80% ¡û ¡ß ¡û bass ¡ß ¡ß ¡ß ¡ß treble ¡ß ¡ß ¡ß ¡ß synth ¡ß ¡ß ¡ß ¡ß pcm ¡û 80%,80% ¡ß ¡ß ¡û speaker ¡û 80% ¡ß ¡ß ¡ß line ¡û 80%,80% ¡û ¡ß ¡û mic ¡û 80% ¡û ¡û ¡ß cd ¡û 80%,80% ¡û ¡ß ¡û mix ¡ß ¡ß ¡ß ¡ß pcm2 ¡ß ¡ß ¡ß ¡ß rec ¡û 80%,80% ¡ß ¡ß ¡û igain ¡ß ¡ß ¡ß ¡ß ogain ¡û 80% ¡ß ¡ß ¡ß line1 ¡û 80%,80% ¡û ¡ß ¡û line2 ¡ß ¡ß ¡ß ¡ß line3 ¡ß ¡ß ¡ß ¡ß dig1 ¡ß ¡ß ¡ß ¡ß dig2 ¡ß ¡ß ¡ß ¡ß dig3 ¡ß ¡ß ¡ß ¡ß phin ¡û 80% ¡û ¡ß ¡ß phout ¡ß ¡û ¡ß ¡û video ¡û 80%,80% ¡û ¡ß ¡û radio ¡ß ¡ß ¡ß ¡ß monitor ¡ß ¡ß ¡ß ¡ß ### Rec Sources are EXCLUSIVE ###
--- mixer_test.c ---
1 #include <fcntl.h> 2 #include <linux/soundcard.h> 3 #include <stdio.h> 4 #include <sys/ioctl.h> 5 #include <unistd.h> 6 7 static int mixer_getinfo( int fd ); 8 static int mixer_getcaps( int fd ); 9 10 int 11 main( void ) 12 { 13 int fd; 14 15 if ( ( fd = open( "/dev/mixer", O_RDONLY ) ) == -1 ) { 16 perror( "open()" ); 17 return 1; 18 } 19 20 /* ¥Á¥ã¥ó¥Í¥ë¾ðÊó¤ò¼èÆÀ */ 21 if ( mixer_getinfo( fd ) == -1 ) { 22 perror( "mixer_getinfo() failed" ); 23 close( fd ); 24 return 1; 25 } 26 27 /* ¥ß¥¥µ¡¼µ¡Ç½¾ðÊó(¤¢¤¤¤Þ¤¤¤Ç¤¹¤¬)¤ò¼èÆÀ */ 28 if ( mixer_getcaps( fd ) == -1 ) { 29 perror( "mixer_getcaps() failed" ); 30 close( fd ); 31 return 1; 32 } 33 34 close( fd ); 35 return 0; 36 } 37 38 39 /* 40 * /dev/mixer ¤«¤é¥Á¥ã¥ó¥Í¥ë¾ðÊó¤ò¼èÆÀ 41 */ 42 static int 43 mixer_getinfo( int fd ) 44 { 45 int devmask, recmask; 46 int recsrc; 47 int stereodevs; 48 int level; 49 int i; 50 51 /* soundcard.h ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë¥Á¥ã¥ó¥Í¥ë̾¾Î */ 52 const char* sound_device_names[] = SOUND_DEVICE_NAMES; 53 54 55 /* ¥ß¥¥µ¡¼¤¬¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¥Á¥ã¥ó¥Í¥ë¾ðÊó¤ò¼èÆÀ */ 56 if ( ioctl( fd, SOUND_MIXER_READ_DEVMASK, &devmask ) == -1 ) { 57 perror( "ioctl( SOUND_MIXER_READ_DEVMASK )" ); 58 return -1; 59 } 60 61 /* Ï¿²»¸»¤È¤·¤Æ»È¤¨¤ë¥Á¥ã¥ó¥Í¥ë¾ðÊó¤ò¼èÆÀ */ 62 if ( ioctl( fd, SOUND_MIXER_READ_RECMASK, &recmask ) == -1 ) { 63 perror( "ioctl( SOUND_MIXER_READ_RECMASK )" ); 64 return -1; 65 } 66 67 /* ¸½ºßÏ¿²»¸»¤È¤·¤ÆÁªÂò¤µ¤ì¤Æ¤¤¤ë¥Á¥ã¥ó¥Í¥ë¾ðÊó¤ò¼èÆÀ */ 68 if ( ioctl( fd, SOUND_MIXER_READ_RECSRC, &recsrc ) == -1 ) { 69 perror( "ioctl( SOUND_MIXER_READ_RECSRC )" ); 70 return -1; 71 } 72 73 /* ¥Á¥ã¥ó¥Í¥ë¤¬¥¹¥Æ¥ì¥ª¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¤«¤É¤¦¤«¤ò¼èÆÀ */ 74 if ( ioctl( fd, SOUND_MIXER_READ_STEREODEVS, &stereodevs ) == -1 ) { 75 perror( "ioctl( SOUND_MIXER_READ_STEREODEVS )" ); 76 return -1; 77 } 78 79 printf("\n" ); 80 printf("Channel Support Channel Rec Current Stereo\n"); 81 printf("Name Level Source Input \n"); 82 printf("-------- ------- ------- ------ ------- ------\n"); 83 84 85 /* ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¥Á¥ã¥ó¥Í¥ë¤Î¿ô¤À¤±¥ë¡¼¥× */ 86 for ( i = 0; i < SOUND_MIXER_NRDEVICES; i ++ ) { 87 /* ¥Á¥ã¥ó¥Í¥ë̾¾Î */ 88 printf( "%-8s ", sound_device_names[i] ); 89 90 /* ¥Á¥ã¥ó¥Í¥ë¤Î¥µ¥Ý¡¼¥È¾õ¶· */ 91 ( devmask & ( 1 << i ) ) ? 92 printf( "¡û " ) : printf( "¡ß " ); 93 94 95 if ( ( devmask & ( 1 << i ) ) ) { 96 /* ¥Á¥ã¥ó¥Í¥ë¤Î¥Ü¥ê¥å¡¼¥à¤ò¼èÆÀ */ 97 if ( ioctl( fd, MIXER_READ( i ), &level ) == -1 ) { 98 perror( "ioctl(MIXER_READ())" ); 99 return -1; 100 } 101 102 if ( stereodevs & ( 1 << i ) ) { 103 /* ¥¹¥Æ¥ì¥ª¤Î¾ì¹ç¤Ï²¼°Ì8¥Ó¥Ã¥È¤¬º¸¡¢¾å°Ì8¥Ó¥Ã¥È¤¬±¦ */ 104 printf( "%d%%,%d%% ", 105 level & 0xff, ( level & 0xff00 ) >> 8 ); 106 } 107 else { 108 /* ¥â¥Î¥é¥ë */ 109 printf( "%d%% ", level & 0xff ); 110 } 111 } 112 else { 113 printf( " " ); 114 } 115 116 117 /* Ï¿²»¸»¤È¤·¤Æ»È¤¨¤ë¤«¡¢¸½ºß¤ÎÏ¿²»¸»¤«¡¢¥¹¥Æ¥ì¥ª¤« */ 118 ( recmask & ( 1 << i ) ) ? 119 printf( "¡û " ) : printf( "¡ß " ); 120 121 ( recsrc & ( 1 << i ) ) ? 122 printf( "¡û " ) : printf( "¡ß " ); 123 124 ( stereodevs & ( 1 << i ) ) ? 125 printf( "¡û" ) : printf( "¡ß" ); 126 127 printf( "\n" ); 128 } 129 130 return 0; 131 } 132 133 134 /* 135 * ¥µ¥¦¥ó¥É¥«¡¼¥É¤Î¥ß¥¥µ¡¼µ¡Ç½¤Ë¤Ä¤¤¤Æ¤Î¾ðÊó¤ò¼èÆÀ¡£ 136 * ËÜ¥×¥í¥°¥é¥àºîÀ®»þÅÀ¤Ç¤Ï¡¢Ï¿²»¸»¤ÎÊ£¿ôƱ»þ»ÈÍѲÄÈݾðÊó¤Î¤ß¡£ 137 */ 138 static int 139 mixer_getcaps( int fd ) 140 { 141 int caps; 142 143 /* ¥µ¥¦¥ó¥É¥«¡¼¥É¤Î¥ß¥¥µ¡¼µ¡Ç½¾ðÊó¤ò¼èÆÀ */ 144 if ( ioctl( fd, SOUND_MIXER_READ_CAPS, &caps ) == -1 ) { 145 perror( "SOUND_MIXER_READ_CAPS" ); 146 return -1; 147 } 148 149 printf( "\n" ); 150 151 152 /* Ï¿²»¸»¤òÊ£¿ôƱ»þ¤Ë»ÈÍѲÄǽ¤« */ 153 ( caps & SOUND_CAP_EXCL_INPUT ) ? 154 printf( "### Rec Sources are EXCLUSIVE ###\n" ) : 155 printf( "### Rec Sources are NOT EXCLUSIVE ###\n" ); 156 157 printf( "\n" ); 158 159 return 0; 160 } 161 162 /* End of mixer_test.c */
¡û ¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤ÎÀâÌÀ
¤Ç¤Ï¡¢¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤Ë¤Ä¤¤¤ÆÀâÌÀ¤·¤Æ¤¤¤¤Þ¤¹¡£
- 10 ¡Á 36 ¹ÔÌÜ ( main() )
main() ´Ø¿ô¤Ç¤Ï¡¢³Æ¼ï¤Î¾ðÊó¤ò¼èÆÀ¤¹¤ë¤¿¤á¤Î¼«ºî´Ø¿ô¤ò¼Â¹Ô¤·¤Æ¤¤¤ë¤À¤±¤Ç¤¹¡£ ¼«ºî´Ø¿ô¤Ë¤Ä¤¤¤Æ¤³¤ì¤«¤éÀâÌÀ¤·¤Æ¤¤¤¤Þ¤¹¡£
- 39 ¡Á 131 ¹ÔÌÜ ( mixer_getinfo() )
mixer_getinfo() ¤Ï¡¢/dev/mixer ¤¬¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ëÆþ½ÐÎÏ¥Á¥ã¥ó¥Í¥ë¡¢ Ï¿²»¸»¤È¤·¤Æ»È¤¨¤ë¥Á¥ã¥ó¥Í¥ë¡¢¸½ºß¤ÎÏ¿²»¸»¡¢¥Á¥ã¥ó¥Í¥ë¤¬¥¹¥Æ¥ì¥ª²»¤ò°·¤¨¤ë¤«¤É¤¦¤« ¤Ê¤É¤Î¾ðÊó¤ò¼èÆÀ¤¹¤ë¤¿¤á¤Î´Ø¿ô¤Ç¤¹¡£
- 51 ¡Á 52 ¹ÔÌÜ
SOUND_DEVICE_NAMES ¤Ï¡¢¥ß¥¥µ¡¼¤Ç°·¤¦¤³¤È¤Î¤Ç¤¤ë¥Á¥ã¥ó¥Í¥ë¤Î̾¾Î¤ÎÇÛÎó¤È¤·¤Æ <linux/soundcard.h> ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¤Þ¤¿¡¢»÷¤¿¤è¤¦¤ÊÆâÍÆ¤Ç SOUND_DEVICE_LABELS ¤È¤¤¤¦¥Þ¥¯¥í¤âÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
#define SOUND_DEVICE_LABELS {"Vol ", "Bass", "Treb1", ... ¾Êά } #define SOUND_DEVICE_NAMES {"vol", "bass", "treble", ... ¾Êά }
¤Á¤Ê¤ß¤Ë²¿¤Î¤¿¤á¤Ëʬ¤«¤ì¤Æ¤¤¤ë¤Î¤«Îɤ¯Ê¬¤«¤ê¤Þ¤»¤ó m(__)m¡£¤³¤Î¥Þ¥¯¥í¤Ë¤è¤Ã¤ÆÆÀ¤é¤ì¤ëÇÛÎó¤ÎÍ×ÁÇ¿ô¤Ï¡¢SOUND_MIXER_NRDEVICES ¤È¤·¤ÆÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤é¤Ï¸åÄø¥Á¥ã¥ó¥Í¥ë̾¾Î¤òɽ¼¨¤¹¤ëºÝ¤Ë»ÈÍѤ·¤Þ¤¹¡£ ¤Ê¤ª¡¢²¼µ¤ÎÄê¿ô¤¬³Æ¥Á¥ã¥ó¥Í¥ë¤òɽ¤¹Åº»ú¤ËÂбþ¤·¤Æ¤¤¤Þ¤¹¡£
²¼µ¤Î¥Á¥ã¥ó¥Í¥ë¤ÎÃæ¤Ë¤ÏËͤâÎɤ¯Ê¬¤«¤Ã¤Æ¤¤¤Ê¤¤¤â¤Î¤â¤¢¤ê¤Þ¤¹¡£ ¤¬¡¢°ì±þËͤδĶ²¼( <linux/soundcard.h> Æâ¤Î SOUND_VERSION ¤Ë¤è¤ë¤È OSS 3.8.2 ¤ÎÍͤǤ¹ )¤Ç¥µ¥¦¥ó¥É¥·¥¹¥Æ¥à¤È¤·¤Æ¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¤â¤Î¤Î°ìÍ÷¤È¤·¤Æ ½ñ¤¤¤Æ¤ª¤¤Þ¤¹¡£
Äê¿ô̾ ¥Á¥ã¥ó¥Í¥ë SOUND_MIXER_VOLUME ¥á¥¤¥ó¥Ü¥ê¥å¡¼¥à SOUND_MIXER_BASS Äã²»°è SOUND_MIXER_TREBLE ¹â²»°è SOUND_MIXER_SYNTH FM ¥·¥ó¥»¥µ¥¤¥¶ SOUND_MIXER_PCM D/A ÊÑ´¹´ï SOUND_MIXER_SPEAKER PC ¥¹¥Ô¡¼¥«½ÐÎÏ SOUND_MIXER_LINE ¥é¥¤¥óÆþÎÏ SOUND_MIXER_MIC ¥Þ¥¤¥¯ÆþÎÏ SOUND_MIXER_CD CD ÆþÎÏ SOUND_MIXER_IMIX Ï¿²»¸»¤«¤é¤ÎºÆÀ¸¥Ü¥ê¥å¡¼¥à SOUND_MIXER_ALTPCM Âè 2 D/A ÊÑ´¹´ï SOUND_MIXER_RECLEV ¥á¥¤¥óÏ¿²»¥ì¥Ù¥ë SOUND_MIXER_IGAIN ÆþÎÏ¥²¥¤¥ó SOUND_MIXER_OGAIN ½ÐÎÏ¥²¥¤¥ó SOUND_MIXER_LINE1 ¥«¡¼¥ÉÀìÍÑÆþÎϸ» 1 SOUND_MIXER_LINE2 ¥«¡¼¥ÉÀìÍÑÆþÎϸ» 2 SOUND_MIXER_LINE3 ¥«¡¼¥ÉÀìÍÑÆþÎϸ» 3 SOUND_MIXER_DIGITAL1 ¥Ç¥¸¥¿¥ëÆþÎÏ 1 SOUND_MIXER_DIGITAL2 ¥Ç¥¸¥¿¥ëÆþÎÏ 2 SOUND_MIXER_DIGITAL3 ¥Ç¥¸¥¿¥ëÆþÎÏ 3 SOUND_MIXER_PHONEIN PHONE ÆþÎÏ SOUND_MIXER_PHONEOUT PHONE ½ÐÎÏ SOUND_MIXER_VIDEO ¥Ó¥Ç¥ª / TV (²»À¼) ÆþÎÏ SOUND_MIXER_RADIO ¥é¥¸¥ªÆþÎÏ SOUND_MIXER_MONITOR ¥â¥Ë¥¿¡¼¤Î¥Ü¥ê¥å¡¼¥à ºÇ¸å¤Î "¥â¥Ë¥¿¡¼" ¤Ã¤Æ²¿¤Ç¤·¤ç¤¦¡©(ʬ¤«¤ê¤Þ¤»¤ó m(__)m)
- 55 ¡Á 59 ¹ÔÌÜ
/dev/mixer ¤¬¤É¤Î¥Á¥ã¥ó¥Í¥ë¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¤Î¤«¤Ë¤Ä¤¤¤Æ¤Î¾ðÊó¤ò¼èÆÀ¤·¤Æ¤¤¤Þ¤¹¡£ ioctl() ¤ÎÂè 2 °ú¿ô¤Ë SOUND_MIXER_READ_DEVMASK ¤â¤·¤¯¤Ï MIXER_READ( SOUND_MIXER_DEVMASK ) ¤òÀßÄꤷ¤Þ¤¹ ( SOUND_MIXER_READ_DEVMASK ¤Ï MIXER_READ( SOUND_MIXER_DEVMASK ) ¤Î¥¨¥¤¥ê¥¢¥¹ )¡£
ioctl() ¤ò¼Â¹Ô¤¹¤ë¤È¡¢Âè 3 °ú¿ô¤ËÀßÄꤷ¤¿ÊÑ¿ô¤Ë¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¥Á¥ã¥ó¥Í¥ë¤Î ¥Ó¥Ã¥È¥Þ¥¹¥¯¤¬ÀßÄꤵ¤ì¤Þ¤¹¡£
int mask; ioctl( fd, SOUND_MIXER_READ_DEVMASK, &mask );
¤³¤Î¥Ó¥Ã¥È¥Þ¥¹¥¯¤È²¼µ¤Î¥Á¥ã¥ó¥Í¥ëËè¤Î¥Þ¥¹¥¯¤òɽ¤¹Äê¿ô¤Î AND ¤ò¹Ô¤Ã¤¿·ë²Ì¤¬ 1 ¤Ç¤¢¤ì¤Ð¡¢¤½¤Î¥Á¥ã¥ó¥Í¥ë¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¤È¤¤¤¦¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£
Äê¿ô̾ ¥Á¥ã¥ó¥Í¥ë SOUND_MIXER_...¤ò»È¤Ã¤¿ÊÌɽ¸½ SOUND_MASK_VOLUME ¥á¥¤¥ó¥Ü¥ê¥å¡¼¥à ( 1 << SOUND_MIXER_VOLUME ) SOUND_MASK_BASS Äã²»°è ( 1 << SOUND_MIXER_BASS ) SOUND_MASK_TREBLE ¹â²»°è ( 1 << SOUND_MIXER_TREBLE ) SOUND_MASK_SYNTH FM ¥·¥ó¥»¥µ¥¤¥¶ ( 1 << SOUND_MIXER_SYNTH ) SOUND_MASK_PCM D/A ÊÑ´¹´ï ( 1 << SOUND_MIXER_PCM ) SOUND_MASK_SPEAKER PC ¥¹¥Ô¡¼¥«½ÐÎÏ ( 1 << SOUND_MIXER_SPEAKER ) SOUND_MASK_LINE ¥é¥¤¥óÆþÎÏ ( 1 << SOUND_MIXER_LINE ) SOUND_MASK_MIC ¥Þ¥¤¥¯ÆþÎÏ ( 1 << SOUND_MIXER_MIC ) SOUND_MASK_CD CD ÆþÎÏ ( 1 << SOUND_MIXER_CD ) SOUND_MASK_IMIX Ï¿²»¸»¤«¤é¤ÎºÆÀ¸¥Ü¥ê¥å¡¼¥à ( 1 << SOUND_MIXER_IMIX ) SOUND_MASK_ALTPCM Âè 2 D/A ÊÑ´¹´ï ( 1 << SOUND_MIXER_ALTPCM ) SOUND_MASK_RECLEV ¥á¥¤¥óÏ¿²»¥ì¥Ù¥ë ( 1 << SOUND_MIXER_RECLEV ) SOUND_MASK_IGAIN ÆþÎÏ¥²¥¤¥ó ( 1 << SOUND_MIXER_IGAIN ) SOUND_MASK_OGAIN ½ÐÎÏ¥²¥¤¥ó ( 1 << SOUND_MIXER_OGAIN ) SOUND_MASK_LINE1 ¥«¡¼¥ÉÀìÍÑÆþÎϸ» 1 ( 1 << SOUND_MIXER_LINE1 ) SOUND_MASK_LINE2 ¥«¡¼¥ÉÀìÍÑÆþÎϸ» 2 ( 1 << SOUND_MIXER_LINE2 ) SOUND_MASK_LINE3 ¥«¡¼¥ÉÀìÍÑÆþÎϸ» 3 ( 1 << SOUND_MIXER_LINE3 ) SOUND_MASK_DIGITAL1 ¥Ç¥¸¥¿¥ëÆþÎÏ 1 ( 1 << SOUND_MIXER_DIGITAL1 ) SOUND_MASK_DIGITAL2 ¥Ç¥¸¥¿¥ëÆþÎÏ 2 ( 1 << SOUND_MIXER_DIGITAL2 ) SOUND_MASK_DIGITAL3 ¥Ç¥¸¥¿¥ëÆþÎÏ 3 ( 1 << SOUND_MIXER_DIGITAL3 ) SOUND_MASK_PHONEIN PHONE ÆþÎÏ ( 1 << SOUND_MIXER_PHONEIN ) SOUND_MASK_PHONEOUT PHONE ½ÐÎÏ ( 1 << SOUND_MIXER_PHONEOUT ) SOUND_MASK_VIDEO ¥Ó¥Ç¥ª / TV (²»À¼) ÆþÎÏ ( 1 << SOUND_MIXER_RADIO ) SOUND_MASK_RADIO ¥é¥¸¥ªÆþÎÏ ( 1 << SOUND_MIXER_VIDEO ) SOUND_MASK_MONITOR ¥â¥Ë¥¿¡¼¤Î¥Ü¥ê¥å¡¼¥à ( 1 << SOUND_MIXER_MONITOR )
- 61 ¡Á 65 ¹ÔÌÜ
/dev/mixer ¤¬¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¥Á¥ã¥ó¥Í¥ë¤Î¤¦¤Á¡¢¤É¤Î¥Á¥ã¥ó¥Í¥ë¤¬Ï¿²»¸»¤È¤·¤Æ »ÈÍѤǤ¤ë¤Î¤«¤Ë¤Ä¤¤¤Æ¤Î¾ðÊó¤ò¼èÆÀ¤·¤Æ¤¤¤Þ¤¹¡£ioctl() ¤ÎÂè 2 °ú¿ô¤Ë SOUND_MIXER_READ_RECMASK ¤â¤·¤¯¤Ï MIXER_READ( SOUND_MIXER_RECMASK ) ¤òÀßÄꤷ¤Þ¤¹ ( SOUND_MIXER_READ_RECMASK ¤Ï MIXER_READ( SOUND_MIXER_RECMASK ) ¤Î¥¨¥¤¥ê¥¢¥¹ )¡£
ioctl() ¤ò¼Â¹Ô¤¹¤ë¤È¡¢Âè 3 °ú¿ô¤ËÀßÄꤷ¤¿ÊÑ¿ô¤Ë¡¢Ï¿²»¸»¤È¤·¤Æ»ÈÍѤǤ¤ë ¥Á¥ã¥ó¥Í¥ë¤Î¥Ó¥Ã¥È¥Þ¥¹¥¯¤¬ÀßÄꤵ¤ì¤Þ¤¹¡£
int mask; ioctl( fd, SOUND_MIXER_READ_RECMASK, &mask );
¤³¤Î¥Ó¥Ã¥È¥Þ¥¹¥¯¤ÈÀèÄø¤Î¥Þ¥¹¥¯Äê¿ô¤Î AND ¤ò¹Ô¤Ã¤¿·ë²Ì¤¬ 1 ¤Ç¤¢¤ì¤Ð¡¢¤½¤Î¥Á¥ã¥ó¥Í¥ë¤ÏÏ¿²»¸»¤È¤·¤Æ»È¤¨¤ë¤È¤¤¤¦¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£
- 67 ¡Á 71 ¹ÔÌÜ
¸½ºßÏ¿²»¸»¤È¤·¤ÆÁªÂò¤µ¤ì¤Æ¤¤¤ë¥Á¥ã¥ó¥Í¥ë¤Ï¤É¤ì¤Ê¤Î¤«¤Ë¤Ä¤¤¤Æ¤Î¾ðÊó¤ò¼èÆÀ¤·¤Æ¤¤¤Þ¤¹¡£ ioctl() ¤ÎÂè 2 °ú¿ô¤Ë SOUND_MIXER_READ_RECSRC ¤â¤·¤¯¤Ï MIXER_READ( SOUND_MIXER_RECSRC ) ¤òÀßÄꤷ¤Þ¤¹ ( SOUND_MIXER_READ_RECSRC ¤Ï MIXER_READ( SOUND_MIXER_RECSRC ) ¤Î¥¨¥¤¥ê¥¢¥¹ )¡£
ioctl() ¤ò¼Â¹Ô¤¹¤ë¤È¡¢Âè 3 °ú¿ô¤ËÀßÄꤷ¤¿ÊÑ¿ô¤Ë¸½ºßÏ¿²»¸»¤È¤·¤ÆÁªÂò¤µ¤ì¤Æ¤¤¤ë ¥Á¥ã¥ó¥Í¥ë¤Î¥Ó¥Ã¥È¥Þ¥¹¥¯¤¬ÀßÄꤵ¤ì¤Þ¤¹¡£
int mask; ioctl( fd, SOUND_MIXER_READ_RECSRC, &mask );
¤³¤Î¥Ó¥Ã¥È¥Þ¥¹¥¯¤ÈÀèÄø¤Î¥Þ¥¹¥¯Äê¿ô¤Î AND ¤ò¹Ô¤Ã¤¿·ë²Ì¤¬ 1 ¤Ç¤¢¤ì¤Ð¡¢¤½¤Î¥Á¥ã¥ó¥Í¥ë¤ÏÏ¿²»¸»¤È¤·¤ÆÁªÂò¤µ¤ì¤Æ¤¤¤ë¤È¤¤¤¦¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£
- 73 ¡Á 77 ¹ÔÌÜ
³Æ¥Á¥ã¥ó¥Í¥ë¤¬¥¹¥Æ¥ì¥ª¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¤«¤É¤¦¤«¤Ë¤Ä¤¤¤Æ¤Î¾ðÊó¤ò¼èÆÀ¤·¤Æ¤¤¤Þ¤¹¡£ ioctl() ¤ÎÂè 2 °ú¿ô¤Ë SOUND_MIXER_READ_STEREODEVS ¤â¤·¤¯¤Ï MIXER_READ( SOUND_MIXER_STEREODEVS ) ¤òÀßÄꤷ¤Þ¤¹ ( SOUND_MIXER_READ_STEREODEVS ¤Ï MIXER_READ( SOUND_MIXER_STEREODEVS ) ¤Î¥¨¥¤¥ê¥¢¥¹ )¡£
ioctl() ¤ò¼Â¹Ô¤¹¤ë¤È¡¢Âè 3 °ú¿ô¤ËÀßÄꤷ¤¿ÊÑ¿ô¤Ë¥¹¥Æ¥ì¥ª¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë ¥Á¥ã¥ó¥Í¥ë¤Î¥Ó¥Ã¥È¥Þ¥¹¥¯¤¬ÀßÄꤵ¤ì¤Þ¤¹¡£
int mask; ioctl( fd, SOUND_MIXER_READ_STEREODEVS, &mask );
¤³¤Î¥Ó¥Ã¥È¥Þ¥¹¥¯¤ÈÀèÄø¤Î¥Þ¥¹¥¯Äê¿ô¤Î AND ¤ò¹Ô¤Ã¤¿·ë²Ì¤¬ 1 ¤Ç¤¢¤ì¤Ð¡¢¤½¤Î¥Á¥ã¥ó¥Í¥ë¤Ï¥¹¥Æ¥ì¥ª¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¤È¤¤¤¦¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£
- 79 ¡Á 128 ¹ÔÌÜ
¤³¤³¤Þ¤Ç¤Ë¼èÆÀ¤·¤¿¾ðÊó¤Îɽ¼¨½èÍý¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£¤Û¤È¤ó¤É¤Î²Õ½ê¤Ï ÆÀ¤é¤ì¤¿¥Ó¥Ã¥È¥Þ¥¹¥¯¤ò¥Á¥§¥Ã¥¯¤·¤Æ¤¤¤ë¤À¤±¤Ç¤¹¤¬¡¢96 ¡Á 100 ¹ÔÌܤǤϥµ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¥Á¥ã¥ó¥Í¥ë¤Î¥²¥¤¥ó¥ì¥Ù¥ë¤ò¼èÆÀ¤¹¤ë¤¿¤á¤Ë¿·¤¿¤Ê ioctl() ¤òȯ¹Ô¤·¤Æ¤¤¤Þ¤¹¡£
ioctl() ¤ÎÂè 2 °ú¿ô¤Ë¥²¥¤¥ó¥ì¥Ù¥ë¤òÆɤߤ¿¤¤¥Á¥ã¥ó¥Í¥ë¤Ë±þ¤¸¤¿Äê¿ô¤òÀßÄꤷ¤Þ¤¹¡£ °Ê²¼¤Ë¤½¤Î°ìÍ÷¤ò¼¨¤·¤Þ¤¹¡£
Äê¿ô̾ ¥Á¥ã¥ó¥Í¥ë MIXER_READ ¤ò»È¤Ã¤¿É½¸½ SOUND_MIXER_READ_VOLUME ¥á¥¤¥ó¥Ü¥ê¥å¡¼¥à MIXER_READ( SOUND_MIXER_VOLUME ) SOUND_MIXER_READ_BASS Äã²»°è MIXER_READ( SOUND_MIXER_BASS ) SOUND_MIXER_READ_TREBLE ¹â²»°è MIXER_READ( SOUND_MIXER_TREBLE ) SOUND_MIXER_READ_SYNTH FM ¥·¥ó¥»¥µ¥¤¥¶ MIXER_READ( SOUND_MIXER_SYNTH ) SOUND_MIXER_READ_PCM D/A ÊÑ´¹´ï MIXER_READ( SOUND_MIXER_PCM ) SOUND_MIXER_READ_SPEAKER PC ¥¹¥Ô¡¼¥«½ÐÎÏ MIXER_READ( SOUND_MIXER_SPEAKER ) SOUND_MIXER_READ_LINE ¥é¥¤¥óÆþÎÏ MIXER_READ( SOUND_MIXER_LINE ) SOUND_MIXER_READ_MIC ¥Þ¥¤¥¯ÆþÎÏ MIXER_READ( SOUND_MIXER_MIC ) SOUND_MIXER_READ_CD CD ÆþÎÏ MIXER_READ( SOUND_MIXER_CD ) SOUND_MIXER_READ_IMIX Ï¿²»¸»¤«¤é¤ÎºÆÀ¸¥Ü¥ê¥å¡¼¥à MIXER_READ( SOUND_MIXER_IMIX ) SOUND_MIXER_READ_ALTPCM Âè 2 D/A ÊÑ´¹´ï MIXER_READ( SOUND_MIXER_ALTPCM ) SOUND_MIXER_READ_RECLEV ¥á¥¤¥óÏ¿²»¥ì¥Ù¥ë MIXER_READ( SOUND_MIXER_RECLEV ) SOUND_MIXER_READ_IGAIN ÆþÎÏ¥²¥¤¥ó MIXER_READ( SOUND_MIXER_IGAIN ) SOUND_MIXER_READ_OGAIN ½ÐÎÏ¥²¥¤¥ó MIXER_READ( SOUND_MIXER_OGAIN ) SOUND_MIXER_READ_LINE1 ¥«¡¼¥ÉÀìÍÑÆþÎϸ» 1 MIXER_READ( SOUND_MIXER_LINE1 ) SOUND_MIXER_READ_LINE2 ¥«¡¼¥ÉÀìÍÑÆþÎϸ» 2 MIXER_READ( SOUND_MIXER_LINE2 ) SOUND_MIXER_READ_LINE3 ¥«¡¼¥ÉÀìÍÑÆþÎϸ» 3 MIXER_READ( SOUND_MIXER_LINE3 ) ¤³¤Î¾¤Î¥Á¥ã¥ó¥Í¥ë¤Ë´Ø¤·¤Æ¤Ï¡¢ËͤδĶ²¼¤Ç¤ÏÄê¿ô¤¬¤¢¤ê¤Þ¤»¤ó¤Ç¤·¤¿¡£
ioctl() ¤ò¼Â¹Ô¤¹¤ë¤È¡¢Âè 3 °ú¿ô¤ËÀßÄꤷ¤¿ÊÑ¿ô¤Ë»ØÄꤷ¤¿¥Á¥ã¥ó¥Í¥ë¤Î ¥²¥¤¥ó¥ì¥Ù¥ë¤¬ÀßÄꤵ¤ì¤Þ¤¹¡£
int level; ioctl( fd, SOUND_MIXER_READ_XXX, &level );
¥Á¥ã¥ó¥Í¥ë¤¬¥¹¥Æ¥ì¥ª¤ò¥µ¥Ý¡¼¥È¤¹¤ë¾ì¹ç¤Ï¡¢level ¤Î²¼°Ì 8 ¥Ó¥Ã¥È¤¬º¸¥Á¥ã¥ó¥Í¥ë¤Î ¥²¥¤¥ó¥ì¥Ù¥ë¡¢¾å°Ì 8 ¥Ó¥Ã¥È¤¬±¦¥Á¥ã¥ó¥Í¥ë¤Î¥²¥¤¥ó¥ì¥Ù¥ë¤Ë¤Ê¤ê¤Þ¤¹¡£¥â¥Î¥é¥ë¤Î¾ì¹ç¤Ï ²¼°Ì 8 ¥Ó¥Ã¥È¤¬¥²¥¤¥ó¥ì¥Ù¥ë¤Ë¤Ê¤ê¤Þ¤¹¡£¤¤¤º¤ì¤Î¾ì¹ç¤â¡¢¥²¥¤¥ó¥ì¥Ù¥ë¤Ï 0 ¡Á 100 ¤ÎÃͤȤʤê¤Þ¤¹( 102 ¡Á 110 ¹Ô»²¾È )¡£
- 134 ¡Á 160 ¹ÔÌÜ ( mixer_getcaps() )
mixer_getcaps() ¤Ï¡¢mixer_getinfo() ¤ÇÆÀ¤é¤ì¤ë¥Á¥ã¥ó¥Í¥ëËè¤Î¾ðÊó¤Î¾¤Î ¥ß¥¥µ¡¼µ¡Ç½¤Ë´Ø¤¹¤ë¾ðÊó¤ò¼èÆÀ¤¹¤ë´Ø¿ô¤Ç¤¹¡£
- 143 ¡Á 147 ¹ÔÌÜ
¥ß¥¥µ¡¼µ¡Ç½¤Î¾ðÊó¤ò ioctl() ¤Ç¼èÆÀ¤·¤Æ¤¤¤Þ¤¹¡£ioctl() ¤ÎÂè 2 °ú¿ô¤Ë SOUND_MIXER_READ_CAPS ¤â¤·¤¯¤Ï MIXER_READ( SOUND_MIXER_CAPS ) ¤òÀßÄꤷ¤Þ¤¹ ( SOUND_MIXER_READ_CAPS ¤Ï MIXER_READ( SOUND_MIXER_CAPS ) ¤Î¥¨¥¤¥ê¥¢¥¹ )¡£
ioctl() ¤ò¼Â¹Ô¤¹¤ë¤È¡¢ Âè 3 °ú¿ô¤ËÀßÄꤷ¤¿ÊÑ¿ô¤Ëµ¡Ç½¤òɽ¤¹¥Ó¥Ã¥È¥Þ¥¹¥¯¤¬ÀßÄꤵ¤ì¤Þ¤¹¡£
int caps; ioctl( fd, SOUND_MIXER_READ_CAPS, &caps );
OSS 3.8.2 ¤Ç¤Ï¡¢SOUND_MIXER_READ_CAPS ¤ÇÄ´¤Ù¤é¤ì¤ëµ¡Ç½¤Ï°ì¤Ä¤Î¤ß¤ÎÍͤǤ¹¡£ Ê£¿ô¤ÎÏ¿²»¸»¤òƱ»þ¤ËÁªÂò²Äǽ¤«¤É¤¦¤«¤È¤¤¤¦¤â¤Î¤Ç¡¢SOUND_CAP_EXCL_INPUT ¤È cap ¤Î AND ¤ò·×»»¤·¤¿·ë²Ì¡¢¥Ó¥Ã¥È¤¬Î©¤Ã¤Æ¤¤¤ì¤Ð°ìÅ٤˰ì¤Ä¤ÎÏ¿²»¸»¤·¤« »ÈÍѤǤ¤Þ¤»¤ó¡£¥Ó¥Ã¥È¤¬Î©¤Ã¤Æ¤¤¤Ê¤±¤ì¤Ð¡¢ Ê£¿ô¤ÎÏ¿²»¸»¤òƱ»þ¤ËÁªÂò¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹ ( 152 ¡Á 155 ¹Ô»²¾È )¡£
mixer_test.c ¤ÎÀâÌÀ¤Ï°Ê¾å¤Ç¤¹¡£dsptest.c ¤ÈƱÍͤˡ¢¼«Ê¬¤¬»È¤Ã¤Æ¤¤¤ë¥µ¥¦¥ó¥É¥«¡¼¥É¤È¥É¥é¥¤¥Ð¤¬¤É¤ÎÍͤʵ¡Ç½¤ò»ý¤Ã¤Æ¤¤¤ë¤Î¤«¤³¤Î¥×¥í¥°¥é¥à¤Çɽ¼¨¤µ¤»¤Æ¤ß¤Þ¤·¤ç¤¦¡¼¡£