[Scummvm-cvs-logs] CVS: scummvm/morphos morphos.cpp,1.17,1.18 morphos.h,1.9,1.10

Ruediger Hanke tomjoad at users.sourceforge.net
Thu May 9 05:46:03 CEST 2002


Update of /cvsroot/scummvm/scummvm/morphos
In directory usw-pr-cvs1:/tmp/cvs-serv31089

Modified Files:
	morphos.cpp morphos.h 
Log Message:
Simplified CD audio code

Index: morphos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/morphos/morphos.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- morphos.cpp	9 May 2002 11:26:37 -0000	1.17
+++ morphos.cpp	9 May 2002 12:45:29 -0000	1.18
@@ -60,6 +60,7 @@
 													{ CDPA_StartFrame, 0 },
 													{ CDPA_EndTrack, 	 1 },
 													{ CDPA_EndFrame, 	 0 },
+													{ CDPA_Loops, 	    1 },
 													{ TAG_DONE,			 0	}
 												 };
 
@@ -248,7 +249,7 @@
 
 		case PROP_OPEN_CD:
 			FindCDTags[ 0 ].ti_Data = (ULONG)((GameID == GID_LOOM256) ? "LoomCD" : "Monkey1CD");
-			if( !CDDABase ) CDDABase = OpenLibrary( "cdda.library", 0 );
+			if( !CDDABase ) CDDABase = OpenLibrary( "cdda.library", 2 );
 			if( CDDABase )
 			{
 				CDrive = CDDA_FindNextDrive( NULL, FindCDTags );
@@ -262,7 +263,7 @@
 					else if( GameID == GID_LOOM256 )
 					{
 						// Offset correction *may* be required
-						struct CDS_TrackInfo ti;
+						struct CDS_TrackInfo ti = { sizeof( struct CDS_TrackInfo ) };
 
 						if( CDDA_GetTrackInfo( CDrive, 1, 0, &ti ) )
 							CDDATrackOffset = ti.ti_TrackStart.tm_Format.tm_Frame-22650;
@@ -294,24 +295,15 @@
 {
 	if( CDrive && start_frame >= 0 )
 	{
-		struct CDS_TrackInfo ti;
-
 		if( start_frame > 0 )
 			start_frame -= CDDATrackOffset;
 
-		cd_track = track;
-		cd_num_loops = num_loops;
-		cd_start_frame = start_frame;
-
 		PlayTags[ 0 ].ti_Data = track;
 		PlayTags[ 1 ].ti_Data = start_frame;
 		PlayTags[ 2 ].ti_Data = (length == 0) ? track+1 : track;
 		PlayTags[ 3 ].ti_Data = length ? start_frame+length : 0;
+		PlayTags[ 4 ].ti_Data = (num_loops == 0) ? 1 : num_loops;
 		CDDA_Play( CDrive, PlayTags );
-		cd_stop_time = 0;
-		
-		CDDA_GetTrackInfo( CDrive, track, 0, &ti );
-		cd_end_time = get_msecs() + ti.ti_TrackLength.tm_Format.tm_Frame * 1000 / 75;
 	}
 }
 
@@ -319,8 +311,7 @@
 // track is started in the meantime.
 void OSystem_MorphOS::stop_cdrom()
 {
-	cd_stop_time = get_msecs() + 100;
-	cd_num_loops = 0;
+	CDDA_Stop( CDrive );
 }
 
 bool OSystem_MorphOS::poll_cdrom()
@@ -331,47 +322,11 @@
 		return false;
 
 	CDDA_GetAttr( CDDA_Status, CDrive, &status );
-	return (cd_num_loops != 0 && (get_msecs() < cd_end_time || status != CDDA_Status_Ready));
+	return status == CDDA_Status_Busy;
 }
 
 void OSystem_MorphOS::update_cdrom()
 {
-	if( CDrive )
-	{
-		if( cd_stop_time != 0 && get_msecs() >= cd_stop_time )
-		{
-			CDDA_Stop( CDrive );
-			cd_num_loops = 0;
-			cd_stop_time = 0;
-			return;
-		}
-		if( cd_num_loops == 0 || get_msecs() < cd_end_time )
-			return;
-
-		ULONG status;
-		CDDA_GetAttr( CDDA_Status, CDrive, &status );
-		if( cd_num_loops != 1 && status != CDDA_Status_Ready )
-		{
-			// Wait another second for it to be done
-			cd_end_time += 1000;
-			return;
-		}
-
-		if( cd_num_loops > 0 )
-			cd_num_loops--;
-
-		if( cd_num_loops != 0 )
-		{
-			struct CDS_TrackInfo ti;
-
-			PlayTags[ 0 ].ti_Data = cd_track;
-			PlayTags[ 1 ].ti_Data = cd_start_frame;
-			CDDA_Play( CDrive, PlayTags );
-		
-			CDDA_GetTrackInfo( CDrive, cd_track, 0, &ti );
-			cd_end_time = get_msecs() + ti.ti_TrackLength.tm_Format.tm_Frame * 1000 / 75;
-		}
-	}
 }
 
 void OSystem_MorphOS::quit()

Index: morphos.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/morphos/morphos.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- morphos.h	9 May 2002 11:26:37 -0000	1.9
+++ morphos.h	9 May 2002 12:45:29 -0000	1.10
@@ -167,8 +167,6 @@
 		/* CD-ROM related attributes */
 		CDRIVEPTR 		 CDrive;
 		ULONG 			 CDDATrackOffset;
-		int 				 cd_track, cd_num_loops, cd_start_frame, cd_end_frame;
-		uint32 			 cd_end_time, cd_stop_time, cd_next_second;
 
 		/* Scaling-related attributes */
 		SCALERTYPE ScummScaler;





More information about the Scummvm-git-logs mailing list