OpenMoHAA 0.82.0
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 {
34 protected:
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
69 public:
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
80 (
81 Archiver &arc
82 )
83
84 {
85 int i;
86 int num;
87 int currentFacet;
88
89 Listener::Archive( arc );
90
91 arc.ArchiveInteger( &currentFacet );
92 arc.ArchiveObjectPointer( ( Class ** )&current );
93
94 if ( arc.Saving() )
95 {
96 num = soundList.NumObjects();
97 arc.ArchiveInteger( &num );
98 }
99 else
100 {
101 soundList.ClearObjectList();
102 arc.ArchiveInteger( &num );
103 soundList.Resize( num );
104 }
105 for( i = 1; i <= num; i++ )
106 {
107 arc.ArchiveObjectPointer( ( Class ** )soundList.AddressOfObjectAt( i ) );
108 }
109 }
110
111extern 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:487
Definition trigger.h:517
Definition trigger.h:326