📄 devctxt.h
字号:
#pragma once
// -----------------------------------------------------------------------------
//
// 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) 1995-2000 Microsoft Corporation. All rights reserved.
//
// -----------------------------------------------------------------------------
/*
** INTEL CONFIDENTIAL
** Copyright 2000-2003 Intel Corporation All Rights Reserved.
**
** The source code contained or described herein and all documents
** related to the source code (Material) are owned by Intel Corporation
** or its suppliers or licensors. Title to the Material remains with
** Intel Corporation or its suppliers and licensors. The Material contains
** trade secrets and proprietary and confidential information of Intel
** or its suppliers and licensors. The Material is protected by worldwide
** copyright and trade secret laws and treaty provisions. No part of the
** Material may be used, copied, reproduced, modified, published, uploaded,
** posted, transmitted, distributed, or disclosed in any way without Intel抯
** prior express written permission.
** No license under any patent, copyright, trade secret or other intellectual
** property right is granted to or conferred upon you by disclosure or
** delivery of the Materials, either expressly, by implication, inducement,
** estoppel or otherwise. Any license under such intellectual property rights
** must be express and approved by Intel in writing.
*/
#define SECONDARYGAINCLASSMAX 4
// number of classes affected by the device gain
#define SECONDARYDEVICEGAINCLASSMAX 2
class DeviceContext
{
public:
DeviceContext()
{
InitializeListHead(&m_StreamList);
m_dwGain = 0xFFFF;
m_dwDefaultStreamGain = 0xFFFF;
for (int i=0;i<SECONDARYGAINCLASSMAX;i++)
{
m_dwSecondaryGainLimit[i]=0xFFFF;
}
}
virtual BOOL IsSupportedFormat(LPWAVEFORMATEX lpFormat);
PBYTE TransferBuffer(PBYTE pBuffer, PBYTE pBufferEnd, DWORD *pNumStreams);
void NewStream(StreamContext *pStreamContext);
void DeleteStream(StreamContext *pStreamContext);
DWORD GetGain()
{
return m_dwGain;
}
DWORD SetGain(DWORD dwGain)
{
m_dwGain = dwGain;
RecalcAllGains();
return MMSYSERR_NOERROR;
}
DWORD GetDefaultStreamGain()
{
return m_dwDefaultStreamGain;
}
DWORD SetDefaultStreamGain(DWORD dwGain)
{
m_dwDefaultStreamGain = dwGain;
return MMSYSERR_NOERROR;
}
DWORD GetSecondaryGainLimit(DWORD GainClass)
{
return m_dwSecondaryGainLimit[GainClass];
}
DWORD SetSecondaryGainLimit(DWORD GainClass, DWORD Limit)
{
if (GainClass>=SECONDARYGAINCLASSMAX)
{
return MMSYSERR_ERROR;
}
m_dwSecondaryGainLimit[GainClass]=Limit;
RecalcAllGains();
return MMSYSERR_NOERROR;
}
void RecalcAllGains();
DWORD OpenStream(LPWAVEOPENDESC lpWOD, DWORD dwFlags, StreamContext **ppStreamContext);
virtual DWORD GetExtDevCaps(PVOID pCaps, DWORD dwSize)=0;
virtual DWORD GetDevCaps(PVOID pCaps, DWORD dwSize)=0;
virtual void StreamReadyToRender(StreamContext *pStreamContext)=0;
virtual StreamContext *CreateStream(LPWAVEOPENDESC lpWOD)=0;
protected:
LIST_ENTRY m_StreamList; // List of streams rendering to/from this device
DWORD m_dwGain;
DWORD m_dwDefaultStreamGain;
DWORD m_dwSecondaryGainLimit[SECONDARYGAINCLASSMAX];
};
class InputDeviceContext : public DeviceContext
{
public:
StreamContext *CreateStream(LPWAVEOPENDESC lpWOD);
DWORD GetExtDevCaps(PVOID pCaps, DWORD dwSize);
DWORD GetDevCaps(PVOID pCaps, DWORD dwSize);
void StreamReadyToRender(StreamContext *pStreamContext);
};
class OutputDeviceContext : public DeviceContext
{
public:
BOOL IsSupportedFormat(LPWAVEFORMATEX lpFormat);
StreamContext *CreateStream(LPWAVEOPENDESC lpWOD);
DWORD GetExtDevCaps(PVOID pCaps, DWORD dwSize);
DWORD GetDevCaps(PVOID pCaps, DWORD dwSize);
void StreamReadyToRender(StreamContext *pStreamContext);
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -