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

stream_provider_raw.h

Go to the documentation of this file.
00001 /*
00002         $Id: stream_provider_raw.h,v 1.1 2001/03/06 15:09:12 mbn Exp $
00003 
00004         ------------------------------------------------------------------------
00005         ClanLib, the platform independent game SDK.
00006 
00007         This library is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE
00008         version 2. See COPYING for details.
00009 
00010         For a total list of contributers see CREDITS.
00011 
00012         ------------------------------------------------------------------------
00013 
00014         File purpose:
00015                 Streamed sample header file
00016 */
00017 
00019 
00020 #ifndef header_streamed_raw_sample
00021 #define header_streamed_raw_sample
00022 
00023 #include <stdlib.h>
00024 #include "../stream_soundprovider.h"
00025 #include "../soundbuffer.h"
00026 
00027 class CL_Streamed_RawSample : public CL_StreamSoundProvider
00028 //: Streamed sample in raw PCM format (no header).
00029 // This class providers playback support for raw PCM samples. That is just
00030 // the PCM sample data, not header.
00031 // <br>
00032 // Unlike CL_Sample_Raw, this class doesn't load the entire PCM stream into
00033 // memory. Instead it slowly loads it from disk as the data is needed. With
00034 // very large samples, this is a very good idea.
00035 // <br>
00036 // If the sample is small and used a lot, you should consider using
00037 // CL_Sample_Raw instead.
00044 {
00045 public:
00046         static CL_SoundBuffer *create(
00047                 const char *filename,
00048                 SoundFormat format,
00049                 int frequency,
00050                 CL_InputSourceProvider *inputprovider = NULL,
00051                 bool looped = false);
00052         // Creates a soundbuffer using this provider.
00059 
00060         CL_Streamed_RawSample(
00061                 const char *filename,
00062                 SoundFormat format,
00063                 int frequency,
00064                 CL_InputSourceProvider *inputprovider = NULL,
00065                 bool looped = false);
00066         // Constructs an instance of this class.
00072 
00073         virtual ~CL_Streamed_RawSample();
00074 
00075         virtual CL_StreamSoundProvider_Session *begin_session();
00076         // Called by the sound implementation when a session is begun.
00077 
00078         virtual void end_session(CL_StreamSoundProvider_Session *session);
00079         // Called by the sound implementation just before a playback session has
00080         // ended.
00081 
00082 protected:
00083         std::string filename;
00084         CL_InputSourceProvider *inputprovider;
00085         bool looped;
00086         SoundFormat format;
00087         int frequency;
00088 };
00089 
00090 class CL_Streamed_RawSample_Session : public CL_StreamSoundProvider_Session
00091 {
00092 protected:
00093         CL_InputSource *input;
00094 
00095         SoundFormat sample_format;
00096         int sample_size;
00097         int sample_freq;
00098         int sample_left;
00099         bool looped;
00100 
00101 public:
00102         CL_Streamed_RawSample_Session(
00103                 CL_InputSource *input,
00104                 SoundFormat format,
00105                 int frequency,
00106                 bool looped);
00107 
00108         virtual ~CL_Streamed_RawSample_Session();
00109 
00110         virtual void stop() {}; //FIXME
00111         virtual bool play() { return false; }; //FIXME
00112         virtual bool set_position(int pos) { pos=pos; return false; }; //FIXME
00113         
00114         virtual bool eof() const;
00115         virtual int get_data(void *data_ptr, int data_requested);
00116         virtual int get_frequency() const;
00117         virtual SoundFormat get_format() const;
00118 };
00119 
00120 #endif

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