Files
itgmania212121/stepmania/src/arch/Sound/RageSoundDriver_Null.h
T

62 lines
1.5 KiB
C++
Raw Normal View History

2003-02-12 01:54:01 +00:00
#ifndef RAGE_SOUND_NULL
#define RAGE_SOUND_NULL
/* RageSound_Null fakes playing sounds having GetPosition()
* return seconds since the constructor was called.
*
* Only tested in linux, but intended to work across the globe.
* ( uses time_t, sleep() and nanosleep() from <time.h> )
*
* The timing probably isn't accurate, but at least it is fairly
* steady. Someone with more knowledge of RageSound, feel free
* to play around with this (not that it's any sort of priority).
*/
2003-02-12 01:54:01 +00:00
#include "RageSound.h"
2003-04-23 19:38:30 +00:00
#include "RageSoundDriver.h"
2003-07-26 23:12:38 +00:00
#include "RageThreads.h"
2003-02-12 01:54:01 +00:00
class RageSound_Null: public RageSoundDriver
{
2003-06-13 20:49:09 +00:00
private:
struct sound {
2004-01-15 02:59:44 +00:00
RageSoundBase *snd;
2003-02-20 22:54:12 +00:00
bool stopping;
int samples_buffered; /* fake */
sound() { snd = NULL; stopping=false; samples_buffered = 0; }
};
2003-02-20 22:54:12 +00:00
/* List of currently playing sounds: */
vector<sound *> sounds;
bool shutdown;
2003-07-27 03:10:44 +00:00
RageThread MixingThread;
2003-02-20 22:54:12 +00:00
static int MixerThread_start(void *p);
void MixerThread();
2003-06-13 20:49:09 +00:00
protected:
2003-02-12 01:54:01 +00:00
/* virtuals: */
2004-01-15 02:59:44 +00:00
virtual void StartMixing( RageSoundBase *snd );
virtual void StopMixing( RageSoundBase *snd );
2004-01-19 22:21:57 +00:00
virtual int64_t GetPosition( const RageSoundBase *snd ) const;
2003-06-13 20:49:09 +00:00
virtual float GetPlayLatency() const;
virtual void Update(float delta);
virtual bool GetData();
2003-06-13 20:49:09 +00:00
public:
2003-02-20 22:54:12 +00:00
RageSound_Null();
~RageSound_Null();
2003-02-12 01:54:01 +00:00
};
#endif
/*
* Copyright (c) 2003 by the person(s) listed below. All rights reserved.
*
* Glenn Maynard
*
* 2003-02 Modified to fake playing sound Aaron VonderHaar
*
2003-02-12 01:54:01 +00:00
*/