new node image

This commit is contained in:
Respirant
2020-12-29 17:30:47 +03:00
parent 9ccdc0ede6
commit b68876da8b
2 changed files with 44 additions and 12 deletions
@@ -9,7 +9,15 @@ URuntimeAudioImporterBPLibrary::URuntimeAudioImporterBPLibrary(const FObjectInit
}
/* Transcode audio file to USoundWave static object */
/**
* Transcode audio file to USoundWave static object
*
* @param filePath Path to the audio file to import
* @param Format Audio file format (extension)
* @param status Final import status (TranscodingStatus)
* @param DefineFormatAutomatically Whether to define format (extension) automatically or not
* @return Returns USoundWave Static Object.
*/
class USoundWave* URuntimeAudioImporterBPLibrary::GetSoundWaveFromAudioFile(const FString& filePath, TEnumAsByte < AudioFormat > Format, TEnumAsByte < TranscodingStatus >& status, bool DefineFormatAutomatically)
{
return GetUSoundWaveFromAudioFile_Internal(filePath, Format, status, DefineFormatAutomatically);
@@ -79,20 +87,31 @@ class USoundWave* URuntimeAudioImporterBPLibrary::GetSoundWaveObject(const uint8
return sw;
}
/* Destroy USoundWave static object */
void URuntimeAudioImporterBPLibrary::DestroySoundWave(USoundWave* ReadySoundWave, bool& SuccessfullyDestroyed) {
if (IsValid(ReadySoundWave) && ReadySoundWave->IsReadyForFinishDestroy()) {
FMemory::Free(ReadySoundWave->RawPCMData);
/**
* Destroy USoundWave static object
*
* @return Returns true - success, false - failure.
*/
bool URuntimeAudioImporterBPLibrary::DestroySoundWave(USoundWave* ReadySoundWave) {
ReadySoundWave->RawData.RemoveBulkData();
if (IsValid(ReadySoundWave) && ReadySoundWave->IsValidLowLevel()) {
/* Free memory */
ReadySoundWave->InvalidateCompressedData();
ReadySoundWave->FreeResources();
FMemory::Free(ReadySoundWave->RawPCMData);
ReadySoundWave->RawData.RemoveBulkData();
ReadySoundWave->RemoveAudioResource();
/* Free memory */
/* Destroying USoundWave object as UObject */
ReadySoundWave->ConditionalBeginDestroy();
SuccessfullyDestroyed = true;
ReadySoundWave = NULL;
/* Destroying USoundWave object as UObject */
return true;
}
else {
SuccessfullyDestroyed = false;
return false;
}
}
@@ -43,12 +43,25 @@ class RUNTIMEAUDIOIMPORTER_API URuntimeAudioImporterBPLibrary : public UBlueprin
GENERATED_UCLASS_BODY()
public:
/* Transcode audio file to USoundWave static object */
/**
* Transcode audio file to USoundWave static object
*
* @param filePath Path to the audio file to import
* @param Format Audio file format (extension)
* @param status Final import status (TranscodingStatus)
* @param DefineFormatAutomatically Whether to define format (extension) automatically or not
* @return Returns USoundWave Static Object.
*/
UFUNCTION(BlueprintCallable, meta = (Keywords = "Importer, Transcoder, Converter, MP3, FLAC, WAV", ToolTip = "Transcode audio file to USoundWave static object"), Category = "RuntimeAudioImporter")
static class USoundWave* GetSoundWaveFromAudioFile(const FString & filePath, TEnumAsByte < AudioFormat > Format, TEnumAsByte < TranscodingStatus > & status, bool DefineFormatAutomatically);
UFUNCTION(BlueprintCallable, meta = (Keywords = "MP3, FLAC, WAV, Destroy", ToolTip = "After the Soundwave is no longer needed, you need to call this function to free memory"), Category = "RuntimeAudioImporter")
static void DestroySoundWave(USoundWave * ReadySoundWave, bool& SuccessfullyDestroyed);
/**
* Destroy USoundWave static object
*
* @return Returns true - success, false - failure.
*/
UFUNCTION(BlueprintCallable, meta = (Keywords = "Importer, Transcoder, Converter, MP3, FLAC, WAV, Destroy", ToolTip = "After the Soundwave is no longer needed, you need to call this function to free memory"), Category = "RuntimeAudioImporter")
static bool DestroySoundWave(USoundWave * ReadySoundWave);
private: