aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWalter van Niftrik2010-01-09 02:16:17 +0000
committerWalter van Niftrik2010-01-09 02:16:17 +0000
commitd1d4091281ea42528c89fadb48c7ab1409ed4583 (patch)
treecb2e56ddd56373db5eb66d70dff32ff9f0959316
parent6f78bc40dd04b0480c53e81772c3b2f8bd6cf0da (diff)
downloadscummvm-rg350-d1d4091281ea42528c89fadb48c7ab1409ed4583.tar.gz
scummvm-rg350-d1d4091281ea42528c89fadb48c7ab1409ed4583.tar.bz2
scummvm-rg350-d1d4091281ea42528c89fadb48c7ab1409ed4583.zip
SCI: Cleanup
svn-id: r47191
-rw-r--r--engines/sci/sound/iterator/core.cpp6
-rw-r--r--engines/sci/sound/music.cpp5
-rw-r--r--engines/sci/sound/softseq/mididriver.h2
-rw-r--r--engines/sci/sound/softseq/pcjr.cpp62
-rw-r--r--engines/sci/sound/softseq/pcjr.h84
5 files changed, 67 insertions, 92 deletions
diff --git a/engines/sci/sound/iterator/core.cpp b/engines/sci/sound/iterator/core.cpp
index 5ea7f1d0f7..be17a77459 100644
--- a/engines/sci/sound/iterator/core.cpp
+++ b/engines/sci/sound/iterator/core.cpp
@@ -32,8 +32,6 @@
#include "sci/sound/iterator/iterator.h"
#include "sci/sound/softseq/mididriver.h"
-#include "sci/sound/softseq/pcjr.h"
-
#include "common/system.h"
#include "common/timer.h"
@@ -236,10 +234,10 @@ Common::Error SfxPlayer::init(ResourceManager *resMan, int expected_latency) {
_mididrv = MidiPlayer_Adlib_create();
break;
case MD_PCJR:
- _mididrv = new MidiPlayer_PCJr();
+ _mididrv = MidiPlayer_PCJr_create();
break;
case MD_PCSPK:
- _mididrv = new MidiPlayer_PCSpeaker();
+ _mididrv = MidiPlayer_PCSpeaker_create();
break;
default:
break;
diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp
index 1b18b8f434..aa64c30d83 100644
--- a/engines/sci/sound/music.cpp
+++ b/engines/sci/sound/music.cpp
@@ -33,7 +33,6 @@
#include "sci/engine/state.h"
#include "sci/sound/midiparser_sci.h"
#include "sci/sound/music.h"
-#include "sci/sound/softseq/pcjr.h"
namespace Sci {
@@ -89,10 +88,10 @@ void SciMusic::init() {
_pMidiDrv = MidiPlayer_Adlib_create();
break;
case MD_PCJR:
- _pMidiDrv = new MidiPlayer_PCJr();
+ _pMidiDrv = MidiPlayer_PCJr_create();
break;
case MD_PCSPK:
- _pMidiDrv = new MidiPlayer_PCSpeaker();
+ _pMidiDrv = MidiPlayer_PCSpeaker_create();
break;
//case MD_MT32:
// TODO
diff --git a/engines/sci/sound/softseq/mididriver.h b/engines/sci/sound/softseq/mididriver.h
index 0569374a10..c2045e4f54 100644
--- a/engines/sci/sound/softseq/mididriver.h
+++ b/engines/sci/sound/softseq/mididriver.h
@@ -104,6 +104,8 @@ public:
extern MidiPlayer *MidiPlayer_Adlib_create();
extern MidiPlayer *MidiPlayer_Amiga_create();
+extern MidiPlayer *MidiPlayer_PCJr_create();
+extern MidiPlayer *MidiPlayer_PCSpeaker_create();
} // End of namespace Sci
diff --git a/engines/sci/sound/softseq/pcjr.cpp b/engines/sci/sound/softseq/pcjr.cpp
index 569548c33a..8b2ded4a8a 100644
--- a/engines/sci/sound/softseq/pcjr.cpp
+++ b/engines/sci/sound/softseq/pcjr.cpp
@@ -24,7 +24,6 @@
*/
#include "sci/sound/softseq/mididriver.h"
-#include "sci/sound/softseq/pcjr.h"
namespace Sci {
@@ -58,6 +57,43 @@ static inline int get_freq(int note) {
return freq;
}
+class MidiDriver_PCJr : public MidiDriver_Emulated {
+public:
+ friend class MidiPlayer_PCJr;
+
+ enum {
+ kMaxChannels = 3
+ };
+
+ MidiDriver_PCJr(Audio::Mixer *mixer) : MidiDriver_Emulated(mixer) { }
+ ~MidiDriver_PCJr() { }
+
+ // MidiDriver
+ int open() { return open(kMaxChannels); }
+ void close();
+ void send(uint32 b);
+ MidiChannel *allocateChannel() { return NULL; }
+ MidiChannel *getPercussionChannel() { return NULL; }
+
+ // AudioStream
+ bool isStereo() const { return false; }
+ int getRate() const { return _mixer->getOutputRate(); }
+
+ // MidiDriver_Emulated
+ void generateSamples(int16 *buf, int len);
+
+ int open(int channels);
+private:
+ int _channels_nr;
+ int _global_volume; // Base volume
+ int _volumes[kMaxChannels];
+ int _notes[kMaxChannels]; // Current halftone, or 0 if off
+ int _freq_count[kMaxChannels];
+ int _channel_assigner;
+ int _channels_assigned;
+ int _chan_nrs[kMaxChannels];
+};
+
void MidiDriver_PCJr::send(uint32 b) {
byte command = b & 0xff;
byte op1 = (b >> 8) & 0xff;
@@ -192,6 +228,16 @@ void MidiDriver_PCJr::close() {
_mixer->stopHandle(_mixerSoundHandle);
}
+class MidiPlayer_PCJr : public MidiPlayer {
+public:
+ MidiPlayer_PCJr() { _driver = new MidiDriver_PCJr(g_system->getMixer()); }
+ int open(ResourceManager *resMan) { return static_cast<MidiDriver_PCJr *>(_driver)->open(getPolyphony()); }
+ byte getPlayId(SciVersion soundVersion);
+ int getPolyphony() const { return 3; }
+ bool hasRhythmChannel() const { return false; }
+ void setVolume(byte volume) { static_cast<MidiDriver_PCJr *>(_driver)->_global_volume = volume; }
+};
+
byte MidiPlayer_PCJr::getPlayId(SciVersion soundVersion) {
switch (soundVersion) {
case SCI_VERSION_0_EARLY:
@@ -203,6 +249,16 @@ byte MidiPlayer_PCJr::getPlayId(SciVersion soundVersion) {
}
}
+MidiPlayer *MidiPlayer_PCJr_create() {
+ return new MidiPlayer_PCJr();
+}
+
+class MidiPlayer_PCSpeaker : public MidiPlayer_PCJr {
+public:
+ byte getPlayId(SciVersion soundVersion);
+ int getPolyphony() const { return 1; }
+};
+
byte MidiPlayer_PCSpeaker::getPlayId(SciVersion soundVersion) {
switch (soundVersion) {
case SCI_VERSION_0_EARLY:
@@ -214,4 +270,8 @@ byte MidiPlayer_PCSpeaker::getPlayId(SciVersion soundVersion) {
}
}
+MidiPlayer *MidiPlayer_PCSpeaker_create() {
+ return new MidiPlayer_PCSpeaker();
+}
+
} // End of namespace Sci
diff --git a/engines/sci/sound/softseq/pcjr.h b/engines/sci/sound/softseq/pcjr.h
deleted file mode 100644
index 2693706956..0000000000
--- a/engines/sci/sound/softseq/pcjr.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "sci/sound/softseq/mididriver.h"
-
-namespace Sci {
-
-class MidiDriver_PCJr : public MidiDriver_Emulated {
-public:
- friend class MidiPlayer_PCJr;
-
- enum {
- kMaxChannels = 3
- };
-
- MidiDriver_PCJr(Audio::Mixer *mixer) : MidiDriver_Emulated(mixer) { }
- ~MidiDriver_PCJr() { }
-
- // MidiDriver
- int open() { return open(kMaxChannels); }
- void close();
- void send(uint32 b);
- MidiChannel *allocateChannel() { return NULL; }
- MidiChannel *getPercussionChannel() { return NULL; }
-
- // AudioStream
- bool isStereo() const { return false; }
- int getRate() const { return _mixer->getOutputRate(); }
-
- // MidiDriver_Emulated
- void generateSamples(int16 *buf, int len);
-
- int open(int channels);
-private:
- int _channels_nr;
- int _global_volume; // Base volume
- int _volumes[kMaxChannels];
- int _notes[kMaxChannels]; // Current halftone, or 0 if off
- int _freq_count[kMaxChannels];
- int _channel_assigner;
- int _channels_assigned;
- int _chan_nrs[kMaxChannels];
-};
-
-class MidiPlayer_PCJr : public MidiPlayer {
-public:
- MidiPlayer_PCJr() { _driver = new MidiDriver_PCJr(g_system->getMixer()); }
- int open(ResourceManager *resMan) { return static_cast<MidiDriver_PCJr *>(_driver)->open(getPolyphony()); }
- byte getPlayId(SciVersion soundVersion);
- int getPolyphony() const { return 3; }
- bool hasRhythmChannel() const { return false; }
- void setVolume(byte volume) { static_cast<MidiDriver_PCJr *>(_driver)->_global_volume = volume; }
-};
-
-class MidiPlayer_PCSpeaker : public MidiPlayer_PCJr {
-public:
- byte getPlayId(SciVersion soundVersion);
- int getPolyphony() const { return 1; }
-};
-
-} // End of namespace Sci
-