BACKENDS: Add a closeCD() function to the AudioCDManager
This commit is contained in:
parent
ec5df573cb
commit
30e68efac4
6 changed files with 20 additions and 4 deletions
|
@ -113,6 +113,11 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual bool openCD() = 0;
|
virtual bool openCD() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close the currently open CD drive
|
||||||
|
*/
|
||||||
|
virtual void closeCD() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Poll CD status.
|
* Poll CD status.
|
||||||
* @return true if CD audio is playing
|
* @return true if CD audio is playing
|
||||||
|
|
|
@ -43,6 +43,7 @@ public:
|
||||||
virtual Status getStatus() const; // Subclasses should override for better status results
|
virtual Status getStatus() const; // Subclasses should override for better status results
|
||||||
|
|
||||||
bool openCD();
|
bool openCD();
|
||||||
|
virtual void closeCD() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open a CD using the specified drive index
|
* Open a CD using the specified drive index
|
||||||
|
|
|
@ -43,10 +43,7 @@ SdlAudioCDManager::SdlAudioCDManager()
|
||||||
}
|
}
|
||||||
|
|
||||||
SdlAudioCDManager::~SdlAudioCDManager() {
|
SdlAudioCDManager::~SdlAudioCDManager() {
|
||||||
if (_cdrom) {
|
closeCD();
|
||||||
SDL_CDStop(_cdrom);
|
|
||||||
SDL_CDClose(_cdrom);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SdlAudioCDManager::openCD(int drive) {
|
bool SdlAudioCDManager::openCD(int drive) {
|
||||||
|
@ -67,6 +64,14 @@ bool SdlAudioCDManager::openCD(int drive) {
|
||||||
return (_cdrom != NULL);
|
return (_cdrom != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SdlAudioCDManager::closeCD() {
|
||||||
|
if (_cdrom) {
|
||||||
|
SDL_CDStop(_cdrom);
|
||||||
|
SDL_CDClose(_cdrom);
|
||||||
|
_cdrom = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SdlAudioCDManager::stopCD() {
|
void SdlAudioCDManager::stopCD() {
|
||||||
// Stop CD Audio in 1/10th of a second
|
// Stop CD Audio in 1/10th of a second
|
||||||
_cdStopTime = SDL_GetTicks() + 100;
|
_cdStopTime = SDL_GetTicks() + 100;
|
||||||
|
|
|
@ -39,6 +39,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool openCD(int drive);
|
virtual bool openCD(int drive);
|
||||||
|
virtual void closeCD();
|
||||||
virtual void updateCD();
|
virtual void updateCD();
|
||||||
virtual bool pollCD() const;
|
virtual bool pollCD() const;
|
||||||
virtual void playCD(int track, int num_loops, int start_frame, int duration);
|
virtual void playCD(int track, int num_loops, int start_frame, int duration);
|
||||||
|
|
|
@ -60,6 +60,9 @@ class DCCDManager : public DefaultAudioCDManager {
|
||||||
// Initialize the specified CD drive for audio playback.
|
// Initialize the specified CD drive for audio playback.
|
||||||
bool openCD();
|
bool openCD();
|
||||||
|
|
||||||
|
// Close the open CD drive
|
||||||
|
void closeCD() {}
|
||||||
|
|
||||||
// Poll cdrom status
|
// Poll cdrom status
|
||||||
// Returns true if cd audio is playing
|
// Returns true if cd audio is playing
|
||||||
bool pollCD();
|
bool pollCD();
|
||||||
|
|
|
@ -131,6 +131,7 @@ public:
|
||||||
// and should be replaced by an AudioCDManager subclass,
|
// and should be replaced by an AudioCDManager subclass,
|
||||||
// see backends/audiocd/ and common/system.h
|
// see backends/audiocd/ and common/system.h
|
||||||
virtual bool openCD();
|
virtual bool openCD();
|
||||||
|
virtual void closeCD() {}
|
||||||
virtual bool pollCD();
|
virtual bool pollCD();
|
||||||
virtual void playCD(int track, int num_loops, int start_frame, int duration);
|
virtual void playCD(int track, int num_loops, int start_frame, int duration);
|
||||||
virtual void stopCD();
|
virtual void stopCD();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue