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 HOLLYWOOD_SOUND_H
23
#define HOLLYWOOD_SOUND_H
24
25
#include "audio/mixer.h"
26
#include "common/rect.h"
27
28
namespace
Hollywood {
29
30
// Owns a mixer channel. Optional positions describe the horizontal (x, z)
31
// sound plane: Point::y is distance in front of the listener, not screen y.
32
class
SoundChannel
{
33
public
:
34
enum
PositionMode {
35
kSpatial,
36
kStereoPan
37
};
38
39
SoundChannel
() =
default
;
40
~SoundChannel
();
41
SoundChannel
(
const
SoundChannel
&) =
delete
;
42
SoundChannel
&operator=(
const
SoundChannel
&) =
delete
;
43
44
void
play(
Audio::Mixer
*mixer,
Audio::Mixer::SoundType
type,
Audio::AudioStream
*stream,
45
byte
volume,
const
Common::Point
*position =
nullptr
,
int
listenerX = 0,
float
rolloff = 1.0f,
46
PositionMode mode = kSpatial);
47
void
stop();
48
bool
isPlaying()
const
;
49
void
setVolume(
byte
volume);
50
void
setListenerPosition(
int
x);
51
52
private
:
53
void
mixerLevels(
byte
&volume, int8 &balance)
const
;
54
void
updateVolume();
55
56
Audio::Mixer
*_mixer =
nullptr
;
57
Audio::SoundHandle
_handle;
58
byte
_volume = 0;
59
bool
_positional =
false
;
60
Common::Point
_position;
61
int
_listenerX = 0;
62
float
_rolloff = 1.0f;
63
PositionMode _positionMode = kSpatial;
64
};
65
66
}
// End of namespace Hollywood
67
68
#endif
// HOLLYWOOD_SOUND_H
Audio::AudioStream
Definition:
audiostream.h:50
Audio::Mixer
Definition:
mixer.h:70
Audio::Mixer::SoundType
SoundType
Definition:
mixer.h:73
Audio::SoundHandle
Definition:
mixer.h:49
Hollywood::SoundChannel
Definition:
sound.h:32
Common::Point
Definition:
rect.h:144
engines
hollywood
sound.h
Generated on Sun Nov 22 2026 09:24:49 for ScummVM API documentation by
1.9.4