MediaParams.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. // MediaParams.h: interface for the CMediaParams class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_MEDIAPARAMS_H__3DB99F00_3887_4C35_BBA8_C47835777A69__INCLUDED_)
  5. #define AFX_MEDIAPARAMS_H__3DB99F00_3887_4C35_BBA8_C47835777A69__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #include <MedParam.h> // DX8 automation
  10. #include "CakeMedParam.h" // DX8 automation
  11. #include "ParamEnvelope.h"
  12. #include "Parameters.h"
  13. ////////////////////////////////////////////////////////////////////////////////
  14. class CMediaParams :
  15. public IMediaParams,
  16. public IMediaParamInfo,
  17. public IMediaParamsSetUICallback,
  18. public IMediaParamsUICallback
  19. {
  20. public:
  21. static HRESULT Create( CMediaParams** ppObj, IUnknown* pUnkOuter );
  22. public:
  23. // IUnknown
  24. STDMETHOD(QueryInterface)( REFIID riid, void** ppv );
  25. STDMETHODIMP_(ULONG) AddRef();
  26. STDMETHODIMP_(ULONG) Release();
  27. // IMediaParams
  28. STDMETHOD(GetParam)(ULONG dwParamIndex, FLOAT* pValue);
  29. STDMETHOD(SetParam)(ULONG dwParamIndex, FLOAT value);
  30. STDMETHOD(AddEnvelope)(ULONG dwParamIndex, ULONG cSegments, MP_ENVELOPE_SEGMENT* pEnvelopeSegments);
  31. STDMETHOD(FlushEnvelope)(ULONG dwParamIndex, REFERENCE_TIME refTimeStart, REFERENCE_TIME refTimeEnd);
  32. STDMETHOD(SetTimeFormat)(GUID guidTimeFormat, ULONG mpTimeData);
  33. // IMediaParamInfo
  34. STDMETHOD(GetParamCount)(ULONG* pdwParams);
  35. STDMETHOD(GetParamInfo)(ULONG dwParamIndex, MP_PARAMINFO* pInfo);
  36. STDMETHOD(GetParamText)(ULONG dwParamIndex, WCHAR** ppwchText);
  37. STDMETHOD(GetNumTimeFormats)(ULONG* pdwNumTimeFormats);
  38. STDMETHOD(GetSupportedTimeFormat)(ULONG dwFormatIndex, GUID* pguidTimeFormat);
  39. STDMETHOD(GetCurrentTimeFormat)(GUID* pguidTimeFormat, ULONG* pTimeData);
  40. // IMediaParamsSetUICallback
  41. STDMETHOD(SetUICallback)(IMediaParamsUICallback* pICallback);
  42. // IMediaParamsUICallback
  43. STDMETHOD(ParamsBeginCapture)(DWORD *aIndex, DWORD cPoints);
  44. STDMETHOD(ParamsChanged)(DWORD *aIndex, DWORD cPoints, MP_DATA *paData);
  45. STDMETHOD(ParamsEndCapture)(DWORD *aIndex, DWORD cPoints);
  46. // Helpers for setting the current sample rate
  47. void SetSampleRate( long lFs ) { m_lFs = lFs; }
  48. long GetSampleRate() const { return m_lFs; }
  49. // Helpers to decimate shapes into smaller chunks
  50. HRESULT GetDecimationTimes( LONGLONG llSampStart, LONGLONG llSampEnd, std::vector<LONGLONG>* pTimes );
  51. void SetDecimationInterval( double d ) { m_dDecimationInterval = d; }
  52. double GetDecimationInterval() const { return m_dDecimationInterval; }
  53. // Set our position among all parameter segments, updating current values, and
  54. // flushing any out-of-date segments.
  55. HRESULT UpdateValuesForSample( LONGLONG llSamp );
  56. // Get the envelope for a given parameter
  57. const CParamEnvelope& GetParamEnvelope( DWORD ix )
  58. {
  59. ASSERT( ix >= 0 && ix < NUM_PARAMS );
  60. return m_aEnv[ ix ];
  61. }
  62. private:
  63. IUnknown* m_pUnkOuter;
  64. IMediaParamsUICallback* m_pCallback;
  65. LONG m_cRef;
  66. CParamEnvelope* m_aEnv;
  67. double m_dDecimationInterval;
  68. long m_lFs;
  69. private:
  70. static const ParamInfo m_aParamInfo[ NUM_PARAMS ];
  71. private:
  72. CMediaParams( IUnknown* pUnkOuter );
  73. virtual ~CMediaParams();
  74. };
  75. #endif // !defined(AFX_MEDIAPARAMS_H__3DB99F00_3887_4C35_BBA8_C47835777A69__INCLUDED_)