MorphOS CD audio reenableeSystem()

svn-id: r3964
This commit is contained in:
Ruediger Hanke 2002-04-16 20:28:56 +00:00
parent 0d580b358e
commit 2ad6eb6ef7
4 changed files with 45 additions and 19 deletions

View File

@ -387,11 +387,16 @@ int GameDetector::detectMain(int argc, char **argv)
}
OSystem *GameDetector::createSystem() {
#ifdef __MORPHOS__
_gfx_driver = GD_MORPHOS;
#endif
/* auto is to use SDL */
switch(_gfx_driver) {
case GD_SDL:
case GD_AUTO:
#if !defined(__MORPHOS__)
return OSystem_SDL_create(_gfx_mode, _fullScreen);
#endif
case GD_WIN32:
/* not implemented yet */
break;
@ -400,6 +405,12 @@ OSystem *GameDetector::createSystem() {
/* not implemented yet */
break;
case GD_MORPHOS:
#if defined(__MORPHOS__)
return OSystem_MorphOS_create(_gameId, _gfx_mode, _fullScreen);
#endif
break;
case GD_NULL:
return OSystem_NULL_create();
}
@ -426,4 +437,4 @@ MidiDriver *GameDetector::createMidi() {
error("Invalid midi driver selected");
return NULL;
}
}

View File

@ -288,9 +288,9 @@ uint32 OSystem_MorphOS::property(int param, uint32 value)
return 0;
}
void cd_play( Scumm *s, int track, int num_loops, int start_frame, int length )
void OSystem_MorphOS::play_cdrom( int track, int num_loops, int start_frame, int length )
{
/* if( CDrive && start_frame >= 0 )
if( CDrive && start_frame >= 0 )
{
struct CDS_TrackInfo ti;
@ -309,42 +309,41 @@ void cd_play( Scumm *s, int track, int num_loops, int start_frame, int length )
cd_stop_time = 0;
CDDA_GetTrackInfo( CDrive, track, 0, &ti );
cd_end_time = GetTicks() + ti.ti_TrackLength.tm_Format.tm_Frame * 1000 / 75;
}*/
cd_end_time = get_msecs() + ti.ti_TrackLength.tm_Format.tm_Frame * 1000 / 75;
}
}
// Schedule the music to be stopped after 1/10 sec, unless another
// track is started in the meantime.
void cd_stop()
void OSystem_MorphOS::stop_cdrom()
{
/* cd_stop_time = GetTicks() + 100;
cd_num_loops = 0;*/
cd_stop_time = get_msecs() + 100;
cd_num_loops = 0;
}
int cd_is_running()
bool OSystem_MorphOS::poll_cdrom()
{
/* ULONG status;
ULONG status;
if( CDrive == NULL )
return 0;
return false;
CDDA_GetAttr( CDDA_Status, CDrive, &status );
return (cd_num_loops != 0 && (GetTicks() < cd_end_time || status != CDDA_Status_Ready));*/
return FALSE;
return (cd_num_loops != 0 && (get_msecs() < cd_end_time || status != CDDA_Status_Ready));
}
void cd_music_loop()
void OSystem_MorphOS::update_cdrom()
{
/* if( CDrive )
if( CDrive )
{
if( cd_stop_time != 0 && GetTicks() >= cd_stop_time )
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 || GetTicks() < cd_end_time )
if( cd_num_loops == 0 || get_msecs() < cd_end_time )
return;
ULONG status;
@ -368,9 +367,9 @@ void cd_music_loop()
CDDA_Play( CDrive, PlayTags );
CDDA_GetTrackInfo( CDrive, cd_track, 0, &ti );
cd_end_time = GetTicks() + ti.ti_TrackLength.tm_Format.tm_Frame * 1000 / 75;
cd_end_time = get_msecs() + ti.ti_TrackLength.tm_Format.tm_Frame * 1000 / 75;
}
}*/
}
}
void OSystem_MorphOS::quit()

View File

@ -77,6 +77,19 @@ class OSystem_MorphOS : public OSystem
virtual uint32 property(int param, uint32 value);
// Poll cdrom status
// Returns true if cd audio is playing
virtual bool poll_cdrom();
// Play cdrom audio track
virtual void play_cdrom(int track, int num_loops, int start_frame, int length);
// Stop cdrom audio track
virtual void stop_cdrom();
// Update cdrom audio status
virtual void update_cdrom();
// Quit
virtual void quit();
@ -149,6 +162,8 @@ class OSystem_MorphOS : public OSystem
/* 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;

View File

@ -138,6 +138,7 @@ enum {
GD_WIN32 = 2,
GD_X = 3,
GD_NULL = 4,
GD_MORPHOS = 5,
};