Back to index

supertuxkart  0.5+dfsg1
music_information.hpp
Go to the documentation of this file.
00001 //  $Id: music_information.hpp 1610 2008-03-01 03:18:53Z hikerstk $
00002 //
00003 //  SuperTuxKart - a fun racing game with go-kart
00004 //  Copyright (C) 2008 Joerg Henrichs
00005 //
00006 //  This program is free software; you can redistribute it and/or
00007 //  modify it under the terms of the GNU General Public License
00008 //  as published by the Free Software Foundation; either version 2
00009 //  of the License, or (at your option) any later version.
00010 //
00011 //  This program is distributed in the hope that it will be useful,
00012 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //  GNU General Public License for more details.
00015 //
00016 //  You should have received a copy of the GNU General Public License
00017 //  along with this program; if not, write to the Free Software
00018 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 
00020 #ifndef HEADER_MUSIC_INFORMATION
00021 #define HEADER_MUSIC_INFORMATION
00022 
00023 #include <string>
00024 #include <vector>
00025 #include "music.hpp"
00026 
00027 class MusicInformation
00028 {
00029 private:
00030     std::string              m_composer;
00031     std::string              m_title;
00032     std::string              m_normal_filename;
00033     std::string              m_fast_filename;
00034     std::vector<std::string> m_all_tracks;      
00035     int                      m_numLoops;
00036     float                    m_faster_time;    // Either time for fading faster
00037                                                // music in, or time to change pitch
00038     float                    m_max_pitch;      // maximum pitch for faster music
00039     static const int         LOOP_FOREVER=-1;
00040     Music                   *m_normal_music,
00041                             *m_fast_music;
00042     enum {SOUND_NORMAL,                        // normal music is played
00043           SOUND_FADING,                        // normal music fading out, faster fading in
00044           SOUND_FASTER,                        // change pitch of normal music
00045           SOUND_FAST}                          // playing faster music or max pitch reached
00046                              m_mode; 
00047     float                    m_time_since_faster;
00048 
00049 public:
00050                        MusicInformation (const std::string& filename);
00051     const std::string& getComposer      () const {return m_composer;        }
00052     const std::string& getTitle         () const {return m_title;           }
00053     const std::string& getNormalFilename() const {return m_normal_filename; }
00054     const std::string& getFastFilename  () const {return m_fast_filename;   }
00055     int                getNumLoops      () const {return m_numLoops;        }
00056     float              getFasterTime    () const {return m_faster_time;     }
00057     float              getMaxPitch      () const {return m_max_pitch;       }
00058     void               addMusicToTracks ();
00059     void               update           (float dt);
00060     void               startMusic       ();
00061     void               stopMusic        ();
00062     void               pauseMusic       ();
00063     void               resumeMusic      ();
00064     void               switchToFastMusic();
00065 };   // MusicInformation
00066 #endif