#ifndef SNDDM_H
#define SNDDM_H

//----------------------------------------------------
//flags/constants to be moved to public header
#define DM_CONTAINED	1
#define DM_LOOP			2

//identification of DMusic objects
#define DM_EMPTY 0
#define DM_STYLE 1 /* -1 => index */
#define DM_PERSO 2
#define DM_SEGMT 3
#define DM_BAND  4
#define DM_DLS   5

#define DM_INVALIDREF 0xFFFFFFFF
//----------------------------------------------------
#define WITH_DM_NOTIFICATION

#ifndef __cplusplus
#define IDirectMusic_CreatePort(p,a,b,c,d,e)    (p)->lpVtbl->CreatePort(p,&a,&b,c,d,e)
#define IDirectMusic_Release(p)                 (p)->lpVtbl->Release(p)
#define IDirectMusicCollection_EnumInstrument(p,i,patch,wNam,max) (p)->lpVtbl->EnumInstrument(p,i,patch,wNam,max)					
#define IDirectMusicCollection_GetInstrument(p,patch,pInst) (p)->lpVtbl->GetInstrument(p,patch,pInst)
#define IDirectMusicCollection_Release(p)       (p)->lpVtbl->Release(p)
#define IDirectMusicComposer_Release(p)         (p)->lpVtbl->Release(p)
#define IDirectMusicDownloadedInstrument_Release(p) (p)->lpVtbl->Release(p)
#define IDirectMusicInstrument_Release(p)       (p)->lpVtbl->Release(p)
#define IDirectMusicInstrument_SetPatch(p,patch) (p)->lpVtbl->SetPatch(p,patch)
#define IDirectMusicLoader_GetObject(p,desc,guid,pObj) (p)->lpVtbl->GetObject(p,desc,&guid,pObj)
#define IDirectMusicLoader_ScanDirectory(p,guid,ext,cache) (p)->lpVtbl->ScanDirectory(p,&guid,ext,cache)
#define IDirectMusicLoader_SetSearchDirectory(p,guid,dir,b) (p)->lpVtbl->SetSearchDirectory(p,&guid,dir,b)
#define IDirectMusicLoader_Release(p)           (p)->lpVtbl->Release(p)
#define IDirectMusicPerformance_Release(p)      (p)->lpVtbl->Release(p)
#define IDirectMusicPerformance_CloseDown(p)    (p)->lpVtbl->CloseDown(p)
#define IDirectMusicPerformance_Init(p,a)       (p)->lpVtbl->Init(p,a)
#define IDirectMusicPerformance_AddPort(p,a)    (p)->lpVtbl->AddPort(p,a)
#define IDirectMusicPerformance_AssignPChannelBlock(p,a,b,c) (p)->lpVtbl->AssignPChannelBlock( p,a,b,c)
#define IDirectMusicPerformance_PlaySegment(p,seg, fl, a, pstate) (p)->lpVtbl->PlaySegment(p,seg, fl, a, pstate)
#define IDirectMusicPerformance_Stop(p,a,b,c,d)				 (p)->lpVtbl->Stop(p,a,b,c,d)
#define IDirectMusicPort_Release(p)							 (p)->lpVtbl->Release(p)
#define IDirectMusicPort_UnloadInstrument(p,i)				 (p)->lpVtbl->UnloadInstrument(p,i)
#define IDirectMusicSegment_Release(p)						 (p)->lpVtbl->Release(p)
#define IDirectMusicSegment_SetRepeats(p,n)					 (p)->lpVtbl->SetRepeats(p,n)
#define IDirectMusicSegment_GetLength(p,pt)					 (p)->lpVtbl->GetLength(p,pt)
#define IDirectMusicSegmentState_GetSeek(p,mt)				 (p)->lpVtbl->GetSeek(p,mt)
#define IDirectMusicPerformance_MusicToReferenceTime(p,t,pt) (p)->lpVtbl->MusicToReferenceTime(p,t,pt)
#define IDirectMusicPerformance_SetNotificationHandle(p,h,n) (p)->lpVtbl->SetNotificationHandle(p,h,n)
#define IDirectMusicPerformance_AddNotificationType(p, guid) (p)->lpVtbl->AddNotificationType(p, &guid)
#define IDirectMusicPerformance_DownloadInstrument(p,pIns,pChan,ppDLIns,range,numRange,pPort,pGroup,p2Chan) (p)->lpVtbl->DownloadInstrument(p,pIns,pChan,ppDLIns,range,numRange,pPort,pGroup,p2Chan)
#define IDirectMusicPerformance_FreePMsg(p,pMsg) (p)->lpVtbl->FreePMsg(p,pMsg)
#define IDirectMusicPerformance_GetNotificationPMsg(p, pMsg) (p)->lpVtbl->GetNotificationPMsg(p, pMsg)
#define IDirectMusicPerformance_IsPlaying(p,pSeg,pState)	 (p)->lpVtbl->IsPlaying(p,pSeg,pState)

