ScummVM API documentation
player_v4a.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 SCUMM_PLAYERS_PLAYER_V4A_H
23#define SCUMM_PLAYERS_PLAYER_V4A_H
24
25#include "common/scummsys.h"
26#include "common/util.h"
27#include "scumm/music.h"
28#include "audio/mixer.h"
29#include "audio/mods/tfmx.h"
30
31class Mixer;
32
33namespace Scumm {
34
35class ScummEngine;
36
40class Player_V4A : public MusicEngine {
41public:
42 Player_V4A(ScummEngine *scumm, Audio::Mixer *mixer);
43 ~Player_V4A() override;
44
45 void setMusicVolume(int vol) override;
46 void startSound(int sound) override;
47 void stopSound(int sound) override;
48 void stopAllSounds() override;
49 int getMusicTimer() override;
50 int getSoundStatus(int sound) const override;
52 void restoreAfterLoad() override;
53
54private:
55 ScummEngine *const _vm;
56 Audio::Mixer *const _mixer;
57
58 Audio::Tfmx _tfmxMusic;
59 Audio::Tfmx _tfmxSfx;
60 Audio::SoundHandle _musicHandle;
61 Audio::SoundHandle _sfxHandle;
62
63 int _musicId;
64 int16 _lastSong;
65 uint16 _signal;
66
67 struct SfxChan {
68 int id;
69// byte type;
70 } _sfxSlots[4];
71
72 int8 _initState; // < 0: failed, 0: uninitialized, > 0: initialized
73
74 int getSfxChan(int id) const {
75 for (int i = 0; i < ARRAYSIZE(_sfxSlots); ++i)
76 if (_sfxSlots[i].id == id)
77 return i;
78 return -1;
79 }
80
81 void setSfxSlot(int channel, int id, byte type = 0) {
82 _sfxSlots[channel].id = id;
83// _sfxSlots[channel].type = type;
84 }
85
86 void clearSfxSlots() {
87 for (int i = 0; i < ARRAYSIZE(_sfxSlots); ++i){
88 _sfxSlots[i].id = 0;
89// _sfxSlots[i].type = 0;
90 }
91 }
92
93 bool init();
94};
95
96} // End of namespace Scumm
97
98#endif
Definition: mixer.h:70
Definition: mixer.h:49
Definition: serializer.h:80
Definition: music.h:40
Definition: player_v4a.h:40
void stopAllSounds() override
void startSound(int sound) override
int getSoundStatus(int sound) const override
void setMusicVolume(int vol) override
void restoreAfterLoad() override
void stopSound(int sound) override
void saveLoadWithSerializer(Common::Serializer &ser) override
int getMusicTimer() override
Definition: scumm.h:536
#define ARRAYSIZE(x)
Definition: util.h:114
Definition: actor.h:30