ScummVM API documentation
sound.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 ADL_SOUND_H
23#define ADL_SOUND_H
24
25#include "audio/audiostream.h"
26
27#include "common/array.h"
28#include "common/frac.h"
29
30namespace Adl {
31
32class Speaker;
33
34struct Tone {
35 double freq; // Hz
36 double len; // ms
37
38 Tone(double frequency, double length) : freq(frequency), len(length) { }
39};
40
42
43class Sound : public Audio::AudioStream {
44public:
45 Sound(const Tones &tones);
46 ~Sound() override;
47
48 // AudioStream
49 int readBuffer(int16 *buffer, const int numSamples) override;
50 bool isStereo() const override { return false; }
51 bool endOfData() const override;
52 int getRate() const override { return _rate; }
53
54private:
55 const Tones &_tones;
56
57 Speaker *_speaker;
58 int _rate;
59 uint _toneIndex;
60 int _samplesRem;
61};
62
63} // End of namespace Adl
64
65#endif
Definition: sound.h:43
int readBuffer(int16 *buffer, const int numSamples) override
int getRate() const override
Definition: sound.h:52
bool isStereo() const override
Definition: sound.h:50
bool endOfData() const override
Definition: audiostream.h:50
Definition: array.h:52
Definition: sound.h:34