Linux»·¾³ÏÂÓÃcÓïÑÔдµÄ²¥·ÅwavÎļþµÄС³ÌÐò
±¾³ÌÐò¿ÉÒÔ¶ÁÈ¡.wavÎļþ£¬È»ºó½øÐв¥·Å¡£
È·ÈÏ·½·¨£ºcat /etc/sndstat£¬Èç¹ûÏÔʾÎÞ´ËÉ豸£¬ÔòûÓа²×°Çý¶¯¡£
#include <unistd.h>#include <fcntl.h>#include <sys/types.h>#include <sys/ioctl.h>#include <stdlib.h>#include <stdio.h>#include <linux/soundcard.h>/* ÏÂÃæµÄÈý¸ö²ÎÊýÊǸú¾ßÌåÎļþÏà¹ØµÄ£¬ÎļþʲôÑù£¬¾ÍÒªÉèÖóÉʲôÑù */
int main(){ int fd; int wavfd; //wavÎļþµÄÃèÊö·û
if (fd < 0) { printf("open of /dev/dsp failed"); exit(1);} wavfd = open("12193767609.wav",O_RDONLY); if (wavfd < 0) { printf("open of wav failed"); exit(1); }
/* .......... */ arg = CHANNELS; status = ioctl(fd, SOUND_PCM_WRITE_CHANNELS, &arg); if (status == -1) perror("SOUND_PCM_WRITE_CHANNELS ioctl failed"); if (arg != CHANNELS) perror("unable to set number of channels");
/* ´ÓwavÎļþÖжÁbuf´óСµÄÄÚÈÝ£¬È»ºóдÈë/etc/dspÖУ¬Ö±µ½Îļþ½áÊø */ int time = 0; //¶¯Ì¬ÏÔʾ²¥·Åʱ¼äÓÃ
/*status = ioctl(fd, SOUND_PCM_SYNC, 0);
}}±¾³ÌÐòÖÐÐèÒªÒ»¸ö.wavÎļþ²ÅÄܲ¥·Å£¬Äã¿ÉÒÔµ½°Ù¶Èmp3ÉÏÈ¥ËÑË÷Ò»¸ö.wavÎļþ£¬·Åµ½³ÌÐòĿ¼Ï¡£È»ºó£¬°Ñ³ÌÐòÖеÄÎļþÃû¸Ä³É¸ÃÒôƵµÄÎļþÃû¡£
Ïà¹ØÎĵµ£º
Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖÐÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀÐÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......
Ò»£ºÇ°ÑÔ
×î½üÔÚÑо¿androidµÄsensor driver£¬Ö÷ÒªÊÇE-compass£¬ÆäÖÐÓõ½ÁËLinux input×Óϵͳ.ÔÚÍøÉÏÒ²¿´Á˺ܶàÕâ·½ÃæµÄ×ÊÁÏ£¬¸Ð¾õ»¹ÊÇÕâƪ·ÖÎöµÄ±È½ÏϸÖÂ͸³¹£¬Òò´ËתÔØÒ»ÏÂÒÔ±ã×Ô¼ºÑ§Ï°£¬Í¬Ê±ºÍ´ó¼Ò·ÖÏí£¡
£¨Õâƪ²©¿ÍÖ÷ÒªÊÇÒÔ¼üÅÌÇý¶¯ÎªÀýµÄ£¬²»¹ý½²½âµÄÊÇLinux Input Subsystem£¬¿ÉÒÔ×ÐϸµÄÑо¿Ò»Ï£¡£©
¼üÅÌÇý¶¯½«¼ì ......
Ö¸ÕëÊÇ£ÃÓïÑÔÖй㷺ʹÓõÄÒ»ÖÖÊý¾ÝÀàÐÍ¡£ÔËÓÃÖ¸Õë±à³ÌÊÇ£ÃÓïÑÔ×îÖ÷ÒªµÄ·ç¸ñÖ®Ò»¡£ÀûÓÃÖ¸Õë±äÁ¿¿ÉÒÔ±íʾ¸÷ÖÖÊý¾Ý½á¹¹£»Äܷܺ½±ãµØʹÓÃÊý×éºÍ×Ö·û´®£»²¢ÄÜÏó»ã±àÓïÑÔÒ»Ñù´¦ÀíÄÚ´æµØÖ·£¬´Ó¶ø±à³ö¾«Á·¶ø¸ßЧµÄ³ÌÐò¡£Ö¸Õ뼫´óµØ·á¸»ÁË£ÃÓïÑԵŦÄÜ¡£Ñ§Ï°Ö¸ÕëÊÇѧϰ£ÃÓïÑÔÖÐ×îÖØÒªµÄÒ»»·£¬ÄÜ·ñÕýÈ·Àí½âºÍʹÓÃÖ¸ÕëÊÇÎÒÃÇÊÇ·ñÕÆÎÕ ......
Ö¸ÕëÊÇ£ÃÓïÑÔÖй㷺ʹÓõÄÒ»ÖÖÊý¾ÝÀàÐÍ¡£ÔËÓÃÖ¸Õë±à³ÌÊÇ£ÃÓïÑÔ×îÖ÷ÒªµÄ·ç¸ñÖ®Ò»¡£ÀûÓÃÖ¸Õë±äÁ¿¿ÉÒÔ±íʾ¸÷ÖÖÊý¾Ý½á¹¹£»Äܷܺ½±ãµØʹÓÃÊý×éºÍ×Ö·û´®£»²¢ÄÜÏó»ã±àÓïÑÔÒ»Ñù´¦ÀíÄÚ´æµØÖ·£¬´Ó¶ø±à³ö¾«Á·¶ø¸ßЧµÄ³ÌÐò¡£Ö¸Õ뼫´óµØ·á¸»ÁË£ÃÓïÑԵŦÄÜ¡£Ñ§Ï°Ö¸ÕëÊÇѧϰ£ÃÓïÑÔÖÐ×îÖØÒªµÄÒ»»·£¬ÄÜ·ñÕýÈ·Àí½âºÍʹÓÃÖ¸ÕëÊÇÎÒÃÇÊÇ·ñÕÆÎÕ ......
11¡¢ÏÂÃæµÄ´úÂëÊä³öÊÇʲô£¬ÎªÊ²Ã´£¿
Void foo(void)
{
unsigned int a = 6;
int b = -20;
(a+b > 6) £¿puts("> 6") : puts("<= 6");
}
²»¹ÜÈçºÎ£¬ÕâÎÞ·ûºÅÕûÐÍÎÊÌâµÄ´ð°¸ÊÇÊä³öÊÇ“>6”¡£ÔÒòÊǵ±±í´ïʽÖдæÔÚÓзûºÅÀàÐͺÍÎÞ·ûºÅÀàÐÍʱËùÓеIJÙ×÷Êý¶¼×Ô¶¯×ª»»ÎªÎÞ·ûºÅÀàÐÍ¡£Òò´Ë-20±ä³ÉÁËÒ»¸ ......