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.

97 lines
2.4 KiB

  1. // Copyright (c) 1999 Microsoft Corporation. All rights reserved.
  2. //
  3. // Implementation of CAutDirectMusicAudioPathConfig.
  4. //
  5. #include "stdinc.h"
  6. #include "autaudiopathconfig.h"
  7. #include "activescript.h"
  8. const WCHAR CAutDirectMusicAudioPathConfig::ms_wszClassName[] = L"AudioPathConfig";
  9. //////////////////////////////////////////////////////////////////////
  10. // Method Names/DispIDs
  11. const DISPID DMPDISP_Load = 1;
  12. const DISPID DMPDISP_Create = 2;
  13. const AutDispatchMethod CAutDirectMusicAudioPathConfig::ms_Methods[] =
  14. {
  15. // dispid, name,
  16. // return: type, (opt), (iid),
  17. // parm 1: type, opt, iid,
  18. // parm 2: type, opt, iid,
  19. // ...
  20. // ADT_None
  21. { DMPDISP_Load, L"Load",
  22. ADPARAM_NORETURN,
  23. ADT_None },
  24. { DMPDISP_Create, L"Create",
  25. ADT_Interface, true, &IID_IUnknown, // returned audiopath
  26. ADT_None },
  27. { DISPID_UNKNOWN }
  28. };
  29. const DispatchHandlerEntry<CAutDirectMusicAudioPathConfig> CAutDirectMusicAudioPathConfig::ms_Handlers[] =
  30. {
  31. { DMPDISP_Load, Load },
  32. { DMPDISP_Create, Create },
  33. { DISPID_UNKNOWN }
  34. };
  35. //////////////////////////////////////////////////////////////////////
  36. // Creation
  37. CAutDirectMusicAudioPathConfig::CAutDirectMusicAudioPathConfig(
  38. IUnknown* pUnknownOuter,
  39. const IID& iid,
  40. void** ppv,
  41. HRESULT *phr)
  42. : BaseImpAPConfig(pUnknownOuter, iid, ppv, phr)
  43. {
  44. }
  45. HRESULT
  46. CAutDirectMusicAudioPathConfig::CreateInstance(
  47. IUnknown* pUnknownOuter,
  48. const IID& iid,
  49. void** ppv)
  50. {
  51. HRESULT hr = S_OK;
  52. CAutDirectMusicAudioPathConfig *pInst = new CAutDirectMusicAudioPathConfig(pUnknownOuter, iid, ppv, &hr);
  53. if (FAILED(hr))
  54. {
  55. delete pInst;
  56. return hr;
  57. }
  58. if (pInst == NULL)
  59. return E_OUTOFMEMORY;
  60. return hr;
  61. }
  62. //////////////////////////////////////////////////////////////////////
  63. // Automation methods
  64. HRESULT
  65. CAutDirectMusicAudioPathConfig::Load(AutDispatchDecodedParams *paddp)
  66. {
  67. // Loading is actually implemented generically by container items.
  68. // If we're here, we're already loaded and don't need to do anything.
  69. return S_OK;
  70. }
  71. HRESULT
  72. CAutDirectMusicAudioPathConfig::Create(AutDispatchDecodedParams *paddp)
  73. {
  74. IDirectMusicAudioPath **ppAudioPath = reinterpret_cast<IDirectMusicAudioPath **>(paddp->pvReturn);
  75. if (!ppAudioPath)
  76. return S_OK;
  77. HRESULT hr = S_OK;
  78. IDirectMusicPerformance8 *pPerformance = CActiveScriptManager::GetCurrentPerformanceWEAK();
  79. hr = pPerformance->CreateAudioPath(m_pITarget, TRUE, ppAudioPath);
  80. if (FAILED(hr))
  81. return hr;
  82. return S_OK;
  83. }