/** * * SoundTouch.ax Header * 作成者: id:yuaaaa * ほんとはGPLっていわなきゃいけない * * $Id$ */ #include #include #include #include #include "stchguids.h" #include "ISoundTouch.h" #include "stchprop.h" #include "./soundtouch-1.3.1/include/SoundTouch.h" class CSoundTouch : public CTransInPlaceFilter , public ISpecifyPropertyPages , public ISoundTouch , public CPersistStream { public: static CUnknown * WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr); DECLARE_IUNKNOWN; HRESULT CheckInputType(const CMediaType *mtIn); HRESULT GetMediaType(int iPosition, CMediaType *pMediaType); STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv); int SizeMax(); STDMETHODIMP GetClassID(CLSID *pClsid); HRESULT Setup_GraphRate(void); // --- ISpecifyPropertyPages --- // return our property pages STDMETHODIMP GetPages(CAUUID * pPages); STDMETHODIMP get_TouchKey(int *pkey); STDMETHODIMP put_TouchKey(int key); //Change Pitch, but Not Change Tempo (use IMediaSeeking::SetRate) STDMETHODIMP get_Speed(float *pspeed); STDMETHODIMP put_Speed(float speed); STDMETHODIMP get_Setting ( uint id, uint *pparam ); STDMETHODIMP put_Setting ( uint id, uint param ); STDMETHODIMP get_Enable ( bool *penable ); STDMETHODIMP put_Enable ( bool enable ); protected: CSoundTouch(TCHAR *tszName, LPUNKNOWN punk, HRESULT *phr); private: 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. // This variable has no other purpose. static int m_nInstanceCount; // total instances int m_nThisInstance; HRESULT Transform(IMediaSample *pSample); void MessItAbout(PBYTE pb, int cb , int* retsize); void Setup_Pitch ( void ); protected: int m_SamplesPerSec; // Current sample format int m_BytesPerSample; // Current sample format int m_AvgBytesPerSec; int m_BlockAlign; int m_Channels; // Current sample format CCritSec m_SoundTouchLock; int m_Key; float m_Speed; bool m_Enable; soundtouch::SoundTouch SoundTouch; }; class CSoundTouch_AutoJoy : public CSoundTouch { public: static CUnknown * WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr); HRESULT CheckConnect(PIN_DIRECTION dir, IPin* pPin); STDMETHODIMP JoinFilterGraph(IFilterGraph* pGraph, LPCWSTR pName); STDMETHODIMP Run(REFERENCE_TIME tStart); STDMETHODIMP Pause(); STDMETHODIMP Stop(); HRESULT CheckInputType(const CMediaType* mtIn); HRESULT SetupSpeed ( int newspd ); void JoyDrawStatus ( void ); HWND joyhackWindow; HWND hookWindow; WNDPROC hookWndOrgProc; int speed; bool failed_subclass; private: CSoundTouch_AutoJoy(TCHAR *tszName, LPUNKNOWN punk, HRESULT *phr); HRESULT CheckAutoLoad (void); void SetSubclass(); static BOOL CALLBACK EnumChildWindowProc(HWND hwnd , LPARAM lp); static BOOL CALLBACK EnumWindowProc(HWND hwnd , LPARAM lp); static LRESULT CALLBACK SubProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); static LPCTSTR Str_WndProp_OrgProc; };