?? adjust_balance.c
字號:
#include "Sample Playback.h"
//This subroutine is called for every sport interrupt. It's function is
//to sweep the audio balance from right to left and back to right again.
//This is synchronized with the LED sweeping. Note, the sample has some
//ambient sound at the end, so the middle of the sweep is NOT the middle
//of the entire audio sample.
void adjust_balance(void)
{
int offset;
//current offset into sample
offset=(FirstSample->CurrentAddr - FirstSample->StartAddr);
//For the first half of sweep percieved source shifts left<-right
if (offset <= SWEEP_MIDDLE) {
//step is simply 1/SWEEP_MIDDLE, and allows the gain to move from 0<->1 over half the sample.
//decrease Rgain
Rgain = 1-(step*offset);
//increse Lgain
Lgain = (step*offset);
}
// for second half of sweep, shift source left->right
if ((offset>SWEEP_MIDDLE)&(offset<=2*SWEEP_MIDDLE) ){
//decrease Lgain
Lgain = 1-(step*(offset-(float)SWEEP_MIDDLE));
//decrease Rgain
Rgain = (step*(offset-(float)SWEEP_MIDDLE));
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -