ScummVM API documentation
smush_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 GRIM_MOVIE_SMUSH_SOUND_H
23#define GRIM_MOVIE_SMUSH_SOUND_H
24
25#include "common/scummsys.h"
26
27namespace Grim {
28
29#define SOU_MAX_CHANNELS 16
30#define SOU_MASTER_VOLUME 127
31
32class SmushTimer;
33class SmushDriver;
34
36 byte *dataBuffer;
37 byte *stagingBuffer;
38 byte *scriptPointer;
39 byte *dataArea;
40 int capacity;
41 uint8 volume;
42 int8 pan;
43 uint8 state;
44 uint8 format;
45 int soundClass;
46 int age;
47 int dataAreaSize;
48 int writePosition;
49 int consumedPosition;
50 int totalSize;
51 int tag1;
52 int chunkCounter;
53 int tag2;
54};
55
57 byte *script;
58 byte *dataStart;
59 int dataSize;
60 int readPosition;
61 int remaining;
62 int rate;
63 uint8 format;
64 int previousState;
65 int previousRate;
66 int previousVolume;
67 int tailBytes;
68 uint8 previousFormat;
69 int gain;
70};
71
73
74private:
75 SmushTimer *_timer;
76 SmushDriver *_driver;
77 SmushSoundChannel _channels[SOU_MAX_CHANNELS];
78 SmushSoundPlayback _playback[SOU_MAX_CHANNELS];
79 int _channelCount;
80 int _sampleRate;
81 int _resetFlag;
82 int _bytesPerFrame[6];
83 int _pauseCount;
84 int _engineOk;
85 int _syncMark;
86 double _syncAccumulator;
87 int _fillCounter;
88 int _driverRate;
89 int _reserveRam;
90 int _bufferSizes[SOU_MAX_CHANNELS + 1];
91
92 int engineInitialize(int rate, int reserveRam, const int *bufferSizes);
93 int engineTerminate();
94 int engineAllocChannel(int size, int reserveRam);
95 int souEngineMarkSyncTime();
96 int souEngineExternalSync(double ticks);
97 int souEngineStartStream(const byte *data, int size, uint32 volume, int pan, int soundClass, int tag1, int chunkCounter, int tag2);
98
99public:
100 SmushSound(SmushTimer *timer, SmushDriver *driver);
101 ~SmushSound();
102
103 int moduleStartup();
104 int moduleShutdown();
105
106 int souEngineStart(const byte *data, int volume, int pan, int soundClass);
107 void souEnginePause();
108 int souEngineResume();
109 void souEngineStopAll();
110 int souEngineGetRate();
111 int souEngineQueryTime(int channelIndex);
112 void souEngineFill(int frameCount, SmushDriver *driver);
113
114};
115
116} // End of namespace Grim
117#endif
Definition: smush_mixer.h:89
Definition: smush_sound.h:72
Definition: smush_timer.h:49
Definition: smush_sound.h:35
Definition: smush_sound.h:56