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

RageSoundDriver_ALSA9.h

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

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