<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 10">
<meta name=Originator content="Microsoft Word 10">
<link rel=File-List href="cid:filelist.xml@01C6D9D2.0CB84400">
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:DoNotRelyOnCSS/>
</o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:SpellingState>Clean</w:SpellingState>
<w:GrammarState>Clean</w:GrammarState>
<w:DocumentKind>DocumentEmail</w:DocumentKind>
<w:HyphenationZone>21</w:HyphenationZone>
<w:EnvelopeVis/>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;
        mso-font-charset:0;
        mso-generic-font-family:swiss;
        mso-font-pitch:variable;
        mso-font-signature:1627421319 -2147483648 8 0 66047 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-parent:"";
        margin:0cm;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;
        text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;
        text-underline:single;}
span.E-postmall17
        {mso-style-type:personal-reply;
        mso-style-noshow:yes;
        mso-ansi-font-size:10.0pt;
        mso-bidi-font-size:10.0pt;
        font-family:Arial;
        mso-ascii-font-family:Arial;
        mso-hansi-font-family:Arial;
        mso-bidi-font-family:Arial;
        color:navy;}
span.SpellE
        {mso-style-name:"";
        mso-spl-e:yes;}
span.GramE
        {mso-style-name:"";
        mso-gram-e:yes;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;
        mso-header-margin:35.4pt;
        mso-footer-margin:35.4pt;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
        {mso-style-name:"Normal tabell";
        mso-tstyle-rowband-size:0;
        mso-tstyle-colband-size:0;
        mso-style-noshow:yes;
        mso-style-parent:"";
        mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
        mso-para-margin:0cm;
        mso-para-margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:10.0pt;
        font-family:"Times New Roman";}
</style>
<![endif]-->
</head>
<body lang=SV link=blue vlink=purple style='tab-interval:65.2pt'>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy;mso-ansi-language:EN-GB'>What
kind of crazy old Win32 API is that?<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy;mso-ansi-language:EN-GB'>I’ve
used DirectSound and <span class=SpellE>WinMM</span> and never needed to do
something like what you are doing.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>
<p class=MsoNormal><span class=SpellE><font size=2 color=navy face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial;color:navy;mso-ansi-language:
EN-GB'>AFAIK</span></font></span><font size=2 color=navy face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial;color:navy;mso-ansi-language:
EN-GB'>, all existing Win32 APIs for capturing sound returns buffers of 16-bit <span
class=SpellE>PCM</span> data, assuming <span class=SpellE>PCM</span> was
specified as buffer format.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy;mso-ansi-language:EN-GB'><br>
//JT<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:65.2pt'><span class=GramE><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>----<span
class=SpellE>-Ursprungligt</span> meddelande-----<br>
<b><span style='font-weight:bold'>Från:</span></b> speex-dev-bounces@xiph.org</span></font></span><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
[mailto:speex-dev-bounces@xiph.org] <b><span style='font-weight:bold'>För </span></b>Peter
Gien<br>
<b><span style='font-weight:bold'>Skickat:</span></b> den 16 september 2006
16:48<br>
<b><span style='font-weight:bold'>Till:</span></b> speex-dev<br>
<b><span style='font-weight:bold'>Ämne:</span></b> [Speex-dev] converting
16-bit samples in LPSTR to short</span></font></p>
<p class=MsoNormal style='margin-left:65.2pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<div>
<p class=MsoNormal style='margin-left:65.2pt'><span class=GramE><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>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. </span></font></span>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 <span class=GramE>*lpSaveBuffer;<br>
......<br>
for(</span>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.<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal style='margin-left:65.2pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'> <o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:65.2pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>Thanks,<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-left:65.2pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>Peter<o:p></o:p></span></font></p>
</div>
</div>
</body>
</html>