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.

105 lines
3.7 KiB

  1. // DirectSoundFXFlangerPage.cpp : Implementation of CDirectSoundFXFlangerPage
  2. #include "stdafx.h"
  3. #include "Dsdmoprp.h"
  4. #include "DirectSoundFXFlangerPage.h"
  5. /////////////////////////////////////////////////////////////////////////////
  6. // CDirectSoundFXFlangerPage
  7. const CRadioChoice::ButtonEntry g_rgWaveButtons[] =
  8. {
  9. IDC_RADIO_TRIANGLE, DSFXCHORUS_WAVE_TRIANGLE, // �� chorus/flanger
  10. IDC_RADIO_SIN, DSFXCHORUS_WAVE_SIN, // �� chorus/flanger
  11. 0
  12. };
  13. CDirectSoundFXFlangerPage::CDirectSoundFXFlangerPage()
  14. : m_radioWaveform(g_rgWaveButtons)
  15. {
  16. m_dwTitleID = IDS_TITLEDirectSoundFXFlangerPage;
  17. m_dwHelpFileID = IDS_HELPFILEDirectSoundFXFlangerPage;
  18. m_dwDocStringID = IDS_DOCSTRINGDirectSoundFXFlangerPage;
  19. m_rgpHandlers[0] = &m_sliderWetDryMix;
  20. m_rgpHandlers[1] = &m_sliderDepth;
  21. m_rgpHandlers[2] = &m_sliderFeedback;
  22. m_rgpHandlers[3] = &m_sliderFrequency;
  23. m_rgpHandlers[4] = &m_sliderDelay;
  24. m_rgpHandlers[5] = &m_sliderPhase;
  25. m_rgpHandlers[6] = &m_radioWaveform;
  26. m_rgpHandlers[7] = NULL;
  27. }
  28. STDMETHODIMP CDirectSoundFXFlangerPage::SetObjects(ULONG nObjects, IUnknown **ppUnk)
  29. {
  30. if (nObjects < 1 || nObjects > 1)
  31. return E_UNEXPECTED;
  32. HRESULT hr = ppUnk[0]->QueryInterface(IID_IDirectSoundFXFlanger, reinterpret_cast<void**>(&m_IDSFXFlanger));
  33. return hr;
  34. }
  35. STDMETHODIMP CDirectSoundFXFlangerPage::Apply(void)
  36. {
  37. if (!m_IDSFXFlanger)
  38. return E_UNEXPECTED;
  39. DSFXFlanger dsfxflanger;
  40. ZeroMemory(&dsfxflanger, sizeof(DSFXFlanger));
  41. dsfxflanger.fWetDryMix = m_sliderWetDryMix.GetValue();
  42. dsfxflanger.fDepth = m_sliderDepth.GetValue();
  43. dsfxflanger.fFeedback = m_sliderFeedback.GetValue();
  44. dsfxflanger.fFrequency = m_sliderFrequency.GetValue();
  45. dsfxflanger.fDelay = m_sliderDelay.GetValue();
  46. dsfxflanger.lPhase = static_cast<short>(m_sliderPhase.GetValue());
  47. dsfxflanger.lWaveform = m_radioWaveform.GetChoice(*this);
  48. HRESULT hr = m_IDSFXFlanger->SetAllParameters(&dsfxflanger);
  49. if (FAILED(hr))
  50. return hr;
  51. SetDirty(FALSE);
  52. return S_OK;
  53. }
  54. LRESULT CDirectSoundFXFlangerPage::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  55. {
  56. if (!m_IDSFXFlanger)
  57. return 1;
  58. DSFXFlanger dsfxflanger;
  59. ZeroMemory(&dsfxflanger, sizeof(DSFXFlanger));
  60. m_IDSFXFlanger->GetAllParameters(&dsfxflanger);
  61. m_sliderWetDryMix.Init(GetDlgItem(IDC_SLIDER_WetDryMix), GetDlgItem(IDC_EDIT_WetDryMix), 0, 100, false);
  62. m_sliderWetDryMix.SetValue(dsfxflanger.fWetDryMix);
  63. m_sliderDepth.Init(GetDlgItem(IDC_SLIDER_Depth), GetDlgItem(IDC_EDIT_Depth), 0, 100, false);
  64. m_sliderDepth.SetValue(dsfxflanger.fDepth);
  65. m_sliderFeedback.Init(GetDlgItem(IDC_SLIDER_Feedback), GetDlgItem(IDC_EDIT_Feedback), -99, 99, false);
  66. m_sliderFeedback.SetValue(dsfxflanger.fFeedback);
  67. m_sliderFrequency.Init(GetDlgItem(IDC_SLIDER_Frequency), GetDlgItem(IDC_EDIT_Frequency), 0, 10, false);
  68. m_sliderFrequency.SetValue(dsfxflanger.fFrequency);
  69. m_sliderDelay.Init(GetDlgItem(IDC_SLIDER_Delay), GetDlgItem(IDC_EDIT_Delay), 0, 4, false);
  70. m_sliderDelay.SetValue(dsfxflanger.fDelay);
  71. m_sliderPhase.Init(GetDlgItem(IDC_SLIDER_Phase), GetDlgItem(IDC_EDIT_Phase), 0, 4, true);
  72. m_sliderPhase.SetValue(static_cast<float>(dsfxflanger.lPhase));
  73. m_radioWaveform.SetChoice(*this, dsfxflanger.lWaveform);
  74. return 1;
  75. }
  76. LRESULT CDirectSoundFXFlangerPage::OnControlMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  77. {
  78. LRESULT lr = MessageHandlerChain(m_rgpHandlers, uMsg, wParam, lParam, bHandled);
  79. if (bHandled)
  80. SetDirty(TRUE);
  81. return lr;
  82. }