Planeshift

queue.h

Go to the documentation of this file.
00001 /*
00002  * queue.h
00003  *
00004  * Copyright (C) 2001-2010 Atomic Blue ([email protected], http://www.planeshift.it)
00005  *
00006  * Credits : Saul Leite <[email protected]>
00007  *           Mathias 'AgY' Voeroes <[email protected]>
00008  *           and all past and present planeshift coders
00009  *
00010  * This program is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU General Public License
00012  * as published by the Free Software Foundation (version 2 of the License.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00021  *
00022  */
00023 
00024 #ifndef _SOUND_QUEUE_H_
00025 #define _SOUND_QUEUE_H_
00026 
00027 #include <csutil/csstring.h>
00028 #include <csutil/array.h>
00029 
00030 class SoundHandle;
00031 class SoundControl;
00032 
00039 class SoundQueueItem
00040 {
00041     public:
00042     csString        filename;   
00043     SoundHandle     *handle;    
00044 
00049     SoundQueueItem (const char *file);
00053     ~SoundQueueItem ();
00054 };
00055 
00056 
00061 class SoundQueue
00062 {
00063     private:
00064     csArray<SoundQueueItem*>    queue;              
00065     float                       volume;             
00066     SoundControl               *sndCtrl;            
00067 
00068     public:
00074     SoundQueue (SoundControl* &ctrl, float vol);
00078     ~SoundQueue ();
00084     void AddItem (const char *filename);
00090     void DeleteItem (SoundQueueItem* &item);
00096     void Work ();
00098     void Purge ();
00099 
00103     size_t GetSize(); 
00104 };
00105 
00106 #endif /*_SOUND_QUEUE_H_*/