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.

48 lines
1.5 KiB

  1. // Copyright (c) 2000 Microsoft Corporation. All rights reserved.
  2. //
  3. // Code that needs to be shared between the script track (CDirectMusicScriptTrack) and
  4. // the script object (CDirectMusicScript, etc.).
  5. //
  6. #include "stdinc.h"
  7. #include "trackshared.h"
  8. #include "dmusicp.h"
  9. HRESULT FireScriptTrackErrorPMsg(IDirectMusicPerformance *pPerf, IDirectMusicSegmentState *pSegSt, DWORD dwVirtualTrackID, DMUS_SCRIPT_ERRORINFO *pErrorInfo)
  10. {
  11. SmartRef::ComPtr<IDirectMusicGraph> scomGraph;
  12. HRESULT hr = pSegSt->QueryInterface(IID_IDirectMusicGraph, reinterpret_cast<void**>(&scomGraph));
  13. if (FAILED(hr))
  14. return hr;
  15. SmartRef::PMsg<DMUS_SCRIPT_TRACK_ERROR_PMSG> pmsgScriptTrackError(pPerf);
  16. hr = pmsgScriptTrackError.hr();
  17. if (FAILED(hr))
  18. return hr;
  19. // generic PMsg fields
  20. REFERENCE_TIME rtTimeNow = 0;
  21. hr = pPerf->GetTime(&rtTimeNow, NULL);
  22. if (FAILED(hr))
  23. return hr;
  24. pmsgScriptTrackError.p->rtTime = rtTimeNow;
  25. pmsgScriptTrackError.p->dwFlags = DMUS_PMSGF_REFTIME | DMUS_PMSGF_LOCKTOREFTIME | DMUS_PMSGF_DX8;
  26. // dwPChannel: the script doesn't have a channel so leave as 0
  27. pmsgScriptTrackError.p->dwVirtualTrackID = dwVirtualTrackID;
  28. pmsgScriptTrackError.p->dwType = DMUS_PMSGT_SCRIPTTRACKERROR;
  29. pmsgScriptTrackError.p->dwGroupID = -1; // the script track doesn't have a group so just say all
  30. // error PMsg fields
  31. CopyMemory(&pmsgScriptTrackError.p->ErrorInfo, pErrorInfo, sizeof(pmsgScriptTrackError.p->ErrorInfo));
  32. // send it
  33. pmsgScriptTrackError.StampAndSend(scomGraph);
  34. hr = pmsgScriptTrackError.hr();
  35. if (FAILED(hr))
  36. return hr;
  37. return S_OK;
  38. }