00001 /* 00002 * The Mana World 00003 * Copyright (C) 2004 The Mana World Development Team 00004 * 00005 * This file is part of The Mana World. 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 */ 00021 00022 #ifndef SOUND_H 00023 #define SOUND_H 00024 00025 #ifdef __APPLE__ 00026 #include <SDL_mixer/SDL_mixer.h> 00027 #else 00028 #include <SDL_mixer.h> 00029 #endif 00030 00031 #include <string> 00032 00037 class Sound 00038 { 00039 public: 00040 Sound(); 00041 ~Sound(); 00042 00046 void init(); 00047 00051 void close(); 00052 00058 void playMusic(const std::string &path); 00059 00063 void stopMusic(); 00064 00071 void fadeInMusic(const std::string &path, int ms = 2000); 00072 00078 void fadeOutMusic(int ms); 00079 00080 int getMaxVolume() const; 00081 00082 void setMusicVolume(int volume); 00083 void setSfxVolume(int volume); 00084 00090 void playSfx(const std::string &path); 00091 00092 private: 00094 void info(); 00095 00097 void haltMusic(); 00098 00099 bool mInstalled; 00100 00101 int mSfxVolume; 00102 int mMusicVolume; 00103 00104 std::string mCurrentMusicFile; 00105 Mix_Music *mMusic; 00106 }; 00107 00108 extern Sound sound; 00109 00110 #endif