Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

182 lines
5.9 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1998
  6. //
  7. // File: dmcomposerobj.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. // dmPerformanceObj.cpp
  11. #include "dmusici.h"
  12. #include "dmusicc.h"
  13. #include "dmusicf.h"
  14. #include "stdafx.h"
  15. #include "Direct.h"
  16. #include "dms.h"
  17. #include "dmChordMapObj.h"
  18. #include "dmStyleObj.h"
  19. #include "dmComposerObj.h"
  20. #include "dmSegmentObj.h"
  21. extern void *g_dxj_DirectMusicComposer;
  22. extern void *g_dxj_DirectMusicSegment;
  23. extern void *g_dxj_DirectMusicChordMap;
  24. extern HRESULT BSTRtoGUID(LPGUID,BSTR);
  25. CONSTRUCTOR(_dxj_DirectMusicComposer, {});
  26. DESTRUCTOR(_dxj_DirectMusicComposer, {});
  27. GETSET_OBJECT(_dxj_DirectMusicComposer);
  28. typedef IDirectMusicSegment* LPDIRECTMUSICSEGMENT;
  29. typedef IDirectMusicPerformance* LPDIRECTMUSICPERFORMANCE;
  30. typedef IDirectMusicChordMap* LPDIRECTMUSICCHORDMAP;
  31. typedef IDirectMusicStyle* LPDIRECTMUSICSTYLE;
  32. HRESULT C_dxj_DirectMusicComposerObject::autoTransition(
  33. /* [in] */ I_dxj_DirectMusicPerformance __RPC_FAR *Performance,
  34. /* [in] */ I_dxj_DirectMusicSegment __RPC_FAR *ToSeg,
  35. /* [in] */ long lCommand,
  36. /* [in] */ long lFlags,
  37. /* [in] */ I_dxj_DirectMusicChordMap __RPC_FAR *chordmap,
  38. /* [retval][out] */ I_dxj_DirectMusicSegment __RPC_FAR *__RPC_FAR *ppTransSeg)
  39. {
  40. HRESULT hr;
  41. DO_GETOBJECT_NOTNULL(LPDIRECTMUSICPERFORMANCE, pPerf,Performance);
  42. DO_GETOBJECT_NOTNULL(LPDIRECTMUSICSEGMENT, pToSeg,ToSeg);
  43. DO_GETOBJECT_NOTNULL(LPDIRECTMUSICCHORDMAP, pMap,chordmap);
  44. LPDIRECTMUSICSEGMENT pNewSeg=NULL;
  45. hr=m__dxj_DirectMusicComposer->AutoTransition(pPerf,pToSeg,(WORD)lCommand,(DWORD)lFlags,pMap,&pNewSeg,NULL,NULL);
  46. if FAILED(hr) return hr;
  47. if (pNewSeg) {
  48. INTERNAL_CREATE_NOADDREF(_dxj_DirectMusicSegment,pNewSeg,ppTransSeg);
  49. }
  50. else{
  51. *ppTransSeg=NULL;
  52. }
  53. return hr;
  54. }
  55. HRESULT C_dxj_DirectMusicComposerObject::composeSegmentFromTemplate(
  56. /* [in] */ I_dxj_DirectMusicStyle __RPC_FAR *style,
  57. /* [in] */ I_dxj_DirectMusicSegment __RPC_FAR *TemplateSeg,
  58. /* [in] */ short activity,
  59. /* [in] */ I_dxj_DirectMusicChordMap __RPC_FAR *chordmap,
  60. /* [retval][out] */ I_dxj_DirectMusicSegment __RPC_FAR *__RPC_FAR *SectionSeg)
  61. {
  62. HRESULT hr;
  63. DO_GETOBJECT_NOTNULL(LPDIRECTMUSICSTYLE, pStyle,style);
  64. DO_GETOBJECT_NOTNULL(LPDIRECTMUSICSEGMENT, pTemp,TemplateSeg);
  65. DO_GETOBJECT_NOTNULL(LPDIRECTMUSICCHORDMAP, pMap,chordmap);
  66. LPDIRECTMUSICSEGMENT pNewSeg=NULL;
  67. hr=m__dxj_DirectMusicComposer->ComposeSegmentFromTemplate(pStyle,pTemp,activity,pMap,&pNewSeg);
  68. if FAILED(hr) return hr;
  69. INTERNAL_CREATE_NOADDREF(_dxj_DirectMusicSegment,pNewSeg,SectionSeg);
  70. return hr;
  71. }
  72. HRESULT C_dxj_DirectMusicComposerObject::composeSegmentFromShape(
  73. /* [in] */ I_dxj_DirectMusicStyle __RPC_FAR *style,
  74. /* [in] */ short numberOfMeasures,
  75. /* [in] */ short shape,
  76. /* [in] */ short activity,
  77. /* [in] */ VARIANT_BOOL bIntro,
  78. /* [in] */ VARIANT_BOOL bEnd,
  79. /* [in] */ I_dxj_DirectMusicChordMap __RPC_FAR *chordmap,
  80. /* [retval][out] */ I_dxj_DirectMusicSegment __RPC_FAR *__RPC_FAR *SectionSeg)
  81. {
  82. HRESULT hr;
  83. BOOL bi= (bIntro==VARIANT_TRUE);
  84. BOOL be= (bEnd==VARIANT_TRUE);
  85. DO_GETOBJECT_NOTNULL(LPDIRECTMUSICSTYLE, pStyle,style);
  86. DO_GETOBJECT_NOTNULL(LPDIRECTMUSICCHORDMAP, pMap,chordmap);
  87. LPDIRECTMUSICSEGMENT pNewSeg=NULL;
  88. hr=m__dxj_DirectMusicComposer->ComposeSegmentFromShape(pStyle,numberOfMeasures,shape,activity,bi,be,pMap,&pNewSeg);
  89. if FAILED(hr) return hr;
  90. INTERNAL_CREATE_NOADDREF(_dxj_DirectMusicSegment,pNewSeg,SectionSeg);
  91. return hr;
  92. }
  93. HRESULT C_dxj_DirectMusicComposerObject::composeTransition(
  94. /* [in] */ I_dxj_DirectMusicSegment __RPC_FAR *FromSeg,
  95. /* [in] */ I_dxj_DirectMusicSegment __RPC_FAR *ToSeg,
  96. /* [in] */ long mtTime,
  97. /* [in] */ long lCommand,
  98. /* [in] */ long lFlags,
  99. /* [in] */ I_dxj_DirectMusicChordMap __RPC_FAR *chordmap,
  100. /* [retval][out] */ I_dxj_DirectMusicSegment __RPC_FAR *__RPC_FAR *SectionSeg)
  101. {
  102. HRESULT hr;
  103. DO_GETOBJECT_NOTNULL(LPDIRECTMUSICSEGMENT, pFromSeg,FromSeg);
  104. DO_GETOBJECT_NOTNULL(LPDIRECTMUSICSEGMENT, pToSeg,ToSeg);
  105. DO_GETOBJECT_NOTNULL(LPDIRECTMUSICCHORDMAP, pMap,chordmap);
  106. LPDIRECTMUSICSEGMENT pNewSeg=NULL;
  107. hr=m__dxj_DirectMusicComposer->ComposeTransition(pFromSeg,pToSeg,(MUSIC_TIME)mtTime,(WORD)lCommand,(DWORD)lFlags,pMap,&pNewSeg);
  108. if FAILED(hr) return hr;
  109. INTERNAL_CREATE_NOADDREF(_dxj_DirectMusicSegment,pNewSeg,SectionSeg);
  110. return hr;
  111. }
  112. HRESULT C_dxj_DirectMusicComposerObject::composeTemplateFromShape(
  113. /* [in] */ short numMeasures,
  114. /* [in] */ short shape,
  115. /* [in] */ VARIANT_BOOL bIntro,
  116. /* [in] */ VARIANT_BOOL bEnd,
  117. /* [in] */ short endLength,
  118. /* [retval][out] */ I_dxj_DirectMusicSegment __RPC_FAR *__RPC_FAR *TempSeg)
  119. {
  120. HRESULT hr;
  121. BOOL bi=(bIntro==VARIANT_TRUE);
  122. BOOL be=(bEnd==VARIANT_TRUE);
  123. LPDIRECTMUSICSEGMENT pNewSeg=NULL;
  124. hr=m__dxj_DirectMusicComposer->ComposeTemplateFromShape(numMeasures,shape,bi,be,endLength,&pNewSeg);
  125. if FAILED(hr) return hr;
  126. INTERNAL_CREATE_NOADDREF(_dxj_DirectMusicSegment,pNewSeg,TempSeg);
  127. return hr;
  128. }
  129. HRESULT C_dxj_DirectMusicComposerObject::changeChordMap(
  130. /* [in] */ I_dxj_DirectMusicSegment __RPC_FAR *segment,
  131. /* [in] */ VARIANT_BOOL trackScale,
  132. /* [retval][out] */ I_dxj_DirectMusicChordMap __RPC_FAR *ChordMap)
  133. {
  134. HRESULT hr;
  135. DO_GETOBJECT_NOTNULL(LPDIRECTMUSICSEGMENT, pSeg,segment);
  136. DO_GETOBJECT_NOTNULL(LPDIRECTMUSICCHORDMAP, pMap,ChordMap);
  137. BOOL bs=(trackScale==VARIANT_TRUE);
  138. hr=m__dxj_DirectMusicComposer->ChangeChordMap(pSeg,bs,pMap);
  139. return hr;
  140. }