Wing Commander II
Reconstructed Win32 source (1996)
Loading...
Searching...
No Matches
music.c File Reference

Music and sound-effect control. More...

#include "game.h"

Go to the source code of this file.

Macros

#define MUSIC_C

Functions

void StopMusicStream (void)
void SetMusBreakpt (int first, int second)
void SetMusicOn (short enabled)
void StopMusic (short enabled)
short StartMusic (void *music)
short StartInteractiveMusic (int track)
int StartSoundEffectHook (const unsigned char *definition, int effectHandle, int volume, int pan, int sample, int looping)
void FlushSoundEffect (void)
void FlushSoundEffects (void)
void FadeMusic (short duration)
void SceneLeaveHook (void)
unsigned short ProcessMusicScriptCommand (int track, int command, short enabled)
void spacetrack (int track, int mode, int enabled)
void StopMusicUnlessSuppressed (void)
unsigned int IsMusicTrackComplete (void)
void wait_for_end_of_music (void)
void new_space_music_changes (short attacker, short victim)
int changetrack (void)
void gametrack (void)
void ScaleFixedVector (FixedVector *vector, int scale, FixedVector *result)
void AddFixedVectors (const FixedVector *left, const FixedVector *right, FixedVector *sum)
void ComputeVectorDelta (FixedVector *from, FixedVector *to, FixedVector *delta)
void servicetrack (void)
void ResetSoundState (void)
void ResetSoundStateForScene (void)
void ResetSoundStateForFlight (void)
void DisableMusicForSceneHook (void)
void EnableMusicForScene (void)
int LogUnknownSoundEffect (const unsigned char *definition, short sourceObject, short pan, short volume, short looping, short priority)
void FlushSoundEffectsAndLog (void *effect, short flags)
void sound_effect (signed char soundNumber, short sourceObject, short looping)
void PlaySfxWaveFileByNumber (int soundNumber, int sourceObject, int looping)

Variables

static int g_nActiveMusicStreamMask = 0
static signed char g_acMusicTrackStreamFlags [72]
short g_nMusicTrackComplete = 1
short g_nMusicDriverMode = 1
short g_nCutsceneMusicVolume = 0
short g_nTitleMusicSequenceStage = 0
int g_nCurrentMusicTrack = -1
struct LimitedMusicBuffer g_aLimitedMusicBuffers [2]
short g_nWaitForMusicEnabled = 1
short g_bFlightSoundEffectsEnabled = 1
short g_nInitialFlightMusicPending = 1
short g_nCombatMusicActive = 0
short g_nInFlightMusicActive = 0
int g_nUnusedMusicWord1 = 0
short g_nPassingShipSoundObject = -1
short g_nPassingShipSoundCountdown = 0
unsigned char g_abSoundEffectDefinitions [0x1b8]
int g_aiSoundEffectSourceActiveValue [SPACE_OBJECT_COUNT]
MusicResource g_aTuneResources [66]
int g_nPassingShipSndCooldown
short g_10_nAlternateSampleToggle
int g_14_anObjectSoundEffects [SPACE_OBJECT_COUNT]
int g_2_nUnusedMusicWord2

Detailed Description

Music and sound-effect control.

Definition in file music.c.

Macro Definition Documentation

◆ MUSIC_C

#define MUSIC_C

Definition at line 7 of file music.c.

Function Documentation

◆ AddFixedVectors()

void AddFixedVectors ( const FixedVector * left,
const FixedVector * right,
FixedVector * sum )

Definition at line 211 of file geom.c.

◆ changetrack()

◆ ComputeVectorDelta()

void ComputeVectorDelta ( FixedVector * from,
FixedVector * to,
FixedVector * delta )

Definition at line 229 of file geom.c.

◆ DisableMusicForSceneHook()

void DisableMusicForSceneHook ( void )

Definition at line 408 of file music.c.

References DisableMusicForSceneHook().

Referenced by DisableMusicForSceneHook(), and UpdateShipTurretGuns().

◆ EnableMusicForScene()

void EnableMusicForScene ( void )

Definition at line 413 of file music.c.

References EnableMusicForScene(), g_nWaitForMusicEnabled, and SetMusicOn().

Referenced by EnableMusicForScene(), and UpdateShipTurretGuns().

◆ FadeMusic()

void FadeMusic ( short duration)

Definition at line 75 of file music.c.

References FadeMusic().

Referenced by FadeMusic(), InitializeMusicResources(), RunCutsceneScript(), and UpdateShipTurretGuns().

◆ FlushSoundEffect()

◆ FlushSoundEffects()

◆ FlushSoundEffectsAndLog()

◆ gametrack()

◆ IsMusicTrackComplete()

unsigned int IsMusicTrackComplete ( void )

◆ LogUnknownSoundEffect()

int LogUnknownSoundEffect ( const unsigned char * definition,
short sourceObject,
short pan,
short volume,
short looping,
short priority )

◆ new_space_music_changes()

◆ PlaySfxWaveFileByNumber()

◆ ProcessMusicScriptCommand()

◆ ResetSoundState()

◆ ResetSoundStateForFlight()

void ResetSoundStateForFlight ( void )

◆ ResetSoundStateForScene()

void ResetSoundStateForScene ( void )

◆ ScaleFixedVector()

void ScaleFixedVector ( FixedVector * vector,
int scale,
FixedVector * result )

Definition at line 237 of file geom.c.

◆ SceneLeaveHook()

void SceneLeaveHook ( void )

Definition at line 80 of file music.c.

References SceneLeaveHook().

Referenced by death_sequence(), SceneLeaveHook(), and UpdateShipTurretGuns().

