📄 hxaudses.h
字号:
/* ***** BEGIN LICENSE BLOCK *****
* Source last modified: $Id: hxaudses.h,v 1.11.2.1.2.1 2004/12/13 23:12:45 gwright Exp $
*
* Portions Copyright (c) 1995-2004 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 (the "RPSL") available at
* http://www.helixcommunity.org/content/rpsl unless you have licensed
* the file under the current version of the RealNetworks Community
* Source License (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.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License Version 2 or later (the
* "GPL") in which case the provisions of the GPL are applicable
* instead of those above. If you wish to allow use of your version of
* this file only under the terms of the GPL, and not to allow others
* to use your version of this file under the terms of either the RPSL
* or RCSL, indicate your decision by deleting the provisions above
* and replace them with the notice and other provisions required by
* the GPL. If you do not delete the provisions above, a recipient may
* use your version of this file under the terms of any one of the
* RPSL, the RCSL or the GPL.
*
* 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
// IHXTimelineWatcher defines.
# define TLW_PAUSE 1
# define TLW_RESUME 2
# define TLW_CLOSE 3
# define TLW_TIMESYNC 4
// 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,
#if defined(HELIX_FEATURE_TIMELINE_WATCHER)
public IHXTimelineManager,
#endif
public IHXAudioPushdown2
{
public:
/*
* IUnknown methods
*/
STDMETHOD(QueryInterface) (THIS_
REFIID riid,
void** ppvObj);
STDMETHOD_(ULONG32,AddRef) (THIS);
STDMETHOD_(ULONG32,Release) (THIS);
CHXAudioSession(void);
#if defined(HELIX_FEATURE_TIMELINE_WATCHER)
//IHXTimelineManager methods...
STDMETHOD(AddTimelineWatcher) (THIS_ IHXTimelineWatcher* );
STDMETHOD(RemoveTimelineWatcher) (THIS_ IHXTimelineWatcher* );
#endif
#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);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -