当前位置: 代码迷 >> WinCE >> ,三星2416 wince6.0下移植WM8731(IIS),录音不正常。多谢大家
  详细解决方案

,三星2416 wince6.0下移植WM8731(IIS),录音不正常。多谢大家

热度:360   发布时间:2016-04-28 13:03:27.0
求助,三星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);
  相关解决方案