home *** CD-ROM | disk | FTP | other *** search
/ Beginning Direct3D Game Programming / Direct3D.iso / directx / dxf / include / dmusics.h < prev    next >
C/C++ Source or Header  |  2000-09-22  |  10KB  |  194 lines

  1. /************************************************************************
  2. *                                                                       *
  3. *   dmusics.h -- Definitions for created a DirectMusic software synth   *
  4. *                                                                       *
  5. *   Copyright (c) 1998-1999 Microsoft Corporation
  6. *                                                                       *
  7. ************************************************************************/
  8.  
  9. #ifndef _DMUSICS_
  10. #define _DMUSICS_
  11.  
  12. #include "dmusicc.h"
  13.  
  14. /* Software synths are enumerated from under this registry key.
  15.  */
  16. #define REGSTR_PATH_SOFTWARESYNTHS  "Software\\Microsoft\\DirectMusic\\SoftwareSynths"
  17.  
  18. interface IDirectMusicSynth;
  19. interface IDirectMusicSynthSink;
  20.  
  21. #ifndef __cplusplus 
  22. typedef interface IDirectMusicSynth IDirectMusicSynth;
  23. typedef interface IDirectMusicSynthSink IDirectMusicSynthSink;
  24. #endif
  25.  
  26. #ifndef _DMUS_VOICE_STATE_DEFINED
  27. #define _DMUS_VOICE_STATE_DEFINED
  28.  
  29. typedef struct _DMUS_VOICE_STATE
  30. {
  31.     BOOL                bExists;
  32.     SAMPLE_POSITION     spPosition;
  33. } DMUS_VOICE_STATE; 
  34.  
  35. #endif /* _DMUS_VOICE_STATE_DEFINED */
  36.  
  37. /* IDirectMusicSynth::Refresh
  38.  *
  39.  * This is the last buffer of the stream. It may be a partial block.
  40.  */
  41. #define REFRESH_F_LASTBUFFER        0x00000001
  42.  
  43. #undef  INTERFACE
  44. #define INTERFACE  IDirectMusicSynth
  45. DECLARE_INTERFACE_(IDirectMusicSynth, IUnknown)
  46. {
  47.     /* IUnknown */
  48.     STDMETHOD(QueryInterface)       (THIS_ REFIID, LPVOID FAR *) PURE;
  49.     STDMETHOD_(ULONG,AddRef)        (THIS) PURE;
  50.     STDMETHOD_(ULONG,Release)       (THIS) PURE;
  51.  
  52.     /* IDirectMusicSynth */
  53.     STDMETHOD(Open)                 (THIS_ LPDMUS_PORTPARAMS pPortParams) PURE;
  54.     STDMETHOD(Close)                (THIS) PURE;
  55.     STDMETHOD(SetNumChannelGroups)  (THIS_ DWORD dwGroups) PURE;
  56.     STDMETHOD(Download)             (THIS_ LPHANDLE phDownload, 
  57.                                            LPVOID pvData, 
  58.                                            LPBOOL pbFree ) PURE;
  59.     STDMETHOD(Unload)               (THIS_ HANDLE hDownload, 
  60.                                            HRESULT ( CALLBACK *lpFreeHandle)(HANDLE,HANDLE), 
  61.                                            HANDLE hUserData ) PURE; 
  62.     STDMETHOD(PlayBuffer)           (THIS_ REFERENCE_TIME rt, 
  63.                                            LPBYTE pbBuffer, 
  64.                                            DWORD cbBuffer) PURE;
  65.     STDMETHOD(GetRunningStats)      (THIS_ LPDMUS_SYNTHSTATS pStats) PURE;
  66.     STDMETHOD(GetPortCaps)          (THIS_ LPDMUS_PORTCAPS pCaps) PURE;
  67.     STDMETHOD(SetMasterClock)       (THIS_ IReferenceClock *pClock) PURE;
  68.     STDMETHOD(GetLatencyClock)      (THIS_ IReferenceClock **ppClock) PURE;
  69.     STDMETHOD(Activate)             (THIS_ BOOL fEnable) PURE;
  70.     STDMETHOD(SetSynthSink)         (THIS_ IDirectMusicSynthSink *pSynthSink) PURE;
  71.     STDMETHOD(Render)               (THIS_ short *pBuffer, 
  72.                                            DWORD dwLength, 
  73.                                            LONGLONG llPosition) PURE;
  74.     STDMETHOD(SetChannelPriority)   (THIS_ DWORD dwChannelGroup,
  75.                                            DWORD dwChannel,
  76.                                            DWORD dwPriority) PURE;
  77.     STDMETHOD(GetChannelPriority)   (THIS_ DWORD dwChannelGroup,
  78.                                            DWORD dwChannel,
  79.                                            LPDWORD pdwPriority) PURE;
  80.     STDMETHOD(GetFormat)            (THIS_ LPWAVEFORMATEX pWaveFormatEx,
  81.                                            LPDWORD pdwWaveFormatExSize) PURE;
  82.     STDMETHOD(GetAppend)            (THIS_ DWORD* pdwAppend) PURE;
  83. };
  84.  
  85. #undef  INTERFACE
  86.  
  87. #define INTERFACE  IDirectMusicSynth8
  88. DECLARE_INTERFACE_(IDirectMusicSynth8, IDirectMusicSynth)
  89. {
  90.     /* IUnknown */
  91.     STDMETHOD(QueryInterface)       (THIS_ REFIID, LPVOID FAR *) PURE;
  92.     STDMETHOD_(ULONG,AddRef)        (THIS) PURE;
  93.     STDMETHOD_(ULONG,Release)       (THIS) PURE;
  94.  
  95.     /* IDirectMusicSynth */
  96.     STDMETHOD(Open)                 (THIS_ LPDMUS_PORTPARAMS pPortParams) PURE;
  97.     STDMETHOD(Close)                (THIS) PURE;
  98.     STDMETHOD(SetNumChannelGroups)  (THIS_ DWORD dwGroups) PURE;
  99.     STDMETHOD(Download)             (THIS_ LPHANDLE phDownload, 
  100.                                            LPVOID pvData, 
  101.                                            LPBOOL pbFree ) PURE;
  102.     STDMETHOD(Unload)               (THIS_ HANDLE hDownload, 
  103.                                            HRESULT ( CALLBACK *lpFreeHandle)(HANDLE,HANDLE), 
  104.                                            HANDLE hUserData ) PURE; 
  105.     STDMETHOD(PlayBuffer)           (THIS_ REFERENCE_TIME rt, 
  106.                                            LPBYTE pbBuffer, 
  107.                                            DWORD cbBuffer) PURE;
  108.     STDMETHOD(GetRunningStats)      (THIS_ LPDMUS_SYNTHSTATS pStats) PURE;
  109.     STDMETHOD(GetPortCaps)          (THIS_ LPDMUS_PORTCAPS pCaps) PURE;
  110.     STDMETHOD(SetMasterClock)       (THIS_ IReferenceClock *pClock) PURE;
  111.     STDMETHOD(GetLatencyClock)      (THIS_ IReferenceClock **ppClock) PURE;
  112.     STDMETHOD(Activate)             (THIS_ BOOL fEnable) PURE;
  113.     STDMETHOD(SetSynthSink)         (THIS_ IDirectMusicSynthSink *pSynthSink) PURE;
  114.     STDMETHOD(Render)               (THIS_ short *pBuffer, 
  115.                                            DWORD dwLength, 
  116.                                            LONGLONG llPosition) PURE;
  117.     STDMETHOD(SetChannelPriority)   (THIS_ DWORD dwChannelGroup,
  118.                                            DWORD dwChannel,
  119.                                            DWORD dwPriority) PURE;
  120.     STDMETHOD(GetChannelPriority)   (THIS_ DWORD dwChannelGroup,
  121.                                            DWORD dwChannel,
  122.                                            LPDWORD pdwPriority) PURE;
  123.     STDMETHOD(GetFormat)            (THIS_ LPWAVEFORMATEX pWaveFormatEx,
  124.                                            LPDWORD pdwWaveFormatExSize) PURE;
  125.     STDMETHOD(GetAppend)            (THIS_ DWORD* pdwAppend) PURE;
  126.  
  127.     /* IDirectMusicSynth8 */
  128.     STDMETHOD(PlayVoice)            (THIS_ REFERENCE_TIME rt, 
  129.                                            DWORD dwVoiceId, 
  130.                                            DWORD dwChannelGroup, 
  131.                                            DWORD dwChannel, 
  132.                                            DWORD dwDLId, 
  133.                                            long     prPitch,            /* PREL not defined here */
  134.                                            long  vrVolume,          /* VREL not defined here */
  135.                                            SAMPLE_TIME stVoiceStart,
  136.                                            SAMPLE_TIME stLoopStart,
  137.                                            SAMPLE_TIME stLoopEnd) PURE;
  138.  
  139.     STDMETHOD(StopVoice)            (THIS_ REFERENCE_TIME rt, 
  140.                                            DWORD dwVoiceId ) PURE;
  141.  
  142.     STDMETHOD(GetVoiceState)        (THIS_ DWORD dwVoice[], 
  143.                                            DWORD cbVoice,
  144.                                            DMUS_VOICE_STATE dwVoiceState[] ) PURE;
  145.     STDMETHOD(Refresh)              (THIS_ DWORD dwDownloadID,
  146.                                            DWORD dwFlags) PURE;
  147.     STDMETHOD(AssignChannelToBuses) (THIS_ DWORD dwChannelGroup,
  148.                                            DWORD dwChannel,
  149.                                            LPDWORD pdwBuses,
  150.                                            DWORD cBuses) PURE;                                           
  151. };
  152.  
  153. #undef  INTERFACE
  154. #define INTERFACE  IDirectMusicSynthSink
  155. DECLARE_INTERFACE_(IDirectMusicSynthSink, IUnknown)
  156. {
  157.     /* IUnknown */
  158.     STDMETHOD(QueryInterface)       (THIS_ REFIID, LPVOID FAR *) PURE;
  159.     STDMETHOD_(ULONG,AddRef)        (THIS) PURE;
  160.     STDMETHOD_(ULONG,Release)       (THIS) PURE;
  161.  
  162.     /* IDirectMusicSynthSink */
  163.     STDMETHOD(Init)                 (THIS_ IDirectMusicSynth *pSynth) PURE;
  164.     STDMETHOD(SetMasterClock)       (THIS_ IReferenceClock *pClock) PURE;
  165.     STDMETHOD(GetLatencyClock)      (THIS_ IReferenceClock **ppClock) PURE;
  166.     STDMETHOD(Activate)             (THIS_ BOOL fEnable) PURE;
  167.     STDMETHOD(SampleToRefTime)      (THIS_ LONGLONG llSampleTime,
  168.                                            REFERENCE_TIME *prfTime) PURE;
  169.     STDMETHOD(RefTimeToSample)      (THIS_ REFERENCE_TIME rfTime, 
  170.                                            LONGLONG *pllSampleTime) PURE;
  171.     STDMETHOD(SetDirectSound)       (THIS_ LPDIRECTSOUND pDirectSound,
  172.                                            LPDIRECTSOUNDBUFFER pDirectSoundBuffer) PURE;                                           
  173.     STDMETHOD(GetDesiredBufferSize) (THIS_ LPDWORD pdwBufferSizeInSamples) PURE;                                           
  174. };
  175.  
  176. DEFINE_GUID(IID_IDirectMusicSynth, 0x9823661,  0x5c85, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6);
  177. DEFINE_GUID(IID_IDirectMusicSynth8,0x53cab625, 0x2711, 0x4c9f, 0x9d, 0xe7, 0x1b, 0x7f, 0x92, 0x5f, 0x6f, 0xc8);
  178. DEFINE_GUID(IID_IDirectMusicSynthSink,0x9823663, 0x5c85, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6);
  179.  
  180. /* Property Set GUID_DMUS_PROP_SetSynthSink
  181.  *
  182.  * Item 0: An IUnknown on which the port can QueryInterface for a user-mode synth sink.
  183.  */
  184. DEFINE_GUID(GUID_DMUS_PROP_SetSynthSink,0x0a3a5ba5, 0x37b6, 0x11d2, 0xb9, 0xf9, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
  185.  
  186. /* Property Set GUID_DMUS_PROP_SinkUsesDSound
  187.  *
  188.  * Item 0: A DWORD boolean indicating whether or not the sink requires an IDirectSound interface. The
  189.  * default is FALSE if this property item is not implemented by the sink.
  190.  */
  191. DEFINE_GUID(GUID_DMUS_PROP_SinkUsesDSound, 0xbe208857, 0x8952, 0x11d2, 0xba, 0x1c, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); 
  192.  
  193. #endif
  194.