00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "aa_config.h"
00029
00030 #ifndef ArmageTron_SOUNDMIXER_H
00031 #define ArmageTron_SOUNDMIXER_H
00032
00033 #include "rSDL.h"
00034
00035
00036 #include "tString.h"
00037 #include "tSafePTR.h"
00038
00039 #ifndef DEDICATED
00040 #include <SDL_mixer.h>
00041 #else
00042
00043 typedef int Mix_Chunk;
00044 typedef int Mix_Music;
00045 #endif
00046 #include "tPlayList.h"
00047
00048 #include "sdl_mixer/eChannelSDLMixer.h"
00049
00050 #include <deque>
00051
00052 void se_SoundMenu();
00053
00054
00055 enum MusicMode {
00056 TITLE_TRACK, GUI_TRACK, GRID_TRACK
00057 };
00058
00059 enum SoundEffect {
00060 CYCLE_TURN,
00061 CYCLE_EXPLOSION,
00062 ANNOUNCER_1,
00063 ANNOUNCER_2,
00064 ANNOUNCER_3,
00065 ANNOUNCER_GO,
00066 NEW_MATCH,
00067 NEW_ROUND,
00068 ROUND_WINNER,
00069 MATCH_WINNER,
00070 ZONE_SPAWN,
00071 CYCLE_MOTOR,
00072 CYCLE_GRIND_WALL
00073 };
00074
00075 extern char const * MusicModeString[];
00076 extern char const * SoundEffectString[];
00077
00078
00079 class eGameObject;
00080 class eCoord;
00081
00082
00083 class eMusicTrack;
00084 class eChannel;
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 class eSoundMixer {
00101
00102 public:
00103 ~eSoundMixer();
00104
00105
00106 static eSoundMixer* GetMixer();
00107
00108 static void ShutDown();
00109 void Init();
00110
00111
00112 static void SetMode(MusicMode newMode);
00113 void PushButton(int soundEffect);
00114 void PushButton(int soundEffect, eCoord location);
00115
00116
00117
00118
00119
00120 void SetMicrophoneOwner(eGameObject* newOwner);
00121
00122 void PlayContinuous(int soundEffect, eGameObject* owner);
00123 void RemoveContinuous(int soundEffect, eGameObject* owner);
00124
00125
00126
00127 static void SDLMusicFinished();
00128
00129
00130
00131 static void SongFinished();
00132
00133 static bool Music_play(REAL x);
00134 static bool Music_next_song(REAL x);
00135 static bool Music_previous_song(REAL x);
00136 static bool Music_stop(REAL x);
00137 static bool Music_pause(REAL x);
00138 static bool Music_volume_up(REAL x);
00139 static bool Music_volume_down(REAL x);
00140
00141 void LoadPlaylist();
00142
00143 tString GetCurrentSong();
00144
00145
00146 static void ChannelFinished(int channel);
00147 private:
00148 void __channelFinished(int channel);
00149
00150 public:
00151
00152 void Update();
00153 private:
00154
00155 int FirstAvailableChannel();
00156
00157 static eSoundMixer* _instance;
00158 bool sound_is_there;
00159 SDL_AudioSpec audio;
00160
00161 static int m_Mode;
00162 tJUST_CONTROLLED_PTR< eGameObject > m_Owner;
00163
00164
00165
00166 static bool m_isDirty;
00167
00168 bool m_PlayMusic;
00169
00170 bool m_active;
00171
00172 tSong m_CurrentSong;
00173 tPlayList* m_Playlist;
00174
00175 std::deque<eWavData> m_SoundEffects;
00176 std::deque<eChannel> m_Channels;
00177 int m_numChannels;
00178
00179 static eMusicTrack* m_TitleTrack;
00180 static eMusicTrack* m_GuiTrack;
00181 static eMusicTrack* m_GameTrack;
00182
00183
00184
00185 static bool m_musicIsPlaying;
00186
00187
00188 eSoundMixer();
00189 };
00190
00191 #endif
00192
00193
00194