当前位置: 技术问答>linux和unix
linux下C编程,处理音频问题,感觉跟windows下C有不同,看的不明白
来源: 互联网 发布时间:2017-05-10
本文导语: 有一段示例:passthrough #include #include #include #include #include #include #include int main(int argc, char *argv[]) { while(1){ // Buffer containing one sample (left and right, both 16 bit). int16_t samples[2]; unsigned cbBuffer=size...
有一段示例:passthrough
#include
#include
#include
#include
#include
#include
#include
int main(int argc, char *argv[])
{
while(1){
// Buffer containing one sample (left and right, both 16 bit).
int16_t samples[2];
unsigned cbBuffer=sizeof(samples); // size in bytes of
// Read one sample from input
int got=read(STDIN_FILENO, samples, cbBuffer);
if(got ../tmp/sine1000.raw
2.怎么输入两段音频,然后求和,输出来?还调用signal_generator 这个函数来产生输入音频
调用形式如下:
./signal_generator 1000 > ../tmp/sine1000.raw
./signal_generator 2000 > ../tmp/sine2000.raw
./merge ../tmp/sine1000.raw ../tmp/sine2000.raw | ./audio_sink.sh
|
锅锅确定地址正确嘛。