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.

86 lines
2.7 KiB

  1. // DirectSoundFXParamEqPage.cpp : Implementation of CDirectSoundFXParamEqPage
  2. #include "stdafx.h"
  3. #include "Dsdmoprp.h"
  4. #include "DirectSoundFXParamEqPage.h"
  5. /////////////////////////////////////////////////////////////////////////////
  6. // CDirectSoundFXParamEqPage
  7. CDirectSoundFXParamEqPage::CDirectSoundFXParamEqPage()
  8. {
  9. m_dwTitleID = IDS_TITLEDirectSoundFXParamEqPage;
  10. m_dwHelpFileID = IDS_HELPFILEDirectSoundFXParamEqPage;
  11. m_dwDocStringID = IDS_DOCSTRINGDirectSoundFXParamEqPage;
  12. m_rgpHandlers[0] = &m_sliderCenter;
  13. m_rgpHandlers[1] = &m_sliderBandwidth;
  14. m_rgpHandlers[2] = &m_sliderGain;
  15. m_rgpHandlers[3] = NULL;
  16. }
  17. STDMETHODIMP CDirectSoundFXParamEqPage::SetObjects(ULONG nObjects, IUnknown **ppUnk)
  18. {
  19. if (nObjects < 1 || nObjects > 1)
  20. return E_UNEXPECTED;
  21. HRESULT hr = ppUnk[0]->QueryInterface(IID_IDirectSoundFXParamEq, reinterpret_cast<void**>(&m_IDSFXParamEq));
  22. return hr;
  23. }
  24. STDMETHODIMP CDirectSoundFXParamEqPage::Apply(void)
  25. {
  26. if (!m_IDSFXParamEq)
  27. return E_UNEXPECTED;
  28. DSFXParamEq dsfxparameq;
  29. ZeroMemory(&dsfxparameq, sizeof(DSFXParamEq));
  30. dsfxparameq.fCenter = m_sliderCenter.GetValue();
  31. dsfxparameq.fBandwidth = m_sliderBandwidth.GetValue();
  32. dsfxparameq.fGain = m_sliderGain.GetValue();
  33. HRESULT hr = m_IDSFXParamEq->SetAllParameters(&dsfxparameq);
  34. if (FAILED(hr))
  35. return hr;
  36. hr = m_IDSFXParamEq->GetAllParameters(&dsfxparameq);
  37. if (FAILED(hr))
  38. return hr;
  39. m_sliderCenter.SetValue(dsfxparameq.fCenter);
  40. m_sliderBandwidth.SetValue(dsfxparameq.fBandwidth);
  41. m_sliderGain.SetValue(dsfxparameq.fGain);
  42. SetDirty(FALSE);
  43. return S_OK;
  44. }
  45. LRESULT CDirectSoundFXParamEqPage::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  46. {
  47. if (!m_IDSFXParamEq)
  48. return 1;
  49. DSFXParamEq dsfxparameq;
  50. ZeroMemory(&dsfxparameq, sizeof(DSFXParamEq));
  51. m_IDSFXParamEq->GetAllParameters(&dsfxparameq);
  52. m_sliderCenter.Init(GetDlgItem(IDC_SLIDER_Center), GetDlgItem(IDC_EDIT_Center), 80, 16000, true);
  53. m_sliderCenter.SetValue(dsfxparameq.fCenter);
  54. m_sliderBandwidth.Init(GetDlgItem(IDC_SLIDER_Bandwidth), GetDlgItem(IDC_EDIT_Bandwidth), 1, 36, false);
  55. m_sliderBandwidth.SetValue(dsfxparameq.fBandwidth);
  56. m_sliderGain.Init(GetDlgItem(IDC_SLIDER_Gain), GetDlgItem(IDC_EDIT_Gain), -15, 15, false);
  57. m_sliderGain.SetValue(dsfxparameq.fGain);
  58. return 1;
  59. }
  60. LRESULT CDirectSoundFXParamEqPage::OnControlMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  61. {
  62. LRESULT lr = MessageHandlerChain(m_rgpHandlers, uMsg, wParam, lParam, bHandled);
  63. if (bHandled)
  64. SetDirty(TRUE);
  65. return lr;
  66. }