TWaveOut class v2.1
-------------------

TWaveOut is a wrapper class, encapsulating the WinAPI waveOut*
functions. The previous versions had more latency and could also
produce a short popping sound when opening and closing the sound
device. This should now be history!

Latency: There will be some time differance between the moment
you send a sample until it reaches the D/A. The latency (counted
in samples) is:
"number of buffers * samples per buffer"

Step by step instructions of how to use it:

// 1. Include the file TWaveOut.hpp in your project:
   #include "TWaveOut.hpp"

// 2. Create a TWaveOut object:
   TWaveOut *woTest = new TWaveOut(); // using 2 buffers

// 3. Open the wave out device:
   woTest->OpenPCM(); /* WAVE_MAPPER,
                         8820 samples per buffer,
                         44100 samples/second,
                         2 channels,
                         16 bits/sample */

// 4. Write some raw sound data:
   #include <math.h>  // for the sine function

   // One second of sound

   int lvol=32767,     // left channel volume
       rvol=32767;     // right channel volume
   double lfreq=440.0, // left channel frequency
          rfreq=880.0; // right channel frequency

   for( int sample=0; sample<44100; sample++ ) {
       woTest->Write_16( lvol*sin(sample*lfreq*2*M_PI/44100) ); // Left channel
       woTest->Write_16( rvol*sin(sample*rfreq*2*M_PI/44100) ); // Right channel
   }

// 5. Close the wave out device:
   woTest->Close();

Please report success or failure to
ted@lyncon.se

Kind regards,
Ted Lyngmo
13-June-2003