| 1 | /*
 | 
|---|
| 2 |  * Direct Sound Primary Buffer Implemetation for ODIN
 | 
|---|
| 3 |  *
 | 
|---|
| 4 |  * Kevin Langman (langman@earthling.net)
 | 
|---|
| 5 |  *
 | 
|---|
| 6 |  * Project Odin Software License can be found in LICENSE.TXT
 | 
|---|
| 7 |  */
 | 
|---|
| 8 | 
 | 
|---|
| 9 | #ifndef __OS2PRIMBUFF_H__
 | 
|---|
| 10 | #define __OS2PRIMBUFF_H__
 | 
|---|
| 11 | 
 | 
|---|
| 12 | #include <mmsystem.h>
 | 
|---|
| 13 | 
 | 
|---|
| 14 | #undef THIS
 | 
|---|
| 15 | #define THIS VOID*This
 | 
|---|
| 16 | 
 | 
|---|
| 17 | #undef THIS_
 | 
|---|
| 18 | #define THIS_ VOID*This,
 | 
|---|
| 19 | 
 | 
|---|
| 20 | // a forward declaration is needed here
 | 
|---|
| 21 | class OS2IDirectSound3DListener;
 | 
|---|
| 22 | 
 | 
|---|
| 23 | class OS2PrimBuff: public OS2IDirectSoundBuffer
 | 
|---|
| 24 | {
 | 
|---|
| 25 |  public:
 | 
|---|
| 26 | 
 | 
|---|
| 27 |     OS2PrimBuff(OS2IDirectSound *DSound, const DSBUFFERDESC *lpDSBufferDesc);
 | 
|---|
| 28 |     ~OS2PrimBuff();
 | 
|---|
| 29 | 
 | 
|---|
| 30 |     int     Referenced;
 | 
|---|
| 31 |     inline  HRESULT       GetLastError()    { return lastError;    };
 | 
|---|
| 32 |     inline  void          Set3DListener(OS2IDirectSound3DListener *_listener) {
 | 
|---|
| 33 |                                             listener = _listener; };
 | 
|---|
| 34 | 
 | 
|---|
| 35 |  private:
 | 
|---|
| 36 |  protected:
 | 
|---|
| 37 | 
 | 
|---|
| 38 |     void *vpMixBuffer;
 | 
|---|
| 39 |     void *vpMixSetup;
 | 
|---|
| 40 |     void *vpBuffParms;
 | 
|---|
| 41 |     //void *vpGenericParms;
 | 
|---|
| 42 | 
 | 
|---|
| 43 |     USHORT usDeviceID;
 | 
|---|
| 44 | 
 | 
|---|
| 45 |     long  rate;    // Samples per second
 | 
|---|
| 46 |     WORD  bps;     // Bits per sample 8 or 16 !!
 | 
|---|
| 47 |     WORD  channels;// Number of Channels 1 or 2 MONO/Stereo
 | 
|---|
| 48 | 
 | 
|---|
| 49 |     OS2IDirectSound3DListener* listener;  // pointer to the associated 3DListener object
 | 
|---|
| 50 | 
 | 
|---|
| 51 |     HRESULT lastError;
 | 
|---|
| 52 | 
 | 
|---|
| 53 |     friend    HRESULT __stdcall PrimBufQueryInterface(THIS, REFIID riid, LPVOID * ppvObj);
 | 
|---|
| 54 |     friend    ULONG   __stdcall PrimBufAddRef(THIS);
 | 
|---|
| 55 |     friend    ULONG   __stdcall PrimBufRelease(THIS);
 | 
|---|
| 56 |     friend    HRESULT __stdcall PrimBufGetCaps(THIS_ LPDSBCAPS );
 | 
|---|
| 57 |     friend    HRESULT __stdcall PrimBufGetCurrentPosition(THIS_ LPDWORD,LPDWORD ) ;
 | 
|---|
| 58 |     friend    HRESULT __stdcall PrimBufGetFormat(THIS_ LPWAVEFORMATEX, DWORD, LPDWORD ) ;
 | 
|---|
| 59 |     friend    HRESULT __stdcall PrimBufGetVolume(THIS_ LPLONG ) ;
 | 
|---|
| 60 |     friend    HRESULT __stdcall PrimBufGetPan(THIS_ LPLONG ) ;
 | 
|---|
| 61 |     friend    HRESULT __stdcall PrimBufGetFrequency(THIS_ LPDWORD ) ;
 | 
|---|
| 62 |     friend    HRESULT __stdcall PrimBufGetStatus(THIS_ LPDWORD ) ;
 | 
|---|
| 63 |     friend    HRESULT __stdcall PrimBufInitialize(THIS_ LPDIRECTSOUND, LPDSBUFFERDESC ) ;
 | 
|---|
| 64 |     friend    HRESULT __stdcall PrimBufLock(THIS_ DWORD,DWORD,LPVOID,LPDWORD,LPVOID,LPDWORD,DWORD ) ;
 | 
|---|
| 65 |     friend    HRESULT __stdcall PrimBufPlay(THIS_ DWORD,DWORD,DWORD ) ;
 | 
|---|
| 66 |     friend    HRESULT __stdcall PrimBufSetCurrentPosition(THIS_ DWORD ) ;
 | 
|---|
| 67 |     friend    HRESULT __stdcall PrimBufSetFormat(THIS_ LPWAVEFORMATEX ) ;
 | 
|---|
| 68 |     friend    HRESULT __stdcall PrimBufSetVolume(THIS_ LONG ) ;
 | 
|---|
| 69 |     friend    HRESULT __stdcall PrimBufSetPan(THIS_ LONG ) ;
 | 
|---|
| 70 |     friend    HRESULT __stdcall PrimBufSetFrequency(THIS_ DWORD ) ;
 | 
|---|
| 71 |     friend    HRESULT __stdcall PrimBufStop(THIS  ) ;
 | 
|---|
| 72 |     friend    HRESULT __stdcall PrimBufUnlock(THIS_ LPVOID,DWORD,LPVOID,DWORD ) ;
 | 
|---|
| 73 |     friend    HRESULT __stdcall PrimBufRestore(THIS  ) ;
 | 
|---|
| 74 | };
 | 
