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.

95 lines
3.0 KiB

  1. // DirectSoundFXEchoPage.cpp : Implementation of CDirectSoundFXEchoPage
  2. #include "stdafx.h"
  3. #include "Dsdmoprp.h"
  4. #include "DirectSoundFXEchoPage.h"
  5. /////////////////////////////////////////////////////////////////////////////
  6. // CDirectSoundFXEchoPage
  7. const CRadioChoice::ButtonEntry g_rgPanDelayButtons[] =
  8. {
  9. IDC_RADIO_PANNED, 1,
  10. IDC_RADIO_NOTPANNED, 0,
  11. 0
  12. };
  13. CDirectSoundFXEchoPage::CDirectSoundFXEchoPage()
  14. : m_radioPanDelay(g_rgPanDelayButtons)
  15. {
  16. m_dwTitleID = IDS_TITLEDirectSoundFXEchoPage;
  17. m_dwHelpFileID = IDS_HELPFILEDirectSoundFXEchoPage;
  18. m_dwDocStringID = IDS_DOCSTRINGDirectSoundFXEchoPage;
  19. m_rgpHandlers[0] = &m_sliderWetDryMix;
  20. m_rgpHandlers[1] = &m_sliderFeedback;
  21. m_rgpHandlers[2] = &m_sliderLeftDelay;
  22. m_rgpHandlers[3] = &m_sliderRightDelay;
  23. m_rgpHandlers[4] = &m_radioPanDelay;
  24. m_rgpHandlers[5] = NULL;
  25. }
  26. STDMETHODIMP CDirectSoundFXEchoPage::SetObjects(ULONG nObjects, IUnknown **ppUnk)
  27. {
  28. if (nObjects < 1 || nObjects > 1)
  29. return E_UNEXPECTED;
  30. HRESULT hr = ppUnk[0]->QueryInterface(IID_IDirectSoundFXEcho, reinterpret_cast<void**>(&m_IDSFXEcho));
  31. return hr;
  32. }
  33. STDMETHODIMP CDirectSoundFXEchoPage::Apply(void)
  34. {
  35. if (!m_IDSFXEcho)
  36. return E_UNEXPECTED;
  37. DSFXEcho dsfxecho;
  38. ZeroMemory(&dsfxecho, sizeof(DSFXEcho));
  39. dsfxecho.fWetDryMix = m_sliderWetDryMix.GetValue();
  40. dsfxecho.fFeedback = m_sliderFeedback.GetValue();
  41. dsfxecho.fLeftDelay = m_sliderLeftDelay.GetValue();
  42. dsfxecho.fRightDelay = m_sliderRightDelay.GetValue();
  43. dsfxecho.lPanDelay = m_radioPanDelay.GetChoice(*this);
  44. HRESULT hr = m_IDSFXEcho->SetAllParameters(&dsfxecho);
  45. if (FAILED(hr))
  46. return hr;
  47. SetDirty(FALSE);
  48. return S_OK;
  49. }
  50. LRESULT CDirectSoundFXEchoPage::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  51. {
  52. if (!m_IDSFXEcho)
  53. return 1;
  54. DSFXEcho dsfxecho;
  55. ZeroMemory(&dsfxecho, sizeof(DSFXEcho));
  56. m_IDSFXEcho->GetAllParameters(&dsfxecho);
  57. m_sliderWetDryMix.Init(GetDlgItem(IDC_SLIDER_WetDryMix), GetDlgItem(IDC_EDIT_WetDryMix), 0, 100, false);
  58. m_sliderWetDryMix.SetValue(dsfxecho.fWetDryMix);
  59. m_sliderFeedback.Init(GetDlgItem(IDC_SLIDER_Feedback), GetDlgItem(IDC_EDIT_Feedback), 0, 100, false);
  60. m_sliderFeedback.SetValue(dsfxecho.fFeedback);
  61. m_sliderLeftDelay.Init(GetDlgItem(IDC_SLIDER_LeftDelay), GetDlgItem(IDC_EDIT_LeftDelay), 1, 2000, false);
  62. m_sliderLeftDelay.SetValue(dsfxecho.fLeftDelay);
  63. m_sliderRightDelay.Init(GetDlgItem(IDC_SLIDER_RightDelay), GetDlgItem(IDC_EDIT_RightDelay), 1, 2000, false);
  64. m_sliderRightDelay.SetValue(dsfxecho.fRightDelay);
  65. m_radioPanDelay.SetChoice(*this, dsfxecho.lPanDelay);
  66. return 1;
  67. }
  68. LRESULT CDirectSoundFXEchoPage::OnControlMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  69. {
  70. LRESULT lr = MessageHandlerChain(m_rgpHandlers, uMsg, wParam, lParam, bHandled);
  71. if (bHandled)
  72. SetDirty(TRUE);
  73. return lr;
  74. }