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
/*
23
* This code is based on original Sfinx source code
24
* Copyright (c) 1994-1997 Janusz B. Wisniewski and L.K. Avalon
25
*/
26
27
#ifndef CGE2_SOUND_H
28
#define CGE2_SOUND_H
29
30
#include "audio/midiplayer.h"
31
#include "audio/mixer.h"
32
33
namespace
Audio
{
34
class
RewindableAudioStream;
35
}
36
37
namespace
CGE2
{
38
39
class
CGE2Engine;
40
class
EncryptedStream;
41
42
// sample info
43
struct
SmpInfo
{
44
const
uint8 *_saddr;
// address
45
uint16 _slen;
// length
46
uint16 _span;
// left/right pan (0-15)
47
int
_counter;
// number of time the sample should be played
48
};
49
50
class
DataCk
{
51
byte *_buf;
52
int
_ckSize;
53
public
:
54
DataCk
(byte *buf,
int
bufSize);
55
~
DataCk
();
56
inline
const
byte *addr() {
57
return
_buf;
58
}
59
inline
int
size() {
60
return
_ckSize;
61
}
62
};
63
64
class
Sound
{
65
public
:
66
SmpInfo
_smpinf;
67
68
explicit
Sound
(
CGE2Engine
*vm);
69
~
Sound
();
70
void
open();
71
void
close();
72
void
play(
Audio::Mixer::SoundType
soundType,
int
ref,
int
sub,
int
pan = 8);
73
int16 getRepeat();
74
void
setRepeat(int16 count);
75
void
stop();
76
void
checkSoundHandles();
77
private
:
78
int
_soundRepeatCount;
79
CGE2Engine
*_vm;
80
Audio::SoundHandle
_sfxHandle;
81
Audio::SoundHandle
_speechHandle;
82
Audio::RewindableAudioStream
*_audioStream;
83
84
void
sndDigiStart(
SmpInfo
*PSmpInfo,
Audio::Mixer::SoundType
soundType);
85
void
sndDigiStop(
Audio::SoundHandle
&handle);
86
};
87
88
class
Fx
{
89
CGE2Engine
*_vm;
90
91
DataCk
*loadWave(
EncryptedStream
*file);
92
Common::String
name(
int
ref,
int
sub);
93
public
:
94
DataCk
*_current;
95
96
Fx
(
CGE2Engine
*vm,
int
size);
97
~
Fx
();
98
void
clear();
99
bool
exist(
int
ref,
int
sub = 0);
100
DataCk
*load(
int
ref,
int
sub = 0);
101
};
102
103
class
MusicPlayer
:
public
Audio::MidiPlayer
{
104
private
:
105
CGE2Engine
*_vm;
106
byte *_data;
107
int
_dataSize;
108
bool
_isGM;
109
110
// Start MIDI File
111
void
sndMidiStart();
112
113
// Stop MIDI File
114
void
sndMidiStop();
115
public
:
116
explicit
MusicPlayer
(
CGE2Engine
*vm);
117
~
MusicPlayer
()
override
;
118
119
void
loadMidi(
int
ref);
120
void
killMidi();
121
122
void
send(uint32 b)
override
;
123
void
sendToChannel(byte channel, uint32 b)
override
;
124
};
125
126
}
// End of namespace CGE2
127
128
#endif // CGE2_SOUND_H
Audio::MidiPlayer
Definition:
midiplayer.h:63
CGE2::CGE2Engine
Definition:
cge2.h:149
CGE2::Sound
Definition:
sound.h:64
Common::String
Definition:
str.h:59
Audio::SoundHandle
Definition:
mixer.h:49
Audio::Mixer::SoundType
SoundType
Definition:
mixer.h:62
CGE2::EncryptedStream
Definition:
fileio.h:105
CGE2
Definition:
bitmap.h:33
CGE2::MusicPlayer
Definition:
sound.h:103
Audio::RewindableAudioStream
Definition:
audiostream.h:109
CGE2::Fx
Definition:
sound.h:88
CGE2::DataCk
Definition:
sound.h:50
Audio
Definition:
system.h:38
CGE2::SmpInfo
Definition:
sound.h:43
engines
cge2
sound.h
Generated on Wed Dec 18 2024 09:08:17 for ScummVM API documentation by
1.8.13