diff options
-rw-r--r-- | backends/audiocd/audiocd.h | 5 | ||||
-rw-r--r-- | backends/audiocd/default/default-audiocd.h | 1 | ||||
-rw-r--r-- | backends/audiocd/sdl/sdl-audiocd.cpp | 13 | ||||
-rw-r--r-- | backends/audiocd/sdl/sdl-audiocd.h | 1 | ||||
-rw-r--r-- | backends/platform/dc/dc.h | 3 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/osystem_ds.h | 1 |
6 files changed, 20 insertions, 4 deletions
diff --git a/backends/audiocd/audiocd.h b/backends/audiocd/audiocd.h index 72a01fd87e..598893e315 100644 --- a/backends/audiocd/audiocd.h +++ b/backends/audiocd/audiocd.h @@ -114,6 +114,11 @@ public: virtual bool openCD() = 0; /** + * Close the currently open CD drive + */ + virtual void closeCD() = 0; + + /** * Poll CD status. * @return true if CD audio is playing */ diff --git a/backends/audiocd/default/default-audiocd.h b/backends/audiocd/default/default-audiocd.h index 1d64690add..6011a8fafd 100644 --- a/backends/audiocd/default/default-audiocd.h +++ b/backends/audiocd/default/default-audiocd.h @@ -43,6 +43,7 @@ public: virtual Status getStatus() const; // Subclasses should override for better status results bool openCD(); + virtual void closeCD() {} /** * Open a CD using the specified drive index diff --git a/backends/audiocd/sdl/sdl-audiocd.cpp b/backends/audiocd/sdl/sdl-audiocd.cpp index ff50c56af3..d745f29a12 100644 --- a/backends/audiocd/sdl/sdl-audiocd.cpp +++ b/backends/audiocd/sdl/sdl-audiocd.cpp @@ -43,10 +43,7 @@ SdlAudioCDManager::SdlAudioCDManager() } SdlAudioCDManager::~SdlAudioCDManager() { - if (_cdrom) { - SDL_CDStop(_cdrom); - SDL_CDClose(_cdrom); - } + closeCD(); } bool SdlAudioCDManager::openCD(int drive) { @@ -67,6 +64,14 @@ bool SdlAudioCDManager::openCD(int drive) { return (_cdrom != NULL); } +void SdlAudioCDManager::closeCD() { + if (_cdrom) { + SDL_CDStop(_cdrom); + SDL_CDClose(_cdrom); + _cdrom = 0; + } +} + void SdlAudioCDManager::stopCD() { // Stop CD Audio in 1/10th of a second _cdStopTime = SDL_GetTicks() + 100; diff --git a/backends/audiocd/sdl/sdl-audiocd.h b/backends/audiocd/sdl/sdl-audiocd.h index bfad7b6805..4ece8ddfe7 100644 --- a/backends/audiocd/sdl/sdl-audiocd.h +++ b/backends/audiocd/sdl/sdl-audiocd.h @@ -39,6 +39,7 @@ public: protected: virtual bool openCD(int drive); + virtual void closeCD(); virtual void updateCD(); virtual bool pollCD() const; virtual void playCD(int track, int num_loops, int start_frame, int duration); diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h index 80e484f6f8..b49080324d 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -60,6 +60,9 @@ class DCCDManager : public DefaultAudioCDManager { // Initialize the specified CD drive for audio playback. bool openCD(); + // Close the open CD drive + void closeCD() {} + // Poll cdrom status // Returns true if cd audio is playing bool pollCD(); diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index 9b66e24b88..9f73e125c2 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -131,6 +131,7 @@ public: // and should be replaced by an AudioCDManager subclass, // see backends/audiocd/ and common/system.h virtual bool openCD(); + virtual void closeCD() {} virtual bool pollCD(); virtual void playCD(int track, int num_loops, int start_frame, int duration); virtual void stopCD(); |