2020-07-28 11:45:27 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "MetasoundDataReference.h"
|
|
|
|
|
#include "MetasoundDataTypeRegistrationMacro.h"
|
2020-08-13 19:07:41 -04:00
|
|
|
#include "IAudioProxyInitializer.h"
|
|
|
|
|
#include "Sound/SoundWave.h"
|
2021-03-24 16:42:09 -04:00
|
|
|
#include "DSP/InterpolatedLinearPitchShifter.h"
|
2020-07-28 11:45:27 -04:00
|
|
|
|
2021-01-24 16:12:59 -04:00
|
|
|
|
2020-07-28 11:45:27 -04:00
|
|
|
namespace Metasound
|
|
|
|
|
{
|
2020-07-30 19:14:41 -04:00
|
|
|
// Forward declare ReadRef
|
2020-09-08 18:12:55 -04:00
|
|
|
class FWaveAsset;
|
|
|
|
|
typedef TDataReadReference<FWaveAsset> FWaveAssetReadRef;
|
2020-08-11 16:50:48 -04:00
|
|
|
|
2023-05-26 13:55:21 -04:00
|
|
|
// Helper utility to test if exact types are required for a datatype.
|
|
|
|
|
template <>
|
|
|
|
|
struct TIsExplicit<FWaveAsset>
|
|
|
|
|
{
|
|
|
|
|
static constexpr bool Value = true;
|
|
|
|
|
};
|
2021-01-24 16:12:59 -04:00
|
|
|
|
2020-09-08 18:12:55 -04:00
|
|
|
// Metasound data type that holds onto a weak ptr. Mostly used as a placeholder until we have a proper proxy type.
|
|
|
|
|
class METASOUNDENGINE_API FWaveAsset
|
2020-08-13 19:07:41 -04:00
|
|
|
{
|
2021-02-26 02:30:51 -04:00
|
|
|
FSoundWaveProxyPtr SoundWaveProxy;
|
2021-03-09 21:30:41 -04:00
|
|
|
public:
|
2020-08-13 19:07:41 -04:00
|
|
|
|
|
|
|
|
FWaveAsset() = default;
|
2021-03-09 21:30:41 -04:00
|
|
|
FWaveAsset(const FWaveAsset&) = default;
|
|
|
|
|
FWaveAsset& operator=(const FWaveAsset& Other) = default;
|
2020-08-13 19:07:41 -04:00
|
|
|
|
2022-12-14 13:56:22 -05:00
|
|
|
FWaveAsset(const TSharedPtr<Audio::IProxyData>& InInitData);
|
2021-01-24 16:12:59 -04:00
|
|
|
|
2021-04-12 03:49:32 -04:00
|
|
|
bool IsSoundWaveValid() const;
|
2021-03-09 21:30:41 -04:00
|
|
|
|
|
|
|
|
const FSoundWaveProxyPtr& GetSoundWaveProxy() const
|
|
|
|
|
{
|
|
|
|
|
return SoundWaveProxy;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const FSoundWaveProxy* operator->() const
|
|
|
|
|
{
|
|
|
|
|
return SoundWaveProxy.Get();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FSoundWaveProxy* operator->()
|
|
|
|
|
{
|
|
|
|
|
return SoundWaveProxy.Get();
|
|
|
|
|
}
|
2024-05-07 15:58:09 -04:00
|
|
|
|
|
|
|
|
friend FORCEINLINE uint32 GetTypeHash(const Metasound::FWaveAsset& InWaveAsset)
|
|
|
|
|
{
|
2024-05-10 17:01:47 -04:00
|
|
|
if (InWaveAsset.IsSoundWaveValid())
|
|
|
|
|
{
|
|
|
|
|
return GetTypeHash(*InWaveAsset.GetSoundWaveProxy());
|
|
|
|
|
}
|
|
|
|
|
return INDEX_NONE;
|
2024-05-07 15:58:09 -04:00
|
|
|
}
|
2020-08-13 19:07:41 -04:00
|
|
|
};
|
|
|
|
|
|
2020-09-01 16:35:28 -04:00
|
|
|
DECLARE_METASOUND_DATA_REFERENCE_TYPES(FWaveAsset, METASOUNDENGINE_API, FWaveAssetTypeInfo, FWaveAssetReadRef, FWaveAssetWriteRef)
|
2020-07-28 11:45:27 -04:00
|
|
|
}
|
2021-03-31 04:09:57 -04:00
|
|
|
|