engine
 
载入中...
搜索中...
未找到
Public 成员函数 | Protected 成员函数 | 所有成员列表
IAudioEndpoint类 参考abstract

Class that allows audio to be sent to an arbitrary locale. 更多...

#include <IAudioEndpoint.h>

Public 成员函数

Audio::FPatchInput PatchNewInput (float ExpectedDurationPerRender, float &OutSampleRate, int32 &OutNumChannels)
 Create a new patch point for this endpoint. 更多...
 
void ProcessAudioIfNeccessary ()
 If this audio endpoint hasn't spawned a seperate callback thread but requires a callback, this should be executed somewhere.
 
void SetNewSettings (TUniquePtr< IAudioEndpointSettingsProxy > &&InNewSettings)
 Post new settings for this endpoint. 更多...
 

Protected 成员函数

void DisconnectAllInputs ()
 Thread safe function to disconnect everything from this endpoint. 更多...
 
virtual bool EndpointRequiresCallback () const
 OPTIONAL OVERRIDES: 更多...
 
virtual int32 GetNumChannels () const =0
 This should return the number of channels we should be sending to this endpoint. 更多...
 
virtual float GetSampleRate () const =0
 REQUIRED OVERRIDES: 更多...
 
virtual bool OnAudioCallback (const TArrayView< const float > &InAudio, const int32 &NumChannels, const IAudioEndpointSettingsProxy *InSettings)
 For endpoints that override EndpointRequiresCallback to return true, this callback will be called every (GetDesiredNumFrames() / GetSampleRate()) seconds. 更多...
 
void PollSettings (TFunctionRef< void(const IAudioEndpointSettingsProxy *)> NewSettingsRetrieved)
 Use this as a thread safe way to use the current settings posted to this IAudioEndpoint. 更多...
 
int32 PopAudio (float *OutAudio, int32 NumSamples)
 METHODS USED BY IMPLEMENTATIONS OF IAudioEndpoint: 更多...
 
void RunCallbackSynchronously ()
 If EndpointRequiresCallback() returns true, this can be used to manually run the callback.
 
void StartRunningAsyncCallback ()
 If EndpointRequiresCallback() returns true, this can be used to spawn an async thread and begin calling OnAudioCallback.
 

详细描述

Class that allows audio to be sent to an arbitrary locale.

This can be used for multi-device rendering, haptics systems, etc. Note that this only for interleaved audio buffers with no metadata for object-based or soundfield-based rendering. For those, see

成员函数说明

◆ DisconnectAllInputs()

void IAudioEndpoint::DisconnectAllInputs ( )
protected

Thread safe function to disconnect everything from this endpoint.

Anything that owns an Audio::FPatchInput will be notified and will have to call PatchNewInput() again to reconnect.

◆ EndpointRequiresCallback()

virtual bool IAudioEndpoint::EndpointRequiresCallback ( ) const
inlineprotectedvirtual

OPTIONAL OVERRIDES:

For endpoints that do not explicitly fire a timed callback to poll audio data, this should be overridden to return true, and OnAudioCallback and GetDesiredNumFrames should be overridden.

◆ GetNumChannels()

virtual int32 IAudioEndpoint::GetNumChannels ( ) const
protectedpure virtual

This should return the number of channels we should be sending to this endpoint.

If the number of channels changes, please call DisconnectAllInputs.

◆ GetSampleRate()

virtual float IAudioEndpoint::GetSampleRate ( ) const
protectedpure virtual

REQUIRED OVERRIDES:

This should return the sample rate we should be sending to this endpoint. If the sample rate changes, please call DisconnectAllInputs().

◆ OnAudioCallback()

virtual bool IAudioEndpoint::OnAudioCallback ( const TArrayView< const float > &  InAudio,
const int32 &  NumChannels,
const IAudioEndpointSettingsProxy *  InSettings 
)
inlineprotectedvirtual

For endpoints that override EndpointRequiresCallback to return true, this callback will be called every (GetDesiredNumFrames() / GetSampleRate()) seconds.

返回
whether the endpoint is still valid. If this returns false, DisconnectAllInputs will be called automatically.

◆ PatchNewInput()

Audio::FPatchInput IAudioEndpoint::PatchNewInput ( float  ExpectedDurationPerRender,
float &  OutSampleRate,
int32 &  OutNumChannels 
)

Create a new patch point for this endpoint.

Please see MultithreadedPatching.h to see how to use the FPatchInput class.

参数
[in]ExpectedDurationPerRenderThe worst-case amount of time expected between render callbacks. This is used to determined how much to allocate for this input.
[out]OutSampleRate.The sample rate expected to be pushed to the returned FPatchInput. If you need to resample your input, please see Audio::FResampler.
[out]OutNumChannels.The number of channels expected to be pushed to the returned FPatchInput. If you need to downmix or upmix your input, try using the following: TArray<float> MixdownGainsMap; Audio::FMixerDevice::Get2DChannelMap(false, NumInputChannels, NumOutputChannels, false, MixdownGainsMap); Audio::DownmixBuffer(NumInputChannels, NumOutputChannels, InputAudio, OutputAudio, MixdownGainsMap.GetData());
返回
a new Audio::FPatchInput. The FPatchInput may be disconnected if this endpoint's sample rate or channel count changes, in which case you will need to reconnect by calling this again.

◆ PollSettings()

void IAudioEndpoint::PollSettings ( TFunctionRef< void(const IAudioEndpointSettingsProxy *)>  NewSettingsRetrieved)
protected

Use this as a thread safe way to use the current settings posted to this IAudioEndpoint.

Locks with IAudioEndpoint::SetSettings.

参数
[in]NewSettingsRetrievedlambda used to work with the retrieved settings. This lambda is called immediately and synchronously, but is used to safely scope usage of the IAudioEndpointSettingsProxy pointer.

◆ PopAudio()

int32 IAudioEndpoint::PopAudio ( float *  OutAudio,
int32  NumSamples 
)
protected

METHODS USED BY IMPLEMENTATIONS OF IAudioEndpoint:

This is used by the IAudioEndpoint implementation to poll buffered audio to process or send to the endpoint. Note that this is NOT thread safe if EndpointRequiresCallback() is overridden to return true. If that is the case, use an override of OnAudioCallback instead.

参数
[in]OutAudioPointer to already allocated buffer of floats, at least NumSamples long. This will be filled with interleaved audio based on GetNumChannels().
[in]NumSamplesThe number of samples to fill OutAudio with.
返回
[out] the number of samples polled from this thing.

◆ SetNewSettings()

void IAudioEndpoint::SetNewSettings ( TUniquePtr< IAudioEndpointSettingsProxy > &&  InNewSettings)

Post new settings for this endpoint.

There is no type safety on this call, so make sure that you are using the correct implementation of IAudioEndpointSettingsProxy for this implementation of IAudioEndpoint.


该类的文档由以下文件生成: