|
UFO: Alien Invasion
|
#include "s_music.h"#include "s_local.h"#include "../cl_shared.h"#include "../../shared/parse.h"#include "../../ports/system.h"#include "../../common/filesys.h"#include "../../common/common.h"#include "../../common/scripts.h"#include "../cl_renderer.h"#include "../cl_video.h"#include "../battlescape/cl_camera.h"#include "../battlescape/cl_localentity.h"#include "../battlescape/cl_battlescape.h"
Go to the source code of this file.
Data Structures | |
| struct | music_t |
Macros | |
| #define | MUSIC_MAX_ENTRIES 64 |
Enumerations | |
| enum | { MUSIC_MAIN , MUSIC_GEOSCAPE , MUSIC_BATTLESCAPE , MUSIC_AIRCOMBAT , MUSIC_MAX } |
Functions | |
| void | M_ParseMusic (const char *name, const char **text) |
| Parses music definitions for different situations. More... | |
| void | M_Stop (void) |
| static void | M_Start (const char *file) |
| static void | M_Play_f (void) |
| Plays the music file given via commandline parameter. More... | |
| static void | M_RandomTrack_f (void) |
| Sets the music cvar to a random track. More... | |
| static bool | M_PlayRandomByCategory (int category) |
| static void | M_Change_f (void) |
| Changes the music if it suits the current situation. More... | |
| static int | M_CompleteMusic (const char *partial, const char **match) |
| static void | M_MusicStreamUpdate (void) |
| void | M_Frame (void) |
| void | M_Init (void) |
| void | M_Shutdown (void) |
| static void | M_MusicStreamCallback (musicStream_t *userdata, byte *stream, int length) |
| static void | M_PlayMusicStream (musicStream_t *userdata) |
| void | M_AddToSampleBuffer (musicStream_t *userdata, int rate, int samples, const byte *data) |
| Add stereo samples with a 16 byte width to the stream buffer. More... | |
| void | M_StopMusicStream (musicStream_t *userdata) |
Variables | |
| static char * | musicArrays [MUSIC_MAX][MUSIC_MAX_ENTRIES] = {{}, {}} |
| static int | musicArrayLength [MUSIC_MAX] = {} |
| static music_t | music = {{}, {}, nullptr, 0, nullptr, false, false, true} |
| static cvar_t * | snd_music |
| static cvar_t * | snd_music_volume |
| static cvar_t * | snd_music_play |
| static const cmdList_t | musicCmds [] |
| #define MUSIC_MAX_ENTRIES 64 |
Definition at line 61 of file s_music.cpp.
| anonymous enum |
| Enumerator | |
|---|---|
| MUSIC_MAIN | |
| MUSIC_GEOSCAPE | |
| MUSIC_BATTLESCAPE | |
| MUSIC_AIRCOMBAT | |
| MUSIC_MAX | |
Definition at line 39 of file s_music.cpp.
| void M_AddToSampleBuffer | ( | musicStream_t * | userdata, |
| int | rate, | ||
| int | samples, | ||
| const byte * | data | ||
| ) |
Add stereo samples with a 16 byte width to the stream buffer.
| [in] | samples | The amount of stereo samples that should be added to the stream buffer (this is usually 1/4 of the size of the data buffer, one sample should have 4 bytes, 2 for each channel) |
| [in] | data | The stereo sample buffer |
| [in,out] | userdata | The music stream |
| [in] | rate | The sample rate |
Definition at line 431 of file s_music.cpp.
References data, i, s_env_t::initialized, LittleShort, M_PlayMusicStream(), MAX_RAW_SAMPLES, s_env_t::rate, s_env, musicStream_t::sampleBuf, musicStream_t::samplePos, and scale.
Referenced by CIN_OGM_LoadAudioFrame(), CIN_ROQ_DecodeSoundMono(), and CIN_ROQ_DecodeSoundStereo().
Changes the music if it suits the current situation.
Definition at line 259 of file s_music.cpp.
References CL_OnBattlescape(), Cmd_Argc(), Cmd_Argv(), Com_DPrintf(), Com_Printf(), DEBUG_SOUND, s_env_t::initialized, M_PlayRandomByCategory(), music, MUSIC_AIRCOMBAT, MUSIC_BATTLESCAPE, MUSIC_GEOSCAPE, MUSIC_MAIN, musicArrayLength, music_t::playing, Q_streq, s_env, and type.
|
static |
Definition at line 296 of file s_music.cpp.
References Cmd_GenericCompleteFunction(), Com_Printf(), and FS_NextFileFromFileList().
Referenced by M_Init().
Definition at line 317 of file s_music.cpp.
References music_t::category, music_t::currentTrack, cvar_t::integer, M_MusicStreamUpdate(), M_PlayRandomByCategory(), M_Start(), M_Stop(), cvar_t::modified, music, music_t::nextTrack, music_t::playing, music_t::playingStream, Q_strvalid, snd_music, snd_music_play, snd_music_volume, and cvar_t::string.
Referenced by S_Frame().
Definition at line 359 of file s_music.cpp.
References Cmd_AddParamCompleteFunction(), Cmd_Exists(), Cmd_RemoveCommand(), Cmd_TableAddList(), CVAR_ARCHIVE, Cvar_Get(), cvar_t::integer, M_CompleteMusic(), cvar_t::modified, music, musicCmds, music_t::playing, snd_music, snd_music_play, and snd_music_volume.
Referenced by S_Init().
|
static |
Definition at line 379 of file s_music.cpp.
References music_t::interruptStream, length, MAX_RAW_SAMPLES, musicStream_t::mixerPos, music, musicStream_t::playing, musicStream_t::sampleBuf, musicStream_t::samplePos, and Sys_Sleep().
Referenced by M_PlayMusicStream().
Definition at line 309 of file s_music.cpp.
References music_t::interruptStream, M_StopMusicStream(), and music.
Referenced by M_Frame().
| void M_ParseMusic | ( | const char * | name, |
| const char ** | text | ||
| ) |
Parses music definitions for different situations.
Definition at line 73 of file s_music.cpp.
References cl_genericPool, Com_Error(), Com_ParseList(), Com_Printf(), ERR_DROP, i, LIST_Delete(), Mem_PoolStrDup, MUSIC_AIRCOMBAT, MUSIC_BATTLESCAPE, MUSIC_GEOSCAPE, MUSIC_MAIN, MUSIC_MAX_ENTRIES, musicArrayLength, musicArrays, name, linkedList_t::next, and Q_streq.
Referenced by CL_ParseClientData().
Plays the music file given via commandline parameter.
Definition at line 206 of file s_music.cpp.
References Cmd_Argc(), Cmd_Argv(), Cvar_GetString(), Cvar_Set(), and M_Start().
|
static |
Definition at line 410 of file s_music.cpp.
References M_MusicStreamCallback(), M_Stop(), music, musicStream_t::playing, and music_t::playingStream.
Referenced by M_AddToSampleBuffer().
|
static |
Definition at line 242 of file s_music.cpp.
References music_t::category, CL_OnBattlescape(), Com_Printf(), music_t::currentTrack, Cvar_Set(), cvar_t::modified, music, MUSIC_BATTLESCAPE, musicArrayLength, musicArrays, and snd_music.
Referenced by M_Change_f(), and M_Frame().
Sets the music cvar to a random track.
Definition at line 217 of file s_music.cpp.
References Com_DPrintf(), Com_Printf(), Com_SkipPath(), Cvar_Set(), DEBUG_SOUND, FS_BuildFileList(), FS_NextFileFromFileList(), s_env_t::initialized, music, music_t::playing, and s_env.
Definition at line 372 of file s_music.cpp.
References Cmd_TableRemoveList(), M_Stop(), and musicCmds.
Referenced by S_Shutdown().
|
static |
Definition at line 135 of file s_music.cpp.
References music_t::buffer, Com_Printf(), Com_StripExtension(), music_t::currentTrack, music_t::data, FS_FreeFile(), FS_LoadFile(), s_env_t::initialized, len, M_Stop(), MAX_QPATH, music, name, music_t::nextTrack, music_t::playing, music_t::playingStream, Q_streq, Q_strncpyz(), Q_strnull(), s_env, UFO_SIZE_T, and va().
Referenced by M_Frame(), and M_Play_f().
Definition at line 114 of file s_music.cpp.
References music_t::buffer, music_t::data, FS_FreeFile(), music, and music_t::playingStream.
Referenced by M_Frame(), M_PlayMusicStream(), M_Shutdown(), and M_Start().
| void M_StopMusicStream | ( | musicStream_t * | userdata | ) |
Definition at line 465 of file s_music.cpp.
References music_t::interruptStream, music, musicStream_t::playing, and music_t::playingStream.
Referenced by CIN_OGM_CloseCinematic(), CIN_ROQ_CloseCinematic(), and M_MusicStreamUpdate().
Definition at line 64 of file s_music.cpp.
Referenced by M_Change_f(), M_Frame(), M_Init(), M_MusicStreamCallback(), M_MusicStreamUpdate(), M_PlayMusicStream(), M_PlayRandomByCategory(), M_RandomTrack_f(), M_Start(), M_Stop(), and M_StopMusicStream().
Definition at line 63 of file s_music.cpp.
Referenced by M_Change_f(), M_ParseMusic(), and M_PlayRandomByCategory().
|
static |
Definition at line 62 of file s_music.cpp.
Referenced by M_ParseMusic(), and M_PlayRandomByCategory().
|
static |
Definition at line 351 of file s_music.cpp.
Referenced by M_Init(), and M_Shutdown().
|
static |
Definition at line 65 of file s_music.cpp.
Referenced by M_Frame(), M_Init(), and M_PlayRandomByCategory().
|
static |
Definition at line 67 of file s_music.cpp.
|
static |
Definition at line 66 of file s_music.cpp.