Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

directsound.h

Go to the documentation of this file.
00001 /*
00002         ClanSound, sound mixing library written for ClanLib.
00003         Copyright (c)1998 Magnus Norddahl / ClanSoft.
00004 */
00005 
00006 #ifndef header_directsound
00007 #define header_directsound
00008 
00009 #include <dsound.h>
00010 
00011 class CL_CSOutput
00012 {
00013 public:
00014         CL_CSOutput();
00015         ~CL_CSOutput();
00016 
00017         void silence();
00018         // Called when we have no samples to play - and wants to tell the soundcard
00019         // about this possible event.
00020 
00021         bool is_full();
00022         // Returns true if all fragments are filled with data.
00023 
00024         int get_frag_size() const { return frag_size; }
00025         // Returns the buffer size used by device (returned as num [stereo] samples).
00026 
00027         void write_fragment(short *data);
00028         // Writes a fragment to the soundcard.
00029 
00030         void wait();
00031         // Waits until output source isn't full anymore.
00032 
00033 private:
00034         LPDIRECTSOUND directsound;
00035         LPDIRECTSOUNDBUFFER soundbuffer;
00036         int frag_size, buffer_size, bytes_per_sample;
00037         HANDLE sleep_event;
00038         LPDIRECTSOUNDNOTIFY notify;
00039 };
00040 
00041 #endif

Generated at Wed Apr 4 19:53:59 2001 for ClanLib by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001