[Scummvm-cvs-logs] SF.net SVN: scummvm: [26477] scummvm/trunk/sound

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Apr 14 20:51:39 CEST 2007


Revision: 26477
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26477&view=rev
Author:   fingolfin
Date:     2007-04-14 11:51:38 -0700 (Sat, 14 Apr 2007)

Log Message:
-----------
Got rid of the last traces of DigitalTrackInfo

Modified Paths:
--------------
    scummvm/trunk/sound/audiocd.h
    scummvm/trunk/sound/flac.cpp
    scummvm/trunk/sound/flac.h
    scummvm/trunk/sound/mp3.cpp
    scummvm/trunk/sound/mp3.h
    scummvm/trunk/sound/vorbis.cpp
    scummvm/trunk/sound/vorbis.h

Modified: scummvm/trunk/sound/audiocd.h
===================================================================
--- scummvm/trunk/sound/audiocd.h	2007-04-14 18:48:09 UTC (rev 26476)
+++ scummvm/trunk/sound/audiocd.h	2007-04-14 18:51:38 UTC (rev 26477)
@@ -32,15 +32,6 @@
 namespace Audio {
 
 
-class DigitalTrackInfo {
-public:
-	virtual ~DigitalTrackInfo() {}
-
-	virtual void play(Mixer *mixer, SoundHandle *handle, int numLoops, int startFrame, int duration) = 0;
-//	virtual void stop();
-};
-
-
 class AudioCDManager : public Common::Singleton<AudioCDManager> {
 public:
 	struct Status {

Modified: scummvm/trunk/sound/flac.cpp
===================================================================
--- scummvm/trunk/sound/flac.cpp	2007-04-14 18:48:09 UTC (rev 26476)
+++ scummvm/trunk/sound/flac.cpp	2007-04-14 18:51:38 UTC (rev 26477)
@@ -770,96 +770,6 @@
 	return input;
 }
 
-
-#pragma mark -
-#pragma mark --- Flac Audio CD emulation ---
-#pragma mark -
-
-
-class FlacTrackInfo : public DigitalTrackInfo {
-private:
-	Common::String _filename;
-	bool _errorFlag;
-
-public:
-	FlacTrackInfo(const char *filename);
-	bool error() { return _errorFlag; }
-	void play(Mixer *mixer, SoundHandle *handle, int numLoops, int startFrame, int duration);
-};
-
-FlacTrackInfo::FlacTrackInfo(const char *filename) :
-	_filename(filename),
-	_errorFlag(false) {
-	
-	// Try to open the file
-	Common::File file;
-	if (!file.open(_filename)) {
-		_errorFlag = true;
-		return;
-	}
-	
-	// Next, try to create a FlacInputStream from it
-	FlacInputStream *tempStream = new FlacInputStream(&file, false);
-
-	// If initialising the stream fails, we set the error flag
-	if (!tempStream || !tempStream->isStreamDecoderReady())
-		_errorFlag = true;
-
-	delete tempStream;
-}
-
-void FlacTrackInfo::play(Mixer *mixer, SoundHandle *handle, int numLoops, int startFrame, int duration) {
-	assert(!_errorFlag);
-
-	if (error()) {
-		debug(1, "FlacTrackInfo::play:  invalid state, method should not been called");
-	}
-
-	// Open the file
-	Common::File *file = new Common::File();
-	if (!file || !file->open(_filename)) {
-		warning("FlacTrackInfo::play: failed to open '%s'", _filename.c_str());
-		delete file;
-		return;
-	}
-
-	// Convert startFrame & duration from frames (1/75 s) to milliseconds (1/1000s)
-	uint start = startFrame * 1000 / 75;
-	uint end = duration ? ((startFrame + duration) * 1000 / 75) : 0;
-
-	// ... create an AudioStream ...
-	FlacInputStream *input = new FlacInputStream(file, true, start, end, numLoops);
-	if (!input->isStreamDecoderReady()) {
-		delete input;
-		return;
-	}
-	
-	// ... and play it
-	mixer->playInputStream(Audio::Mixer::kMusicSoundType, handle, input);
-}
-
-DigitalTrackInfo* getFlacTrack(int track) {
-	assert(track >= 1);
-	char trackName[4][32];
-
-	sprintf(trackName[0], "track%d.flac", track);
-	sprintf(trackName[1], "track%02d.flac", track);
-	sprintf(trackName[2], "track%d.fla", track);
-	sprintf(trackName[3], "track%02d.fla", track);
-
-	for (int i = 0; i < 4; ++i) {
-		if (Common::File::exists(trackName[i])) {
-			FlacTrackInfo *trackInfo = new FlacTrackInfo(trackName[i]);
-			if (!trackInfo->error())
-				return trackInfo;
-			delete trackInfo;
-		}
-	}
-
-	return NULL;
-}
-
-
 } // End of namespace Audio
 
 #endif // #ifdef USE_FLAC

Modified: scummvm/trunk/sound/flac.h
===================================================================
--- scummvm/trunk/sound/flac.h	2007-04-14 18:48:09 UTC (rev 26476)
+++ scummvm/trunk/sound/flac.h	2007-04-14 18:51:38 UTC (rev 26477)
@@ -36,10 +36,7 @@
 namespace Audio {
 
 class AudioStream;
-class DigitalTrackInfo;
 
-DigitalTrackInfo *getFlacTrack(int track);
-
 /**
  * Create a new AudioStream from the FLAC data in the given
  * file. If you only want to play part of that file, then seek

Modified: scummvm/trunk/sound/mp3.cpp
===================================================================
--- scummvm/trunk/sound/mp3.cpp	2007-04-14 18:48:09 UTC (rev 26476)
+++ scummvm/trunk/sound/mp3.cpp	2007-04-14 18:51:38 UTC (rev 26477)
@@ -339,93 +339,6 @@
 	return new MP3InputStream(stream, disposeAfterUse, start, end, numLoops);
 }
 
-
-#pragma mark -
-#pragma mark --- MP3 Audio CD emulation ---
-#pragma mark -
-
-
-class MP3TrackInfo : public DigitalTrackInfo {
-private:
-	Common::String _filename;
-	bool _errorFlag;
-
-public:
-	MP3TrackInfo(const char *filename);
-	bool error() { return _errorFlag; }
-	void play(Mixer *mixer, SoundHandle *handle, int numLoops, int startFrame, int duration);
-};
-
-MP3TrackInfo::MP3TrackInfo(const char *filename) :
-	_filename(filename),
-	_errorFlag(false) {
-
-	// Try to open the file
-	Common::File file;
-	if (!file.open(_filename)) {
-		_errorFlag = true;
-		return;
-	}
-	
-	// Next, try to create an MP3InputStream from it
-	MP3InputStream *tempStream = new MP3InputStream(&file, false);
-	
-	// If we see EOS here then that means that not (enough) valid input
-	// data was given.
-	_errorFlag = tempStream->endOfData();
-	
-	// Clean up again	
-	delete tempStream;
-}
-
-void MP3TrackInfo::play(Mixer *mixer, SoundHandle *handle, int numLoops, int startFrame, int duration) {
-	assert(!_errorFlag);
-
-	mad_timer_t start;
-	mad_timer_t end;
-	
-	// Both startFrame and duration are given in frames, where 75 frames are one second.
-	// Calculate the appropriate mad_timer_t values from them.
-	mad_timer_set(&start, startFrame / 75, startFrame % 75, 75);
-	if (duration == 0) {
-		end = mad_timer_zero;
-	} else {
-		int endFrame = startFrame + duration;
-		mad_timer_set(&end, endFrame / 75, endFrame % 75, 75);
-	}
-
-	// Open the file
-	Common::File *file = new Common::File();
-	if (!file || !file->open(_filename)) {
-		warning("MP3TrackInfo::play: failed to open '%s'", _filename.c_str());
-		delete file;
-		return;
-	}
-
-	// ... create an AudioStream ...
-	MP3InputStream *input = new MP3InputStream(file, true, start, end, numLoops);
-	
-	// ... and play it
-	mixer->playInputStream(Audio::Mixer::kMusicSoundType, handle, input);
-}
-
-DigitalTrackInfo *getMP3Track(int track) {
-	char trackName[2][32];
-
-	sprintf(trackName[0], "track%d.mp3", track);
-	sprintf(trackName[1], "track%02d.mp3", track);
-
-	for (int i = 0; i < 2; ++i) {
-		if (Common::File::exists(trackName[i])) {
-			MP3TrackInfo *trackInfo = new MP3TrackInfo(trackName[i]);
-			if (!trackInfo->error())
-				return trackInfo;
-			delete trackInfo;
-		}
-	}
-	return NULL;
-}
-
 } // End of namespace Audio
 
 #endif // #ifdef USE_MAD

Modified: scummvm/trunk/sound/mp3.h
===================================================================
--- scummvm/trunk/sound/mp3.h	2007-04-14 18:48:09 UTC (rev 26476)
+++ scummvm/trunk/sound/mp3.h	2007-04-14 18:51:38 UTC (rev 26477)
@@ -36,10 +36,7 @@
 namespace Audio {
 
 class AudioStream;
-class DigitalTrackInfo;
 
-DigitalTrackInfo *getMP3Track(int track);
-
 /**
  * Create a new AudioStream from the MP3 data in the given
  * file. If you only want to play part of that file, then seek

Modified: scummvm/trunk/sound/vorbis.cpp
===================================================================
--- scummvm/trunk/sound/vorbis.cpp	2007-04-14 18:48:09 UTC (rev 26476)
+++ scummvm/trunk/sound/vorbis.cpp	2007-04-14 18:51:38 UTC (rev 26477)
@@ -293,86 +293,6 @@
 }
 
 
-#pragma mark -
-#pragma mark --- Ogg Vorbis Audio CD emulation ---
-#pragma mark -
-
-
-class VorbisTrackInfo : public DigitalTrackInfo {
-private:
-	Common::String _filename;
-	bool _errorFlag;
-
-public:
-	VorbisTrackInfo(const char *filename);
-	bool error() { return _errorFlag; }
-	void play(Mixer *mixer, SoundHandle *handle, int numLoops, int startFrame, int duration);
-};
-
-VorbisTrackInfo::VorbisTrackInfo(const char *filename) :
-	_filename(filename),
-	_errorFlag(false) {
-	
-
-	// Try to open the file
-	Common::File file;
-	if (!file.open(_filename)) {
-		_errorFlag = true;
-		return;
-	}
-	
-	// Next, try to create a VorbisInputStream from it
-	VorbisInputStream *tempStream = new VorbisInputStream(&file, false);
-
-	// If an error occured...
-	// TODO: add an error or init method to VorbisInputStream
-	_errorFlag = tempStream->endOfData();
-	
-	// Clean up again	
-	delete tempStream;
-}
-
-void VorbisTrackInfo::play(Mixer *mixer, SoundHandle *handle, int numLoops, int startFrame, int duration) {
-	assert(!_errorFlag);
-
-	// Open the file
-	Common::File *file = new Common::File();
-	if (!file || !file->open(_filename)) {
-		warning("VorbisTrackInfo::play: failed to open '%s'", _filename.c_str());
-		delete file;
-		return;
-	}
-	
-	// Convert startFrame & duration from frames (1/75 s) to milliseconds (1/1000s),
-	// i.e. multiply with a factor of 1000/75 = 40/3.
-	uint start = startFrame * 40 / 3;
-	uint end = duration ? ((startFrame + duration) * 40 / 3) : 0;
-
-	// ... create an AudioStream ...
-	VorbisInputStream *input = new VorbisInputStream(file, true, start, end, numLoops);
-	
-	// ... and play it
-	mixer->playInputStream(Audio::Mixer::kMusicSoundType, handle, input);
-}
-
-DigitalTrackInfo *getVorbisTrack(int track) {
-	char trackName[2][32];
-
-	sprintf(trackName[0], "track%d.ogg", track);
-	sprintf(trackName[1], "track%02d.ogg", track);
-
-	for (int i = 0; i < 2; ++i) {
-		if (Common::File::exists(trackName[i])) {
-			VorbisTrackInfo *trackInfo = new VorbisTrackInfo(trackName[i]);
-			if (!trackInfo->error())
-				return trackInfo;
-			delete trackInfo;
-		}
-	}
-	return NULL;
-}
-
-
 } // End of namespace Audio
 
 #endif // #ifdef USE_VORBIS

Modified: scummvm/trunk/sound/vorbis.h
===================================================================
--- scummvm/trunk/sound/vorbis.h	2007-04-14 18:48:09 UTC (rev 26476)
+++ scummvm/trunk/sound/vorbis.h	2007-04-14 18:51:38 UTC (rev 26477)
@@ -36,10 +36,7 @@
 namespace Audio {
 
 class AudioStream;
-class DigitalTrackInfo;
 
-DigitalTrackInfo *getVorbisTrack(int track);
-
 /**
  * Create a new AudioStream from the Ogg Vorbis data in the given
  * file. If you only want to play part of that file, then seek


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