4 개의 버퍼를 혼합하고 패닝을 적용합니다. 그러나 팬의 변경을 트리거 할 때 클립이 들립니다. 어떤 몸이 다음 코드 잠재적으로 잘못된 것을 볼 수 있습니다 -DSP/수동 혼합 및 팬 법
for (int i = 0 ; i < numFrames; i++) {
//Convert buffer to float
float s1 = track1[0][i]/32768.0f;
float s2 = track2[0][i]/32768.0f;;
float s3 = track3[0][i]/32768.0f;;
float s4 = track4[0][i]/32768.0f;;
//Apply pan on track one
float s1R = s1 * sqrt(1 - panA);
float s1L = s1 * sqrt(panA);
//Apply pan on track two
float s2R = s2 * sqrt(1 - panB);
float s2L = s2 * sqrt(panB);
//Apply pan on track three
float s3R = s3 * sqrt(1 - panC);
float s3L = s3 * sqrt(panC);
//Apply pan on track four
float s4R = s4 * sqrt(1 - panD);
float s4L = s4 * sqrt(panD);
//Mix the right channel
float mixedR = s1R + s2R + s3R + s4R;
mixedR *= 0.6f;
if(mixedR > 1.0f) mixedR = 1.0f;
if(mixedR < -1.0f) mixedR = -1.0f;
//Mix the Left channel
float mixedL = s1L + s2L + s3L + s4L;
mixedL *= 0.6f;
if(mixedL > 1.0f) mixedL = 1.0f;
if(mixedL < -1.0f) mixedL = -1.0f;
//Apply the Left channel
audioIn[0][i] = (short) (mixedL * 32768.0f);
//Apply the right channel
audioIn[1][i] = (short) (mixedR * 32768.0f);
}
패닝 알고리즘이 개선 될 수있다, 나는 여기에서 그것을 해제 : -
http://www.kvraudio.com/forum/viewtopic.php?t=181222&postdays=0&postorder=asc&start=0
NumFrames가 512; 오디오가 믹싱되면 Dirac을 사용하여 시간 스트레칭 알고리즘을 적용합니다.
Dirac 처리없이 클리핑이 발생합니다.
@peter - 답장을 보내 주셔서 감사합니다. 난 그냥 0.25 곱하기 시도하고 동일한 클립 얻을. 이는 동적으로 패닝을 변경하는 경우에만 발생합니다. – Carl
OK - 팬 값이 범위를 벗어날 가능성이 있습니까? 즉 < 0 or > 1입니까? –
@peter - 절대로 플로트, 1 또는 0 테스트로 하드 코딩하고 있습니다. – Carl