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.

148 lines
3.6 KiB

  1. #include "stdafx.h"
  2. #include "Direct.h"
  3. #include "dms.h"
  4. #include "dsoundsourceobj.h"
  5. extern void *g_dxj_DirectSoundSource;
  6. ///////////////////////////////////////////////////////////////////
  7. // InternalAddRef
  8. ///////////////////////////////////////////////////////////////////
  9. DWORD C_dxj_DirectSoundSource::InternalAddRef(){
  10. DWORD i;
  11. i=CComObjectRoot::InternalAddRef();
  12. DPF2(1,"DirectSoundSource [%d] AddRef %d \n",creationid,i);
  13. return i;
  14. }
  15. ///////////////////////////////////////////////////////////////////
  16. // InternalRelease
  17. ///////////////////////////////////////////////////////////////////
  18. DWORD C_dxj_DirectSoundSource::InternalRelease(){
  19. DWORD i;
  20. i=CComObjectRoot::InternalRelease();
  21. DPF2(1,"DirectSoundSource [%d] Release %d \n",creationid,i);
  22. return i;
  23. }
  24. ///////////////////////////////////////////////////////////////////
  25. // C_dxj_DirectSoundSource
  26. ///////////////////////////////////////////////////////////////////
  27. C_dxj_DirectSoundSource::C_dxj_DirectSoundSource(){
  28. DPF1(1,"Constructor Creation DirectSoundSource Object[%d] \n ",g_creationcount);
  29. m__dxj_DirectSoundSource = NULL;
  30. parent = NULL;
  31. pinterface = NULL;
  32. nextobj = g_dxj_DirectSoundSource;
  33. creationid = ++g_creationcount;
  34. g_dxj_DirectSoundSource = (void *)this;
  35. }
  36. ///////////////////////////////////////////////////////////////////
  37. // ~C_dxj_DirectSoundSource
  38. ///////////////////////////////////////////////////////////////////
  39. C_dxj_DirectSoundSource::~C_dxj_DirectSoundSource()
  40. {
  41. DPF(1,"Entering ~C_dxj_DirectSoundSource destructor \n");
  42. C_dxj_DirectSoundSource *prev=NULL;
  43. for(C_dxj_DirectSoundSource *ptr=(C_dxj_DirectSoundSource*)g_dxj_DirectSoundSource ; ptr; ptr=(C_dxj_DirectSoundSource *)ptr->nextobj)
  44. {
  45. if(ptr == this)
  46. {
  47. if(prev)
  48. prev->nextobj = ptr->nextobj;
  49. else
  50. g_dxj_DirectSoundSource = (void*)ptr->nextobj;
  51. DPF(1,"DirectSoundSource found in g_dxj list now removed\n");
  52. break;
  53. }
  54. prev = ptr;
  55. }
  56. if(m__dxj_DirectSoundSource){
  57. int count = IUNK(m__dxj_DirectSoundSource)->Release();
  58. #ifdef DEBUG
  59. char buffer[256];
  60. wsprintf(buffer,"DirectX IDirectSoundSource Ref count [%d] \n",count);
  61. #endif
  62. if(count==0) m__dxj_DirectSoundSource = NULL;
  63. }
  64. if(parent) IUNK(parent)->Release();
  65. }
  66. HRESULT C_dxj_DirectSoundSource::InternalGetObject(IUnknown **pUnk){
  67. *pUnk=(IUnknown*)m__dxj_DirectSoundSource;
  68. return S_OK;
  69. }
  70. HRESULT C_dxj_DirectSoundSource::InternalSetObject(IUnknown *pUnk){
  71. m__dxj_DirectSoundSource=(LPDIRECTSOUNDSOURCE)pUnk;
  72. return S_OK;
  73. }
  74. HRESULT C_dxj_DirectSoundSource::GetFormat(WAVEFORMATEX_CDESC *WaveFormatEx)
  75. {
  76. HRESULT hr;
  77. DWORD dwSize;
  78. WAVEFORMATEX *fxFormat = (WAVEFORMATEX*)WaveFormatEx;
  79. fxFormat->cbSize = sizeof(WAVEFORMATEX);
  80. dwSize = sizeof(WAVEFORMATEX);
  81. if ( FAILED ( hr = m__dxj_DirectSoundSource->GetFormat(fxFormat, &dwSize) ) )
  82. return hr;
  83. //WaveFormatEx = (WAVEFORMATEX_CDESC)*fxFormat;
  84. return S_OK;
  85. }
  86. HRESULT C_dxj_DirectSoundSource::SetSink(I_dxj_DirectSoundSink *SoundSink)
  87. {
  88. HRESULT hr;
  89. DO_GETOBJECT_NOTNULL( LPDIRECTSOUNDSINK8, lpDSoundSink, SoundSink);
  90. if ( FAILED ( hr = m__dxj_DirectSoundSource->SetSink(lpDSoundSink) ) )
  91. return hr;
  92. return S_OK;
  93. }
  94. HRESULT C_dxj_DirectSoundSource::Seek(long lPosition)
  95. {
  96. HRESULT hr;
  97. if ( FAILED ( hr = m__dxj_DirectSoundSource->Seek(lPosition) ) )
  98. return hr;
  99. return S_OK;
  100. }
  101. HRESULT C_dxj_DirectSoundSource::Read(I_dxj_DirectSoundBuffer *Buffers[], long *busIDs, long lBusCount)
  102. {
  103. HRESULT hr;
  104. return S_OK;
  105. }
  106. HRESULT C_dxj_DirectSoundSource::GetSize(long *ret)
  107. {
  108. HRESULT hr;
  109. if ( FAILED ( hr = m__dxj_DirectSoundSource->GetSize((ULONGLONG*)ret) ) )
  110. return hr;
  111. return S_OK;
  112. }