Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

linux ²¥·ÅÉùÒôÎļþ³ÌÐò´úÂë

ÉùÒôÎļþ±ØÐëΪWave PCM unsigned 8bits mono¸ñʽ
/* the *.wav must be 8000Hz 64kbps  8bits MONO(1)*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <linux/soundcard.h> /*for OSS style sound programing */
#define BUFF_SIZE  512 /*buffer size:512 Bytes */
#define FMT8BITS AFMT_U8 /*unsigned 8 bits(for almost PC) */
#define FMT16BITS AFMT_S16_LE /*signed 16 bits,little endian */
#define FMT8K    8000 /*default sampling rate */
#define FMT11K   11025 /*11,22,44,48 are three pop rate */
#define FMT22K   22050
#define FMT44K   44100
#define FMT48K  48000
#define MONO     1
#define STEREO   2
int main(int argc, char *argv[])
{
    if(argc!=2)
        printf("input error! ./playvoice filename");
   
    int fd; //for device
 fd=open("/dev/dsp",O_WRONLY);
 if (fd<0){
  perror("Can't open /dev/dsp");
  return -1;
 }
 
 int outfile;
 outfile=open(argv[1],O_RDONLY);
 if (outfile<0) {
  perror("Cannot open file for writing");
  return -1;
 }
 
    /* set bit format */
    int bits = FMT16BITS;
    if (ioctl(fd, SNDCTL_DSP_SETFMT, &bits) == -1) {
 fprintf(stderr, "Set fmt to bit %d failed:%s\n", bits,
  strerror(errno));
 return (-1);
    }
    if (bits != FMT16BITS) {
 fprintf(stderr, "do not support bit %d, supported 8¡¢16\n", bits);
 return (-1);
    }
    /*set channel */
    int channel = MONO;
    if ((ioctl(fd, SNDCTL_DSP_CHANNELS, &channel)) == -1) {
 fprintf(stderr, "Set Au


Ïà¹ØÎĵµ£º

LinuxÉ豸ģÐÍÖ®input×ÓϵͳÏê½â

Ò»£ºÇ°ÑÔ
×î½üÔÚÑо¿androidµÄsensor driver£¬Ö÷ÒªÊÇE-compass£¬ÆäÖÐÓõ½ÁËLinux input×Óϵͳ.ÔÚÍøÉÏÒ²¿´Á˺ܶàÕâ·½ÃæµÄ×ÊÁÏ£¬¸Ð¾õ»¹ÊÇÕâƪ·ÖÎöµÄ±È½ÏϸÖÂ͸³¹£¬Òò´ËתÔØÒ»ÏÂÒÔ±ã×Ô¼ºÑ§Ï°£¬Í¬Ê±ºÍ´ó¼Ò·ÖÏí£¡
£¨Õâƪ²©¿ÍÖ÷ÒªÊÇÒÔ¼üÅÌÇý¶¯ÎªÀýµÄ£¬²»¹ý½²½âµÄÊÇLinux Input Subsystem£¬¿ÉÒÔ×ÐϸµÄÑо¿Ò»Ï£¡£©
¼üÅÌÇý¶¯½«¼ì ......

LinuxÉϵÄÐéÄ⻯¼¼Êõ


ÐéÄ⻯¼¼ÊõµÄ·½·¨, ¼Ü¹¹ºÍʵÏÖ¸ÅÀÀ
¼¶±ð: Öм¶
M. Tim Jones [mtj@mtjones.com], ¹ËÎʹ¤³Ìʦ, Emulex
Ô­ÎÄ: Virtual Linux
Òë: ÕÔçæ cn.zhaoke.com
http://blog.zhaoke.com/45.html
2006Äê12ÔÂ29ÈÕ
ÐéÄ⻯¼¼ÊõµÄÓ¦ÓÃÊ®·Ö¹ã·º. µ±Ç°ÐéÄ⻯¼¼ÊõÖ÷Òª¹Ø×¢ÓÚ·þÎñÆ÷µÄÐéÄ⻯, »òÔÚµ¥¸öÖ÷»úÉϼĴæ¶à¸ö¶ÀÁ¢µÄ²Ù×÷ϵͳ. ±¾Î ......

LinuxÄں˴íÎó ÐÞ¸´

»·¾³½éÉÜ£ºCentos5.2+2.6.18-8.el5Äںˣ¬±àÒëÆ÷ÊÇGCC4.1.2¡£
Òª±àÒëµÄÄÚºË2.6.18-8.el3
½ö½öÐÞ¸ÄÁ˲¿·ÖÄں˵ÄÅäÖÃÐÅÏ¢£¬Ã»ÓдóµÄ±ä»¯¡£
È»ºó£ºmake ;make modules;make modules_install;
±àÒëûÓгöÎÊÌ⣬Éú³ÉÁËÄںˣ¬mkinitrdÉú³ÉÁËinitrd£¬¼Óµ½lilo.confÖУ¬ÖØÆôÑ¡ÔñÐÂÄںˣ¬³öÏÖÒ»ÏÂÎÊÌ⣺
hub 3-0:1.0: USB hub fo ......

linux¶àÏß³ÌÈëÃÅ

ת×Ô£º http://www.diybl.com/course/6_system/linux/Linuxxl/20081124/152557.html
ºÃºÃѧϰ£¬ÌìÌìÏòÉÏ
ÒýÑÔ
¡¡¡¡ Ị̈߳¨thread£©¼¼ÊõÔçÔÚ60Äê´ú¾Í±»Ìá³ö£¬µ«ÕæÕýÓ¦ÓöàÏ̵߳½²Ù×÷ϵͳÖÐÈ¥£¬ÊÇÔÚ80Äê´úÖÐÆÚ£¬ solarisÊÇÕâ·½ÃæµÄٮٮÕß¡£´«Í³µÄUnixÒ²Ö§³ÖÏ̵߳ĸÅÄµ«ÊÇÔÚÒ»¸ö½ø³Ì£¨process£©ÖÐÖ»ÔÊÐíÓÐÒ»¸öỊ̈߳¬ÕâÑù ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