易截截图软件、单文件、免安装、纯绿色、仅160KB

Linux环境下用c语言写的播放wav文件的小程序

#include <unistd.h>
#include <fcntl.h>
#include
<sys/types.h>
#include <sys/ioctl.h>
#include
<stdlib.h>
#include <stdio.h>
#include
<linux/soundcard.h>
/* 下面的三个参数是跟具体文件相关的,文件什么样,就要设置成什么样 */
#define RATE 11025  
#define SIZE 16    
#define CHANNELS
2  // 1表示单声道,2为立体声
/* ................ */
unsigned char
buf[RATE*SIZE/8]; //buf里面正好放一秒钟的音频,下面的计时还要用
int main()
{
    int fd;
    int wavfd; //wav文件的描述符
    int arg;        /* ..ioctl..... */
    int status;   /*
........ */
                /* ...... */
    fd = open("/dev/dsp",
O_RDWR);      
    if (fd < 0) {
        printf("open of /dev/dsp failed");
       
exit(1);
}
    wavfd = open("a.wav",O_RDONLY);
    if (wavfd
< 0) {
        printf("open of wav failed");
        exit(1);
 
}
 
/* .......... */
    arg = SIZE;
    status = ioctl(fd,
SOUND_PCM_WRITE_BITS, &arg);
    if (status == -1)
        
perror("SOUND_PCM_WRITE_BITS ioctl failed");
    if (arg != SIZE)
        
perror("unable to set sample size");
 
/* .......... */
    arg = CHANNELS;
    status = ioctl(fd,
SOUND_PCM_WRITE_CHANNELS, &arg);
    if (status == -1)
 &nb


相关文档:

ARM Linux Boot Sequence

contact me go -> xuqiang.docs@hotmail.com
ARM Linux Boot Sequence
The following traces the Linux boot sequence for ARM-based systems in the 2.6.18 kernel. It looks at just the earliest stages of the boot process, until the generic non-processor-specific start_kernel function is called. The line ......

linux学习

星际译王的安装


                “星际译王”是用Gtk2开发的跨平台的国际化的词典软件。它具有“通配符匹配”、“选中区取词”、“模糊查询”等强大功能。本文主要解说一下主程序和词库的安装;
一、什么 ......

linux makefile编写

一、Makefile的规则
在讲述这个Makefile之前,还是让我们先来粗略地看一看Makefile的规则。
target ... : prerequisites ...
command
...
...
target也就是一个目标文件,可以是Object File,也可以是执行文件。
prerequisites就是,要生成那个target所需要的文件或是目标。
command也就是make需要执行的命令。(任 ......

Linux下安装apache

1.下载apache源码包,进入页面http://httpd.apache.org/download.cgi,下来后放入/usr/local/src目录中
2.解压:
cd /usr/local/src
tar --zxvf httpd-2.2.15.tar.gz
3.cd httpd-2.2.15
./configure --prefix=/usr/local/src/apache2 \
--enable-so \
--enable-rewrite
make;make install
4.启动服务 service httpd s ......

Linux 下MySQL NDB配置

A) Shutdown management node and data node
devmysql3# ndb_mgm -e shutdown
devmysql4# ndb_mgm -e shutdown
B) Shutdown MySQL proccess
devmysql3# mysqladmin shutdown
devmysql4# mysqladmin shutdown
devmysql3 ip: 10.130.30.217
devmysql4 ip: 10.130.30.218
rpm -ivh MySQL-Cluster-gpl-storage ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号