add virtual copy ctor for RageSoundReaders
This commit is contained in:
@@ -16,6 +16,7 @@ public:
|
|||||||
virtual int SetPosition_Fast(int ms) { return SetPosition_Accurate(ms); }
|
virtual int SetPosition_Fast(int ms) { return SetPosition_Accurate(ms); }
|
||||||
virtual int Read(char *buf, unsigned len) = 0;
|
virtual int Read(char *buf, unsigned len) = 0;
|
||||||
virtual ~SoundReader() { }
|
virtual ~SoundReader() { }
|
||||||
|
virtual SoundReader *Copy() const = 0;
|
||||||
|
|
||||||
bool Error() const { return !error.empty(); }
|
bool Error() const { return !error.empty(); }
|
||||||
string GetError() const { return error; }
|
string GetError() const { return error; }
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
* something wrong with my SDL_sound MAD wrapper ...
|
* something wrong with my SDL_sound MAD wrapper ...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef DEBUG
|
||||||
#pragma comment(lib, "SDL_sound-1.0.0/lib/sdl_sound_static_d.lib")
|
#pragma comment(lib, "SDL_sound-1.0.0/lib/sdl_sound_static_d.lib")
|
||||||
#else
|
#else
|
||||||
#pragma comment(lib, "SDL_sound-1.0.0/lib/sdl_sound_static.lib")
|
#pragma comment(lib, "SDL_sound-1.0.0/lib/sdl_sound_static.lib")
|
||||||
@@ -21,8 +21,9 @@ const int samplerate = 44100;
|
|||||||
/* The amount of data to read from SDL_sound at once. */
|
/* The amount of data to read from SDL_sound at once. */
|
||||||
const int read_block_size = 1024;
|
const int read_block_size = 1024;
|
||||||
|
|
||||||
bool SoundReader_SDL_Sound::Open(CString filename)
|
bool SoundReader_SDL_Sound::Open(CString filename_)
|
||||||
{
|
{
|
||||||
|
filename=filename_;
|
||||||
static bool initialized = false;
|
static bool initialized = false;
|
||||||
if(!initialized)
|
if(!initialized)
|
||||||
{
|
{
|
||||||
@@ -150,3 +151,11 @@ SoundReader_SDL_Sound::~SoundReader_SDL_Sound()
|
|||||||
{
|
{
|
||||||
Sound_FreeSample(Sample);
|
Sound_FreeSample(Sample);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SoundReader *SoundReader_SDL_Sound::Copy() const
|
||||||
|
{
|
||||||
|
SoundReader_SDL_Sound *ret = new SoundReader_SDL_Sound;
|
||||||
|
ret->Open(filename);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class SoundReader_SDL_Sound: public SoundReader {
|
|||||||
const char *inbuf;
|
const char *inbuf;
|
||||||
unsigned avail;
|
unsigned avail;
|
||||||
int SetPosition(int ms, bool accurate);
|
int SetPosition(int ms, bool accurate);
|
||||||
|
CString filename;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool Open(CString filename);
|
bool Open(CString filename);
|
||||||
@@ -18,6 +19,7 @@ public:
|
|||||||
int SetPosition_Fast(int ms) { return SetPosition(ms, false); }
|
int SetPosition_Fast(int ms) { return SetPosition(ms, false); }
|
||||||
int Read(char *buf, unsigned len);
|
int Read(char *buf, unsigned len);
|
||||||
~SoundReader_SDL_Sound();
|
~SoundReader_SDL_Sound();
|
||||||
|
SoundReader *Copy() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user