ScummVM API documentation
music_effect.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ZVISION_MUSIC_NODE_H
23 #define ZVISION_MUSIC_NODE_H
24 
25 #include "audio/mixer.h"
26 #include "zvision/scripting/scripting_effect.h"
27 #include "zvision/text/subtitles.h"
28 
29 namespace Common {
30 class String;
31 }
32 
33 namespace ZVision {
34 
36 public:
37  MusicNodeBASE(ZVision *engine, uint32 key, ScriptingEffectType type) : ScriptingEffect(engine, key, type) {}
38  ~MusicNodeBASE() override {}
39 
47  bool process(uint32 deltaTimeInMillis) override = 0;
48 
49  virtual void setVolume(uint8 volume) = 0;
50  virtual uint8 getVolume() = 0;
51  virtual void setDeltaVolume(uint8 volume) = 0;
52  virtual void setBalance(int8 balance) = 0;
53 
54  virtual void setFade(int32 time, uint8 target) = 0;
55 };
56 
57 class MusicNode : public MusicNodeBASE {
58 public:
59  MusicNode(ZVision *engine, uint32 key, Common::Path &file, bool loop, uint8 volume);
60  ~MusicNode() override;
61 
69  bool process(uint32 deltaTimeInMillis) override;
70 
71  void setVolume(uint8 volume) override;
72  uint8 getVolume() override;
73  void setDeltaVolume(uint8 volume) override;
74  void setBalance(int8 balance) override;
75 
76  void setFade(int32 time, uint8 target) override;
77 
78 private:
79  uint8 _volume;
80  uint8 _deltaVolume;
81  int8 _balance;
82  bool _loop;
83  bool _crossfade;
84  uint8 _crossfadeTarget;
85  int32 _crossfadeTime;
86  bool _stereo;
87  Audio::SoundHandle _handle;
88  Subtitle *_sub;
89  bool _loaded;
90 };
91 
92 // Only used by Zork: Nemesis, for the flute and piano puzzles (tj4e and ve6f, as well as vr)
93 class MusicMidiNode : public MusicNodeBASE {
94 public:
95  MusicMidiNode(ZVision *engine, uint32 key, int8 program, int8 note, int8 volume);
96  ~MusicMidiNode() override;
97 
105  bool process(uint32 deltaTimeInMillis) override;
106 
107  void setVolume(uint8 volume) override;
108  uint8 getVolume() override;
109  void setDeltaVolume(uint8 volume) override;
110  void setBalance(int8 balance) override;
111 
112  void setFade(int32 time, uint8 target) override;
113 
114 private:
115  int8 _chan;
116  int8 _noteNumber;
117  int8 _pan;
118  int8 _volume;
119  int8 _prog;
120 };
121 
123 public:
124  PanTrackNode(ZVision *engine, uint32 key, uint32 slot, int16 pos);
125  ~PanTrackNode() override;
126 
127  bool process(uint32 deltaTimeInMillis) override;
128 
129 private:
130  uint32 _slot;
131  int16 _position;
132 };
133 
134 } // End of namespace ZVision
135 
136 #endif
Definition: music_effect.h:122
Definition: music_effect.h:93
Definition: path.h:52
Definition: clock.h:29
Definition: mixer.h:49
Definition: subtitles.h:31
Definition: scripting_effect.h:45
Definition: algorithm.h:29
Definition: music_effect.h:57
Definition: music_effect.h:35