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 * This file contains the Sound Driver data structures etc.
21 */
22
23#ifndef TINSEL_SOUND_H
24#define TINSEL_SOUND_H
25
26#include "common/file.h"
27#include "common/file.h"
28
29#include "audio/mixer.h"
30
31#include "tinsel/dw.h"
32#include "tinsel/tinsel.h"
33#include "tinsel/drives.h"
34
35namespace Tinsel {
36
37enum STYPE {FX, VOICE};
38
39enum PlayPriority { PRIORITY_SCRIPT, PRIORITY_SPLAY1, PRIORITY_SPLAY2, PRIORITY_TALK };
40
41enum SampleFlags {PS_COMPLETE = 0x01, PS_SUSTAIN = 0x02};
42
43/*----------------------------------------------------------------------*\
44|* Function Prototypes *|
45\*----------------------------------------------------------------------*/
46
48protected:
49 static const int kNumSFX = 3; // Number of SFX channels
50 enum {
51 kChannelTalk = 0,
52 kChannelTinsel1 = 0, // Always using this channel for DW1
53 kChannelSFX = 1,
54 kChannelDW1MacMusic = 2
55 };
56 static const int kNumChannels = kChannelSFX + kNumSFX;
57
58 enum SoundMode {
59 kVOCMode,
60 kMP3Mode,
61 kVorbisMode,
62 kFLACMode
63 };
64
65 struct Channel {
66 // Sample handle
67 Audio::SoundHandle handle;
68
69 // Sample id
70 int sampleNum;
71 int subSample;
72
73 // Playing properties
74 bool looped;
75 int x, y;
76 int priority;
77
78 // Time properties
79 uint32 timeStarted;
80 uint32 timeDuration;
81 uint32 lastStart;
82 };
83
84 Channel _channels[kNumChannels];
85
86 //TinselEngine *_vm; // TODO: Enable this once global _vm var is gone
87
89 uint32 *_sampleIndex;
90
93
95 SoundMode _soundMode;
96
99
100 bool offscreenChecks(int x, int &y);
101 int8 getPan(int x);
102
103public:
104
107
108 bool playSample(int id, Audio::Mixer::SoundType type, Audio::SoundHandle *handle = 0);
109 bool playSample(int id, int sub, bool bLooped, int x, int y, int priority,
111 void playDW1MacMusic(Common::File &s, uint32 length);
112
113 void stopAllSamples(); // Stops any currently playing sample
114 void stopSpecSample(int id, int sub = 0); // Stops a specific sample
115
116 void setSFXVolumes(uint8 volume);
117
118 bool sampleExists(int id);
119 bool sampleIsPlaying();
120
121 void openSampleFiles();
122 void closeSampleStream();
123
124private:
125 void showSoundError(const char *errorMsg, const char *soundFile);
126};
127
128} // End of namespace Tinsel
129
130#endif // TINSEL_SOUND_H
SoundType
Definition: mixer.h:73
Definition: mixer.h:49
Definition: file.h:47
Definition: sound.h:47
int _sampleIndexLen
Definition: sound.h:92
uint32 * _sampleIndex
Definition: sound.h:89
SoundMode _soundMode
Definition: sound.h:95
TinselFile _sampleStream
Definition: sound.h:98
Definition: tinsel.h:148
Definition: drives.h:62
Definition: actors.h:36
Definition: sound.h:65