00001 /* 00002 CS Senior Project 2003 00003 Team : Leftfield 00004 Project : ModernWarfare 00005 Members : 00006 - Russ Christensen <rchriste@cs.utah.edu> 00007 - Todd Smith <tcsmith@cs.utah.edu> 00008 - Usit Duongsaa <duongsaa@cs.utah.edu> 00009 Copyright 2003 Russ Christensen, Usit Duongsaa, and Todd Smith. All rights reserved. 00010 00011 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 00012 00013 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 00014 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 00015 THIS SOFTWARE IS PROVIDED BY RUSS CHRISTENSEN, USIT DUONGSAA, AND TODD SMITH ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RUSS, USIT, TODD OR OTHER CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00016 */ 00017 00022 #pragma once 00023 00024 #include "..\AEngine\AEngine.h" 00025 #include "Singleton.h" 00026 00027 00028 00029 class Sound : public Singleton<Sound> 00030 { 00031 public: 00034 static const int CLASS_SELECT = 0; 00036 static const int CLASS_ACK = 1; 00038 static const int CLASS_TARGET = 2; 00040 static const int CLASS_DEATH = 3; 00042 static const int CLASS_CREATE_LT = 4; 00044 static const int CLASS_CREATE_HT = 5; 00046 static const int CLASS_CREATE_RT = 6; 00048 static const int CLASS_CREATE_AR = 7; 00050 static const int CLASS_CREATE_JT = 8; 00052 static const int CLASS_BATTLE_CONTACT = 9; 00054 static const int CLASS_BATTLE_STRESS = 10; 00056 static const int CLASS_BATTLE_PANICK = 11; 00058 static const int CLASS_JET_INTERCEPT = 12; 00060 static const int CLASS_JET_BOMBING = 13; 00062 static const int CLASS_JET_DIE = 14; 00063 static const int NUM_CLASSES = 15; 00064 00065 static const int SMPL_SONG_WAR_WORLDS = 0; 00066 static const int SMPL_SONG_MENU = 1; 00067 static const int SMPL_SONG_WIN = 2; 00068 static const int SMPL_SONG_LOST = 3; 00069 static const int SMPL_SFX_EXPLOSION_LARGE = 4; 00070 static const int SMPL_SFX_FIRE_LIGHTTANK = 5; 00071 static const int SMPL_SFX_FIRE_LAUNCHER = 4; 00072 static const int SMPL_SFX_FIRE_ARTILLERY = 7; 00073 static const int SMPL_SFX_FIRE_JET = 8; 00074 static const int SMPL_TUTORIAL_CITIES = 9; 00075 static const int SMPL_TUTORIAL_INTRO = 10; 00076 static const int SMPL_TUTORIAL_OVERHEAD = 11; 00077 static const int SMPL_TUTORIAL_UNITS = 12; 00078 static const int SMPL_TUTORIAL_BATTLE_CIRCLE = 13; 00079 static const int SMPL_TUTORIAL_OVERHEAD_WHILE_BATTLE = 14; 00080 static const int SMPL_TUTORIAL_BATTLE_MODE = 15; 00081 static const int SMPL_TUTORIAL_TWO_BATTLES_AT_ONCE = 16; 00082 static const int MSG_ANOTHER_BATTLE_IS_HAPPENING = 17; 00083 00084 00086 static void init(istream& in); 00088 static void playRandomSound(int soundClass, float volume=s_masterSFXVol); 00090 static void play(int sample, float volume=s_masterSFXVol); 00092 static void loop(int sample, float volume=s_masterSFXVol); 00094 static void stop(int sample); 00096 static const vector<NDX_Sample*>& samples(); 00098 static void increaseSongVol(); 00100 static void decreaseSongVol(); 00102 static void increaseSFXVol(); 00104 static void decreaseSFXVol(); 00105 00106 static float getMasterSFXVol(); 00107 static float getMasterSongVol(); 00108 00110 static void shutdown(); 00111 00114 static void playMusic( int sample, float volume=s_masterSongVol ); 00115 00116 private: 00117 NDX_Sound m_sound; 00118 vector<NDX_Sample*> m_sndClass[NUM_CLASSES]; 00119 vector<NDX_Sample*> m_samples; 00120 00121 static NDX_Sample *sampleFromWAV(LPSTR fn, int bufCount); 00122 int currentMusic; 00123 vector<int> lastRandomSelected; // when you call playRandomSound(soundClass), we record the 00124 // random wav we pick here. Next time, we try to pick a different one 00125 00126 static Sound* s_pObj; 00127 static float s_masterSongVol; 00128 static float s_masterSFXVol; 00129 static int s_songHandle; // handle to music currently playing in background 00130 }; 00131 00132 00133
1.3-rc2