MusicProcess.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2003-2007 The Pentagram team
00003 
00004 This program is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU General Public License
00006 as published by the Free Software Foundation; either version 2
00007 of the License, or (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017 */
00018 
00019 
00020 #ifndef MUSICPROCESS_H_INCLUDED
00021 #define MUSICPROCESS_H_INCLUDED
00022 
00023 #include "Process.h"
00024 #include "intrinsics.h"
00025 
00026 class MidiDriver;
00027 
00028 class MusicProcess : public Process
00029 {
00030 public:
00031         MusicProcess();
00032         MusicProcess(MidiDriver *);     // Note that this does NOT delete the driver
00033         virtual ~MusicProcess();
00034 
00035         // p_dynamic_cast stuff
00036         ENABLE_RUNTIME_CLASSTYPE();
00037 
00039         static MusicProcess     * get_instance() { return the_music_process; }
00040 
00041         void playMusic(int track);
00042         void playCombatMusic(int track);
00043         void queueMusic(int track);
00044         void unqueueMusic();
00045         void restoreMusic();
00046 
00047         INTRINSIC(I_playMusic);
00048         INTRINSIC(I_musicStop);
00049 
00050 
00052         int getTrack() const { return wanted_track; }
00053 
00054         virtual bool run(const uint32 framenum);
00055 
00056         bool loadData(IDataSource* ids, uint32 version);
00057 
00058         // MusicProcess::playMusic console command
00059         static void ConCmd_playMusic(const Console::ArgvType &argv);
00060 
00061 private:
00062         virtual void saveData(ODataSource* ods);
00063 
00066         void playMusic_internal(int track);
00067 
00068         static MusicProcess     *       the_music_process;
00069 
00070         MidiDriver * driver;
00071         int                     state;
00072         int                     current_track;          // Currently playing track (don't save)
00073         int                     wanted_track;           // Track we want to play (save this)
00074         int                     song_branches[128];
00075 
00076         int                     last_request;           // Last requested track
00077         int                     queued_track;           // Track queued to start after current
00078 
00079         enum MusicStates {
00080                 MUSIC_NORMAL                            = 1,
00081                 MUSIC_TRANSITION                        = 2,
00082                 MUSIC_PLAY_WANTED                       = 3
00083         };
00084 };
00085 
00086 
00087 #endif //MUSICPROCESS_H_INCLUDED

Generated on Fri Jul 27 22:27:26 2007 for pentagram by  doxygen 1.4.7