ScummVM API documentation
pc_speaker.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 MM_SHARED_CLASSIC_PC_SPEAKER_H
23#define MM_SHARED_CLASSIC_PC_SPEAKER_H
24
25#include "common/scummsys.h"
26
27namespace Audio {
28class PCSpeaker;
29}
30
31namespace MM {
32namespace Shared {
33namespace Classic {
34
36 uint16 durationTicks;
37 uint16 pitDivisor;
38};
39
41 uint32 lengthUs;
42 float frequency;
43};
44
45class PcSpeaker {
46private:
47 Audio::PCSpeaker *_speaker = nullptr;
48 const PitSequenceEntry *_loopingPitSequence = nullptr;
49 uint32 _loopingPitTickMicros = 0;
50 bool _ready = false;
51
52 void queuePitSequence(const PitSequenceEntry *sequence, uint32 tickMicros);
53
54public:
55 PcSpeaker();
56 ~PcSpeaker();
57
58 bool init();
59 void stop();
60 bool isPlaying() const;
61
62 void playTone(int frequency, int32 lengthMs);
63 void queueTone(float frequency, uint32 lengthUs);
64 void queueSilence(uint32 lengthUs);
65 void playPitSequence(const PitSequenceEntry *sequence, uint32 tickMicros, bool append = false, bool loop = false);
66 void playFrequencySequence(const FrequencySequenceEntry *sequence);
67 void update();
68};
69
70} // namespace Classic
71} // namespace Shared
72} // namespace MM
73
74#endif
Definition: pcspk.h:36
Definition: pc_speaker.h:45
Definition: system.h:39
Definition: detection.h:27
Definition: pc_speaker.h:40
Definition: pc_speaker.h:35