|---|
| 75 | 
 | 
|---|
| 76 | HRESULT __stdcall PrimBufQueryInterface(THIS, REFIID riid, LPVOID * ppvObj);
 | 
|---|
| 77 | ULONG   __stdcall PrimBufAddRef(THIS);
 | 
|---|
| 78 | ULONG   __stdcall PrimBufRelease(THIS);
 | 
|---|
| 79 | HRESULT __stdcall PrimBufGetCaps(THIS_ LPDSBCAPS );
 | 
|---|
| 80 | HRESULT __stdcall PrimBufGetCurrentPosition(THIS_ LPDWORD,LPDWORD ) ;
 | 
|---|
| 81 | HRESULT __stdcall PrimBufGetFormat(THIS_ LPWAVEFORMATEX, DWORD, LPDWORD ) ;
 | 
|---|
| 82 | HRESULT __stdcall PrimBufGetVolume(THIS_ LPLONG ) ;
 | 
|---|
| 83 | HRESULT __stdcall PrimBufGetPan(THIS_ LPLONG ) ;
 | 
|---|
| 84 | HRESULT __stdcall PrimBufGetFrequency(THIS_ LPDWORD ) ;
 | 
|---|
| 85 | HRESULT __stdcall PrimBufGetStatus(THIS_ LPDWORD ) ;
 | 
|---|
| 86 | HRESULT __stdcall PrimBufInitialize(THIS_ LPDIRECTSOUND, LPDSBUFFERDESC ) ;
 | 
|---|
| 87 | HRESULT __stdcall PrimBufLock(THIS_ DWORD,DWORD,LPVOID,LPDWORD,LPVOID,LPDWORD,DWORD ) ;
 | 
|---|
| 88 | HRESULT __stdcall PrimBufPlay(THIS_ DWORD,DWORD,DWORD ) ;
 | 
|---|
| 89 | HRESULT __stdcall PrimBufSetCurrentPosition(THIS_ DWORD ) ;
 | 
|---|
| 90 | HRESULT __stdcall PrimBufSetFormat(THIS_ LPWAVEFORMATEX ) ;
 | 
|---|
| 91 | HRESULT __stdcall PrimBufSetVolume(THIS_ LONG ) ;
 | 
|---|
| 92 | HRESULT __stdcall PrimBufSetPan(THIS_ LONG ) ;
 | 
|---|
| 93 | HRESULT __stdcall PrimBufSetFrequency(THIS_ DWORD ) ;
 | 
|---|
| 94 | HRESULT __stdcall PrimBufStop(THIS  ) ;
 | 
|---|
| 95 | HRESULT __stdcall PrimBufUnlock(THIS_ LPVOID,DWORD,LPVOID,DWORD ) ;
 | 
|---|
| 96 | HRESULT __stdcall PrimBufRestore(THIS  ) ;
 | 
|---|
| 97 | 
 | 
|---|
| 98 | #endif
 | 
|---|