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
|
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.
|
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.
|
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.
|
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().
|
inlineprotectedvirtual |
For endpoints that override EndpointRequiresCallback to return true, this callback will be called every (GetDesiredNumFrames() / GetSampleRate()) seconds.
| 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] | ExpectedDurationPerRender | The 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()); |
|
protected |
Use this as a thread safe way to use the current settings posted to this IAudioEndpoint.
Locks with IAudioEndpoint::SetSettings.
| [in] | NewSettingsRetrieved | lambda 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. |
|
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] | OutAudio | Pointer to already allocated buffer of floats, at least NumSamples long. This will be filled with interleaved audio based on GetNumChannels(). |
| [in] | NumSamples | The number of samples to fill OutAudio with. |
| 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.