title: What precisely is the "silence" value in the SDL audio API?
body: <p>In SDL, when you set up your audio output device, you and SDL have to agree on an audio format - e.g. 44.1KHz stereo 16-bit signed little-endian. That's fine. But along with the final agreed format, you also get a computed "silence" value which doesn't seem well documented.</p>
  
  <p>A silent sound sample obviously consist of the same sample value repeated over and over again, and you want that to be at the "zero" level. In a sense any constant value will do, but you have to agree a value (so you don't get pops when switching to a different sound), and in a sane world you want to choose a value bang in the centre of your sample-value range.</p>
  
  <p>So if you happen to use an unsigned format for your sample value range for 0..whatever, your silence value will be (whatever/2).</p>
  
  <p><strong>EDIT</strong> - inserted "unsigned" below to avoid confusion.</p>
  
  <p>That's all fine. But the silence value you get given is an unsigned 8-bit integer. That doesn't work very well if you want unsigned 16 bit samples - the logical silence value of 0x8000 requires two different byte values and it requires them to be in the correct endian order.</p>
  
  <p>So the silence value you get from SDL doesn't seem to make much sense. You can't use it to wipe your buffers, for instance, without dealing with extra complications and making inferences which pretty much make the precalculated silence value pointless anyway.</p>
  
  <p>Which means, of course, that I've misunderstood the point.</p>
  
  <p>So - if this isn't how the silence value is meant to be used, how <em>should</em> it be used?</p>