<div>Hi,<br><br>I am capturing 16 bit mono sound samples using some Win32 API function calls. These function calls return the sound samples in an array of characters. My assumption is that this array of characters represents pairs of bytes that make up a short integer.
<br><br>I'm using the following code to convert the samples:<br><br>LPTSTR *lpSaveBuffer;<br>......<br>for(j=0;j<nBytes;++J) <br>{<br> BYTE a = lpSaveBuffer[2*j]; // left byte<br> BYTE b = lpSaveBuffer[2*j + 1]; // right byte
<br> short sample = (a << 8) | (b & 0xff);<br>}<br><br>I'm getting garbage as a result of this conversion. Any help would be appreciated.</div>
<div> </div>
<div>Thanks,</div>
<div>Peter</div>