home *** CD-ROM | disk | FTP | other *** search
- //==========================================================================;
- //
- // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
- // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
- // PURPOSE.
- //
- // Copyright (c) 1992 - 1996 Microsoft Corporation. All Rights Reserved.
- //
- //--------------------------------------------------------------------------;
- //
- // Gargle filter - derived from CTransInPlaceFilter.
-
- const int MaxGargleRate = 1000; // 1000Hz max rate
- const int MinGargleRate = 1; // 1Hz min rate
- const int DefaultGargleRate = 10; // 10 Hz default
-
-
- // CGargle
- //
- class CGargle
- : public CTransInPlaceFilter // main Quartz interfaces
-
- , public ISpecifyPropertyPages // Needed for properties only
-
- , public IGargle // Needed for properties only.
- // Without this the PURE virtual
- // functions in IGargle will not
- // be implemented. (If they ever
- // got called the entire app would
- // silently ExitProcess!!).
-
- , public CPersistStream // implements IPersistStream
- {
-
- public:
-
- static CUnknown *CreateInstance(LPUNKNOWN punk, HRESULT *phr);
-
- DECLARE_IUNKNOWN;
-
- //
- // --- CTransInPlaceFilter Overrides --
- //
-
- HRESULT CheckInputType(const CMediaType *mtIn);
-
- // Basic COM - used here to reveal our property interface.
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);
-
- // CPersistStream overrides
- HRESULT WriteToStream(IStream *pStream);
- HRESULT ReadFromStream(IStream *pStream);
- int SizeMax();
- STDMETHODIMP GetClassID(CLSID *pClsid);
-
- // --- ISpecifyPropertyPages ---
-
- // return our property pages
- STDMETHODIMP GetPages(CAUUID * pPages);
-
- // setup helper
- LPAMOVIESETUP_FILTER GetSetupData();
-
- // IGargle - private interface to put/set properties
- STDMETHODIMP get_GargleRate(int *GargleRate);
- STDMETHODIMP put_GargleRate(int GargleRate);
- STDMETHODIMP put_DefaultGargleRate(void);
- STDMETHODIMP put_GargleShape(int iGargleShape);
- STDMETHODIMP get_GargleShape(int *GargleShape);
-
- private:
-
- // Constructor
- CGargle(TCHAR *tszName, LPUNKNOWN punk, HRESULT *phr);
-
- // Overrides the PURE virtual Transform of CTransInPlaceFilter base class
- // This is where the "real work" is done.
- HRESULT Transform(IMediaSample *pSample);
-
- // This is where the real work is really done (called from Transform)
- void MessItAbout(PBYTE pb, int cb);
-
- // Overrides a CTransformInPlace function. Called as part of connecting.
- virtual HRESULT SetMediaType(PIN_DIRECTION direction, const CMediaType *pmt);
-
- // If there are multiple instances of this filter active, it's
- // useful for debug messages etc. to know which one this is.
- static m_nInstanceCount; // total instances
- int m_nThisInstance;
-
- const int m_DefaultGargleRate; // The default rate (Hz)
- int m_GargleRate; // The current rate (Hz)
- int m_Shape; // 0=triangle, 1==square
- int m_SamplesPerSec; // Current sample format
- int m_BytesPerSample; // Current sample format
- int m_Channels; // Current sample format
- int m_Phase; // See MessItAbout in gargle.cpp
- CCritSec m_GargleLock; // To serialise access.
- };
-