home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / mac / SiteBldr / AMOVIE / SDK / _SETUP / COMMON.Z / gargle.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-17  |  3.7 KB  |  101 lines

  1. //==========================================================================;
  2. //
  3. //  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. //  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. //  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. //  PURPOSE.
  7. //
  8. //  Copyright (c) 1992 - 1996  Microsoft Corporation.  All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------;
  11. //
  12. // Gargle filter - derived from CTransInPlaceFilter.
  13.  
  14. const int MaxGargleRate = 1000;    // 1000Hz max rate
  15. const int MinGargleRate = 1;       // 1Hz min rate
  16. const int DefaultGargleRate = 10;  // 10 Hz default
  17.  
  18.  
  19. // CGargle
  20. //
  21. class CGargle
  22.     : public CTransInPlaceFilter       // main Quartz interfaces
  23.  
  24.     , public ISpecifyPropertyPages     // Needed for properties only
  25.  
  26.     , public IGargle                   // Needed for properties only.
  27.                                        // Without this the PURE virtual
  28.                                        // functions in IGargle will not
  29.                                        // be implemented.  (If they ever
  30.                                        // got called the entire app would
  31.                                        // silently ExitProcess!!).
  32.  
  33.     , public CPersistStream            // implements IPersistStream
  34. {
  35.  
  36. public:
  37.  
  38.     static CUnknown *CreateInstance(LPUNKNOWN punk, HRESULT *phr);
  39.  
  40.     DECLARE_IUNKNOWN;
  41.  
  42.     //
  43.     // --- CTransInPlaceFilter Overrides --
  44.     //
  45.  
  46.     HRESULT CheckInputType(const CMediaType *mtIn);
  47.  
  48.     // Basic COM - used here to reveal our property interface.
  49.     STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);
  50.  
  51.     // CPersistStream overrides
  52.     HRESULT WriteToStream(IStream *pStream);
  53.     HRESULT ReadFromStream(IStream *pStream);
  54.     int SizeMax();
  55.     STDMETHODIMP GetClassID(CLSID *pClsid);
  56.  
  57.     // --- ISpecifyPropertyPages ---
  58.  
  59.     // return our property pages
  60.     STDMETHODIMP GetPages(CAUUID * pPages);
  61.  
  62.     // setup helper
  63.     LPAMOVIESETUP_FILTER GetSetupData();
  64.  
  65.     // IGargle - private interface to put/set properties
  66.     STDMETHODIMP get_GargleRate(int *GargleRate);
  67.     STDMETHODIMP put_GargleRate(int GargleRate);
  68.     STDMETHODIMP put_DefaultGargleRate(void);
  69.     STDMETHODIMP put_GargleShape(int iGargleShape);
  70.     STDMETHODIMP get_GargleShape(int *GargleShape);
  71.  
  72. private:
  73.  
  74.     // Constructor
  75.     CGargle(TCHAR *tszName, LPUNKNOWN punk, HRESULT *phr);
  76.  
  77.     // Overrides the PURE virtual Transform of CTransInPlaceFilter base class
  78.     // This is where the "real work" is done.
  79.     HRESULT Transform(IMediaSample *pSample);
  80.  
  81.     // This is where the real work is really done (called from Transform)
  82.     void MessItAbout(PBYTE pb, int cb);
  83.  
  84.     // Overrides a CTransformInPlace function.  Called as part of connecting.
  85.     virtual HRESULT SetMediaType(PIN_DIRECTION direction, const CMediaType *pmt);
  86.  
  87.     // If there are multiple instances of this filter active, it's
  88.     // useful for debug messages etc. to know which one this is.
  89.     static m_nInstanceCount;                   // total instances
  90.     int m_nThisInstance;
  91.  
  92.     const int           m_DefaultGargleRate;   // The default rate (Hz)
  93.     int                 m_GargleRate;          // The current rate (Hz)
  94.     int                 m_Shape;               // 0=triangle, 1==square
  95.     int                 m_SamplesPerSec;       // Current sample format
  96.     int                 m_BytesPerSample;      // Current sample format
  97.     int                 m_Channels;            // Current sample format
  98.     int                 m_Phase;               // See MessItAbout in gargle.cpp
  99.     CCritSec            m_GargleLock;          // To serialise access.
  100. };
  101.