ScummVM API documentation
psound_phantom.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 file.
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  */
11 
12 #ifndef MADS_PHANTOM_SOUND_PSOUND_PHANTOM_H
13 #define MADS_PHANTOM_SOUND_PSOUND_PHANTOM_H
14 
15 #include "mads/phantom/sound/psound.h"
16 
17 namespace MADS {
18 namespace Phantom {
19 namespace Sound {
20 
21 class PhantomPSound : public PSound {
22 protected:
23  PhantomPSound(Audio::Mixer *mixer, const PSoundDriverData &driverData);
24 
25  int dispatchBaseCommand(int commandId);
26  void loadFixedChannels(const uint16 *sequences, uint count);
27  void playSounds(const uint16 *sequences, uint count);
28  void playMusic(const uint16 *sequences, uint count);
29  bool loadFixedIfInactive(uint16 guard, const uint16 *sequences, uint count);
30  void leaveMalformedChannelSilent(const char *filename, byte channel,
31  uint16 sequenceOffset);
32 
33  bool callFunction(uint16 targetOffset, Channel &channel) override;
34  virtual int executeCommand(int commandId) = 0;
35 
36 public:
37  int command(int commandId, int param) override;
38 };
39 
40 #define DECLARE_PHANTOM_PSOUND(_name) \
41  class PSound##_name final : public PhantomPSound { \
42  private: \
43  int executeCommand(int commandId) override; \
44  \
45  public: \
46  explicit PSound##_name(Audio::Mixer *mixer); \
47  }
48 
49 class PSound1 final : public PhantomPSound {
50 private:
51  uint16 _previousSelector;
52  uint16 _olderSelector;
53  int executeCommand(int commandId) override;
54  void selectBackgroundMusic();
55 
56 public:
57  explicit PSound1(Audio::Mixer *mixer);
58 };
59 
60 DECLARE_PHANTOM_PSOUND(2);
61 DECLARE_PHANTOM_PSOUND(3);
62 
63 class PSound4 final : public PhantomPSound {
64 private:
65  int executeCommand(int commandId) override;
66  bool callFunction(uint16 targetOffset, Channel &channel) override;
67 
68 public:
69  explicit PSound4(Audio::Mixer *mixer);
70 };
71 
72 DECLARE_PHANTOM_PSOUND(5);
73 DECLARE_PHANTOM_PSOUND(9);
74 DECLARE_PHANTOM_PSOUND(Demo);
75 
76 #undef DECLARE_PHANTOM_PSOUND
77 
79 bool validatePhantomPSoundFile(int section, bool isDemo,
80  Common::String *reason = nullptr);
81 
82 } // namespace Sound
83 } // namespace Phantom
84 } // namespace MADS
85 
86 #endif // MADS_PHANTOM_SOUND_PSOUND_PHANTOM_H
Definition: str.h:59
bool callFunction(uint16 targetOffset, Channel &channel) override
int command(int commandId, int param) override
Definition: psound_phantom.h:49
Definition: psound_phantom.h:21
Definition: mixer.h:70
Definition: psound_phantom.h:63
Definition: anim_timer.h:27
Definition: psound.h:47