00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00019
00020 #ifndef header_streamed_mikmod_sample
00021 #define header_streamed_mikmod_sample
00022
00023 #include <stdlib.h>
00024 #include "../core.h"
00025 #include "API/Sound/stream_soundprovider.h"
00026 #include "API/Sound/soundbuffer.h"
00027
00028 extern "C"
00029 {
00030 #include <mikmod.h>
00031 }
00032
00033 class CL_Streamed_MikModSample : public CL_StreamSoundProvider
00034
00035
00036
00037
00038
00039 {
00040 protected:
00041 std::string filename;
00042 bool looped;
00043
00044 MODULE *module;
00045 public:
00046 static CL_SoundBuffer *create(
00047 const char *filename,
00048 CL_InputSourceProvider *inputprovider = NULL,
00049 bool looped = false);
00050
00051
00052 static CL_SoundBuffer *load(
00053 const char *res_id,
00054 CL_ResourceManager *manager,
00055 bool looped = false);
00056
00057
00058 CL_Streamed_MikModSample(
00059 const char *filename,
00060 CL_InputSourceProvider *inputprovider = NULL,
00061 bool looped = false);
00062
00063
00064 CL_Streamed_MikModSample(
00065 const char *res_id,
00066 CL_ResourceManager *manager,
00067 bool looped = false);
00068
00069
00070 virtual ~CL_Streamed_MikModSample();
00071
00072 virtual CL_StreamSoundProvider_Session *begin_session();
00073
00074
00075 virtual void end_session(CL_StreamSoundProvider_Session *session);
00076
00077
00078 };
00079
00080 class CL_Streamed_MikModSample_Session : public CL_StreamSoundProvider_Session
00081 {
00082
00083
00084 protected:
00085 friend CL_Streamed_MikModSample;
00086
00087 CL_Streamed_MikModSample_Session(MODULE *_module, bool _looped);
00088
00089 MODULE *module;
00090 bool looped;
00091
00092 SoundFormat sample_format;
00093 int sample_size;
00094 int sample_freq;
00095 int sample_left;
00096
00097 public:
00098
00099
00100
00101
00102 virtual ~CL_Streamed_MikModSample_Session();
00103
00104 virtual void stop();
00105 virtual bool play();
00106 virtual bool set_position(int pos);
00107
00108 virtual bool eof() const;
00109 virtual int get_data(void *data_ptr, int data_requested);
00110 virtual int get_frequency() const;
00111 virtual SoundFormat get_format() const;
00112
00113 static BOOL clanMikMod_IsPresent () { return 1; }
00114 static void clanMikMod_Update () { }
00115 };
00116
00117 #endif
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134