[Scummvm-cvs-logs] CVS: scummvm/sound mixer.cpp,1.4,1.5 mixer.h,1.2,1.3

Pawe? Ko?odziejski aquadran at users.sourceforge.net
Mon Sep 2 00:56:09 CEST 2002


Update of /cvsroot/scummvm/scummvm/sound
In directory usw-pr-cvs1:/tmp/cvs-serv17470/sound

Modified Files:
	mixer.cpp mixer.h 
Log Message:
changed file io in sounds to class File

Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- mixer.cpp	29 Aug 2002 23:45:15 -0000	1.4
+++ mixer.cpp	2 Sep 2002 07:53:43 -0000	1.5
@@ -111,7 +111,7 @@
 	warning("SoundMixer::out of mixer slots");
 	return -1;
 }
-int SoundMixer::playMP3CDTrack(PlayingSoundHandle * handle, FILE * file, mad_timer_t duration) {
+int SoundMixer::playMP3CDTrack(PlayingSoundHandle * handle, File * file, mad_timer_t duration) {
 	/* Stop the previously playing CD track (if any) */
 	for (int i = 0; i != NUM_CHANNELS; i++) {
 		if (_channels[i] == NULL) {
@@ -551,7 +551,7 @@
 		if (s_org == NULL)
 			error("ChannelRaw::mix out of memory");
 
-		uint num_read = fread(s_org, 1, num, (FILE *) _ptr);
+		uint num_read = ((File *)_ptr)->read(s_org, num);
 		if (num - num_read != 0)
 			memset(s_org + num_read, 0x80, num - num_read);
 
@@ -778,7 +778,7 @@
 
 #define MP3CD_BUFFERING_SIZE 131072
 
-SoundMixer::ChannelMP3CDMusic::ChannelMP3CDMusic(SoundMixer * mixer, FILE * file,
+SoundMixer::ChannelMP3CDMusic::ChannelMP3CDMusic(SoundMixer * mixer, File * file,
 														 mad_timer_t duration){
 	_mixer = mixer;
 	_file = file;
@@ -811,7 +811,7 @@
 		int skip_loop;
 		// just skipped
 		memset(_ptr, 0, _bufferSize);
-		_size = fread(_ptr, 1, _bufferSize, _file);
+		_size = _file->read(_ptr, _bufferSize);
 		if (!_size) {
 			realDestroy();
 			return;
@@ -878,7 +878,7 @@
 				} else {
 					not_decoded = _stream.bufend - _stream.next_frame;
 					memcpy(_ptr, _stream.next_frame, not_decoded);
-					_size = fread((unsigned char *)_ptr + not_decoded, 1, _bufferSize - not_decoded, _file);
+					_size = _file->read((unsigned char *)_ptr + not_decoded, _bufferSize - not_decoded);
 				}
 				_stream.error = (enum mad_error)0;
 				// Restream

Index: mixer.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- mixer.h	24 Aug 2002 15:31:37 -0000	1.2
+++ mixer.h	2 Sep 2002 07:53:43 -0000	1.3
@@ -31,6 +31,8 @@
 
 typedef uint32 PlayingSoundHandle;
 
+class File;
+
 class SoundMixer {
 private:
 	class Channel {
@@ -112,11 +114,11 @@
 		uint32 _size;
 		uint32 _bufferSize;
 		mad_timer_t _duration;
-		FILE * _file;
+		File * _file;
 		bool _initialized;
 
 	public:
-		ChannelMP3CDMusic(SoundMixer * mixer, FILE * file, mad_timer_t duration);
+		ChannelMP3CDMusic(SoundMixer * mixer, File * file, mad_timer_t duration);
 		void mix(int16 * data, uint len);
 		void realDestroy();
 		bool soundFinished();
@@ -170,7 +172,7 @@
 									byte flags);
 #ifdef COMPRESSED_SOUND_FILE
 	int playMP3(PlayingSoundHandle * handle, void * sound, uint32 size, byte flags);
-	int playMP3CDTrack(PlayingSoundHandle * handle, FILE * file, mad_timer_t duration);
+	int playMP3CDTrack(PlayingSoundHandle * handle, File * file, mad_timer_t duration);
 #endif
 
 	/* Premix procedure, useful when using fmopl adlib */





More information about the Scummvm-git-logs mailing list