aboutsummaryrefslogtreecommitdiff
path: root/src/audio/MusicManager.h
blob: 49c91cf81586245646f3ead89f3fdf86af9e5530 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#pragma once

#include "audio_enums.h"

class tStreamedSample
{
public:
	uint32 m_nLength;
	uint32 m_nPosition;
	uint32 m_nLastPosCheckTimer;
};

class CVehicle;

class cMusicManager
{
public:
	bool8 m_bIsInitialised;
	bool8 m_bDisabled;
	uint8 m_nMusicMode;
	uint8 m_nNextTrack;
	uint8 m_nPlayingTrack;
	bool8 m_bFrontendTrackFinished;
	bool8 m_bPlayInFrontend;
	bool8 m_bSetNextStation;
	uint8 m_nAnnouncement;
	bool8 m_bPreviousPlayerInCar;
	bool8 m_bPlayerInCar;
	bool8 m_bAnnouncementInProgress;
	tStreamedSample m_aTracks[TOTAL_STREAMED_SOUNDS];
	bool8 m_bResetTimers;
	uint32 m_nResetTime;
	uint32 m_nLastTrackServiceTime;
	uint32 m_nTimer;
	bool8 m_bDoTrackService;
	bool8 m_bIgnoreTimeDelay;
	bool8 m_bVerifyAmbienceTrackStartedToPlay;
	bool8 m_bRadioSetByScript;
	uint8 m_nRadioStationScript;
	int32 m_nRadioPosition;
	uint8 m_nRadioInCar;

public:
	cMusicManager();
	bool8 IsInitialised() { return m_bIsInitialised; }
	uint32 GetMusicMode() { return m_nMusicMode; }
	uint8 GetNextTrack() { return m_nNextTrack; }

	bool8 Initialise();
	void Terminate();

	void ChangeMusicMode(uint8 mode);
	void StopFrontEndTrack();

	bool8 PlayerInCar();
	void DisplayRadioStationName();

	void PlayAnnouncement(uint8);
	void PlayFrontEndTrack(uint8, bool8);
	void PreloadCutSceneMusic(uint8);
	void PlayPreloadedCutSceneMusic(void);
	void StopCutSceneMusic(void);
	uint8 GetRadioInCar(void);
	void SetRadioInCar(uint32);
	void SetRadioChannelByScript(uint8, int32);

	void ResetMusicAfterReload();

	void ResetTimers(uint32);
	void Service();
	void ServiceFrontEndMode();
	void ServiceGameMode();
	void ServiceAmbience();
	void ServiceTrack();

	bool8 UsesPoliceRadio(CVehicle *veh);
	uint32 GetTrackStartPos(uint8);

	void ComputeAmbienceVol(bool8 reset, uint8& outVolume);
	bool8 ServiceAnnouncement();

	uint8 GetCarTuning();
	uint8 GetNextCarTuning();
	bool8 ChangeRadioChannel();
};

VALIDATE_SIZE(cMusicManager, 0x95C);

extern cMusicManager MusicManager;