search for: lpsavebuffer

Displaying 2 results from an estimated 2 matches for "lpsavebuffer".

2006 Sep 16
3
converting 16-bit samples in LPSTR to short
...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. I'm using the following code to convert the samples: LPTSTR *lpSaveBuffer; ...... for(j=0;j<nBytes;++J) { BYTE a = lpSaveBuffer[2*j]; // left byte BYTE b = lpSaveBuffer[2*j + 1]; // right byte short sample = (a << 8) | (b & 0xff); } I'm getting garbage as a result of this conversion. Any help would be appreciated. Thanks, Peter -----...
2006 Sep 16
0
converting 16-bit samples in LPSTR to short
...indows on x86?) machine, you're reassembling the word backwards. Not to mention, shifting a BYTE left by 8 inside those parentheses is probably turning it into 0. If you actually need to swap the bytes, try casting to a short before shifting. -- john for(j=0;j<nBytes;++J) { BYTE a = lpSaveBuffer[2*j]; // left byte BYTE b = lpSaveBuffer[2*j + 1]; // right byte short sample = (a << 8) | (b & 0xff); } I'm getting garbage as a result of this conversion. Any help would be appreciated. -------------- next part -------------- An HTML attachment was scrubbed... URL: ht...