MusicKit  0.0.0
AudOutDX.h
00001 
00002 //
00003 // CAudOutDX - DirectX implementation of CAudOut
00004 //
00005 // SKoT McDonald / Vellocet
00006 // skot@vellocet.ii.net
00007 // (c) 1999 Vellocet 
00008 // All rights reserved.
00009 //
00010 // Last change: 14 July 1999
00011 //
00013 
00014 #ifndef __VELLOCET_AUDOUTDX_H
00015 #define __VELLOCET_AUDOUTDX_H
00016 
00017 #include "dsound.h"
00018 #include "audout.h"
00019 
00021 
00022 class CAudOutDX : public CAudOut
00023 {
00024   enum {
00025     maxDSDev = 32 // An arbitrary number
00026   };
00027   // members
00028 
00029 protected:
00030   HANDLE               *m_dsbe;
00031   DSCAPS                m_dsCaps;
00032   DSBCAPS               m_dsBCaps;
00033   DWORD                 m_dwMaxDS;
00034   LPGUID               *m_pGUID;
00035   char                **m_ppchDSDesc;     // description of DS driver
00036   char                **m_ppchDSModule;   // DS module name
00037   IDirectSoundBuffer   *m_pDSBuffer;
00038   IDirectSoundBuffer   *m_pDSBufferPrimary;
00039   LPDIRECTSOUND         m_pDS;
00040   IDirectSoundNotify   *m_pDSNotify;
00041   DSBPOSITIONNOTIFY    *m_DSPosNotify;
00042   DSBUFFERDESC          m_dsbd;
00043   DSBUFFERDESC          m_dsbdPrimary;
00044 
00045 public:
00046 
00047   HWND                  m_hWnd;
00048                        // Parent app window, for directSound
00049                        //SetCoordinationLevel call
00050 // Methods
00051 
00052 protected:
00053 
00054   bool    GetDSSystemCaps (void);
00055   static BOOL CALLBACK DSEnumCallback (LPGUID lpGuid, LPCSTR lpcstrDescription, LPCSTR lpcstrModule, LPVOID lpContext);
00056   bool    ProcessDXReturn (HRESULT r);
00057   bool    Open (short iDevID); 
00058   bool    FreeBuffers     (void);
00059   bool    Close(void);
00060 
00061   static void __cdecl AudioThread(void* pThis);
00062 
00063 public:
00064 
00065   CAudOutDX();
00066   ~CAudOutDX();
00067 
00068   bool    FreeMem(void);
00069   bool    AllocateBuffers (DWORD dwNumBuffers, DWORD dwBufferSize); // get chans from m_wfx
00070   bool    Initialise(void (*GenAudio)(float**, DWORD, DWORD, DWORD), DWORD dwGenAudioData);
00071 
00072   char*   GetDevName      (DWORD n);
00073 
00074   void    SetGenAudioData (DWORD dwGenAudioData) { m_dwGenAudioData = dwGenAudioData;};
00075   void    SetGenAudio     (void (*GenAudio)(float**, DWORD, DWORD, DWORD))
00076   {
00077     m_GenAudio = GenAudio;
00078   };
00079 
00080   bool    SetCurDev(short iDevID);
00081 
00082   bool    Start(void);
00083 
00084   LPDIRECTSOUND GetDirectSound(void);
00085 };
00086 
00088 
00089 #endif