Files
UnrealEngineUWP/Engine/Source/Runtime/SignalProcessing/Public/DSP/ConvertDeinterleave.h
phil popp d7bcb9e7a4 Fix for altered volume when using a mono wave file in a metasound wave player node.
#jira UE-141262
#rb Max.Hayes
#preflight 6201c188e85c7a08bbcbefa5

#ROBOMERGE-AUTHOR: phil.popp
#ROBOMERGE-SOURCE: CL 18906409 in //UE5/Release-5.0/... via CL 18906649 via CL 18907001
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v915-18905420)

[CL 18907023 by phil popp in ue5-main branch]
2022-02-08 14:13:09 -05:00

60 lines
2.1 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "DSP/ChannelMap.h"
#include "DSP/MultichannelBuffer.h"
#include "Containers/ArrayView.h"
#include "Templates/UniquePtr.h"
namespace Audio
{
/** Parameters for creating a IConvertDeinterleave object. */
struct FConvertDeinterleaveParams
{
// Number of channels in the input audio.
int32 NumInputChannels = 0;
// Number of channels in the output audio.
int32 NumOutputChannels = 0;
// Method for upmixing mono audio (only used if NumInputChannels == 1)
EChannelMapMonoUpmixMethod MonoUpmixMethod = EChannelMapMonoUpmixMethod::EqualPower;
};
/** IConvertDeinterleave is an interface for transforming multichannel interleaved
* audio samples into multichannel deinterleaved samples. The channel count of
* the input and output audio may differ.
*
* The deinterleaving and channel format conversion operations are combined
* into this single object as both operations are often required for any given
* source audio.
*/
struct IConvertDeinterleave
{
virtual ~IConvertDeinterleave() = default;
/** Deinterleave and convert the channel format of the input audio.
*
* @param InSamples - ArrayView of interleaved input samples. The number of
* samples must be evenly divisible by the number of
* input channels.
* @param OutSamples - A multichannel buffer of samples generated by deinterleaving
* the input samples and possibly upmixing or downmixing
* them to the target channel count.
*/
virtual void ProcessAudio(TArrayView<const float> InSamples, FMultichannelBuffer& OutSamples) const = 0;
/** Create an IConvertDeinterleave object for a given number of input
* and output channels.
*
* @param InNumInputChannels - Number of input channels in incoming audio.
* @param InNumOutputChannels - Number of output channels in outgoing audio.
*
* @return A valid TUniquePtr<> on success, an invalid TUniquePtr<> on failure.
*/
SIGNALPROCESSING_API static TUniquePtr<IConvertDeinterleave> Create(const FConvertDeinterleaveParams& InParams);
};
}