Blender  V2.59
AUD_SequencerFactory.h
Go to the documentation of this file.
00001 /*
00002  * $Id: AUD_SequencerFactory.h 36092 2011-04-10 22:40:37Z nexyon $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * Copyright 2009-2011 Jörg Hermann Müller
00007  *
00008  * This file is part of AudaSpace.
00009  *
00010  * Audaspace is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * AudaSpace is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with Audaspace; if not, write to the Free Software Foundation,
00022  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00023  *
00024  * ***** END GPL LICENSE BLOCK *****
00025  */
00026 
00032 #ifndef AUD_SEQUENCERFACTORY
00033 #define AUD_SEQUENCERFACTORY
00034 
00035 #include "AUD_IFactory.h"
00036 
00037 #include <list>
00038 
00039 typedef float (*AUD_volumeFunction)(void*, void*, float);
00040 
00041 struct AUD_SequencerEntry
00042 {
00043         AUD_IFactory** sound;
00044         float begin;
00045         float end;
00046         float skip;
00047         bool muted;
00048         void* data;
00049 };
00050 
00051 class AUD_SequencerReader;
00052 
00056 class AUD_SequencerFactory : public AUD_IFactory
00057 {
00058 private:
00062         AUD_Specs m_specs;
00063 
00064         std::list<AUD_SequencerEntry*> m_entries;
00065         std::list<AUD_SequencerReader*> m_readers;
00066         bool m_muted;
00067         void* m_data;
00068         AUD_volumeFunction m_volume;
00069 
00070         AUD_IReader* newReader();
00071 
00072         // hide copy constructor and operator=
00073         AUD_SequencerFactory(const AUD_SequencerFactory&);
00074         AUD_SequencerFactory& operator=(const AUD_SequencerFactory&);
00075 
00076 public:
00077         AUD_SequencerFactory(AUD_Specs specs, bool muted, void* data, AUD_volumeFunction volume);
00078         ~AUD_SequencerFactory();
00079 
00080         void mute(bool muted);
00081         bool getMute() const;
00082         AUD_SequencerEntry* add(AUD_IFactory** sound, float begin, float end, float skip, void* data);
00083         void remove(AUD_SequencerEntry* entry);
00084         void move(AUD_SequencerEntry* entry, float begin, float end, float skip);
00085         void mute(AUD_SequencerEntry* entry, bool mute);
00086 
00087         virtual AUD_IReader* createReader() const;
00088 
00089         void removeReader(AUD_SequencerReader* reader);
00090 };
00091 
00092 #endif //AUD_SEQUENCERFACTORY