aboutsummaryrefslogtreecommitdiff
path: root/backends/audiocd
diff options
context:
space:
mode:
authorMatthew Hoops2015-09-30 00:25:24 -0400
committerJohannes Schickel2016-03-13 13:53:35 +0100
commit30e68efac41a96e97fc9d42d0b7f9903e76ccfb5 (patch)
treea2480424a8b917b683d0dcb3280625cef3349e49 /backends/audiocd
parentec5df573cbd8ea33e0ee34f27cc7d732485f3ed1 (diff)
downloadscummvm-rg350-30e68efac41a96e97fc9d42d0b7f9903e76ccfb5.tar.gz
scummvm-rg350-30e68efac41a96e97fc9d42d0b7f9903e76ccfb5.tar.bz2
scummvm-rg350-30e68efac41a96e97fc9d42d0b7f9903e76ccfb5.zip
BACKENDS: Add a closeCD() function to the AudioCDManager
Diffstat (limited to 'backends/audiocd')
-rw-r--r--backends/audiocd/audiocd.h5
-rw-r--r--backends/audiocd/default/default-audiocd.h1
-rw-r--r--backends/audiocd/sdl/sdl-audiocd.cpp13
-rw-r--r--backends/audiocd/sdl/sdl-audiocd.h1
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);