求助,三星2416 wince6.0下移植WM8731(IIS),录音不正常。谢谢大家!
大家好,最近我在三星2416 wince6.0下移植 WM8731 采用的是IIS方式,现在播放声音没有问题了,录音却一直搞不定,录音采用 MIC in ,录完MP3以后播放 ,能听见音乐,但是会听见很大的噪声,噪声感觉是什么信号很有规律的在一直震动,请教大家遇见过这样的问题没?我该怎么样解决?谢谢了!
[解决办法]
顶上去,我也正在解决这个问题。刚把录音调通,可是有杂音哪。。。。
[解决办法]
我查到卡的问题是由于DMA切换造成的,并且是46ms一次数据丢失,而且是A-B切换有有此现象,B-A没有这个问题.很遗憾到目前我还没有解决这个问题,楼上解决这个问题的大侠,可以讲解一下你是如何解决这个问题的吗?
我的QQ是:254514075 欢迎交流
关于杂音问题,我到是解决了,主要是Render2函数处理造成的.以下是我修改过的代码:
PBYTE InputStreamContext::Render2(PBYTE pBuffer, PBYTE pBufferEnd, PBYTE pBufferLast)
{
PBYTE pCurrData = m_lpCurrData;
PBYTE pCurrDataEnd = m_lpCurrDataEnd;
LONG CurrT = m_CurrT;
LONG DeltaT = m_DeltaT;
PCM_TYPE SampleType = m_SampleType;
LONG CurrSamp0 = m_CurrSamp[0];
LONG PrevSamp0 = m_PrevSamp[0];
LONG CurrSamp1 = m_CurrSamp[1];
LONG PrevSamp1 = m_PrevSamp[1];
LONG InSamp0;
LONG InSamp1;
//RETAILMSG(1,(_T("InputStreamContext::Render2()\r\n")));
for (;;)
{
// Make sure we have a place to put the data
if (pCurrData>=pCurrDataEnd)
{
goto Exit;
}
// Get the next sample
while (CurrT >= 0x10000)
{
if (pBuffer>=pBufferEnd)
{
goto Exit;
}
PrevSamp0 = CurrSamp0;
PrevSamp1 = CurrSamp1;
CurrSamp0 = ((HWSAMPLE *)pBuffer)[0];
CurrSamp1 = ((HWSAMPLE *)pBuffer)[1];
pBuffer += 2*sizeof(HWSAMPLE);
CurrT -= 0x10000;
}
InSamp0 = (PrevSamp0 + ((CurrT * (CurrSamp0 - PrevSamp0)) >> DELTAFRAC));
InSamp1 = (PrevSamp1 + ((CurrT * (CurrSamp1 - PrevSamp1)) >> DELTAFRAC));
CurrT += DeltaT;
PPCM_SAMPLE pSampleDest = (PPCM_SAMPLE)pCurrData;
switch (m_SampleType)
{
case PCM_TYPE_M8:
//RETAILMSG(1,(TEXT("sample1 - 8bit mono\r\n")));
default:
//pSampleDest->m8.sample = (UINT8)( ((InSamp0+InSamp1) >> 4) + IN_SCALE);
pSampleDest->m8.sample = (UINT8)( ((InSamp0) >> 8) + IN_SCALE);
pCurrData += 1;
break;
case PCM_TYPE_S8:
//RETAILMSG(1,(TEXT("sample2 - 8bit stereo\r\n")));
//pSampleDest->s8.sample_left = (UINT8)((InSamp0 >> 3) + IN_SCALE);
//pSampleDest->s8.sample_right = (UINT8)((InSamp1 >> 3) + IN_SCALE);
pSampleDest->s8.sample_left = (UINT8)((InSamp0 >> 8) + IN_SCALE);
pSampleDest->s8.sample_right = (UINT8)((InSamp1 >> 8) + IN_SCALE);
pCurrData += 2;
break;
case PCM_TYPE_M16:
//RETAILMSG(1,(TEXT("sample3 - 16bit mono\r\n")));// NOTES
//pSampleDest->m16.sample = (INT16)(((InSamp0+InSamp1)>>1)<<4);
pSampleDest->m16.sample = (INT16)((InSamp0));
pCurrData += 2;
break;
case PCM_TYPE_S16:
//RETAILMSG(1,(TEXT("sample4 - 16bit stereo\r\n")));
//pSampleDest->s16.sample_left = (INT16)(InSamp0<<4);
//pSampleDest->s16.sample_right = (INT16)(InSamp1<<4);
pSampleDest->s16.sample_left = (INT16)(InSamp0);
pSampleDest->s16.sample_right = (INT16)(InSamp1);
pCurrData += 4;
break;
}
}
Exit:
m_lpWaveHdrCurrent->dwBytesRecorded += (pCurrData-m_lpCurrData);
m_dwByteCount += (pCurrData-m_lpCurrData);
m_lpCurrData = pCurrData;
m_CurrT = CurrT;
m_PrevSamp[0] = PrevSamp0;
m_CurrSamp[0] = CurrSamp0;
m_PrevSamp[1] = PrevSamp1;
m_CurrSamp[1] = CurrSamp1;
return pBuffer;
}
[解决办法]
我查到卡的问题是由于DMA切换造成的,并且是46ms一次数据丢失,而且是A-B切换有有此现象,B-A没有这个问题.很遗憾到目前我还没有解决这个问题,楼上解决这个问题的大侠,可以讲解一下你是如何解决这个问题的吗?
我的QQ是:254514075 欢迎交流
我在移植时也出现过这种问题,用示波器观看,有约46ms的数据断列。也试过修改代码,但是没有起效果,最后用三星公司提供的WAVDEV代码修改就好了。(注:之前用UT公司提供的BSP包)
[解决办法]
关于录音的问题,我已经找到了根本原因,并且解决了,其实很简单,大家只要修改hwctxt.cpp文件中的InitInputDMA()函数里对DMA初始化的部分:如下
//----- 2. Initialize the DMA channel to receive data over the I2S bus -----
g_pDMAregs->DIDST1= (int)(g_PhysDMABufferAddr.LowPart);
//g_pDMAregs->DIDSTC1 &= ~(DESTINATION_PERIPHERAL_BUS | FIXED_DESTINATION_ADDRESS);// Destination is system bus, increment addr
g_pDMAregs->DIDSTC1 = 0x04;// Modify by victor
原因其实就出在对DIDSTC1寄存器设置的部分,原理的DIDSTC1的BIT2没有设置为1,这样会导致下次DMA传送时数据丢失,因为下次DMA数据数据时,没有重新装载,造成一部分数据丢失。详细的请参考S3C2416的DATASHEET,希望这对大家有所帮助。