20121107笔记——madplay and wav
来源:互联网 发布:sae网络的边界网关 编辑:程序博客网 时间:2024/06/18 10:23
/* 20121107 */
/* forenoon: qt4 programming
* book: <C++.GUI.Qt.4编程(第二版)>
* afternoon:
* sound programming
* madplayer
*/
1.
多个文件编译链接:
gcc -c test1.c -o test1.o
gcc -c test2.c -o test2.o
gcc -o test test1.o test2.o
2.板子上想要用qt的方式:
1.交叉编译qt库
2.移植qt到板子上
3.交叉编译程序
4.程序的目标文件在板子上执行。
3.设置环境变量: vim /etc/profile
最后一行加上: export PATH=$PATH:/usr/lib/qt4/bin
然后注销一下。
4.挂载镜像到制定目录上:
mount -o files /mnt
5.yum 源修改:
在/etc/yum.repos.d
/***************************************/
[ CDROM ]
name=CentOS
baseurl=file:///opt/yum
enabled=1
gpgcheck=0
/***************************************/
前提是:将yum文件拷贝到/opt/yum文件下面了。
6.@问:yum源的问题。
7.qt4的文件编译:
1.建立hello文件夹
2.在~/hello 文件夹下面新建hello.cpp文件
3.#qmake-qt4 -project
4.#qmake-qt4
5.#make
6.#./hellop //注意:这里的名字和文件夹的名字是一样的。
8.mp3 play
install midplay software.
1.安装zlib库到板子上面 //查看:#rpm -qa zlib
2.tar zxvf libid3tag~
3../configure --> 生成Makefile//如果安装到板子上,则需要加入一些参数,具体的上百度//如果安装到pc就不许要了
4.make
5.make install
6.#ls /usr/local/include/id3tag.h
#ls /usr/local/lib/ 其中有lib3~
7.tar zxvf libmap.tar.~
8../configure
9.make
10.make install
11.#ls /usr/local/lib 其中有libmap~
12.tar zxvf mdplay~
13../configure
14.make
15.make install
16.#ls /usr/local/lib 其中有miplay
17.#madplay *.mp3
//会出现错误:
//madplay: error while loading shared libraries: libmad.so.0: cannot open shared object file: No such file or directory
18.设置加载共享库
#vim /etc/ld.so.conf
加入:
/*************************************/
/usr/local/lib
/*************************************/
19.刷新查找的库:
#ldconfig
20.#madplay *.mp3
9.@search : wav 文件的文件头
10.@homework: install madplay to 板子。
11.@homework: install mplayer
12.在板子上最好静态链接。就不许要依赖太多。
/* sound.c
*
* 播放 *.wav 文件的简单函数
* 使用方法: #sound beyond.wav
*
* thoughts:
* 1.use buffer to read from *.wav
* 2.use buffer to write to /dev/dsp
*
*/
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h> //ioctl
#include <stdio.h> //open
#include <stdlib.h> //exit, malloc
#include <linux/soundcard.h>
int main(int argc, char *argv[])
{
int fd, file;
char *buf;
struct stat statbuf;
if (argc != 2) {
printf("usage: play {filename}\n");
exit(EXIT_FAILURE);
}
/* read the wav files start*/
file = open(argv[1], O_RDONLY);
if (file < 0) {
perror("open file");
exit(EXIT_FAILURE);
}
fstat(file, &statbuf);
buf = malloc(statbuf.st_size);
read(file, buf, statbuf.st_size);
fd = open("/dev/dvd1", O_RDWR);
if (fd < 0) {
perror("open /dev/dsp");
exit(EXIT_FAILURE);
}
/* read the wav files end */
/* write rate */
int rate = 88200; //HZ, 采样率
ioctl(fd, SOUND_PCM_WRITE_RATE, &rate); //写速率
/* write bits */
int bit = 16; //16位的读写位数
ioctl(fd, SOUND_PCM_WRITE_BITS, &bit); //读写位数
/* write bu fd */
write(fd, buf, statbuf.st_size); //写
close(fd);
close(file);
free(buf);
exit(EXIT_SUCCESS);
}
/* 20121107 */
/*
* test the wav's form
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
/*
typedef struct
{
char riff[8];
}WaveHeadher;
*/
int main(int argc,char *argv[])
{
int fd;
char *buf;
struct stat statbuf;
if(argc!=2)
{
printf("usage: wave {filename}");
exit(EXIT_FAILURE);
}
fd=open(argv[1],O_RDONLY);
fstat(fd,&statbuf);
buf=malloc(statbuf.st_size);
read(fd,buf,statbuf.st_size);
printf("%c%c%c%c\n",buf[0],buf[1],buf[2],buf[3]);
printf("%u\n",(unsigned long *)&buf[4]);
close(fd);
free(buf);
exit(EXIT_SUCCESS);
}
- 20121107笔记——madplay and wav
- 20121107——移植madplay到arm开发板
- madplay
- fl2440——按键控制madplay音乐播放器
- madplay播放器——用按键控制音量
- WAV文件格式研究笔记
- 音频制作与转换—WAV音频文件
- 《华清远见学习手记》 之3G智能机器人——移植madplay到FS2410
- linux下shell脚本的使用——安装madplay播放器,sed函数详解
- 构建嵌入式Linux应用系统 —— mp3播放器 madplay的移植
- LPC1768 WAV播放器 笔记
- the difference between pcm and wav
- wav
- WAV
- Linux音频设备驱动_OSS驱动框架(五)————韦东山分析及madplay安装
- Python——Pylab简单读取wav文件示例
- Linux声卡录音程序之——wav
- Android进阶——pcm格式转wav格式
- 20121024总结——构建Linux根文件系统
- 20121025总结——system call ——write,read,open,close,fstat
- 【选择大于努力】牛人的学习心得
- 20121106作业,qvfb使用——>打汉字,打印bmp图片
- 2012年10月份笔记汇总。
- 20121107笔记——madplay and wav
- 20121107——移植madplay到arm开发板
- 20121112日记
- 20121107笔记——TCP/IP protocol
- android Java 笔试考题
- 20121113 日记
- 20121114日记
- (转).c文件到可执行文件的整个编译过程
- (转)硬链接和软链接