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.

120 lines
5.6 KiB

  1. // DirectSoundFXI3DL2SourcePage.cpp : Implementation of CDirectSoundFXI3DL2SourcePage
  2. #include "stdafx.h"
  3. #include "Dsdmoprp.h"
  4. #include "DirectSoundFXI3DL2SourcePage.h"
  5. /////////////////////////////////////////////////////////////////////////////
  6. // CDirectSoundFXI3DL2SourcePage
  7. const CRadioChoice::ButtonEntry g_rgWaveFlags[] =
  8. {
  9. IDC_RADIO_LPF, DSFX_I3DL2SOURCE_OCC_LPF,
  10. IDC_RADIO_VOLUME, DSFX_I3DL2SOURCE_OCC_VOLUME,
  11. 0
  12. };
  13. CDirectSoundFXI3DL2SourcePage::CDirectSoundFXI3DL2SourcePage()
  14. : m_radioFlags(g_rgWaveFlags)
  15. {
  16. m_dwTitleID = IDS_TITLEDirectSoundFXI3DL2SourcePage;
  17. m_dwHelpFileID = IDS_HELPFILEDirectSoundFXI3DL2SourcePage;
  18. m_dwDocStringID = IDS_DOCSTRINGDirectSoundFXI3DL2SourcePage;
  19. m_rgpHandlers[0] = &m_sliderDirect;
  20. m_rgpHandlers[1] = &m_sliderDirectHF;
  21. m_rgpHandlers[2] = &m_sliderRoom;
  22. m_rgpHandlers[3] = &m_sliderRoomHF;
  23. m_rgpHandlers[4] = &m_sliderRoomRolloffFactor;
  24. m_rgpHandlers[5] = &m_sliderObstruction;
  25. m_rgpHandlers[6] = &m_sliderObstructionLFRatio;
  26. m_rgpHandlers[7] = &m_sliderOcclusion;
  27. m_rgpHandlers[8] = &m_sliderOcclusionLFRatio;
  28. m_rgpHandlers[9] = &m_radioFlags;
  29. m_rgpHandlers[10] = NULL;
  30. }
  31. STDMETHODIMP CDirectSoundFXI3DL2SourcePage::SetObjects(ULONG nObjects, IUnknown **ppUnk)
  32. {
  33. if (nObjects < 1 || nObjects > 1)
  34. return E_UNEXPECTED;
  35. HRESULT hr = ppUnk[0]->QueryInterface(IID_IDirectSoundFXI3DL2Source, reinterpret_cast<void**>(&m_IDSFXI3DL2Source));
  36. return hr;
  37. }
  38. STDMETHODIMP CDirectSoundFXI3DL2SourcePage::Apply(void)
  39. {
  40. if (!m_IDSFXI3DL2Source)
  41. return E_UNEXPECTED;
  42. DSFXI3DL2Source dsfxi3dl2source;
  43. ZeroMemory(&dsfxi3dl2source, sizeof(DSFXI3DL2Source));
  44. dsfxi3dl2source.lDirect = static_cast<LONG>(m_sliderDirect.GetValue());
  45. dsfxi3dl2source.lDirectHF = static_cast<LONG>(m_sliderDirectHF.GetValue());
  46. dsfxi3dl2source.lRoom = static_cast<LONG>(m_sliderRoom.GetValue());
  47. dsfxi3dl2source.lRoomHF = static_cast<LONG>(m_sliderRoomHF.GetValue());
  48. dsfxi3dl2source.flRoomRolloffFactor = m_sliderRoomRolloffFactor.GetValue();
  49. dsfxi3dl2source.Obstruction.lHFLevel = static_cast<LONG>(m_sliderObstruction.GetValue());
  50. dsfxi3dl2source.Obstruction.flLFRatio = m_sliderObstructionLFRatio.GetValue();
  51. dsfxi3dl2source.Occlusion.lHFLevel = static_cast<LONG>(m_sliderOcclusion.GetValue());
  52. dsfxi3dl2source.Occlusion.flLFRatio = m_sliderOcclusionLFRatio.GetValue();
  53. dsfxi3dl2source.dwFlags = m_radioFlags.GetChoice(*this);
  54. HRESULT hr = m_IDSFXI3DL2Source->SetAllParameters(&dsfxi3dl2source);
  55. if (FAILED(hr))
  56. return hr;
  57. SetDirty(FALSE);
  58. return S_OK;
  59. }
  60. LRESULT CDirectSoundFXI3DL2SourcePage::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  61. {
  62. if (!m_IDSFXI3DL2Source)
  63. return 1;
  64. DSFXI3DL2Source dsfxi3dl2source;
  65. ZeroMemory(&dsfxi3dl2source, sizeof(DSFXI3DL2Source));
  66. m_IDSFXI3DL2Source->GetAllParameters(&dsfxi3dl2source);
  67. m_sliderDirect.Init(GetDlgItem(IDC_SLIDER_Direct), GetDlgItem(IDC_EDIT_Direct), DSFX_I3DL2SOURCE_DIRECT_MIN, DSFX_I3DL2SOURCE_DIRECT_MAX, true);
  68. m_sliderDirect.SetValue(static_cast<float>(dsfxi3dl2source.lDirect));
  69. m_sliderDirectHF.Init(GetDlgItem(IDC_SLIDER_DirectHF), GetDlgItem(IDC_EDIT_DirectHF), DSFX_I3DL2SOURCE_DIRECTHF_MIN, DSFX_I3DL2SOURCE_DIRECTHF_MAX, true);
  70. m_sliderDirectHF.SetValue(static_cast<float>(dsfxi3dl2source.lDirectHF));
  71. m_sliderRoom.Init(GetDlgItem(IDC_SLIDER_Room), GetDlgItem(IDC_EDIT_Room), DSFX_I3DL2SOURCE_ROOM_MIN, DSFX_I3DL2SOURCE_ROOM_MAX, true);
  72. m_sliderRoom.SetValue(static_cast<float>(dsfxi3dl2source.lRoom));
  73. m_sliderRoomHF.Init(GetDlgItem(IDC_SLIDER_RoomHF), GetDlgItem(IDC_EDIT_RoomHF), DSFX_I3DL2SOURCE_ROOMHF_MIN, DSFX_I3DL2SOURCE_ROOMHF_MAX, true);
  74. m_sliderRoomHF.SetValue(static_cast<float>(dsfxi3dl2source.lRoomHF));
  75. m_sliderRoomRolloffFactor.Init(GetDlgItem(IDC_SLIDER_RoomRolloffFactor), GetDlgItem(IDC_EDIT_RoomRolloffFactor), DSFX_I3DL2SOURCE_ROOMROLLOFFFACTOR_MIN, DSFX_I3DL2SOURCE_ROOMROLLOFFFACTOR_MAX, false);
  76. m_sliderRoomRolloffFactor.SetValue(dsfxi3dl2source.flRoomRolloffFactor);
  77. m_sliderObstruction.Init(GetDlgItem(IDC_SLIDER_Obstruction), GetDlgItem(IDC_EDIT_Obstruction), DSFX_I3DL2SOURCE_OBSTRUCTION_HFLEVEL_MIN, DSFX_I3DL2SOURCE_OBSTRUCTION_HFLEVEL_MAX, true);
  78. m_sliderObstruction.SetValue(static_cast<float>(dsfxi3dl2source.Obstruction.lHFLevel));
  79. m_sliderObstructionLFRatio.Init(GetDlgItem(IDC_SLIDER_ObstructionLFRatio), GetDlgItem(IDC_EDIT_ObstructionLFRatio), DSFX_I3DL2SOURCE_OBSTRUCTION_LFRATIO_MIN, DSFX_I3DL2SOURCE_OBSTRUCTION_LFRATIO_MAX, false);
  80. m_sliderObstructionLFRatio.SetValue(dsfxi3dl2source.Obstruction.flLFRatio);
  81. m_sliderOcclusion.Init(GetDlgItem(IDC_SLIDER_Occlusion), GetDlgItem(IDC_EDIT_Occlusion), DSFX_I3DL2SOURCE_OCCLUSION_HFLEVEL_MIN, DSFX_I3DL2SOURCE_OCCLUSION_HFLEVEL_MAX, true);
  82. m_sliderOcclusion.SetValue(static_cast<float>(dsfxi3dl2source.Occlusion.lHFLevel));
  83. m_sliderOcclusionLFRatio.Init(GetDlgItem(IDC_SLIDER_OcclusionLFRatio), GetDlgItem(IDC_EDIT_OcclusionLFRatio), DSFX_I3DL2SOURCE_OCCLUSION_LFRATIO_MIN, DSFX_I3DL2SOURCE_OCCLUSION_LFRATIO_MAX, false);
  84. m_sliderOcclusionLFRatio.SetValue(dsfxi3dl2source.Occlusion.flLFRatio);
  85. m_radioFlags.SetChoice(*this, dsfxi3dl2source.dwFlags);
  86. return 1;
  87. }
  88. LRESULT CDirectSoundFXI3DL2SourcePage::OnControlMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  89. {
  90. LRESULT lr = MessageHandlerChain(m_rgpHandlers, uMsg, wParam, lParam, bHandled);
  91. if (bHandled)
  92. SetDirty(TRUE);
  93. return lr;
  94. }