Q&A

  • c 소스를 delphi로 바꾸려면..
HFILE Inn;

DWORD len;



Inn = _lcreat(filename,0);

if(Inn == NULL){

AfxMessageBox("Fucking Operation");

return FALSE;

}



//write WAVE Header

_lwrite(Inn,(LPSTR)"RIFF",4);

len = 40+dataSize;



_lwrite(Inn,(LPSTR)&len,4);



_lwrite(Inn,(LPSTR)"WAVE",4);



_lwrite(Inn,(LPSTR)"fmt ",4);



len = 16; //wave format chunk



_lwrite(Inn,(LPSTR)&len,4);

short i;



i = 1; //wave format = 1



_lwrite(Inn,(LPSTR)&i,2);



i = 1; //mono channel

_lwrite(Inn,(LPSTR)&i,2);



DWORD j;



j = 8000; //sampling rate



_lwrite(Inn,(LPSTR)&j,4);



j = 16000*1*2; //(sampling rate)*(nChannels)*(nBlockAlign)

_lwrite(Inn,(LPSTR)&j,4);



//the byte of a sample

i = 2;

_lwrite(Inn,(LPSTR)&i,2);



//the bit of a sample

i = 16;

_lwrite(Inn,(LPSTR)&i,2);



//setting data chunk

_lwrite(Inn,(LPSTR)"data",4);



len = dataSize;

_lwrite(Inn,(LPSTR)&len,4);



if(len != _lwrite(Inn,(LPSTR)data,len)){

char tmp[256];

sprintf(tmp,"Cannot write data into %s len : %f ",filename,len);

AfxMessageBox("Cannot write data into file");

return FALSE;

}



_lclose(Inn);



0  COMMENTS