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 TWINE_SOUND_H
23#define TWINE_SOUND_H
24
25#include "audio/audiostream.h"
26#include "audio/mixer.h"
27#include "common/scummsys.h"
28#include "common/types.h"
29#include "twine/shared.h"
30
31namespace TwinE {
32
33class TextEntry;
34
35#define NUM_CHANNELS 32
36
37namespace Samples {
38enum _Samples {
39 TwinsenHit = 0,
40 SoldierHit = 4,
41 ItemPopup = 11,
42 Explode = 37,
43 BigItemFound = 41,
44 TaskCompleted = 41,
45 Hit = 86,
46 ItemFound = 97,
47 WalkFloorBegin = 126, // BASE_STEP_SOUND
48 WalkFloorRightBegin = 141
49};
50}
51
52class TwinEEngine;
53class Sound {
54private:
55 TwinEEngine *_engine;
56
58 Audio::SoundHandle _samplesPlaying[NUM_CHANNELS];
59
61 int32 _samplesPlayingActors[NUM_CHANNELS]{0};
62
63 bool playSample(int32 channelIdx, int32 index, Audio::SeekableAudioStream *audioStream, int32 loop, const char *name, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
64
65 bool isChannelPlaying(int32 channelIdx);
66
68 int32 getFreeSampleChannelIndex();
69
71 void removeChannelWatch(int32 channelIdx);
72public:
73 int32 _parmSampleVolume = 127;
74 int32 _parmSampleDecalage = 0;
75 int32 _parmSampleFrequence = 0;
76
77 Sound(TwinEEngine *engine);
78 ~Sound();
79
81 int32 getSampleChannel(int32 index);
82
88 void playFlaSample(int32 index, int16 rate, int32 repeat, uint8 volumeLeft, uint8 volumeRight);
89
90 void setChannelBalance(int32 channelIdx, uint8 volumeLeft, uint8 volumeRight);
91
92 void setChannelRate(int32 channelIdx, uint32 rate);
93
95 void setChannelPosition(int32 channelIdx, int32 x, int32 y, int32 z);
96
97 inline void setChannelPosition(int32 channelIdx, const IVec3 &pos) {
98 setChannelPosition(channelIdx, pos.x, pos.y, pos.z);
99 }
100
108 void mixSample3D(int32 index, uint16 pitchbend, int32 repeat, const IVec3 &pos, int32 actorIdx); // HQ_3D_MixSample
109
110 void mixSample(int32 index, uint16 pitchbend, int32 repeat, uint8 volumeLeft, uint8 volumeRight); // HQ_MixSample
111
114
117
118 void startRainSample();
119
122
124 int32 getActorChannel(int32 actorIdx);
125
127 void stopSample(int32 index); // HQ_StopOneSample
128
130 int32 isSamplePlaying(int32 index);
131
133 bool playVoxSample(const TextEntry *text);
134};
135
136} // namespace TwinE
137
138#endif
SoundType
Definition: mixer.h:73
@ kPlainSoundType
Definition: mixer.h:74
Definition: audiostream.h:212
Definition: mixer.h:49
Definition: sound.h:53
void setChannelPosition(int32 channelIdx, int32 x, int32 y, int32 z)
bool playVoxSample(const TextEntry *text)
void stopSamples()
int32 getSampleChannel(int32 index)
void playFlaSample(int32 index, int16 rate, int32 repeat, uint8 volumeLeft, uint8 volumeRight)
void mixSample3D(int32 index, uint16 pitchbend, int32 repeat, const IVec3 &pos, int32 actorIdx)
void pauseSamples()
int32 isSamplePlaying(int32 index)
void stopSample(int32 index)
void resumeSamples()
int32 getActorChannel(int32 actorIdx)
Definition: text.h:33
Definition: twine.h:207
Definition: shared.h:127