[Scummvm-cvs-logs] SF.net SVN: scummvm:[47191] scummvm/trunk/engines/sci/sound

waltervn at users.sourceforge.net waltervn at users.sourceforge.net
Sat Jan 9 03:16:19 CET 2010


Revision: 47191
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47191&view=rev
Author:   waltervn
Date:     2010-01-09 02:16:17 +0000 (Sat, 09 Jan 2010)

Log Message:
-----------
SCI: Cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/sci/sound/iterator/core.cpp
    scummvm/trunk/engines/sci/sound/music.cpp
    scummvm/trunk/engines/sci/sound/softseq/mididriver.h
    scummvm/trunk/engines/sci/sound/softseq/pcjr.cpp

Removed Paths:
-------------
    scummvm/trunk/engines/sci/sound/softseq/pcjr.h

Modified: scummvm/trunk/engines/sci/sound/iterator/core.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/iterator/core.cpp	2010-01-09 02:14:12 UTC (rev 47190)
+++ scummvm/trunk/engines/sci/sound/iterator/core.cpp	2010-01-09 02:16:17 UTC (rev 47191)
@@ -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 @@
 			_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;

Modified: scummvm/trunk/engines/sci/sound/music.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/music.cpp	2010-01-09 02:14:12 UTC (rev 47190)
+++ scummvm/trunk/engines/sci/sound/music.cpp	2010-01-09 02:16:17 UTC (rev 47191)
@@ -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 @@
 			_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

Modified: scummvm/trunk/engines/sci/sound/softseq/mididriver.h
===================================================================
--- scummvm/trunk/engines/sci/sound/softseq/mididriver.h	2010-01-09 02:14:12 UTC (rev 47190)
+++ scummvm/trunk/engines/sci/sound/softseq/mididriver.h	2010-01-09 02:16:17 UTC (rev 47191)
@@ -104,6 +104,8 @@
 
 extern MidiPlayer *MidiPlayer_Adlib_create();
 extern MidiPlayer *MidiPlayer_Amiga_create();
+extern MidiPlayer *MidiPlayer_PCJr_create();
+extern MidiPlayer *MidiPlayer_PCSpeaker_create();
 
 } // End of namespace Sci
 

Modified: scummvm/trunk/engines/sci/sound/softseq/pcjr.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/softseq/pcjr.cpp	2010-01-09 02:14:12 UTC (rev 47190)
+++ scummvm/trunk/engines/sci/sound/softseq/pcjr.cpp	2010-01-09 02:16:17 UTC (rev 47191)
@@ -24,7 +24,6 @@
  */
 
 #include "sci/sound/softseq/mididriver.h"
-#include "sci/sound/softseq/pcjr.h"
 
 namespace Sci {
 
@@ -58,6 +57,43 @@
 	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 @@
 	_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 @@
 	}
 }
 
+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 @@
 	}
 }
 
+MidiPlayer *MidiPlayer_PCSpeaker_create() {
+	return new MidiPlayer_PCSpeaker();
+}
+
 } // End of namespace Sci

Deleted: scummvm/trunk/engines/sci/sound/softseq/pcjr.h
===================================================================
--- scummvm/trunk/engines/sci/sound/softseq/pcjr.h	2010-01-09 02:14:12 UTC (rev 47190)
+++ scummvm/trunk/engines/sci/sound/softseq/pcjr.h	2010-01-09 02:16:17 UTC (rev 47191)
@@ -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
-


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list