Msptrmac.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:3k
源码类别:

模拟服务器

开发平台:

C/C++

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. //        Copyright (c) Microsoft Corporation. All rights reserved.
  4. //
  5. //        Name: tmaudcap.h
  6. //
  7. // Description: Definition of the CAudioCaptureTerminal class
  8. //
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef _MSPTRMAC_H_
  11. #define _MSPTRMAC_H_
  12. #define WAVEIN_NAME L"WaveIn Terminal"
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CAudioCaptureTerminal
  15. class CAudioCaptureTerminal : 
  16.     public IDispatchImpl<ITBasicAudioTerminal, &IID_ITBasicAudioTerminal, &LIBID_TAPI3Lib>, 
  17.     public IDispatchImpl<ITStaticAudioTerminal, &IID_ITStaticAudioTerminal, &LIBID_TAPI3Lib>, 
  18.     public CSingleFilterStaticTerminal,
  19.     public CMSPObjectSafetyImpl
  20. {
  21. BEGIN_COM_MAP(CAudioCaptureTerminal)
  22.     COM_INTERFACE_ENTRY(IObjectSafety)
  23.     COM_INTERFACE_ENTRY(ITBasicAudioTerminal)
  24.     COM_INTERFACE_ENTRY(ITStaticAudioTerminal)
  25.     COM_INTERFACE_ENTRY_CHAIN(CSingleFilterStaticTerminal)
  26. END_COM_MAP()
  27. DECLARE_VQI()
  28. DECLARE_LOG_ADDREF_RELEASE(CAudioCaptureTerminal)
  29. public:
  30.     CAudioCaptureTerminal();
  31.     virtual ~CAudioCaptureTerminal();
  32.     static HRESULT CreateTerminal(
  33.         IN    CComPtr<IMoniker>    pMoniker,
  34.         IN    MSP_HANDLE           htAddress,
  35.         OUT   ITTerminal         **ppTerm
  36.         );
  37.     HRESULT FindTerminalPin();
  38. // ITBasicAudioTerminal
  39. public:
  40.     STDMETHOD(get_Balance)(OUT  long *pVal);
  41.     STDMETHOD(put_Balance)(IN   long newVal);
  42.     STDMETHOD(get_Volume) (OUT  long *pVal);
  43.     STDMETHOD(put_Volume) (IN   long newVal);
  44. // ITStaticAudioTerminal
  45. public:
  46.     STDMETHOD(get_WaveId) (OUT  long * plWaveId);
  47. public:
  48.     // CBaseTerminal overrides 
  49.     STDMETHODIMP CompleteConnectTerminal(void);
  50.     STDMETHODIMP DisconnectTerminal(
  51.             IN      IGraphBuilder  * pGraph,
  52.             IN      DWORD            dwReserved
  53.             );
  54.     virtual HRESULT AddFiltersToGraph();
  55.     virtual DWORD GetSupportedMediaTypes(void)
  56.     {
  57.         return (DWORD) TAPIMEDIATYPE_AUDIO;
  58.     }
  59.     // Helper methods.
  60.     HRESULT CreateFilters();
  61.     // checks if the filters need to be created
  62.     inline HRESULT CreateFiltersIfRequired();
  63. private:
  64.     bool m_bResourceReserved; // keeps track of whether we need to unreserve WaveOut
  65.     CComPtr<IAMAudioInputMixer> m_pIAMAudioInputMixer;
  66. };
  67.     
  68. inline HRESULT
  69. CAudioCaptureTerminal::CreateFiltersIfRequired(
  70.     )
  71. {                                           
  72.     if (m_pIFilter == NULL)   return CreateFilters();          
  73.     
  74.     return S_OK;
  75. }
  76. #endif // _MSPTRMAC_H_
  77. // eof