/*
* Copyright 2001 by Texas Instruments Incorporated.
* All rights reserved. Property of Texas Instruments Incorporated.
* Restricted rights to use, duplicate or disclose this code are
* granted through contract.
* U.S. Patent Nos. 5,283,900 5,392,448
*/
/* "@(#) DSP/BIOS 4.51.0 05-23-01 (barracuda-i10)" */
/***************************************************************************/
/* */
/* V O L U M E . C */
/* */
/* Audio gain processing in a main loop */
/* */
/***************************************************************************/
#include "stdio.h"
#include "volume.h"
/* Global declarations */
int inp1_buffer[BUFSIZE];
int inp2_buffer[BUFSIZE]; /* processing data buffers */
int out1_buffer[BUFSIZE];
int out2_buffer[BUFSIZE];
int out3_buffer[BUFSIZE];
int out4_buffer[BUFSIZE*2];
int size = BUFSIZE;
int ain = MINGAIN;
int zhy=0;
int sk=64; /*sk代表所开的bufsize的大小,需修改它.输入文件sine.dat为32点,sine11.dat,
sin22.dat,sin33.dat,sin44.dat为64点的输入波形.*/
/* volume control variable */
unsigned int processingLoad = 1; /* processing routine load value */
/* Functions */
extern void load(unsigned int loadValue);
static int processing1(int *output1, int *output2);
static int processing2(int *output2, int *output3);
static int processing3(int *input1,int *output2,int *output4);
static int processing4(int *input2, int *output1);
static void dataIO1(void);
static void dataIO2(void);
/*
* ======== main ========
*/
void main()
{
int *input1 = &inp1_buffer[0];
int *input2 = &inp2_buffer[0];
int *output1 = &out1_buffer[0];
int *output2 = &out2_buffer[0];
int *output3 = &out3_buffer[0];
int *output4 = &out4_buffer[0];
puts("volume example started\n");
/* loop forever */
while(TRUE)
{
/*
* Read input data using a probe-point connected to a host file.
* Write output data to a graph connected through a probe-point.
*/
dataIO1();
dataIO2();
/* apply gain */
processing4(input2,output1);
processing1(output1, output2);
processing2(output2, output3);
processing3(input1,output2,output4) ;
}
}
/*
* ======== processing ========
*
* FUNCTION: apply signal processing transform to input signal.
*
* PARAMETERS: address of input and output buffers.
*
* RETURN VALUE: TRUE.
*/
static int processing4(int *input2,int *output1)
{ int m=sk;
for(;m>=0;m--)
{
*output1++ = *input2++ * ain;
}
for(;(size-m)>0;m++)
{output1[m]=0;
}
load(processingLoad);
return(TRUE);
}
static int processing1(int *output1,int *output2)
{
int m=sk-1;
for(;m>0;m--)
{
*output2++ = *output1++ * ain;
}
/* additional processing load */
load(processingLoad);
return(TRUE);
}
static int processing2(int *output2, int *output3)
{ int n=zhy;
size=BUFSIZE;
for(;(size-n)>0;n++)
{ *output3++ = output2[n];
}
/* for (;n>0;n--)
{ *output3++ = 0;
} */
load(processingLoad);
return(TRUE);
}
static int processing3(int *input1,int *output2,int *output4)
{ int m=sk;
int y=zhy;
int z,x,w,i,f,g;
for(;(m-y)>0;)
{i=y;
x=0;
z=0;
f=y;
for(;i>=0;i--)
{g=input1[z]*output2[f];
x=x+g;
z++;
f--;
}
*output4++ = x;
y++;
}
m=sk;
y=sk-1;
w=m-zhy-1;
for(;m>0;m--)
{
y--;
i=y;
z=sk-1;
x=0;
f=sk-y;
for(;i>0;i--,z--,f++)
{g=input1[z]*output2[f];
x=x+g;
}
out4_buffer[w]=x;
w++;
}
load(processingLoad);
return(TRUE);
}
/*
* ======== dataIO ========
*
* FUNCTION: read input signal and write processed output signal.
*
* PARAMETERS: none.
*
* RETURN VALUE: none.
*/
static void dataIO1()
{
/* do data I/O */
return;
}
static void dataIO2()
{
/* do data I/O */
return;
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
juanji.rar (12个子文件)
juanji
volume.c 4KB
sin.dat 492B
sine.dat 12KB
juanji.paf 2KB
volume.cmd 607B
Debug.lkv 486B
vectors.asm 2KB
Debug
cc_build_Debug.log 679B
volume.h 752B
load.asm 1KB
juanji.pjt 1006B
Debug.lkf 486B
共 12 条
- 1
资源评论
- zhuzengkun2013-05-28呵呵 没说清楚 还好吧
- zhmimi08082013-01-14dsp卷积,跟网上的其他都差不多。
- uniquezhang08152017-04-18挺好用的啊 谢谢分享
- afaper2012-05-23我需要的是线性卷积,并且是i/o输入信号的并用图标观察的,不过还是给个好评吧
amwicfmf
- 粉丝: 6
- 资源: 23
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功