aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorMax Horn2006-10-21 12:44:10 +0000
committerMax Horn2006-10-21 12:44:10 +0000
commit9edf1e6a1a95f45b9883e298edc7e578ff9495d1 (patch)
tree897a46c0e4bbc22c8422bd3b96545bfeea3a4a0f /sound
parent86d3f30347d5ee7ee67a4f16d5043b9bef0539db (diff)
downloadscummvm-rg350-9edf1e6a1a95f45b9883e298edc7e578ff9495d1.tar.gz
scummvm-rg350-9edf1e6a1a95f45b9883e298edc7e578ff9495d1.tar.bz2
scummvm-rg350-9edf1e6a1a95f45b9883e298edc7e578ff9495d1.zip
cleanup
svn-id: r24407
Diffstat (limited to 'sound')
-rw-r--r--sound/audiocd.cpp14
-rw-r--r--sound/audiocd.h6
-rw-r--r--sound/mididrv.cpp9
-rw-r--r--sound/mixer.h4
-rw-r--r--sound/mpu401.cpp7
-rw-r--r--sound/softsynth/mt32.cpp2
6 files changed, 24 insertions, 18 deletions
diff --git a/sound/audiocd.cpp b/sound/audiocd.cpp
index 4c07bf4b43..3a7c08959f 100644
--- a/sound/audiocd.cpp
+++ b/sound/audiocd.cpp
@@ -68,6 +68,8 @@ AudioCDManager::AudioCDManager() {
memset(_cachedTracks, 0, sizeof(_cachedTracks));
memset(_trackInfo, 0, sizeof(_trackInfo));
_currentCache = 0;
+ _mixer = g_system->getMixer();
+ assert(_mixer);
}
void AudioCDManager::play(int track, int numLoops, int startFrame, int duration) {
@@ -83,9 +85,9 @@ void AudioCDManager::play(int track, int numLoops, int startFrame, int duration)
_cd.duration = duration;
if (index >= 0) {
- g_engine->_mixer->stopHandle(_cd.handle);
+ _mixer->stopHandle(_cd.handle);
_cd.playing = true;
- _trackInfo[index]->play(g_engine->_mixer, &_cd.handle, _cd.start, _cd.duration);
+ _trackInfo[index]->play(_mixer, &_cd.handle, _cd.start, _cd.duration);
} else {
g_system->playCD(track, numLoops, startFrame, duration);
_cd.playing = false;
@@ -95,7 +97,7 @@ void AudioCDManager::play(int track, int numLoops, int startFrame, int duration)
void AudioCDManager::stop() {
if (_cd.playing) {
- g_engine->_mixer->stopHandle(_cd.handle);
+ _mixer->stopHandle(_cd.handle);
_cd.playing = false;
} else {
g_system->stopCD();
@@ -109,16 +111,16 @@ bool AudioCDManager::isPlaying() const {
void AudioCDManager::updateCD() {
if (_cd.playing) {
// If the sound handle is 0, then playback stopped.
- if (!g_engine->_mixer->isSoundHandleActive(_cd.handle)) {
+ if (!_mixer->isSoundHandleActive(_cd.handle)) {
// If playback just stopped, check if the current track is supposed
// to be repeated, and if that's the case, play it again. Else, stop
// the CD explicitly.
if (_cd.numLoops == -1 || --_cd.numLoops > 0) {
int index = getCachedTrack(_cd.track);
assert(index >= 0);
- _trackInfo[index]->play(g_engine->_mixer, &_cd.handle, _cd.start, _cd.duration);
+ _trackInfo[index]->play(_mixer, &_cd.handle, _cd.start, _cd.duration);
} else {
- g_engine->_mixer->stopHandle(_cd.handle);
+ _mixer->stopHandle(_cd.handle);
_cd.playing = false;
}
}
diff --git a/sound/audiocd.h b/sound/audiocd.h
index 2083ffdf39..837edcff82 100644
--- a/sound/audiocd.h
+++ b/sound/audiocd.h
@@ -31,9 +31,10 @@
namespace Audio {
+
class DigitalTrackInfo {
public:
- virtual void play(Audio::Mixer *mixer, Audio::SoundHandle *handle, int startFrame, int duration) = 0;
+ virtual void play(Mixer *mixer, SoundHandle *handle, int startFrame, int duration) = 0;
virtual ~DigitalTrackInfo() { }
};
@@ -65,7 +66,7 @@ private:
private:
/* used for emulated CD music */
struct ExtStatus : Status {
- Audio::SoundHandle handle;
+ SoundHandle handle;
};
ExtStatus _cd;
@@ -81,6 +82,7 @@ private:
DigitalTrackInfo *_trackInfo[CACHE_TRACKS];
int _currentCache;
+ Mixer *_mixer;
};
/** Shortcut for accessing the audio CD manager. */
diff --git a/sound/mididrv.cpp b/sound/mididrv.cpp
index ea738dba0b..8c2a64f808 100644
--- a/sound/mididrv.cpp
+++ b/sound/mididrv.cpp
@@ -26,6 +26,7 @@
#include "engines/engine.h"
#include "common/config-manager.h"
#include "common/str.h"
+#include "common/system.h"
#include "common/util.h"
#include "sound/mididrv.h"
@@ -211,9 +212,9 @@ MidiDriver *MidiDriver::createMidi(int midiDriver) {
switch (midiDriver) {
case MD_NULL: return MidiDriver_NULL_create();
- case MD_ADLIB: return MidiDriver_ADLIB_create(g_engine->_mixer);
+ case MD_ADLIB: return MidiDriver_ADLIB_create(g_system->getMixer());
- case MD_TOWNS: return MidiDriver_YM2612_create(g_engine->_mixer);
+ case MD_TOWNS: return MidiDriver_YM2612_create(g_system->getMixer());
// Right now PC Speaker and PCjr are handled
// outside the MidiDriver architecture, so
@@ -222,11 +223,11 @@ MidiDriver *MidiDriver::createMidi(int midiDriver) {
case MD_PCJR: return NULL;
#ifdef USE_FLUIDSYNTH
- case MD_FLUIDSYNTH: return MidiDriver_FluidSynth_create(g_engine->_mixer);
+ case MD_FLUIDSYNTH: return MidiDriver_FluidSynth_create(g_system->getMixer());
#endif
#ifdef USE_MT32EMU
- case MD_MT32: return MidiDriver_MT32_create(g_engine->_mixer);
+ case MD_MT32: return MidiDriver_MT32_create(g_system->getMixer());
#endif
#if defined(PALMOS_MODE)
diff --git a/sound/mixer.h b/sound/mixer.h
index f1cbc0586c..34fd54c0ed 100644
--- a/sound/mixer.h
+++ b/sound/mixer.h
@@ -39,8 +39,8 @@ class Channel;
class Mixer;
class SoundHandle {
- friend class Audio::Channel;
- friend class Audio::Mixer;
+ friend class Channel;
+ friend class Mixer;
uint32 _val;
public:
inline SoundHandle() : _val(0xFFFFFFFF) {}
diff --git a/sound/mpu401.cpp b/sound/mpu401.cpp
index 2d1285e2f7..22c4344bae 100644
--- a/sound/mpu401.cpp
+++ b/sound/mpu401.cpp
@@ -21,6 +21,7 @@
#include "common/stdafx.h"
#include "sound/mpu401.h"
+#include "common/system.h"
#include "common/timer.h"
#include "common/util.h" // for ARRAYSIZE
@@ -100,7 +101,7 @@ MidiDriver_MPU401::MidiDriver_MPU401() :
void MidiDriver_MPU401::close() {
if (_timer_proc)
- Common::g_timer->removeTimerProc(_timer_proc);
+ g_system->getTimerManager()->removeTimerProc(_timer_proc);
_timer_proc = 0;
for (int i = 0; i < 16; ++i)
send(0x7B << 8 | 0xB0 | i);
@@ -134,9 +135,9 @@ MidiChannel *MidiDriver_MPU401::allocateChannel() {
void MidiDriver_MPU401::setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc) {
if (!_timer_proc || !timer_proc) {
if (_timer_proc)
- Common::g_timer->removeTimerProc(_timer_proc);
+ g_system->getTimerManager()->removeTimerProc(_timer_proc);
_timer_proc = timer_proc;
if (timer_proc)
- Common::g_timer->installTimerProc(timer_proc, 10000, timer_param);
+ g_system->getTimerManager()->installTimerProc(timer_proc, 10000, timer_param);
}
}
diff --git a/sound/softsynth/mt32.cpp b/sound/softsynth/mt32.cpp
index 4af039287e..70ce6bcf8b 100644
--- a/sound/softsynth/mt32.cpp
+++ b/sound/softsynth/mt32.cpp
@@ -75,7 +75,7 @@ public:
int getRate() const { return _outputRate; }
};
-class MT32File: public MT32Emu::File {
+class MT32File : public MT32Emu::File {
Common::File file;
public:
bool open(const char *filename, OpenMode mode) {