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

RageSoundDriver_DSound.h

Go to the documentation of this file.
00001 #ifndef RAGE_SOUND_DSOUND 00002 #define RAGE_SOUND_DSOUND 00003 00004 #include "RageSoundDriver.h" 00005 #include "DSoundHelpers.h" 00006 #include "RageThreads.h" 00007 #include "RageTimer.h" 00008 00009 struct IDirectSound; 00010 struct IDirectSoundBuffer; 00011 00012 class RageSound_DSound: public RageSoundDriver 00013 { 00014 /* The only place that takes sounds out of INACTIVE is StartMixing; this mutex 00015 * serializes inactive sounds. */ 00016 RageMutex m_InactiveSoundMutex; 00017 00018 struct stream { 00019 /* Actual audio stream: */ 00020 DSoundBuf *pcm; 00021 00022 /* Sound object that's playing on this stream, or NULL if this 00023 * channel is available: */ 00024 RageSoundBase *snd; 00025 00026 enum { 00027 INACTIVE, 00028 SETUP, 00029 PLAYING, 00030 FLUSHING, 00031 FINISHED 00032 } state; 00033 00034 int64_t flush_pos; /* state == FLUSHING only */ 00035 00036 RageTimer start_time; 00037 bool GetData( bool init, bool &bEOF ); 00038 00039 stream() { pcm = NULL; snd = NULL; state=INACTIVE; } 00040 ~stream(); 00041 }; 00042 00043 /* Pool of available streams. */ 00044 vector<stream *> stream_pool; 00045 00046 DSound ds; 00047 00048 RageMutex m_Mutex; 00049 00050 bool shutdown; /* tells the MixerThread to shut down */ 00051 static int MixerThread_start(void *p); 00052 void MixerThread(); 00053 RageThread MixingThread; 00054 00055 /* virtuals: */ 00056 void StartMixing( RageSoundBase *snd ); /* used by RageSound */ 00057 void StopMixing( RageSoundBase *snd ); /* used by RageSound */ 00058 int64_t GetPosition( const RageSoundBase *snd ) const; 00059 void Update(float delta); 00060 00061 int GetSampleRate( int rate ) const { return rate; } 00062 00063 public: 00064 RageSound_DSound(); 00065 ~RageSound_DSound(); 00066 CString Init(); 00067 }; 00068 00069 #endif 00070 00071 /* 00072 * (c) 2002-2004 Glenn Maynard 00073 * All rights reserved. 00074 * 00075 * Permission is hereby granted, free of charge, to any person obtaining a 00076 * copy of this software and associated documentation files (the 00077 * "Software"), to deal in the Software without restriction, including 00078 * without limitation the rights to use, copy, modify, merge, publish, 00079 * distribute, and/or sell copies of the Software, and to permit persons to 00080 * whom the Software is furnished to do so, provided that the above 00081 * copyright notice(s) and this permission notice appear in all copies of 00082 * the Software and that both the above copyright notice(s) and this 00083 * permission notice appear in supporting documentation. 00084 * 00085 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00086 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00087 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00088 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00089 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00090 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00091 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00092 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00093 * PERFORMANCE OF THIS SOFTWARE. 00094 */

Generated on Thu Jan 27 20:57:28 2005 for StepMania by doxygen 1.3.7