Community
cancel
Showing results for 
Search instead for 
Did you mean: 
visiontops
Beginner
53 Views

UMC::FileReader read .pcm file

The following functionis to read data from a ".pcm" file into a buffer. It doesn't work, but for a .txt file it works normal.
Variable "cPCMData" in the function always keeps empty. What wrong with it. Wish someone help me solve it. Thanks!

void ReadAudioPcm(vm_char* strFilename, Ipp8u *cPCMData, Ipp32u fileSize)
{
UMC::Status status;
UMC::FileReader* pFileReader = new UMC::FileReader();
UMC::FileReaderParams FileParams;
FileParams.m_portion_size = 0;
vm_string_strcpy(FileParams.m_file_name, strFilename);

status = pFileReader->Init(&FileParams);
if (status != UMC::UMC_OK)
exit (-1); //init failed
status = pFileReader->MovePosition(0);
pFileReader->ReadData(cPCMData, &fileSize);

pFileReader->Close();
delete pFileReader;
}

0 Kudos
1 Reply
Chao_Y_Intel
Employee
53 Views


Hello,

I just wrote a quick test code bellow. It looked fine for the PCM.
Could you please check PCM file name: Is it a unicode or ascii file name? and did you use theunicode or ascii to compile the UMC sample ?

Thanks,
Chao


void ReadAudioPcm(vm_char* strFilename, Ipp8u *cPCMData, Ipp32u fileSize)

{

UMC::Status status;

UMC::FileReader* pFileReader = new UMC::FileReader();

UMC::FileReaderParams FileParams;

FileParams.m_portion_size = 0;

vm_string_strcpy(FileParams.m_file_name, strFilename);

status = pFileReader->Init(&FileParams);

if (status != UMC::UMC_OK)

exit (-1); //init failed

status = pFileReader->MovePosition(0);

pFileReader->ReadData(cPCMData, &fileSize);

pFileReader->Close();

delete pFileReader;

}

void main()

{

Ipp8u inut[1000000];

ReadAudioPcm("C:\\temp\\test.pcm", inut, 1000000);

}

Reply