?? sine.c
字號:
// ****************************************************************
// Description: This application uses Probe Points to obtain input
// (a sine wave). It then takes this signal, and applies a gain
// factor to it.
// Filename: Sine.c
// ****************************************************************
#include <stdio.h>
#include <math.h>
#include "sine.h"
// gain control variable
/*int gain = INITIALGAIN; */
int gain = 1;
int a[360],i;
// declare and initalize a IO buffer
BufferContents currentBuffer;
// Define some functions
static void processing(); // process the input and generate output
static void dataIO(); // dummy function to be used with ProbePoint
void main()
{
puts("SineWave example started.\n");
for(i=0;i<360;i++)
a[i]=0;
for(i=0;i<360;i++)
a[i]=gain*(int)(sin(i*3.14159/180)*32767);
while(TRUE) // loop forever
{
/* Read input data using a probe-point connected to a host file.
Write output data to a graph connected through a probe-point. */
dataIO();
/* Apply the gain to the input to obtain the output */
processing();
}
}
/*
* FUNCTION: Apply signal processing transform to input signal
* to generate output signal
* PARAMETERS: BufferContents struct containing input/output arrays of size BUFFSIZE
* RETURN VALUE: none.
*/
static void processing()
{
int size = BUFFSIZE;
while(size--){
currentBuffer.output[size] = currentBuffer.input[size] * gain; // apply gain to input
}
}
/*
* FUNCTION: Read input signal and write processed output signal
* using ProbePoints
* PARAMETERS: none.
* RETURN VALUE: none.
*/
static void dataIO()
{
/* do data I/O */
return;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -