📄 rmaausvc.pas
字号:
unit RmaAuSvc;
interface
uses
PnTypes, RmaPckts;
//***************************************************************************
//
// $Id: rmaausvc.h,v 1.62 2000/03/22 21:25:28 rahul Exp $
//
// Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved.
//
// http://www.real.com/devzone
//
// This program contains proprietary
// information of Progressive Networks, Inc, and is licensed
// subject to restrictions on use and distribution.
//
//
// RealMedia Architecture Audio Services Interfaces.
//
//
//***************************************************************************
//
// Audio Services Data Structures
//
type
_RMAAudioFormat = record
uChannels: UINT16; // Num. of Channels (1=Mono, 2=Stereo, etc.
uBitsPerSample: UINT16; // 8 or 16
ulSamplesPerSec: ULONG32; // Sampling Rate
uMaxBlockSize: UINT16; // Max Blocksize
end;
{$EXTERNALSYM _RMAAudioFormat}
RMAAudioFormat = _RMAAudioFormat;
{$EXTERNALSYM RMAAudioFormat}
_AudioStreamType = (STREAMING_AUDIO, INSTANTANEOUS_AUDIO, TIMED_AUDIO);
{$EXTERNALSYM _AudioStreamType}
AudioStreamType = _AudioStreamType;
{$EXTERNALSYM AudioStreamType}
_RMAAudioData = record
pData: IRMABuffer; // Audio data
ulAudioTime: ULONG32; // Start time in milliseconds
uAudioStreamType: AudioStreamType;
end;
{$EXTERNALSYM _RMAAudioData}
RMAAudioData = _RMAAudioData;
{$EXTERNALSYM RMAAudioData}
(***************************************************************************
*
* Interface:
*
* IRMAAudioHook
*
* Purpose:
*
* Clients must implement this interface to access pre- or post-mixed
* audio data. Use this interface to get post processed audio buffers and
* their associated audio format.
*
* IID_IRMAAudioHook:
*
* {00000705-0901-11d1-8B06-00A024406D59}
*
*)
const
IID_IRMAAudioHook: TGUID = '{00000705-0901-11d1-8B06-00A024406D59}';
{$EXTERNALSYM IID_IRMAAudioHook}
type
IRMAAudioHook = interface (IUnknown)
['{00000705-0901-11d1-8B06-00A024406D59}']
{***********************************************************************
* Method:
* IRMAAudioHook::OnInit
* Purpose:
* Audio Services calls OnInit() with the audio data format of the
* audio data that will be provided in the OnBuffer() method.
}
function OnInit(const pFormat: RMAAudioFormat): HRESULT; stdcall;
{***********************************************************************
* Method:
* IRMAAudioHook::OnBuffer
* Purpose:
* Audio Services calls OnBuffer() with audio data packets. The
* renderer should not modify the data in the IRMABuffer part of
* pAudioInData. If the renderer wants to write a modified
* version of the data back to Audio Services, then it should
* create its own IRMABuffer, modify the data and then associate
* this buffer with the pAudioOutData->pData member.
}
function OnBuffer(const pAudioInData: RMAAudioData; var pAudioOutData: RMAAudioData): HRESULT; stdcall;
end;
{$EXTERNALSYM IRMAAudioHook}
(***************************************************************************
*
* Interface:
*
* IRMADryNotification
*
* Purpose:
*
* Audio Renderer should implement this if it needs notification when the
* audio stream is running dry.
*
* IID_IRMADryNotification:
*
* {00000709-0901-11d1-8B06-00A024406D59}
*
*)
const
IID_IRMADryNotification: TGUID = '{00000709-0901-11d1-8B06-00A024406D59}';
{$EXTERNALSYM IID_IRMADryNotification}
type
IRMADryNotification = interface (IUnknown)
['{00000709-0901-11d1-8B06-00A024406D59}']
{***********************************************************************
* Method:
* IRMADryNotification::OnDryNotification
* Purpose:
* This function is called when it is time to write to audio device
* and there is not enough data in the audio stream. The renderer can
* then decide to add more data to the audio stream. This should be
* done synchronously within the call to this function.
* It is OK to not write any data. Silence will be played instead.
}
function OnDryNotification(ulCurrentStreamTime, ulMinimumDurationRequired: UINT32): HRESULT; stdcall;
end;
{$EXTERNALSYM IRMADryNotification}
(***************************************************************************
*
* Interface:
*
* IRMAVolumeAdviseSink
*
* Purpose:
*
* This interface provides access to notifications of volume changes. A
* client must implement this interface if they are interested in receiving
* notifications of volume level changes or mute state changes. A client must
* register their volume advise sink using IRMAVolume::AddAdviseSink().
* See the IRMAVolume interface.
*
* IID_IRMAVolumeAdviseSink:
*
* {00000708-0901-11d1-8B06-00A024406D59}
*
*)
const
IID_IRMAVolumeAdviseSink: TGUID = '{00000708-0901-11d1-8B06-00A024406D59}';
{$EXTERNALSYM IID_IRMAVolumeAdviseSink}
type
IRMAVolumeAdviseSink = interface (IUnknown)
['{00000708-0901-11d1-8B06-00A024406D59}']
{***********************************************************************
* Method:
* IRMAVolumeAdviseSink::OnVolumeChange
* Purpose:
* This interface is called whenever the associated IRMAVolume
* SetVolume() is called.
}
function OnVolumeChange(uVolume: UINT16): HRESULT; stdcall;
{***********************************************************************
* Method:
* IRMAVolumeAdviseSink::OnMuteChange
* Purpose:
* This interface is called whenever the associated IRMAVolume
* SetMute() is called.
*
}
function OnMuteChange(bMute: BOOL): HRESULT; stdcall;
end;
{$EXTERNALSYM IRMAVolumeAdviseSink}
(***************************************************************************
*
* Interface:
*
* IRMAVolume
*
* Purpose:
*
* This interface provides access to Audio Services volume control. Use this
* interface to get, set, or receive notifications of volume changes. Audio
* Services implements IRMAVolume for IRMAAudioPlayer, IRMAAudioStream and
* for the audio device. Clients can use the IRMAVolume interface to get/set
* volume levels of each audio stream, to get/set volume levels for the
* audio player's mixed data, or to get/set the volume levels of the audio
* device. See AudioStream::GetStreamVolume() (TBD), AudioPlayer::
* GetAudioVolume() and AudioPlayer::GetDeviceVolume().
*
* IID_IRMAVolume:
*
* {00000707-0901-11d1-8B06-00A024406D59}
*
*)
const
IID_IRMAVolume: TGUID = '{00000707-0901-11d1-8B06-00A024406D59}';
{$EXTERNALSYM IID_IRMAVolume}
type
IRMAVolume = interface (IUnknown)
['{00000707-0901-11d1-8B06-00A024406D59}']
{***********************************************************************
* Method:
* IRMAVolume::SetVolume
* Purpose:
* Call this to set the volume level.
}
function SetVolume(uVolume: UINT16): HRESULT; stdcall;
{***********************************************************************
* Method:
* IRMAVolume::GetVolume
* Purpose:
* Call this to get the current volume level.
}
function GetVolume: UINT16; stdcall;
{***********************************************************************
* Method:
* IRMAVolume::SetMute
* Purpose:
* Call this to mute the volume.
}
function SetMute(bMute: BOOL): HRESULT; stdcall;
{***********************************************************************
* Method:
* IRMAVolume::GetMute
* Purpose:
* Call this to determine if the volume is muted.
*
}
function GetMute: BOOL; stdcall;
{***********************************************************************
* Method:
* IRMAVolume::AddAdviseSink
* Purpose:
* Call this to register an IRMAVolumeAdviseSink. The advise sink
* methods: OnVolumeChange() and OnMuteChange() are called when
* ever IRMAVolume::SetVolume() and IRMAVolume::SetMute() are
* called.
}
function AddAdviseSink(pSink: IRMAVolumeAdviseSink): HRESULT; stdcall;
{***********************************************************************
* Method:
* IRMAVolume::RemoveAdviseSink
* Purpose:
* Call this to unregister an IRMAVolumeAdviseSink. Use this when
* you are no longer interested in receiving volume or mute change
* notifications.
}
function RemoveAdviseSink(pSink: IRMAVolumeAdviseSink): HRESULT; stdcall;
end;
{$EXTERNALSYM IRMAVolume}
(***************************************************************************
*
* Interface:
*
* IRMAAudioStream
*
* 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_IRMAAudioStream:
*
* {00000702-0901-11d1-8B06-00A024406D59}
*)
const
IID_IRMAAudioStream: TGUID = '{00000702-0901-11d1-8B06-00A024406D59}';
{$EXTERNALSYM IID_IRMAAudioStream}
type
IRMAAudioStream = interface (IUnknown)
['{00000702-0901-11d1-8B06-00A024406D59}']
{***********************************************************************
* Method:
* IRMAAudioStream::Init
* Purpose:
* Initialize an audio stream with the given audio format. The
* IRMAValues contains stream identification information.
}
function Init(pAudioFormat: RMAAudioFormat; pValues: IRMAValues): HRESULT; stdcall;
{***********************************************************************
* Method:
* IRMAAudioStream::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.
}
function Write(pAudioData: RMAAudioData): HRESULT; stdcall;
{***********************************************************************
* Method:
* IRMAAudioStream::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.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -