Introduced the SoundX11::closeDevice() method so that the SoundX11 and

SoundSDL classes are drop-in replacements for each other.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@136 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2002-11-11 22:03:00 +00:00
parent b7f0d2cf79
commit 9e45aa1ada
2 changed files with 29 additions and 14 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: SoundX11.cxx,v 1.1 2002-10-09 04:38:12 bwmott Exp $ // $Id: SoundX11.cxx,v 1.2 2002-11-11 22:02:59 stephena Exp $
//============================================================================ //============================================================================
#include <fcntl.h> #include <fcntl.h>
@ -126,6 +126,14 @@ SoundX11::SoundX11()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SoundX11::~SoundX11() SoundX11::~SoundX11()
{
closeDevice();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundX11::closeDevice()
{
if(myIsInitializedFlag)
{ {
if(myMixerFd != -1) if(myMixerFd != -1)
{ {
@ -145,6 +153,9 @@ SoundX11::~SoundX11()
{ {
close(myDspFd); close(myDspFd);
} }
myIsInitializedFlag = false;
}
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -226,4 +237,3 @@ void SoundX11::updateSound(MediaSource& mediaSource)
} }
} }
} }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: SoundX11.hxx,v 1.1 2002-10-09 04:38:12 bwmott Exp $ // $Id: SoundX11.hxx,v 1.2 2002-11-11 22:03:00 stephena Exp $
//============================================================================ //============================================================================
#ifndef SOUNDX11_HXX #ifndef SOUNDX11_HXX
@ -27,7 +27,7 @@
Open Sound System (OSS) API is currently supported. Open Sound System (OSS) API is currently supported.
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: SoundX11.hxx,v 1.1 2002-10-09 04:38:12 bwmott Exp $ @version $Id: SoundX11.hxx,v 1.2 2002-11-11 22:03:00 stephena Exp $
*/ */
class SoundX11 class SoundX11
{ {
@ -43,6 +43,11 @@ class SoundX11
virtual ~SoundX11(); virtual ~SoundX11();
public: public:
/**
Closes the sound device
*/
void closeDevice();
/** /**
Return the playback sample rate for the sound device. Return the playback sample rate for the sound device.