mirror of https://github.com/stella-emu/stella.git
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:
parent
b7f0d2cf79
commit
9e45aa1ada
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// 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>
|
||||
|
@ -127,23 +127,34 @@ SoundX11::SoundX11()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SoundX11::~SoundX11()
|
||||
{
|
||||
if(myMixerFd != -1)
|
||||
closeDevice();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundX11::closeDevice()
|
||||
{
|
||||
if(myIsInitializedFlag)
|
||||
{
|
||||
if(myOriginalVolume != -1)
|
||||
if(myMixerFd != -1)
|
||||
{
|
||||
if(ioctl(myMixerFd, MIXER_WRITE(SOUND_MIXER_PCM),
|
||||
&myOriginalVolume) == -1)
|
||||
if(myOriginalVolume != -1)
|
||||
{
|
||||
perror(MIXER_DEVICE);
|
||||
if(ioctl(myMixerFd, MIXER_WRITE(SOUND_MIXER_PCM),
|
||||
&myOriginalVolume) == -1)
|
||||
{
|
||||
perror(MIXER_DEVICE);
|
||||
}
|
||||
}
|
||||
|
||||
close(myMixerFd);
|
||||
}
|
||||
|
||||
close(myMixerFd);
|
||||
}
|
||||
if(myDspFd != -1)
|
||||
{
|
||||
close(myDspFd);
|
||||
}
|
||||
|
||||
if(myDspFd != -1)
|
||||
{
|
||||
close(myDspFd);
|
||||
myIsInitializedFlag = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -226,4 +237,3 @@ void SoundX11::updateSound(MediaSource& mediaSource)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// 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
|
||||
|
@ -27,7 +27,7 @@
|
|||
Open Sound System (OSS) API is currently supported.
|
||||
|
||||
@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
|
||||
{
|
||||
|
@ -43,6 +43,11 @@ class SoundX11
|
|||
virtual ~SoundX11();
|
||||
|
||||
public:
|
||||
/**
|
||||
Closes the sound device
|
||||
*/
|
||||
void closeDevice();
|
||||
|
||||
/**
|
||||
Return the playback sample rate for the sound device.
|
||||
|
||||
|
|
Loading…
Reference in New Issue