diff options
Diffstat (limited to 'backends/audiocd')
-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 |
4 files changed, 16 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); |