aboutsummaryrefslogtreecommitdiff
path: root/engines/cge/sound.cpp
diff options
context:
space:
mode:
authorAlyssa Milburn2011-08-20 00:23:45 +0200
committerAlyssa Milburn2011-08-20 00:23:45 +0200
commite4a37322a6678aa3874d96ce131bebbccbdd7a44 (patch)
treec9075b5fbaa7cbefb0fb98df29370ab5c93eb6aa /engines/cge/sound.cpp
parentc1807138fbb9dca4ff2d59f8c5ed39385716c6a0 (diff)
downloadscummvm-rg350-e4a37322a6678aa3874d96ce131bebbccbdd7a44.tar.gz
scummvm-rg350-e4a37322a6678aa3874d96ce131bebbccbdd7a44.tar.bz2
scummvm-rg350-e4a37322a6678aa3874d96ce131bebbccbdd7a44.zip
CGE: More misc cleanup.
Diffstat (limited to 'engines/cge/sound.cpp')
-rw-r--r--engines/cge/sound.cpp19
1 files changed, 3 insertions, 16 deletions
diff --git a/engines/cge/sound.cpp b/engines/cge/sound.cpp
index b22548c16d..432bca75b5 100644
--- a/engines/cge/sound.cpp
+++ b/engines/cge/sound.cpp
@@ -42,22 +42,18 @@ Sound::Sound(CGEEngine *vm) : _vm(vm) {
open();
}
-
Sound::~Sound() {
close();
}
-
void Sound::close() {
_vm->_midiPlayer.killMidi();
}
-
void Sound::open() {
play((*_fx)[30000], 8);
}
-
void Sound::play(DataCk *wav, int pan, int cnt) {
if (wav) {
stop();
@@ -97,16 +93,13 @@ Fx::Fx(int size) : _current(NULL) {
}
}
-
Fx::~Fx() {
clear();
delete[] _cache;
}
-
void Fx::clear() {
- Han *p, * q;
- for (p = _cache, q = p + _size; p < q; p++) {
+ for (Han *p = _cache, *q = p + _size; p < q; p++) {
if (p->_ref) {
p->_ref = 0;
delete p->_wav;
@@ -116,11 +109,9 @@ void Fx::clear() {
_current = NULL;
}
-
int Fx::find(int ref) {
- Han *p, * q;
int i = 0;
- for (p = _cache, q = p + _size; p < q; p++) {
+ for (Han *p = _cache, *q = p + _size; p < q; p++) {
if (p->_ref == ref)
break;
else
@@ -129,12 +120,10 @@ int Fx::find(int ref) {
return i;
}
-
void Fx::preload(int ref0) {
Han *cacheLim = _cache + _size;
- int ref;
- for (ref = ref0; ref < ref0 + 10; ref++) {
+ for (int ref = ref0; ref < ref0 + 10; ref++) {
static char fname[] = "FX00000.WAV";
wtom(ref, fname + 2, 10, 5);
INI_FILE file = INI_FILE(fname);
@@ -149,7 +138,6 @@ void Fx::preload(int ref0) {
}
}
-
DataCk *Fx::load(int idx, int ref) {
static char fname[] = "FX00000.WAV";
wtom(ref, fname + 2, 10, 5);
@@ -164,7 +152,6 @@ DataCk *Fx::load(int idx, int ref) {
return wav;
}
-
DataCk *Fx::operator [](int ref) {
int i;
if ((i = find(ref)) < _size)