[Scummvm-cvs-logs] SF.net SVN: scummvm:[39550] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Fri Mar 20 00:41:01 CET 2009


Revision: 39550
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39550&view=rev
Author:   drmccoy
Date:     2009-03-19 23:40:59 +0000 (Thu, 19 Mar 2009)

Log Message:
-----------
Adding simple support for protracker playback

Modified Paths:
--------------
    scummvm/trunk/engines/gob/module.mk
    scummvm/trunk/engines/gob/sound/sound.cpp
    scummvm/trunk/engines/gob/sound/sound.h

Added Paths:
-----------
    scummvm/trunk/engines/gob/sound/protracker.cpp
    scummvm/trunk/engines/gob/sound/protracker.h

Modified: scummvm/trunk/engines/gob/module.mk
===================================================================
--- scummvm/trunk/engines/gob/module.mk	2009-03-19 23:31:20 UTC (rev 39549)
+++ scummvm/trunk/engines/gob/module.mk	2009-03-19 23:40:59 UTC (rev 39550)
@@ -64,6 +64,7 @@
 	sound/pcspeaker.o \
 	sound/adlib.o \
 	sound/infogrames.o \
+	sound/protracker.o \
 	sound/soundmixer.o \
 	sound/soundblaster.o \
 	sound/cdrom.o \

Added: scummvm/trunk/engines/gob/sound/protracker.cpp
===================================================================
--- scummvm/trunk/engines/gob/sound/protracker.cpp	                        (rev 0)
+++ scummvm/trunk/engines/gob/sound/protracker.cpp	2009-03-19 23:40:59 UTC (rev 39550)
@@ -0,0 +1,68 @@
+/* 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 "common/file.h"
+
+#include "gob/sound/protracker.h"
+
+namespace Gob {
+
+Protracker::Protracker(Audio::Mixer &mixer) : _mixer(&mixer) {
+	_protrackerStream = 0;
+}
+
+Protracker::~Protracker() {
+	stop();
+}
+
+bool Protracker::play(const char *fileName) {
+	stop();
+
+	Common::File f;
+
+	if (!f.open(fileName))
+		return false;
+
+	_protrackerStream = Audio::makeProtrackerStream(&f);
+
+	if (!_protrackerStream)
+		return false;
+
+	_mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_handle,
+			_protrackerStream, -1, 255, 0, false);
+
+	return true;
+}
+
+void Protracker::stop() {
+	if (_protrackerStream) {
+		_mixer->stopHandle(_handle);
+
+		delete _protrackerStream;
+		_protrackerStream = 0;
+	}
+}
+
+} // End of namespace Gob


Property changes on: scummvm/trunk/engines/gob/sound/protracker.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Added: scummvm/trunk/engines/gob/sound/protracker.h
===================================================================
--- scummvm/trunk/engines/gob/sound/protracker.h	                        (rev 0)
+++ scummvm/trunk/engines/gob/sound/protracker.h	2009-03-19 23:40:59 UTC (rev 39550)
@@ -0,0 +1,52 @@
+/* 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$
+ *
+ */
+
+#ifndef GOB_SOUND_PROTRACKER_H
+#define GOB_SOUND_PROTRACKER_H
+
+#include "sound/mixer.h"
+#include "sound/audiostream.h"
+#include "sound/mods/protracker.h"
+
+namespace Gob {
+
+class Protracker {
+public:
+	Protracker(Audio::Mixer &mixer);
+	~Protracker();
+
+	bool play(const char *fileName);
+	void stop();
+
+private:
+	Audio::Mixer *_mixer;
+
+	Audio::AudioStream *_protrackerStream;
+	Audio::SoundHandle _handle;
+};
+
+} // End of namespace Gob
+
+#endif // GOB_SOUND_PROTRACKER_H


Property changes on: scummvm/trunk/engines/gob/sound/protracker.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Modified: scummvm/trunk/engines/gob/sound/sound.cpp
===================================================================
--- scummvm/trunk/engines/gob/sound/sound.cpp	2009-03-19 23:31:20 UTC (rev 39549)
+++ scummvm/trunk/engines/gob/sound/sound.cpp	2009-03-19 23:40:59 UTC (rev 39550)
@@ -39,13 +39,16 @@
 
 	_adlib = 0;
 	_infogrames = 0;
+	_protracker = 0;
 	_cdrom = 0;
 	_bgatmos = 0;
 
 	if (!_vm->_noMusic && _vm->hasAdlib())
 		_adlib = new AdLib(*_vm->_mixer);
-	if (!_vm->_noMusic && (_vm->getPlatform() == Common::kPlatformAmiga))
+	if (!_vm->_noMusic && (_vm->getPlatform() == Common::kPlatformAmiga)) {
 		_infogrames = new Infogrames(*_vm->_mixer);
+		_protracker = new Protracker(*_vm->_mixer);
+	}
 	if (_vm->isCD())
 		_cdrom = new CDROM;
 	if (_vm->getGameType() == kGameTypeWoodruff)
@@ -61,6 +64,7 @@
 	delete _blaster;
 	delete _adlib;
 	delete _infogrames;
+	delete _protracker;
 	delete _cdrom;
 	delete _bgatmos;
 
@@ -183,6 +187,24 @@
 	return _infogrames->loadSong(fileName);
 }
 
+bool Sound::protrackerPlay(const char *fileName) {
+	if (!_protracker)
+		return false;
+
+	debugC(1, kDebugSound, "Protracker: Playing song \"%s\"", fileName);
+
+	return _protracker->play(fileName);
+}
+
+void Sound::protrackerStop() {
+	if (!_protracker)
+		return;
+
+	debugC(1, kDebugSound, "Protracker: Stopping playback");
+
+	_protracker->stop();
+}
+
 void Sound::infogramesPlay() {
 	if (!_infogrames)
 		return;

Modified: scummvm/trunk/engines/gob/sound/sound.h
===================================================================
--- scummvm/trunk/engines/gob/sound/sound.h	2009-03-19 23:31:20 UTC (rev 39549)
+++ scummvm/trunk/engines/gob/sound/sound.h	2009-03-19 23:40:59 UTC (rev 39550)
@@ -31,6 +31,7 @@
 #include "gob/sound/soundblaster.h"
 #include "gob/sound/adlib.h"
 #include "gob/sound/infogrames.h"
+#include "gob/sound/protracker.h"
 #include "gob/sound/cdrom.h"
 #include "gob/sound/bgatmosphere.h"
 
@@ -102,6 +103,11 @@
 	void infogramesStop();
 
 
+	// Protracker
+	bool protrackerPlay(const char *fileName);
+	void protrackerStop();
+
+
 	// CD-ROM
 	void cdLoadLIC(const char *fname);
 	void cdUnloadLIC();
@@ -139,6 +145,7 @@
 	SoundBlaster *_blaster;
 	AdLib *_adlib;
 	Infogrames *_infogrames;
+	Protracker *_protracker;
 	CDROM *_cdrom;
 	BackgroundAtmosphere *_bgatmos;
 };


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