openMSX
DirectXSoundDriver.hh
Go to the documentation of this file.
1 #ifndef DIRECTXSOUNDDRIVER_HH
2 #define DIRECTXSOUNDDRIVER_HH
3 #ifdef _WIN32
4 
5 #include "SoundDriver.hh"
6 #include "noncopyable.hh"
7 #ifdef WIN32_LEAN_AND_MEAN
8 #undef WIN32_LEAN_AND_MEAN // Needed for <dsound.h>
9 #endif
10 #define DIRECTSOUND_VERSION 0x0500
11 #include <windows.h>
12 #include <dsound.h>
13 
14 namespace openmsx {
15 
16 class DirectXSoundDriver : public SoundDriver, private noncopyable
17 {
18 public:
19  DirectXSoundDriver(unsigned sampleRate, unsigned bufferSize);
20  virtual ~DirectXSoundDriver();
21 
22  virtual void mute();
23  virtual void unmute();
24 
25  virtual unsigned getFrequency() const;
26  virtual unsigned getSamples() const;
27 
28  virtual void uploadBuffer(short* buffer, unsigned len);
29 
30 private:
31  void dxClear();
32  int dxCanWrite(unsigned start, unsigned size);
33  void dxWriteOne(short* buffer, unsigned lockSize);
34 
35  enum DxState { DX_SOUND_DISABLED, DX_SOUND_ENABLED, DX_SOUND_RUNNING };
36  DxState state;
37  unsigned bufferOffset;
38  unsigned bufferSize;
39  unsigned fragmentSize;
40  int skipCount;
41  LPDIRECTSOUNDBUFFER primaryBuffer;
42  LPDIRECTSOUNDBUFFER secondaryBuffer;
43  LPDIRECTSOUND directSound;
44 
45  unsigned frequency;
46 };
47 
48 } // namespace openmsx
49 
50 #endif // _WIN32
51 #endif // DIRECTXSOUNDDRIVER_HH
size_t size() const
Based on boost::noncopyable, see boost documentation: http://www.boost.org/libs/utility.
Definition: noncopyable.hh:12