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.

217 lines
5.9 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: dmsegmentobj.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. // dmSegmentObj.cpp
  11. #include "stdafx.h"
  12. #include "Direct.h"
  13. #include "dmusici.h"
  14. #include "dmusicc.h"
  15. #include "dmusicf.h"
  16. #include "dms.h"
  17. #include "dmSegmentObj.h"
  18. extern void *g_dxj_DirectMusicSegment;
  19. //CONSTRUCTOR(_dxj_DirectMusicSegment, {});
  20. C_dxj_DirectMusicSegmentObject::C_dxj_DirectMusicSegmentObject()
  21. {
  22. m__dxj_DirectMusicSegment = NULL;
  23. parent = NULL;
  24. pinterface = NULL;
  25. nextobj = (void*)g_dxj_DirectMusicSegment;
  26. creationid = ++g_creationcount;
  27. g_dxj_DirectMusicSegment = (void*)this;
  28. }
  29. DESTRUCTOR(_dxj_DirectMusicSegment, {});
  30. GETSET_OBJECT(_dxj_DirectMusicSegment);
  31. HRESULT C_dxj_DirectMusicSegmentObject::clone(
  32. /* [in] */ long mtStart,
  33. /* [in] */ long mtEnd,
  34. /* [retval][out] */ I_dxj_DirectMusicSegment __RPC_FAR *__RPC_FAR *ppSegment)
  35. {
  36. HRESULT hr;
  37. IDirectMusicSegment *pOut=NULL;
  38. hr=m__dxj_DirectMusicSegment->Clone((MUSIC_TIME)mtStart,(MUSIC_TIME)mtEnd,&pOut);
  39. if FAILED(hr) return hr;
  40. if (!pOut)return E_OUTOFMEMORY;
  41. INTERNAL_CREATE_NOADDREF(_dxj_DirectMusicSegment,pOut,ppSegment);
  42. if (!*ppSegment)return E_OUTOFMEMORY;
  43. return hr;
  44. }
  45. HRESULT C_dxj_DirectMusicSegmentObject::setStartPoint( /* [in] */ long mtStart)
  46. {
  47. HRESULT hr;
  48. hr=m__dxj_DirectMusicSegment->SetStartPoint((MUSIC_TIME)mtStart);
  49. return hr;
  50. }
  51. HRESULT C_dxj_DirectMusicSegmentObject::getStartPoint( /* [in] */ long *mtStart)
  52. {
  53. HRESULT hr;
  54. hr=m__dxj_DirectMusicSegment->GetStartPoint((MUSIC_TIME*)mtStart);
  55. return hr;
  56. }
  57. HRESULT C_dxj_DirectMusicSegmentObject::setLoopPoints( /* [in] */ long mtStart, /* [in] */ long mtEnd)
  58. {
  59. HRESULT hr;
  60. hr=m__dxj_DirectMusicSegment->SetLoopPoints((MUSIC_TIME)mtStart,(MUSIC_TIME)mtEnd);
  61. return hr;
  62. }
  63. HRESULT C_dxj_DirectMusicSegmentObject::getLoopPointStart( long *mtOut)
  64. {
  65. HRESULT hr;
  66. MUSIC_TIME mtStart =0;
  67. MUSIC_TIME mtEnd =0;
  68. hr=m__dxj_DirectMusicSegment->GetLoopPoints((MUSIC_TIME*)&mtStart,(MUSIC_TIME*)&mtEnd);
  69. *mtOut=(long)mtStart;
  70. return hr;
  71. }
  72. HRESULT C_dxj_DirectMusicSegmentObject::getLoopPointEnd( long *mtOut)
  73. {
  74. HRESULT hr;
  75. MUSIC_TIME mtStart =0;
  76. MUSIC_TIME mtEnd =0;
  77. hr=m__dxj_DirectMusicSegment->GetLoopPoints((MUSIC_TIME*)&mtStart,(MUSIC_TIME*)&mtEnd);
  78. *mtOut=(long)mtEnd;
  79. return hr;
  80. }
  81. HRESULT C_dxj_DirectMusicSegmentObject::setLength( /* [in] */ long mtLength)
  82. {
  83. HRESULT hr;
  84. hr=m__dxj_DirectMusicSegment->SetLength((MUSIC_TIME)mtLength);
  85. return hr;
  86. }
  87. HRESULT C_dxj_DirectMusicSegmentObject::getLength( /* [in] */ long *mtLength)
  88. {
  89. HRESULT hr;
  90. hr=m__dxj_DirectMusicSegment->GetLength((MUSIC_TIME*)mtLength);
  91. return hr;
  92. }
  93. HRESULT C_dxj_DirectMusicSegmentObject::setRepeats( /* [in] */ long lrep)
  94. {
  95. HRESULT hr;
  96. hr=m__dxj_DirectMusicSegment->SetRepeats((DWORD)lrep);
  97. return hr;
  98. }
  99. HRESULT C_dxj_DirectMusicSegmentObject::getRepeats( /* [in] */ long *lrep)
  100. {
  101. HRESULT hr;
  102. hr=m__dxj_DirectMusicSegment->GetRepeats((DWORD*)lrep);
  103. return hr;
  104. }
  105. HRESULT C_dxj_DirectMusicSegmentObject::download(
  106. /* [in] */ I_dxj_DirectMusicPerformance __RPC_FAR *performance)
  107. {
  108. if (!performance) return E_INVALIDARG;
  109. DO_GETOBJECT_NOTNULL(IDirectMusicPerformance*,pPerformance,performance);
  110. HRESULT hr;
  111. hr=m__dxj_DirectMusicSegment->SetParam(GUID_Download,0xFFFFFFFF,(DWORD)0,(MUSIC_TIME)0,pPerformance);
  112. return hr;
  113. }
  114. HRESULT C_dxj_DirectMusicSegmentObject::unload(
  115. /* [in] */ I_dxj_DirectMusicPerformance __RPC_FAR *performance)
  116. {
  117. if (!performance) return E_INVALIDARG;
  118. DO_GETOBJECT_NOTNULL(IDirectMusicPerformance*,pPerformance,performance);
  119. HRESULT hr;
  120. hr=m__dxj_DirectMusicSegment->SetParam(GUID_Unload,0xFFFFFFFF,(DWORD)0,(MUSIC_TIME)0,pPerformance);
  121. return hr;
  122. }
  123. HRESULT C_dxj_DirectMusicSegmentObject::setAutoDownloadEnable(
  124. /* [retval][out] */ VARIANT_BOOL b)
  125. {
  126. HRESULT hr;
  127. if (b==VARIANT_FALSE){
  128. hr=m__dxj_DirectMusicSegment->SetParam(GUID_Disable_Auto_Download,0xFFFFFFFF,(DWORD)0,(MUSIC_TIME)0,NULL);
  129. }
  130. else {
  131. hr=m__dxj_DirectMusicSegment->SetParam(GUID_Enable_Auto_Download,0xFFFFFFFF,(DWORD)0,(MUSIC_TIME)0,NULL);
  132. }
  133. return hr;
  134. }
  135. HRESULT C_dxj_DirectMusicSegmentObject::setTempoEnable(
  136. /* [retval][out] */ VARIANT_BOOL b)
  137. {
  138. HRESULT hr;
  139. DWORD trackIndex=0;
  140. if (b==VARIANT_FALSE){
  141. hr=m__dxj_DirectMusicSegment->SetParam(GUID_DisableTempo,0xFFFFFFFF,(DWORD)trackIndex,(MUSIC_TIME)0,NULL);
  142. }
  143. else {
  144. hr=m__dxj_DirectMusicSegment->SetParam(GUID_EnableTempo,0xFFFFFFFF,(DWORD)trackIndex,(MUSIC_TIME)0,NULL);
  145. }
  146. return hr;
  147. }
  148. HRESULT C_dxj_DirectMusicSegmentObject::setTimeSigEnable(
  149. /* [retval][out] */ VARIANT_BOOL b)
  150. {
  151. HRESULT hr;
  152. DWORD trackIndex=0;
  153. if (b==VARIANT_FALSE){
  154. hr=m__dxj_DirectMusicSegment->SetParam(GUID_DisableTimeSig,0xFFFFFFFF,(DWORD)trackIndex,(MUSIC_TIME)0,NULL);
  155. }
  156. else {
  157. hr=m__dxj_DirectMusicSegment->SetParam(GUID_EnableTimeSig,0xFFFFFFFF,(DWORD)trackIndex,(MUSIC_TIME)0,NULL);
  158. }
  159. return hr;
  160. }
  161. HRESULT C_dxj_DirectMusicSegmentObject::setStandardMidiFile()
  162. {
  163. HRESULT hr;
  164. hr=m__dxj_DirectMusicSegment->SetParam(GUID_StandardMIDIFile,0xFFFFFFFF,(DWORD)0,(MUSIC_TIME)0,NULL);
  165. return hr;
  166. }
  167. HRESULT C_dxj_DirectMusicSegmentObject:: connectToCollection(
  168. /* [in] */ I_dxj_DirectMusicCollection __RPC_FAR *c)
  169. {
  170. HRESULT hr;
  171. DO_GETOBJECT_NOTNULL(IDirectMusicCollection*,pCol,c);
  172. hr=m__dxj_DirectMusicSegment->SetParam(GUID_ConnectToDLSCollection,0xFFFFFFFF,(DWORD)0,(MUSIC_TIME)0,(void*)pCol);
  173. return hr;
  174. }