◆ servicetrack()

◆ SetMusBreakpt()

void SetMusBreakpt ( int first,
int second )

Definition at line 20 of file music.c.

References SetMusBreakpt().

Referenced by SetMusBreakpt(), UpdateShipTurretGuns(), and wait_for_end_of_music().

◆ SetMusicOn()

void SetMusicOn ( short enabled)

Definition at line 25 of file music.c.

References SetMusicOn().

Referenced by EnableMusicForScene(), SetMusicOn(), and UpdateShipTurretGuns().

◆ sound_effect()

◆ spacetrack()

◆ StartInteractiveMusic()

short StartInteractiveMusic ( int track)

◆ StartMusic()

short StartMusic ( void * music)

Definition at line 37 of file music.c.

References SoundDebugPrintf(), and StartMusic().

Referenced by StartMusic(), Title_Sequence(), and UpdateShipTurretGuns().

◆ StartSoundEffectHook()

int StartSoundEffectHook ( const unsigned char * definition,
int effectHandle,
int volume,
int pan,
int sample,
int looping )

◆ StopMusic()

◆ StopMusicStream()

void StopMusicStream ( void )

Definition at line 14 of file music.c.

References StopMusicStream(), and Streamer_stop().

Referenced by StopMusicIfDriverActive(), StopMusicStream(), and UpdateShipTurretGuns().

◆ StopMusicUnlessSuppressed()

◆ wait_for_end_of_music()

Variable Documentation

◆ g_10_nAlternateSampleToggle

short g_10_nAlternateSampleToggle

Definition at line 610 of file music.c.

Referenced by sound_effect().

◆ g_14_anObjectSoundEffects

int g_14_anObjectSoundEffects[SPACE_OBJECT_COUNT]

Definition at line 611 of file music.c.

Referenced by sound_effect().

◆ g_2_nUnusedMusicWord2

int g_2_nUnusedMusicWord2

Definition at line 612 of file music.c.

◆ g_abSoundEffectDefinitions

unsigned char g_abSoundEffectDefinitions[0x1b8]

Definition at line 547 of file music.c.

Referenced by malf_sound(), servicetrack(), and sound_effect().

◆ g_acMusicTrackStreamFlags

signed char g_acMusicTrackStreamFlags
static
Initial value:
= {
6, 6, 6, 6, 6, 6, 10, 10, 10, 10, 10, 10,
6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0,
0, 0, 0, 6, 16, 16, 0, 6, 6, 16, 16, 0,
16, 16, 16, 16, 16, 6, 10, 1, 1, 1, 1, 7,
1, 1, 1, 1, 1, 1, 1, 6, 6, 6, 1, 16,
16, 1, 1, 16, 16, 16, 0, 0, 0, 0, 0, 0
}

Definition at line 11 of file music.c.

Referenced by ProcessMusicScriptCommand().

◆ g_aiSoundEffectSourceActiveValue

int g_aiSoundEffectSourceActiveValue[SPACE_OBJECT_COUNT]

Definition at line 607 of file music.c.

Referenced by PlaySfxWaveFileByNumber().

◆ g_aLimitedMusicBuffers

struct LimitedMusicBuffer g_aLimitedMusicBuffers[2]
Initial value:
= {
{ 0, -1 },
{ 0, -1 }
}

Definition at line 527 of file music.c.

Referenced by free_inflight_music(), InitializeMusicResources(), and ReleaseMusicTrack().

◆ g_aTuneResources

◆ g_bFlightSoundEffectsEnabled

short g_bFlightSoundEffectsEnabled = 1

◆ g_nActiveMusicStreamMask

int g_nActiveMusicStreamMask = 0
static

Definition at line 10 of file music.c.

Referenced by ProcessMusicScriptCommand().

◆ g_nCombatMusicActive

short g_nCombatMusicActive = 0

Definition at line 542 of file music.c.

Referenced by gametrack(), and init_inflight_music().

◆ g_nCurrentMusicTrack

int g_nCurrentMusicTrack = -1

Definition at line 525 of file music.c.

Referenced by ProcessMusicScriptCommand(), and StopMusic().

◆ g_nCutsceneMusicVolume

short g_nCutsceneMusicVolume = 0

Definition at line 523 of file music.c.

Referenced by RunCutsceneScript().

◆ g_nInFlightMusicActive

short g_nInFlightMusicActive = 0

◆ g_nInitialFlightMusicPending

short g_nInitialFlightMusicPending = 1

Definition at line 541 of file music.c.

Referenced by gametrack(), and init_inflight_music().

◆ g_nMusicDriverMode

◆ g_nMusicTrackComplete

short g_nMusicTrackComplete = 1

◆ g_nPassingShipSndCooldown

int g_nPassingShipSndCooldown

Definition at line 609 of file music.c.

Referenced by init_3Space_objects(), and servicetrack().

◆ g_nPassingShipSoundCountdown

short g_nPassingShipSoundCountdown = 0

Definition at line 546 of file music.c.

Referenced by servicetrack().

◆ g_nPassingShipSoundObject

short g_nPassingShipSoundObject = -1

Definition at line 545 of file music.c.

Referenced by servicetrack().

◆ g_nTitleMusicSequenceStage

short g_nTitleMusicSequenceStage = 0

◆ g_nUnusedMusicWord1

int g_nUnusedMusicWord1 = 0

Definition at line 544 of file music.c.

◆ g_nWaitForMusicEnabled

short g_nWaitForMusicEnabled = 1

Definition at line 531 of file music.c.

Referenced by EnableMusicForScene(), and wait_for_end_of_music().