最终在数据准备哪里调到了系统相关的:Render2中(你的可能不同注意)在这里准备了数据
PBYTE OutputStreamContextS16::Render2(PBYTE pBuffer, PBYTE pBufferEnd, PBYTE pBufferLast)
{
LONG CurrT = m_CurrT;
LONG DeltaT = m_DeltaT;
LONG CurrSamp0 = m_CurrSamp[0];
LONG CurrSamp1 = m_CurrSamp[1];
LONG PrevSamp0 = m_PrevSamp[0];
LONG PrevSamp1 = m_PrevSamp[1];
PBYTE pCurrData = m_lpCurrData;
PBYTE pCurrDataEnd = m_lpCurrDataEnd;
LONG fxpGain = m_fxpGain;
LONG OutSamp0;
LONG OutSamp1;
。。。。
PrevSamp0 = CurrSamp0;
PrevSamp1 = CurrSamp1;
PPCM_SAMPLE pSampleSrc = (PPCM_SAMPLE)pCurrData;
CurrSamp0 = (LONG)pSampleSrc->s16.sample_left;
CurrSamp1 = (LONG)pSampleSrc->s16.sample_right;
pCurrData+=4;
。。。。。
#if(HIGH_OUTPUT_QULITY==1)
OutSamp0 = PrevSamp0 + (((CurrSamp0 - PrevSamp0) * CurrT) >> 8);
OutSamp1 = PrevSamp1 + (((CurrSamp1 - PrevSamp1) * CurrT) >> 8);
#else
OutSamp0 = CurrSamp0;
OutSamp1 = CurrSamp1;
#endif
OutSamp0 = (OutSamp0 * fxpGain) >> VOLSHIFT;
OutSamp1 = (OutSamp1 * fxpGain) >> VOLSHIFT;
CurrT += DeltaT;
// DEBUGMSG(1, (TEXT("PrevSamp0=0x%x, CurrSamp0=0x%x, CurrT=0x%x, OutSamp0=0x%x\r\n"), PrevSamp0,CurrSamp0,CurrT,OutSamp0));
.....
最终:
((HWSAMPLE *)pBuffer)[0] = (HWSAMPLE)OutSamp0;
((HWSAMPLE *)pBuffer)[1] = (HWSAMPLE)OutSamp1;
pBuffer += 2*sizeof(HWSAMPLE);
}
Exit:
m_dwByteCount += (pCurrData - m_lpCurrData);
m_lpCurrData = pCurrData;
m_CurrT = CurrT;
m_PrevSamp[0] = PrevSamp0;
m_PrevSamp[1] = PrevSamp1;
m_CurrSamp[0] = CurrSamp0;
m_CurrSamp[1] = CurrSamp1;
return pBuffer;
返回了数据。
再就是:送DMA了
void OutputDeviceContext::StreamReadyToRender(StreamContext *pStreamContext)
{
g_pHWContext->StartOutputDMA();
return;
}
AC97会根据你对AC97 芯片的设置将数据送往不同的声道DAC 然后到不同的channel
不知道你用的是什么方式,居然还有左右声道的CLK 我一直没有注意这个, 我用aC97