Source code of Windows XP (NT5)
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.

189 lines
4.5 KiB

  1. #include "stdafx.h"
  2. #include "Direct.h"
  3. #include "dms.h"
  4. #include "dSoundFXI3DL2ReverbObj.h"
  5. extern void *g_dxj_DirectSoundFXI3DL2Reverb;
  6. ///////////////////////////////////////////////////////////////////
  7. // InternalAddRef
  8. ///////////////////////////////////////////////////////////////////
  9. DWORD C_dxj_DirectSoundFXI3DL2ReverbObject::InternalAddRef(){
  10. DWORD i;
  11. i=CComObjectRoot::InternalAddRef();
  12. DPF2(1,"DirectSoundFXI3DL2Reverb [%d] AddRef %d \n",creationid,i);
  13. return i;
  14. }
  15. ///////////////////////////////////////////////////////////////////
  16. // InternalRelease
  17. ///////////////////////////////////////////////////////////////////
  18. DWORD C_dxj_DirectSoundFXI3DL2ReverbObject::InternalRelease(){
  19. DWORD i;
  20. i=CComObjectRoot::InternalRelease();
  21. DPF2(1,"DirectSoundFXI3DL2Reverb [%d] Release %d \n",creationid,i);
  22. return i;
  23. }
  24. ///////////////////////////////////////////////////////////////////
  25. // C_dxj_DirectSoundFXI3DL2ReverbObject
  26. ///////////////////////////////////////////////////////////////////
  27. C_dxj_DirectSoundFXI3DL2ReverbObject::C_dxj_DirectSoundFXI3DL2ReverbObject(){
  28. DPF1(1,"Constructor Creation DirectSoundFXI3DL2Reverb Object[%d] \n ",g_creationcount);
  29. m__dxj_DirectSoundFXI3DL2Reverb = NULL;
  30. parent = NULL;
  31. pinterface = NULL;
  32. nextobj = g_dxj_DirectSoundFXI3DL2Reverb;
  33. creationid = ++g_creationcount;
  34. g_dxj_DirectSoundFXI3DL2Reverb = (void *)this;
  35. }
  36. ///////////////////////////////////////////////////////////////////
  37. // ~C_dxj_DirectSoundFXI3DL2ReverbObject
  38. ///////////////////////////////////////////////////////////////////
  39. C_dxj_DirectSoundFXI3DL2ReverbObject::~C_dxj_DirectSoundFXI3DL2ReverbObject()
  40. {
  41. DPF(1,"Entering ~C_dxj_DirectSoundFXI3DL2ReverbObject destructor \n");
  42. C_dxj_DirectSoundFXI3DL2ReverbObject *prev=NULL;
  43. for(C_dxj_DirectSoundFXI3DL2ReverbObject *ptr=(C_dxj_DirectSoundFXI3DL2ReverbObject *)g_dxj_DirectSoundFXI3DL2Reverb ; ptr; ptr=(C_dxj_DirectSoundFXI3DL2ReverbObject *)ptr->nextobj)
  44. {
  45. if(ptr == this)
  46. {
  47. if(prev)
  48. prev->nextobj = ptr->nextobj;
  49. else
  50. g_dxj_DirectSoundFXI3DL2Reverb = (void*)ptr->nextobj;
  51. DPF(1,"DirectSoundFXI3DL2ReverbObject found in g_dxj list now removed\n");
  52. break;
  53. }
  54. prev = ptr;
  55. }
  56. if(m__dxj_DirectSoundFXI3DL2Reverb){
  57. int count = IUNK(m__dxj_DirectSoundFXI3DL2Reverb)->Release();
  58. #ifdef DEBUG
  59. char buffer[256];
  60. wsprintf(buffer,"DirectX IDirectSoundFXI3DL2Reverb Ref count [%d] \n",count);
  61. #endif
  62. if(count==0) m__dxj_DirectSoundFXI3DL2Reverb = NULL;
  63. }
  64. if(parent) IUNK(parent)->Release();
  65. }
  66. HRESULT C_dxj_DirectSoundFXI3DL2ReverbObject::InternalGetObject(IUnknown **pUnk){
  67. *pUnk=(IUnknown*)m__dxj_DirectSoundFXI3DL2Reverb;
  68. return S_OK;
  69. }
  70. HRESULT C_dxj_DirectSoundFXI3DL2ReverbObject::InternalSetObject(IUnknown *pUnk){
  71. m__dxj_DirectSoundFXI3DL2Reverb=(LPDIRECTSOUNDFXI3DL2REVERB8)pUnk;
  72. return S_OK;
  73. }
  74. HRESULT C_dxj_DirectSoundFXI3DL2ReverbObject::SetAllParameters(DSFXI3DL2REVERB_CDESC *params)
  75. {
  76. HRESULT hr;
  77. __try {
  78. if (FAILED( hr = m__dxj_DirectSoundFXI3DL2Reverb->SetAllParameters((DSFXI3DL2Reverb*) params) ))
  79. return hr;
  80. }
  81. __except(EXCEPTION_EXECUTE_HANDLER)
  82. {
  83. return E_FAIL;
  84. }
  85. return S_OK;
  86. }
  87. HRESULT C_dxj_DirectSoundFXI3DL2ReverbObject::GetAllParameters(DSFXI3DL2REVERB_CDESC *params)
  88. {
  89. HRESULT hr;
  90. __try {
  91. if (FAILED( hr = m__dxj_DirectSoundFXI3DL2Reverb->GetAllParameters((DSFXI3DL2Reverb*) params) ))
  92. return hr;
  93. }
  94. __except(EXCEPTION_EXECUTE_HANDLER)
  95. {
  96. return E_FAIL;
  97. }
  98. return S_OK;
  99. }
  100. HRESULT C_dxj_DirectSoundFXI3DL2ReverbObject::SetPreset(long lPreset)
  101. {
  102. HRESULT hr;
  103. __try {
  104. if (FAILED( hr = m__dxj_DirectSoundFXI3DL2Reverb->SetPreset((DWORD) lPreset) ))
  105. return hr;
  106. }
  107. __except(EXCEPTION_EXECUTE_HANDLER)
  108. {
  109. return E_FAIL;
  110. }
  111. return S_OK;
  112. }
  113. HRESULT C_dxj_DirectSoundFXI3DL2ReverbObject::GetPreset(long *ret)
  114. {
  115. HRESULT hr;
  116. __try {
  117. if (FAILED( hr = m__dxj_DirectSoundFXI3DL2Reverb->GetPreset((DWORD*) ret) ))
  118. return hr;
  119. }
  120. __except(EXCEPTION_EXECUTE_HANDLER)
  121. {
  122. return E_FAIL;
  123. }
  124. return S_OK;
  125. }
  126. HRESULT C_dxj_DirectSoundFXI3DL2ReverbObject::SetQuality(long lQuality)
  127. {
  128. HRESULT hr;
  129. __try {
  130. if (FAILED( hr = m__dxj_DirectSoundFXI3DL2Reverb->SetQuality(lQuality) ))
  131. return hr;
  132. }
  133. __except(EXCEPTION_EXECUTE_HANDLER)
  134. {
  135. return E_FAIL;
  136. }
  137. return S_OK;
  138. }
  139. HRESULT C_dxj_DirectSoundFXI3DL2ReverbObject::GetQuality(long *ret)
  140. {
  141. HRESULT hr;
  142. __try {
  143. if (FAILED( hr = m__dxj_DirectSoundFXI3DL2Reverb->GetQuality(ret) ))
  144. return hr;
  145. }
  146. __except(EXCEPTION_EXECUTE_HANDLER)
  147. {
  148. return E_FAIL;
  149. }
  150. return S_OK;
  151. }