s_music.c File Reference

#include "s_local.h"
#include "s_main.h"
#include "s_music.h"
#include "../../shared/parse.h"
#include "../../ports/system.h"
Include dependency graph for s_music.c:

Go to the source code of this file.

Data Structures

struct  music_s

Defines

#define MUSIC_MAX_ENTRIES   64

Typedefs

typedef struct music_s music_t

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.
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.
static void M_RandomTrack_f (void)
 Sets the music cvar to a random track.
static void M_Change_f (void)
 Changes the music if it suits the current situation.
static int M_CompleteMusic (const char *partial, const char **match)
void M_Frame (void)
void M_Init (void)
void M_Shutdown (void)
static void M_MusicStreamCallback (musicStream_t *userdata, byte *stream, int length)
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.
void M_PlayMusicStream (musicStream_t *userdata)
void M_StopMusicStream (musicStream_t *userdata)

Variables

static char * musicArrays [MUSIC_MAX][MUSIC_MAX_ENTRIES]
static int musicArrayLength [MUSIC_MAX]
static music_t music
static int musicTrackCount
static cvar_tsnd_music
static cvar_tsnd_music_volume

Detailed Description

Definition in file s_music.c.


Define Documentation

#define MUSIC_MAX_ENTRIES   64

Definition at line 50 of file s_music.c.

Referenced by M_ParseMusic().


Typedef Documentation

typedef struct music_s music_t

Enumeration Type Documentation

anonymous enum
Enumerator:
MUSIC_MAIN 
MUSIC_GEOSCAPE 
MUSIC_BATTLESCAPE 
MUSIC_AIRCOMBAT 
MUSIC_MAX 

Definition at line 31 of file s_music.c.


Function Documentation

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.

Parameters:
[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 398 of file s_music.c.

References i, s_env_s::initialized, LittleShort(), MAX_RAW_SAMPLES, s_env_s::rate, s_env, musicStream_s::sampleBuf, musicStream_s::samplePos, and scale.

Referenced by CIN_OGM_LoadAudioFrame(), CIN_ROQ_DecodeSoundMono(), and CIN_ROQ_DecodeSoundStereo().

static void M_Change_f ( void   )  [static]

Changes the music if it suits the current situation.

Todo:
Make the music a scriptable list

Definition at line 244 of file s_music.c.

References ca_active, cls, Cmd_Argc(), Cmd_Argv(), Com_DPrintf(), Com_Printf(), Cvar_Set(), DEBUG_SOUND, s_env_s::initialized, MUSIC_AIRCOMBAT, MUSIC_BATTLESCAPE, MUSIC_GEOSCAPE, MUSIC_MAIN, musicArrayLength, musicArrays, s_env, client_static_s::state, cvar_s::string, and type.

Referenced by M_Init().

static int M_CompleteMusic ( const char *  partial,
const char **  match 
) [static]
void M_Frame ( void   ) 
void M_Init ( void   ) 
static void M_MusicStreamCallback ( musicStream_t userdata,
byte stream,
int  length 
) [static]
void M_ParseMusic ( const char *  name,
const char **  text 
)

Parses music definitions for different situations.

Note:
We can have lists for geoscape and battlescape e.g.

Definition at line 62 of file s_music.c.

References cl_genericPool, Com_EParse(), Com_Parse(), Com_Printf(), FS_SkipBlock(), i, Mem_PoolStrDup, MUSIC_AIRCOMBAT, MUSIC_BATTLESCAPE, MUSIC_GEOSCAPE, MUSIC_MAIN, MUSIC_MAX_ENTRIES, musicArrayLength, and musicArrays.

Referenced by CL_ParseClientData().

static void M_Play_f ( void   )  [static]

Plays the music file given via commandline parameter.

Definition at line 200 of file s_music.c.

References Cmd_Argc(), Cmd_Argv(), Cvar_GetString(), Cvar_Set(), and M_Start().

Referenced by M_Init().

void M_PlayMusicStream ( musicStream_t userdata  ) 
static void M_RandomTrack_f ( void   )  [static]

Sets the music cvar to a random track.

Definition at line 211 of file s_music.c.

References Com_DPrintf(), Com_Printf(), Com_SkipPath(), Com_sprintf(), Cvar_Set(), DEBUG_SOUND, FS_BuildFileList(), FS_NextFileFromFileList(), s_env_s::initialized, MAX_OSPATH, musicTrackCount, and s_env.

Referenced by M_Init().

void M_Shutdown ( void   ) 

Definition at line 355 of file s_music.c.

References Cmd_RemoveCommand(), and M_Stop().

Referenced by S_Shutdown().

static void M_Start ( const char *  file  )  [static]
void M_Stop ( void   ) 
void M_StopMusicStream ( musicStream_t userdata  ) 

Definition at line 441 of file s_music.c.

References musicStream_s::playing, music_s::playingStream, and qfalse.

Referenced by CIN_OGM_StopCinematic(), and CIN_ROQ_StopCinematic().


Variable Documentation

music_t music [static]

Definition at line 53 of file s_music.c.

int musicArrayLength[MUSIC_MAX] [static]

Definition at line 52 of file s_music.c.

Referenced by M_Change_f(), and M_ParseMusic().

char* musicArrays[MUSIC_MAX][MUSIC_MAX_ENTRIES] [static]

Definition at line 51 of file s_music.c.

Referenced by M_Change_f(), and M_ParseMusic().

int musicTrackCount [static]

Definition at line 54 of file s_music.c.

Referenced by M_RandomTrack_f().

cvar_t* snd_music [static]

Definition at line 55 of file s_music.c.

Definition at line 56 of file s_music.c.


Generated by  doxygen 1.6.2