i tried to do what is on this link: 'http://wiki.forum.nokia.com/index.ph...filled_buffers' but it still doesn't work...
it still producing noise...
when i try to debug it and put some breakpoint in the code...
it still producing noise...
i really need to fix this one....
Here is the code i'm using:
Code:
void CRFsEngine::MaoscBufferCopied(TInt aError, const TDesC8& /*aBuffer*/)
{
TBool finish = EFalse;
TInt error;
if (aError==KErrNone)
{
TBool isEnd = EFalse;
for(TInt i = 0; ETrue; i++)
{
iAlgo = iReader->Read(8);
if(104 == iAlgo)
{
TUint numDec = iReader->Read(32);
iHuffman->createStats();
iHuffman->Decode(numDec);
}
else if(100 == iAlgo)
{
iDifferential->DecodeDifferential();
}
else if(97 == iAlgo)
{
iArithmetic->InitializedValues();
}
else if(110 == iAlgo)
{
iNoCompression->DecompressNoCompression();
}
else
{
finish = ETrue;
break;
}
if(iOutputDecompression->Count() >= 80)
{
do
{
Transform();
iOutputDecompression->Delete(0, 40);
iOutputDecompression->Compress();
if(iCtrRBuf == 8000)
{
isEnd = ETrue;
iCtrRBuf = 0;
if(iBufStatus)
{
iBufStatus = EFalse;
}
else
{
iBufStatus = ETrue;
}
}
}while(iOutputDecompression->Count() >= 80);
}
if(isEnd)
{
break;
}
}
if(!finish)
{
if(iBufStatus)
{
TRAPD(error, iStream->WriteL(rBufMdct1));
}
else
{
TRAPD(error, iStream->WriteL(rBufMdct2));
}
}
}
if(finish)
{
return;
}
}
}
void CRFsEngine::PlayL()
{
rBufMdct1.Close();
rBufMdct2.Close();
LoadFileL();
iStream->SetVolume(iVolStep * KInitialVolume);
iOutputDecompression->Reset();
iReader->SetTotalSizeExist(EFalse);
TBool isEnd = EFalse;
for(TInt i = 0; ETrue; i++)
{
iAlgo = iReader->Read(8);
if(104 == iAlgo)
{
TUint numDec = iReader->Read(32);
iHuffman->createStats();
iHuffman->Decode(numDec);
}
else if(100 == iAlgo)
{
iDifferential->DecodeDifferential();
}
else if(97 == iAlgo)
{
iArithmetic->InitializedValues();
}
else if(110 == iAlgo)
{
iNoCompression->DecompressNoCompression();
}
else
{
break;
}
if(iOutputDecompression->Count() >= 80)
{
do
{
Transform();
iOutputDecompression->Delete(0, 40);
iOutputDecompression->Compress();
if(iCtrRBuf == 8000)
{
isEnd = ETrue;
iCtrRBuf = 0;
iBufStatus = ETrue;
}
}while(iOutputDecompression->Count() >= 80);
}
if(isEnd)
{
break;
}
}
if(iStatus == EEngineReady)
{
iStatus = EEnginePlaying;
iStream->WriteL(rBufMdct1);
}
}
void CRFsEngine::Transform()
{
TInt iSize = 80;
TReal64 temp = 0.0;
TReal64 value = 0.0;
TUint32 final = 0;
TInt error;
for(TUint i = 0; i < iSize; i++, temp = 0.0)
{
for(TUint j = 0; j < (iSize/2); j++)
{
final = iOutputDecompression->At(j);
value = (((2*PI)/iSize) * (i + d) * (j + .5));
error = Math::Cos(value, value);
User::LeaveIfError(error);
temp += iOutputDecompression->At(j) * value;
}
temp = (temp * 4.0) / (TReal64) (iSize);
final = temp;
// Here is the part where i replace the value in the buffer.
if(iBufStatus)
{
rBufMdct2[iCtrRBuf] = final;
}
else
{
rBufMdct1[iCtrRBuf] = final;
}
iCtrRBuf++;
}
}