📄 hxausvc.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 _HXAUSVC_H_
#define _HXAUSVC_H_
#define HX_MAX_VOLUME 100
#define HX_INIT_VOLUME 50
#define HX_MIN_VOLUME 0
/****************************************************************************
*
* Forward declarations of some interfaces defined here-in.
*/
typedef _INTERFACE IHXAudioPlayer IHXAudioPlayer;
typedef _INTERFACE IHXAudioPlayerResponse IHXAudioPlayerResponse;
typedef _INTERFACE IHXAudioStream IHXAudioStream;
typedef _INTERFACE IHXAudioStream2 IHXAudioStream2;
typedef _INTERFACE IHXAudioDevice IHXAudioDevice;
typedef _INTERFACE IHXAudioDeviceResponse IHXAudioDeviceResponse;
typedef _INTERFACE IHXAudioHook IHXAudioHook;
typedef _INTERFACE IHXAudioStreamInfoResponse IHXAudioStreamInfoResponse;
// $Private:
typedef _INTERFACE IHXMultiPlayPauseSupport IHXMultiPlayPauseSupport;
typedef _INTERFACE IHXAudioDeviceManager2 IHXAudioDeviceManager2;
typedef _INTERFACE IHXAudioResampler IHXAudioResampler;
typedef _INTERFACE IHXAudioResamplerManager IHXAudioResamplerManager;
typedef _INTERFACE IHXAudioPushdown2 IHXAudioPushdown2;
// $EndPrivate.
typedef _INTERFACE IHXVolume IHXVolume;
typedef _INTERFACE IHXVolumeAdviseSink IHXVolumeAdviseSink;
typedef _INTERFACE IHXDryNotification IHXDryNotification;
typedef _INTERFACE IHXBuffer IHXBuffer;
typedef _INTERFACE IHXValues IHXValues;
/****************************************************************************
*
* Audio Services Data Structures
*/
typedef struct _HXAudioFormat
{
UINT16 uChannels; /* Num. of Channels (1=Mono, 2=Stereo, etc. */
UINT16 uBitsPerSample; /* 8 or 16 */
UINT32 ulSamplesPerSec;/* Sampling Rate */
UINT16 uMaxBlockSize; /* Max Blocksize */
} HXAudioFormat;
typedef enum _AudioStreamType
{
STREAMING_AUDIO = 0,
INSTANTANEOUS_AUDIO = 1,
TIMED_AUDIO = 2,
STREAMING_INSTANTANEOUS_AUDIO = 3
} AudioStreamType;
typedef struct _HXAudioData
{
IHXBuffer* pData; /* Audio data */
ULONG32 ulAudioTime; /* Start time in milliseconds */
AudioStreamType uAudioStreamType;
} HXAudioData;
/****************************************************************************
*
* Interface:
*
* IHXAudioPlayer
*
* Purpose:
*
* This interface provides access to the Audio Player services. Use this
* interface to create audio streams, "hook" post-mixed audio data, and to
* control volume levels.
*
* IID_IHXAudioPlayer:
*
* {00000700-0901-11d1-8B06-00A024406D59}
*
*/
DEFINE_GUID(IID_IHXAudioPlayer, 0x00000700, 0x901, 0x11d1, 0x8b, 0x6, 0x0,
0xa0, 0x24, 0x40, 0x6d, 0x59);
#undef INTERFACE
#define INTERFACE IHXAudioPlayer
DECLARE_INTERFACE_(IHXAudioPlayer, IUnknown)
{
/*
* IUnknown methods
*/
STDMETHOD(QueryInterface) (THIS_
REFIID riid,
void** ppvObj) PURE;
STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
STDMETHOD_(ULONG32,Release) (THIS) PURE;
/*
* IHXAudioPlayer methods
*/
/************************************************************************
* Method:
* IHXAudioPlayer::CreateAudioStream
* Purpose:
* Call this to create an audio stream.
*/
STDMETHOD(CreateAudioStream) (THIS_
IHXAudioStream** /*OUT*/ pAudioStream
) PURE;
/************************************************************************
* Method:
* IHXAudioPlayer::AddPostMixHook
* Purpose:
* Call this to hook audio data after all audio streams in this
* have been mixed.
*/
STDMETHOD(AddPostMixHook) (THIS_
IHXAudioHook* /*IN*/ pHook,
const BOOL /*IN*/ bDisableWrite,
const BOOL /*IN*/ bFinal
) PURE;
/************************************************************************
* Method:
* IHXAudioPlayer::RemovePostMixHook
* Purpose:
* Call this to remove an already added post hook.
*/
STDMETHOD(RemovePostMixHook) (THIS_
IHXAudioHook* /*IN*/ pHook
) PURE;
/************************************************************************
* Method:
* IHXAudioPlayer::GetAudioStreamCount
* Purpose:
* Get the number of audio streams currently active in the
* audio player. Since streams can be added mid-presentation
* this function may return different values on different calls.
* If the user needs to know about all the streams as they get
* get added to the player, IHXAudioStreamInfoResponse should
* be implemented and passed in SetStreamInfoResponse.
*/
STDMETHOD_(UINT16,GetAudioStreamCount) (THIS) PURE;
/************************************************************************
* Method:
* IHXAudioPlayer::GetAudioStream
* Purpose:
* Get an audio stream at position given.
*/
STDMETHOD_(IHXAudioStream*,GetAudioStream) (THIS_
UINT16 /*IN*/ uIndex
) PURE;
/************************************************************************
* Method:
* IHXAudioPlayer::SetStreamInfoResponse
* Purpose:
* Set a stream info response interface. A client must implement
* an IHXAudioStreamInfoResponse and then call this method with
* the IHXAudioStreamInfoResponse as the parameter. The audio
* player will call IHXAudioStreamInfoResponse::OnStreamsReady
* with the total number of audio streams associated with this
* audio player.
*/
STDMETHOD(SetStreamInfoResponse) (THIS_
IHXAudioStreamInfoResponse* /*IN*/ pResponse
) PURE;
/************************************************************************
* Method:
* IHXAudioPlayer::RemoveStreamInfoResponse
* Purpose:
* Remove stream info response that was added earlier
*/
STDMETHOD(RemoveStreamInfoResponse) (THIS_
IHXAudioStreamInfoResponse* /*IN*/ pResponse
) PURE;
/************************************************************************
* Method:
* IHXAudioPlayer::GetAudioVolume
* Purpose:
* Get the audio player's volume interface. This volume controls
* the volume level of all the mixed audio streams for this
* audio player.
*/
STDMETHOD_(IHXVolume*,GetAudioVolume) (THIS) PURE;
/************************************************************************
* Method:
* IHXAudioPlayer::GetDeviceVolume
* Purpose:
* Get the audio device volume interface. This volume controls
* the audio device volume levels.
*/
STDMETHOD_(IHXVolume*,GetDeviceVolume) (THIS) PURE;
};
/****************************************************************************
*
* Interface:
*
* IHXAudioPlayerResponse
*
* Purpose:
*
* This interface provides access to the Audio Player Response. Use this
* to receive audio player playback notifications. Your implementation of
* OnTimeSync() is called with the current audio playback time (millisecs).
* This interface is currently to be used ONLY by the RMA engine internally.
*
* IID_IHXAudioPlayerResponse:
*
* {00000701-0901-11d1-8B06-00A024406D59}
*
*/
DEFINE_GUID(IID_IHXAudioPlayerResponse, 0x00000701, 0x901, 0x11d1, 0x8b, 0x6, 0x0,
0xa0, 0x24, 0x40, 0x6d, 0x59);
#undef INTERFACE
#define INTERFACE IHXAudioPlayerResponse
DECLARE_INTERFACE_(IHXAudioPlayerResponse, IUnknown)
{
/*
* IUnknown methods
*/
STDMETHOD(QueryInterface) (THIS_
REFIID riid,
void** ppvObj) PURE;
STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
STDMETHOD_(ULONG32,Release) (THIS) PURE;
/*
* IHXAudioPlayerResponse methods
*/
/************************************************************************
* Method:
* IHXAudioPlayerResponse::OnTimeSync
* Purpose:
* This method is called with the current audio playback time.
*/
STDMETHOD(OnTimeSync) (THIS_
ULONG32 /*IN*/ ulTimeEnd
) PURE;
};
/****************************************************************************
*
* Interface:
*
* IHXAudioStream
*
* Purpose:
*
* This interface provides access to an Audio Stream. Use this to play
* audio, "hook" audio stream data, and to get audio stream information.
*
* IID_IHXAudioStream:
*
* {00000702-0901-11d1-8B06-00A024406D59}
*
*/
DEFINE_GUID(IID_IHXAudioStream, 0x00000702, 0x901, 0x11d1, 0x8b, 0x6, 0x0,
0xa0, 0x24, 0x40, 0x6d, 0x59);
#undef INTERFACE
#define INTERFACE IHXAudioStream
DECLARE_INTERFACE_(IHXAudioStream, IUnknown)
{
/*
* IUnknown methods
*/
STDMETHOD(QueryInterface) (THIS_
REFIID riid,
void** ppvObj) PURE;
STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
STDMETHOD_(ULONG32,Release) (THIS) PURE;
/*
* IHXAudioStream methods
*/
/************************************************************************
* Method:
* IHXAudioStream::Init
* Purpose:
* Initialize an audio stream with the given audio format. The
* IHXValues contains stream identification information.
*/
STDMETHOD(Init) (THIS_
const HXAudioFormat* /*IN*/ pAudioFormat,
IHXValues* /*IN*/ pValues
) PURE;
/************************************************************************
* Method:
* IHXAudioStream::Write
* Purpose:
* Write audio data to Audio Services.
*
* NOTE: If the renderer loses packets and there is no loss
* correction, then the renderer should write the next packet
* using a meaningful start time. Audio Services will play
* silence where packets are missing.
*/
STDMETHOD(Write) (THIS_
HXAudioData* /*IN*/ pAudioData
) PURE;
/************************************************************************
* Method:
* IHXAudioStream::AddPreMixHook
* Purpose:
* Use this to "hook" audio stream data prior to the mixing.
* Set bDisableWrite to TRUE to prevent this audio stream data
* from being mixed with other audio stream data associated
* with this audio player.
*/
STDMETHOD(AddPreMixHook) (THIS_
IHXAudioHook* /*IN*/ pHook,
const BOOL /*IN*/ bDisableWrite
) PURE;
/************************************************************************
* Method:
* IHXAudioStream::RemovePreMixHook
* Purpose:
* Use this to remove an already added "hook".
*/
STDMETHOD(RemovePreMixHook) (THIS_
IHXAudioHook* /*IN*/ pHook
) PURE;
/************************************************************************
* Method:
* IHXAudioStream::AddDryNotification
* Purpose:
* Use this to add a notification response object to get
* notifications when audio stream is running dry.
*/
STDMETHOD(AddDryNotification) (THIS_
IHXDryNotification* /*IN*/ pNotification
) PURE;
/************************************************************************
* Method:
* IHXAudioStream::GetStreamInfo
* Purpose:
* Use this to get information specific to this audio stream.
*/
STDMETHOD_(IHXValues*,GetStreamInfo) (THIS) PURE;
/************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -