📄 hxaudses.h
字号:
/* ***** BEGIN LICENSE BLOCK *****
* Version: RCSL 1.0/RPSL 1.0
*
* Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
*
* The contents of this file, and the files included with this file, are
* subject to the current version of the RealNetworks Public Source License
* Version 1.0 (the "RPSL") available at
* http://www.helixcommunity.org/content/rpsl unless you have licensed
* the file under the RealNetworks Community Source License Version 1.0
* (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
* in which case the RCSL will apply. You may also obtain the license terms
* directly from RealNetworks. You may not use this file except in
* compliance with the RPSL or, if you have a valid RCSL with RealNetworks
* applicable to this file, the RCSL. Please see the applicable RPSL or
* RCSL for the rights, obligations and limitations governing use of the
* contents of the file.
*
* This file is part of the Helix DNA Technology. RealNetworks is the
* developer of the Original Code and owns the copyrights in the portions
* it created.
*
* This file, and the files included with this file, is distributed and made
* available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
*
* Technology Compatibility Kit Test Suite(s) Location:
* http://www.helixcommunity.org/content/tck
*
* Contributor(s):
*
* ***** END LICENSE BLOCK ***** */
#ifndef _HXAUDSES_H
#define _HXAUDSES_H
#include "hxaudtyp.h"
#ifdef _UNIX
#include <fcntl.h>
#include <sys/stat.h>
#endif
// foward decls.
struct IHXCallback;
struct IHXScheduler;
struct IHXPreferences;
struct IHXAudioDeviceResponse;
struct IHXAudioPlayerResponse;
struct IHXAudioAdviseSink;
struct IHXAudioDeviceManager;
struct IHXAudioHook;
struct IHXInterruptState;
typedef struct _HXAudioFormat HXAudioFormat;
class CHXAudioPlayer;
class CHXAudioDevice;
class CHXAudioStream;
class CHXSimpleList;
class HXVolumeAdviseSink;
struct IHXBuffer;
class Timeval;
class HXThread;
class HXMutex;
class HXEvent;
#ifdef HELIX_CONFIG_MIN_PCM_PUSHDOWN_BYTES
#define MINIMUM_INITIAL_PUSHDOWN 100
#else
#define MINIMUM_INITIAL_PUSHDOWN 4000
#endif
typedef enum
{
BUFFER_NONE = 0,
BUFFER_PLAYER = 1,
BUFFER_SESSION = 2
} BufType;
class CHXAudioSession : public IHXAudioDeviceResponse,
public IHXAudioDeviceManager,
public IHXAudioHookManager,
public IHXAudioDeviceManager2,
#ifdef HELIX_FEATURE_VOLUME
public IHXVolumeAdviseSink,
#endif
public IHXCallback,
public IHXAudioResamplerManager,
public IHXAudioPushdown2
{
public:
/*
* IUnknown methods
*/
STDMETHOD(QueryInterface) (THIS_
REFIID riid,
void** ppvObj);
STDMETHOD_(ULONG32,AddRef) (THIS);
STDMETHOD_(ULONG32,Release) (THIS);
CHXAudioSession(void);
#ifdef HELIX_FEATURE_VOLUME
//IHXVolumeAdviseSink methods
inline STDMETHOD(OnVolumeChange) (THIS_ const UINT16 uVolume )
{
SetVolume(uVolume);
return HXR_OK;
}
inline STDMETHOD(OnMuteChange)(THIS_ const BOOL bMute )
{
SetMute(bMute);
return HXR_OK;
}
#endif
/*
* IHXAudioDeviceManager methods
*/
/************************************************************************
* Method:
* IHXAudioDeviceManager::Replace
* Purpose:
* This is used to replace the default implementation of the audio
* device by the given audio device interface.
*/
STDMETHOD(Replace) (THIS_
IHXAudioDevice* /*IN*/ pAudioDevice);
/************************************************************************
* Method:
* IHXAudioDeviceManager::Remove
* Purpose:
* This is used to remove the audio device given to the manager in
* the earlier call to Replace.
*/
STDMETHOD(Remove) (THIS_
IHXAudioDevice* /*IN*/ pAudioDevice);
/************************************************************************
* Method:
* IHXAudioDeviceManager::AddFinalHook
* Purpose:
* One last chance to modify data being written to the audio device.
* This hook allows the user to change the audio format that
* is to be written to the audio device. This can be done in call
* to OnInit() in IHXAudioHook.
*/
STDMETHOD(SetFinalHook) (THIS_
IHXAudioHook* /*IN*/ pHook
);
/************************************************************************
* Method:
* IHXAudioDeviceManager::RemoveFinalHook
* Purpose:
* Remove final hook
*/
STDMETHOD(RemoveFinalHook) (THIS_
IHXAudioHook* /*IN*/ pHook
);
/************************************************************************
* Method:
* IHXAudioDeviceManager::GetAudioFormat
* Purpose:
* Returns the audio format in which the audio device is opened.
* This function will fill in the pre-allocated HXAudioFormat
* structure passed in.
*/
STDMETHOD(GetAudioFormat) (THIS_
HXAudioFormat* /*IN/OUT*/pAudioFormat);
/*
* IHXAudioDeviceResponse methods
*/
/************************************************************************
* Method:
* IHXAudioDeviceResponse::OnTimeSync
* Purpose:
* Notification interface provided by users of the IHXAudioDevice
* interface. This method is called by the IHXAudioDevice when
* audio playback occurs.
*/
STDMETHOD(OnTimeSync) (THIS_
ULONG32 /*IN*/ ulTimeEnd);
/*
* IHXAudioHookManager methods
*/
/************************************************************************
* Method:
* IHXAudioHookManager::AddHook
* Purpose:
* Use this to add a hook
*/
STDMETHOD(AddHook) (THIS_
IHXAudioHook* /*IN*/ pHook);
/************************************************************************
* Method:
* IHXAudioHookManager::RemoveHook
* Purpose:
* Use this to remove a hook
*/
STDMETHOD(RemoveHook) (THIS_
IHXAudioHook* /*IN*/ pHook);
/*
* IHXAudioDeviceManager2 methods
*/
/**********************************************************************
* Method:
* IHXAudioDeviceManager2::IsReplacedDevice
* Purpose:
* This is used to determine if the audio device has been replaced.
*/
STDMETHOD_(BOOL, IsReplacedDevice) (THIS);
/*
* IHXAudioResamplerManager methods
*
*/
STDMETHOD(CreateResampler) (THIS_
HXAudioFormat inAudioFormat,
REF(HXAudioFormat) outAudioFormat,
REF(IHXAudioResampler*) pResampler);
/*
* IHXAudioPushdown methods
*/
/************************************************************************
* Method:
* IHXAudioPushdown::SetAudioPushdown
* Purpose:
* Use this to set the minimum audio pushdown value in ms.
* This is the amount of audio data that is being written
* to the audio device before starting playback.
*/
STDMETHOD(SetAudioPushdown) (THIS_
UINT32 /*IN*/ ulMinimumPushdown);
/************************************************************************
* Method:
* IHXAudioPushdown2::GetAudioPushdown
* Purpose:
* Use this to get the minimum audio pushdown value in ms.
* This is the amount of audio data that is being written
* to the audio device before starting playback.
*/
STDMETHOD(GetAudioPushdown) (THIS_
REF(UINT32) /*OUT*/ ulAudioPushdown);
/************************************************************************
* Method:
* IHXAudioPushdown2::GetCurrentAudioDevicePushdown
* Purpose:
* Use this to get the audio pushed down to the audio device and haven't
* been played yet
*/
STDMETHOD(GetCurrentAudioDevicePushdown) (THIS_
REF(UINT32) /*OUT*/ ulAudioPusheddown);
/* It gets Scheduler interface from the context.
* The session object keeps a list of audio player objects.
* Create a session list; add this session to the list.
*/
HX_RESULT Init(IUnknown* pContext);
/* Setup is called by Audio Player object.
*/
HX_RESULT Setup (BOOL bHasStreams);
/* Create audio player. The RMA session object calls this
* for each Player it knows about.
*/
virtual HX_RESULT CreateAudioPlayer(CHXAudioPlayer** ppAudioPlayer);
HX_RESULT _CreateAudioPlayer(CHXAudioPlayer** ppAudioPlayer);
HX_RESULT CloseAudioPlayer( CHXAudioPlayer* pAudioPlayer);
void Close(void);
/* The session object determines the audio device format based
* on all of its players.
*/
HX_RESULT GetDeviceFormat(void);
/* Open is called to open the audio device.
*/
HX_RESULT OpenAudio (void);
HX_RESULT OpenDevice (void);
/* PlayAudio is called by Audio Player object.
*/
HX_RESULT PlayAudio (UINT16 uNumBlocks = 1);
/* Pause is called by Audio Player object.
*/
HX_RESULT Pause (CHXAudioPlayer* p);
/* Resume is called by Audio Player object.
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -