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

70 lines
2.8 KiB
C++
Raw Normal View History

2002-12-13 08:33:25 +00:00
#ifndef RAGE_SOUND_DRIVER
#define RAGE_SOUND_DRIVER
2004-01-15 02:59:44 +00:00
class RageSoundBase;
2002-12-13 08:33:25 +00:00
class RageSoundDriver
{
2004-01-15 02:59:44 +00:00
public:
2002-12-13 08:33:25 +00:00
friend class RageSoundManager;
/* A RageSound calls this to request to be played.
* XXX: define what we should do when it can't be played (eg. out of
* channels) */
2004-01-15 02:59:44 +00:00
virtual void StartMixing( RageSoundBase *snd ) = 0;
2002-12-13 08:33:25 +00:00
/* A RageSound calls this to request it not be played. When this function
* returns, snd is no longer valid; ensure no running threads are still
* accessing it before returning. This must handle gracefully the case where
* snd was not actually being played, though it may print a warning. */
2004-01-15 02:59:44 +00:00
virtual void StopMixing( RageSoundBase *snd ) = 0;
2002-12-13 08:33:25 +00:00
/* Get the current position of a given buffer, in the same units and time base
* as passed to RageSound::GetPCM. */
2004-01-19 22:21:36 +00:00
virtual int64_t GetPosition( const RageSoundBase *snd ) const = 0;
2002-12-13 08:33:25 +00:00
/* When a sound is finished playing (GetPCM returns less than requested) and
* the sound has been completely flushed (so GetPosition is no longer meaningful),
2004-04-07 04:20:32 +00:00
* call RageSoundBase::SoundIsFinishedPlaying(). */
2002-12-13 08:33:25 +00:00
/* Optional, if needed: */
virtual void Update(float delta) { }
/* Sound startup latency--delay between Play() being called and actually
* hearing it. (This isn't necessarily the same as the buffer latency.) */
virtual float GetPlayLatency() const { return 0.0f; }
/* This is called if the volume changed; call SOUNDMAN->GetMixVolume() to
* get it. */
virtual void VolumeChanged() { }
virtual int GetSampleRate( int rate ) const { return 44100; }
2003-04-23 19:30:41 +00:00
2002-12-13 08:33:25 +00:00
virtual ~RageSoundDriver() { }
};
/*
2004-05-15 20:28:17 +00:00
* (c) 2002-2004 Glenn Maynard
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
2002-12-13 08:33:25 +00:00
*/
#endif