Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SoundCard.h
Go to the documentation of this file.
1 /* Project nGenEx
2  Destroyer Studios LLC
3  Copyright © 1997-2004. All Rights Reserved.
4 
5  SUBSYSTEM: nGenEx.lib
6  FILE: SoundCard.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Abstract Audio Output class (hides details of DirectSound)
13 */
14 
15 #ifndef SoundCard_h
16 #define SoundCard_h
17 
18 #include "Types.h"
19 #include "List.h"
20 #include "ThreadSync.h"
21 
22 // +--------------------------------------------------------------------+
23 
24 class Sound;
25 class Camera;
26 struct Vec3;
27 
28 // +--------------------------------------------------------------------+
29 
30 class SoundCard
31 {
32 public:
33  static const char* TYPENAME() { return "SoundCard"; }
34 
35  SoundCard();
36  virtual ~SoundCard();
37 
42  SoundStatus Status() const { return status; }
43 
44  // Format of the sound card's primary buffer:
45  virtual bool GetFormat(LPWAVEFORMATEX format) { return false; }
46  virtual bool SetFormat(LPWAVEFORMATEX format) { return false; }
47  virtual bool SetFormat(int bits, int channels, int hertz) { return false; }
48  virtual bool Pause() { return false; }
49  virtual bool Resume() { return false; }
50  virtual bool StopSoundEffects() { return false; }
51 
52  // Get a blank, writable sound buffer:
53  virtual Sound* CreateSound(DWORD flags, LPWAVEFORMATEX format) { return 0; }
54 
55  // Create a sound resource:
56  virtual Sound* CreateSound(DWORD flags, LPWAVEFORMATEX format,
57  DWORD len, LPBYTE data) { return 0; }
58 
59  // once per frame:
60  virtual void Update();
61 
62  virtual void SetListener(const Camera& cam, const Vec3& vel) { }
63  virtual DWORD UpdateThread();
64  virtual void AddSound(Sound* s);
65 
66 protected:
67 
68  bool shutdown;
69  HANDLE hthread;
73 };
74 
75 #endif SoundCard_h
76