Re: [win 32] loading dll (lame encoder)
Great! I seem to have sorted it out like this:
Code:
int k = 0;
while(1)
{
if(stop_thread_flag)
break;
// CALLBACK EVENT
WaitForSingleObject(hevent, INFINITE);
if(buff[k].dwFlags & WHDR_DONE && !stop_thread_flag)
{
// Save WAVE
hFile2.write(buff[k].lpData, buff[k].dwBytesRecorded);
dwWAVBufferCounter += buff[k].dwBytesRecorded;
// Encode samples
//
// (LPSTR) buff[k].lpData is (system_buf_len) bytes long (8 BIT)
// (PSHORT)buff[k].lpData is (system_buf_len)/2 (16 BIT)
//
result = beEncodeChunk(hbeStream, dwSamples, (PSHORT)buff[k].lpData,
pMP3Buffer, &dwWrite);
// Save MP3
hFile.write((LPSTR)pMP3Buffer, dwWrite);
dwMP3BufferCounter += dwWrite;
waveInAddBuffer(hwi, &buff[k], sizeof(WAVEHDR));
}
if(k == num_buffers -1)
k = 0;
else
k++;
}
basically I get the audio thru the WAVFORM API to a 2304*2 bytes long buffer
(LPSTR),
so that when I do (PSHORT)buffer to the DLL it'll look like 2304 samples (16
BIT)
having said that, I am getting mono audio...
the whole code is avaible here:
http://theartofweb.net/cpp/mp3Recorder_05.txt
the programm is supposed to grab the audi from a device and save it realtime
in both WAVE and MP3 files
Re: [win 32] loading dll (lame encoder)
I use lame_enc.DLL to convert wave file to mp3 file, it works OK for all 16-bits-per-sample wave files, but if the wave files are 8-bits-per-sample wave files, the results mp3 files are only noise. Who could tell me where is wrong? Thank you!
Re: [win 32] loading dll (lame encoder)
Maybe lame_enc doesn't support 8-bits-per-sample wave files. Have you checked the documentation?
Re: [win 32] loading dll (lame encoder)
I unzip lame-3.99.5.tar, in the folder lame-3.99.5\doc\html, there are some help files. I read these files, but don't find whether lame_enc.dll supports 8-bits-per-sample wave file.