#else

#define IDirectMusic_CreatePort(p,a,b,c,d,e)    (p)->CreatePort(a,b,c,d,e)
#define IDirectMusic_Release(p)                 (p)->Release()
#define IDirectMusicCollection_EnumInstrument(p,i,patch,wNam,max) (p)->EnumInstrument(i,patch,wNam,max)
#define IDirectMusicCollection_GetInstrument(p,patch,pInst) (p)->GetInstrument(patch,pInst)
#define IDirectMusicCollection_Release(p)       (p)->Release()
#define IDirectMusicComposer_Release(p)         (p)->Release()
#define IDirectMusicDownloadedInstrument_Release(p) (p)->Release()
#define IDirectMusicInstrument_Release(p)       (p)->Release()
#define IDirectMusicInstrument_SetPatch(p,patch) (p)->SetPatch(patch)
#define IDirectMusicLoader_GetObject(p,desc,guid,pObj) (p)->GetObject(desc,guid,pObj)
#define IDirectMusicLoader_ScanDirectory(p,guid,ext,cache) (p)->ScanDirectory(p,guid,ext,cache)
#define IDirectMusicLoader_SetSearchDirectory(p,guid,dir,b) (p)->SetSearchDirectory(guid,dir,b)
#define IDirectMusicLoader_Release(p)           (p)->Release()
#define IDirectMusicPerformance_Release(p)      (p)->Release()
#define IDirectMusicPerformance_CloseDown(p)    (p)->CloseDown()
#define IDirectMusicPerformance_Init(p,a)       (p)->Init(a)
#define IDirectMusicPerformance_AddPort(p,a)    (p)->AddPort(a)
#define IDirectMusicPerformance_AssignPChannelBlock(p,a,b,c) (p)->AssignPChannelBlock(a,b,c)
#define IDirectMusicPerformance_PlaySegment(p,seg, fl, a, pstate) (p)->PlaySegment(seg, fl, a, pstate)
#define IDirectMusicPerformance_Stop(p,a,b,c,d) (p)->Stop(a,b,c,d)
#define IDirectMusicPort_Release(p)             (p)->Release()
#define IDirectMusicPort_UnloadInstrument(p,i)  (p)->UnloadInstrument(i)
#define IDirectMusicSegment_Release(p)			(p)->Release()
#define IDirectMusicSegment_SetRepeats(p,n)		(p)->SetRepeats(n)
#define IDirectMusicSegment_GetLength(p,pt)		(p)->GetLength(pt)
#define IDirectMusicSegmentState_GetSeek(p,mt)	(p)->GetSeek(p,mt)
#define IDirectMusicPerformance_MusicToReferenceTime(p,t,pt) (p)->MusicToReferenceTime(t,pt)
#define IDirectMusicPerformance_SetNotificationHandle(p,h,n) (p)->SetNotificationHandle(h,n)
#define IDirectMusicPerformance_AddNotificationType(p, guid) (p)->AddNotificationType(guid)
#define IDirectMusicPerformance_DownloadInstrument(p,pIns,pChan,ppDLIns,range,numRange,pPort,pGroup,p2Chan) (p)->DownloadInstrument(pIns,pChan,ppDLIns,range,numRange,pPort,pGroup,p2Chan)
#define IDirectMusicPerformance_FreePMsg(p,pMsg) (p)->FreePMsg(pMsg)
#define IDirectMusicPerformance_GetNotificationPMsg(p, pMsg) (p)->GetNotificationPMsg(pMsg)
#define IDirectMusicPerformance_IsPlaying(p,pSeg,pState)	 (p)->IsPlaying(pSeg,pState)


#endif

void    fn_vFreeDirectMusic();
HRESULT fn_hrLoadExtDMObject(unsigned short uwType, char *szName, void **pObj);

#endif /* SNDDM_H */