ScummVM API documentation
player_v2.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_V2_H
23#define SCUMM_PLAYERS_PLAYER_V2_H
24
25#include "scumm/players/player_v2base.h"
26#include "audio/audiostream.h"
27#include "audio/mixer.h"
28
29namespace Scumm {
30
37public:
38 Player_V2(ScummEngine *scumm, Audio::Mixer *mixer, bool pcjr);
39 ~Player_V2() override;
40
41 // MusicEngine API
42 void setMusicVolume(int vol) override;
43 void startSound(int sound) override;
44 void stopSound(int sound) override;
45 void stopAllSounds() override;
46// virtual int getMusicTimer();
47 int getSoundStatus(int sound) const override;
48
49 // AudioStream API
50 int readBuffer(int16 *buffer, const int numSamples) override;
51 bool isStereo() const override { return true; }
52 bool endOfData() const override { return false; }
53 int getRate() const override { return _sampleRate; }
54
55protected:
56 enum {
57 FIXP_SHIFT = 16
58 };
59
60 unsigned int _update_step;
61 unsigned int _decay;
62 int _level;
63 unsigned int _RNG;
64 unsigned int _volumetable[16];
65
66 int _timer_count[4];
67 int _timer_output;
68
69 Audio::Mixer *_mixer;
70 Audio::SoundHandle _soundHandle;
71 const uint32 _sampleRate;
72
73 Common::Mutex _mutex;
74
75 uint32 _next_tick;
76 uint32 _tick_len;
77
78protected:
79 virtual void generateSpkSamples(int16 *data, uint len);
80 virtual void generatePCjrSamples(int16 *data, uint len);
81
82 void lowPassFilter(int16 *data, uint len);
83 void squareGenerator(int channel, int freq, int vol,
84 int noiseFeedback, int16 *sample, uint len);
85};
86
87} // End of namespace Scumm
88
89#endif
Definition: audiostream.h:50
Definition: mixer.h:70
Definition: mixer.h:49
Definition: mutex.h:67
Definition: player_v2base.h:66
Definition: player_v2.h:36
int getSoundStatus(int sound) const override
bool endOfData() const override
Definition: player_v2.h:52
void setMusicVolume(int vol) override
void stopSound(int sound) override
int readBuffer(int16 *buffer, const int numSamples) override
bool isStereo() const override
Definition: player_v2.h:51
void stopAllSounds() override
void startSound(int sound) override
int getRate() const override
Definition: player_v2.h:53
Definition: scumm.h:536
Definition: actor.h:30