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.

101 lines
3.2 KiB

  1. //
  2. //
  3. //
  4. #ifndef _DirectSoundSVerb_p_
  5. #define _DirectSoundSVerb_p_
  6. #include "dsdmobse.h"
  7. #include "dmocom.h"
  8. #include "dsdmo.h"
  9. #include "PropertyHelp.h"
  10. #include "param.h"
  11. class CDirectSoundWavesReverbDMO :
  12. public CDirectSoundDMO,
  13. public CParamsManager,
  14. public ISpecifyPropertyPages,
  15. public IDirectSoundFXWavesReverb,
  16. public CParamsManager::UpdateCallback,
  17. public CComBase
  18. {
  19. public:
  20. CDirectSoundWavesReverbDMO( IUnknown *pUnk, HRESULT *phr );
  21. ~CDirectSoundWavesReverbDMO();
  22. DECLARE_IUNKNOWN;
  23. STDMETHODIMP NDQueryInterface(REFIID riid, void **ppv);
  24. static CComBase* WINAPI CreateInstance(IUnknown *pUnk, HRESULT *phr);
  25. // InitOnCreation is called by the class factory to give the object a chance to initialize
  26. // immediately after it is created. This is used to prepare the object's parameter information.
  27. HRESULT InitOnCreation();
  28. // The Init function is an override from the CPCMDMO base class and it provides initialization
  29. // for the effect's actual audio processing. Note that InputType must have been set before this
  30. // occurs in order for this to work.
  31. HRESULT Init();
  32. STDMETHOD(Clone) (THIS_ IMediaObjectInPlace **);
  33. STDMETHOD(SetAllParameters) (THIS_ LPCDSFXWavesReverb p);
  34. STDMETHOD(GetAllParameters) (THIS_ LPDSFXWavesReverb p);
  35. // ISpecifyPropertyPages
  36. STDMETHOD(GetPages)(CAUUID * pPages) { return PropertyHelp::GetPages(CLSID_DirectSoundPropWavesReverb, pPages); }
  37. // IPersist methods
  38. virtual HRESULT STDMETHODCALLTYPE GetClassID( CLSID *pClassID );
  39. // IPersistStream
  40. STDMETHOD(IsDirty)(void)
  41. { return m_fDirty ? S_OK : S_FALSE; }
  42. STDMETHOD(Load)(IStream *pStm)
  43. { return PropertyHelp::Load(this, DSFXWavesReverb(), pStm); }
  44. STDMETHOD(Save)(IStream *pStm, BOOL fClearDirty)
  45. { return PropertyHelp::Save(this, DSFXWavesReverb(), pStm, fClearDirty); }
  46. STDMETHOD(GetSizeMax)(ULARGE_INTEGER *pcbSize)
  47. { if (!pcbSize) return E_POINTER; pcbSize->QuadPart = sizeof(DSFXWavesReverb); return S_OK; }
  48. // SetParam handling
  49. STDMETHODIMP SetParam(DWORD dwParamIndex,MP_DATA value);
  50. HRESULT SetParamUpdate(DWORD dwParamIndex, MP_DATA value) { return SetParamInternal(dwParamIndex, value, true); }
  51. HRESULT SetParamInternal(DWORD dwParamIndex, MP_DATA value, bool fSkipPasssingToParamManager);
  52. // Overrides
  53. //
  54. HRESULT FBRProcess(DWORD cQuanta, BYTE *pIn, BYTE *pOut);
  55. HRESULT ProcessInPlace(ULONG ulQuanta, LPBYTE pcbData, REFERENCE_TIME rtStart, DWORD dwFlags);
  56. HRESULT Discontinuity();
  57. // Called whenever a parameter has changed to recalculate the effect coefficients based on the cached parameter values.
  58. void UpdateCoefficients();
  59. bool m_fDirty;
  60. private:
  61. bool m_fInitCPCMDMO;
  62. // cached parameter values
  63. MP_DATA m_fGain;
  64. MP_DATA m_fMix;
  65. MP_DATA m_fTime;
  66. MP_DATA m_fRatio;
  67. void (*m_pfnSVerbProcess)(long, short*, short*, void*, long*);
  68. // Internal SVerb state
  69. //
  70. BYTE *m_pbCoeffs;
  71. long *m_plStates;
  72. protected:
  73. HRESULT CheckInputType(const DMO_MEDIA_TYPE *pmt);
  74. };
  75. EXT_STD_CREATE(WavesReverb);
  76. #endif