OpenMoHAA 0.82.1
Loading...
Searching...
No Matches
soundman.h
1/*
2===========================================================================
3Copyright (C) 2024 the OpenMoHAA team
4
5This file is part of OpenMoHAA source code.
6
7OpenMoHAA source code is free software; you can redistribute it
8and/or modify it under the terms of the GNU General Public License as
9published by the Free Software Foundation; either version 2 of the License,
10or (at your option) any later version.
11
12OpenMoHAA source code is distributed in the hope that it will be
13useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with OpenMoHAA source code; if not, write to the Free Software
19Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20===========================================================================
21*/
22
23// soundman.h: Sound Manager
24//
25
26#pragma once
27
28#include "g_local.h"
29#include "entity.h"
30#include "trigger.h"
31
32class SoundManager : public Listener
33{
34protected:
35 int currentFacet;
36 Entity *current;
37 Container<Entity *> soundList;
38
39 void AddSpeaker(Event *ev);
40 void AddRandomSpeaker(Event *ev);
41 void AddMusicTrigger(Event *ev);
42 void AddReverbTrigger(Event *ev);
43 void Replace(Event *ev);
44 void Delete(Event *ev);
45 void MovePlayer(Event *ev);
46 void Next(Event *ev);
47 void Previous(Event *ev);
48 void ShowingSounds(Event *ev);
49 void Show(Event *ev);
50 void Hide(Event *ev);
51 void Save(Event *ev);
52 void UpdateEvent(Event *ev);
53 void ResetEvent(Event *ev);
54 void GlobalTranslateEvent(Event *ev);
55 void SwitchFacetEvent(Event *ev);
56 void PreviewReverbEvent(Event *ev);
57 void ResetReverbEvent(Event *ev);
58
59 void Show(void);
60 void UpdateUI(void);
61 void Save(void);
62 void CurrentLostFocus(void);
63 void CurrentGainsFocus(void);
64 void UpdateSpeaker(TriggerSpeaker *speaker);
65 void UpdateRandomSpeaker(RandomSpeaker *speaker);
66 void UpdateTriggerMusic(TriggerMusic *music);
67 void UpdateTriggerReverb(TriggerReverb *reverb);
68
69public:
70 CLASS_PROTOTYPE(SoundManager);
71
72 SoundManager();
73 void Reset(void);
74 void Load(void);
75 void AddEntity(Entity *ent);
76 void Archive(Archiver& arc) override;
77};
78
79inline void SoundManager::Archive(Archiver& arc)
80{
81 int i;
82 int num;
83 int currentFacet;
84
85 Listener::Archive(arc);
86
87 arc.ArchiveInteger(&currentFacet);
88 arc.ArchiveObjectPointer((Class **)&current);
89
90 if (arc.Saving()) {
91 num = soundList.NumObjects();
92 arc.ArchiveInteger(&num);
93 } else {
94 soundList.ClearObjectList();
95 arc.ArchiveInteger(&num);
96 soundList.Resize(num);
97 }
98 for (i = 1; i <= num; i++) {
99 arc.ArchiveObjectPointer((Class **)soundList.AddressOfObjectAt(i));
100 }
101}
102
103extern SoundManager SoundMan;
Definition archive.h:86
Definition class.h:276
Definition container.h:85
Definition entity.h:203
Definition listener.h:246
Definition trigger.h:334
Definition soundman.h:33
Definition trigger.h:486
Definition trigger.h:516
Definition trigger.h:326