diff options
-rw-r--r-- | backends/platform/dc/dc.h | 36 | ||||
-rw-r--r-- | backends/platform/dc/dcmain.cpp | 12 |
2 files changed, 28 insertions, 20 deletions
diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h index 057ab283cf..c31328f3f6 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -28,6 +28,7 @@ #include <graphics/colormasks.h> #include <ronin/soundcommon.h> #include "backends/timer/default/default-timer.h" +#include "backends/audiocd/default/default-audiocd.h" #include "backends/fs/fs-factory.h" #include "sound/mixer_intern.h" @@ -50,6 +51,24 @@ class DCHardware { DCHardware() { dc_init_hardware(); } }; +class DCCDManager : public DefaultAudioCDManager { + // Initialise the specified CD drive for audio playback. + bool openCD(int drive); + + // Poll cdrom status + // Returns true if cd audio is playing + bool pollCD(); + + // Play cdrom audio track + void playCD(int track, int num_loops, int start_frame, int duration); + + // Stop cdrom audio track + void stopCD(); + + // Update cdrom audio status + void updateCD(); +}; + class OSystem_Dreamcast : private DCHardware, public BaseBackend, public FilesystemFactory { public: @@ -135,21 +154,7 @@ class OSystem_Dreamcast : private DCHardware, public BaseBackend, public Filesys // Returns true if an event was retrieved. bool pollEvent(Common::Event &event); - // Initialise the specified CD drive for audio playback. - bool openCD(int drive); - - // Poll cdrom status - // Returns true if cd audio is playing - bool pollCD(); - - // Play cdrom audio track - void playCD(int track, int num_loops, int start_frame, int duration); - - // Stop cdrom audio track - void stopCD(); - - // Update cdrom audio status - void updateCD(); + AudioCDManager *getAudioCDManager() { return _cdManager; } // Quit void quit(); @@ -194,6 +199,7 @@ class OSystem_Dreamcast : private DCHardware, public BaseBackend, public Filesys Audio::MixerImpl *_mixer; DefaultTimerManager *_timer; SoftKeyboard _softkbd; + DCCDManager *_cdManager; int _ms_cur_x, _ms_cur_y, _ms_cur_w, _ms_cur_h, _ms_old_x, _ms_old_y; int _ms_hotspot_x, _ms_hotspot_y, _ms_visible, _devpoll, _last_screen_refresh; diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp index 269f400cf5..22a5f6b767 100644 --- a/backends/platform/dc/dcmain.cpp +++ b/backends/platform/dc/dcmain.cpp @@ -61,6 +61,8 @@ void OSystem_Dreamcast::initBackend() uint sampleRate = initSound(); _mixer = new Audio::MixerImpl(this, sampleRate); _mixer->setReady(true); + + _cdManager = new DCCDManager(); } @@ -86,7 +88,7 @@ static bool find_track(int track, int &first_sec, int &last_sec) return false; } -void OSystem_Dreamcast::playCD(int track, int num_loops, int start_frame, int duration) +void DCCDManager::playCD(int track, int num_loops, int start_frame, int duration) { int first_sec, last_sec; #if 1 @@ -103,23 +105,23 @@ void OSystem_Dreamcast::playCD(int track, int num_loops, int start_frame, int du play_cdda_sectors(first_sec, last_sec, num_loops); } -void OSystem_Dreamcast::stopCD() +void DCCDManager::stopCD() { stop_cdda(); } -bool OSystem_Dreamcast::pollCD() +bool DCCDManager::pollCD() { extern int getCdState(); return getCdState() == 3; } -void OSystem_Dreamcast::updateCD() +void DCCDManager::updateCD() { // Dummy. The CD drive takes care of itself. } -bool OSystem_Dreamcast::openCD(int drive) +bool DCCDManager::openCD(int drive) { // Dummy. return true; |