From 483f6acef6fc3c6654447ba8f273ad152efe9aa1 Mon Sep 17 00:00:00 2001 From: Sch <3516520171@qq.com> Date: Mon, 16 Oct 2023 22:54:12 +0800 Subject: [PATCH] ASR --- Config/DefaultEngine.ini | 9 +++ Content/MainMap.umap | Bin 13755 -> 13705 bytes Source/Cut5/Interface/VideoInterface.cpp | 2 +- .../Cut5/Interface/VideoThumbnailThread.cpp | 21 ++++--- Source/Cut5/Interface/VideoThumbnailThread.h | 6 +- Source/Cut5/Widgets/DefineGlobal.h | 4 +- .../DragDropOperator/DragDropOperator.cpp | 4 +- Source/Cut5/Widgets/STimelineClip.cpp | 55 +++++++++--------- 8 files changed, 57 insertions(+), 44 deletions(-) diff --git a/Config/DefaultEngine.ini b/Config/DefaultEngine.ini index 8aac8ed..9969d28 100644 --- a/Config/DefaultEngine.ini +++ b/Config/DefaultEngine.ini @@ -215,3 +215,12 @@ ConnectionType=USBOnly bUseManualIPAddress=False ManualIPAddress= +[Voice] +bEnabled=true + +[SystemSettings] +voice.SilenceDetectionThreshold=0.01 +voice.MicNoiseGateThreshold=0.01 + + + diff --git a/Content/MainMap.umap b/Content/MainMap.umap index ab7a35f75001439f3fd6e8d3b76e9ad16187f7ce..534e14d0b06bbed9a2b72d49a9088921b630ee2c 100644 GIT binary patch delta 3515 zcmd5;T}&KR6utw5veMvgmtmLkx68ur0?V??&Ms8`)+*3;p%sxrZ7ZdyLF!K_8k3fU zkTgxvK1fbdn;5GPQcV;4BgR;bf+ofoAB;98n)uKM|7xlcZQ_H8c+SkZ%K%HWi9Yls zbI;#*&$;)^xp(IML(_*YX^Jo45+Y9sQP(;2#3OaxLytY#J#-lL3^9yje+EfHjKE$c z&^VVXgbg*jRfuBbq>mRE2)jcF4?b=992khTeEfE1`>CdbdFuYD&tP70D#P%N((8U6 z-F;D?M(ys6UN(>5@+NWa)q?xu9QH-XvWDZ z-D<}aPgW@dmZ5qB_&ll4b~>}pvyO5BqKvS7juu;~}X4W+=zrrx(aRX>BICO1sZ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c9qV59jeZfpUX^tg4nB zxWh&0#cuy7gQNi2K?tgdJ1W>{s0akTK_pTL86+)(blWo#DTA)6Wjeu<&AJM=M;zir zqCx>VbVxM@SpWq*WMVcVa7Q$O%#1oJB&mn*ak`5J;CrUcoN^v3sfn~UN7|G~r_vhL zzm5wF*OsBD_^7E3x~X>+mFOoXpPobJC!>Q( zjeGrGTa0QVZn%&xp76WC)5Ctxdh@A3RB+;BOtEBaIdt9#cagZpzxFHcAl0%Dxu(vV zGQTgb-X#O!`iT2`NhiigTxUxa4Y5t(Pd^>{VVK_@?wW($V;z zfpFzYs<9PhEa$Jt&SHHL@8FwdCoIw~xnVdWI0=k8sx(q5List>MV$0KB_Ppwh9D2F zmm7bpFo|9vwGMi{?ltL7qgSk9FTT5O`nmBBE_9xmyL|bRcR!6CoLftDfJ&i-)o!su zGIhcZ47TUkMAw7XR>31~wsCi35)KQO^zG;Vwk7(^^A`WWs|7WI?QcE(rMPZ-_+-e_ z)V4?oRm{rBO7zt8-$IHWW^8f8gQ*Cf{re6i^$K<%)+V)cUwv3o;ht;ahw69QAGvb% zGt2v@<0r4ZHXHr;DDH1q`>8-L?`Sw&ikBm%7%vPq_)*2|gxN+)<%Nw$K>Ml2wUEy? zK5p0(t24H@DPvzU*+;|F9um5@qbQ^$8x()NYWPsIGZfPS$Z*%!P(?JJpt}UGH5MR5zCZhe(_#Fu3@_*I;a)c%jN340`C zH~g2V+;Tc)nR%(aMRk_8(Vo!wCKW$K6KWXpm((sJ&WjEframe_number; + int32 VideoFPS = NewPropertyData.VideoCodecContext->time_base.den; if (VideoFPS < FGlobalData::GlobalFPS) { const double Interval = FGlobalData::GlobalFPS / VideoFPS; diff --git a/Source/Cut5/Interface/VideoThumbnailThread.cpp b/Source/Cut5/Interface/VideoThumbnailThread.cpp index e1657bb..022ad9f 100644 --- a/Source/Cut5/Interface/VideoThumbnailThread.cpp +++ b/Source/Cut5/Interface/VideoThumbnailThread.cpp @@ -3,14 +3,14 @@ #include "Cut5/Utils/FFMPEGUtils.h" #include "Cut5/Utils/Utils.h" -FVideoThumbnailThread::FVideoThumbnailThread(const FString& MoviePath, TFunction OnFinished, int32 BrushCount, const FClipData ClipData) +FVideoThumbnailThread::FVideoThumbnailThread(const FString& MoviePath, TFunction OnFinished, int32 BrushCount, FClipData* ClipData) { this->MoviePath = MoviePath; this->OnFinished = OnFinished; this->BrushCount = BrushCount; this->ClipData = ClipData; - if (ClipData.MovieBrushesPath.Num() == 0) + if (ClipData->MovieBrushesPath.Num() == 0) { bMissionStart = true; } @@ -30,7 +30,7 @@ uint32 FVideoThumbnailThread::Run() int32 i = 0; while (bMissionStart) { - if (i < BrushCount && ClipData.ResourcePropertyDataPtr && ClipData.ResourcePropertyDataPtr->Context && ClipData.ResourcePropertyDataPtr->VideoStream != -1) + if (i < BrushCount && ClipData->ResourcePropertyDataPtr && ClipData->ResourcePropertyDataPtr->Context && ClipData->ResourcePropertyDataPtr->VideoStream != -1) { const int32 CurrentFrame = BrushCount - (BrushCount - i); const int64 Timestamp = av_rescale_q(CurrentFrame / FGlobalData::GlobalFPS * AV_TIME_BASE, AVRational{1, AV_TIME_BASE}, Info.Context->streams[Info.VideoStream]->time_base); @@ -94,11 +94,18 @@ uint32 FVideoThumbnailThread::Run() Texture->UpdateResource(); FGuid Guid = FGuid::NewGuid(); - FFFMPEGUtils::ExportImage(Texture, ToFullPath(FUtils::GetProjectTempPath() / ClipData.ClipGuid.ToString() / Guid.ToString() + ".png")); - OnFinished(FUtils::GetProjectTempPath() / ClipData.ClipGuid.ToString() / Guid.ToString() + ".png"); + if (Texture->IsValidLowLevel()) + { + FFFMPEGUtils::ExportImage(Texture, ToFullPath(FUtils::GetProjectTempPath() / ClipData->ClipGuid.ToString() / Guid.ToString() + ".png")); + FString PicPath = FUtils::GetProjectTempPath() / ClipData->ClipGuid.ToString() / Guid.ToString() + ".png"; + + ClipData->MovieBrushesPath.Add(PicPath); + const FSlateDynamicImageBrush Brush = FSlateDynamicImageBrush(*ToFullPath(PicPath), FVector2f(0, 0)); + ClipData->MovieBrushes.Add(Brush); + + Texture->MarkAsGarbage(); + } - - Texture->MarkAsGarbage(); delete RawData; } }); diff --git a/Source/Cut5/Interface/VideoThumbnailThread.h b/Source/Cut5/Interface/VideoThumbnailThread.h index 8d2ebb6..3e6609c 100644 --- a/Source/Cut5/Interface/VideoThumbnailThread.h +++ b/Source/Cut5/Interface/VideoThumbnailThread.h @@ -5,16 +5,16 @@ class FVideoThumbnailThread : public FRunnable { public: - FVideoThumbnailThread(const FString& MoviePath, TFunction OnFinished, int32 BrushCount, const FClipData ClipData); + FVideoThumbnailThread(const FString& MoviePath, TFunction OnFinished, int32 BrushCount, FClipData* ClipData); virtual bool Init() override { return true; } virtual uint32 Run() override; - virtual void Stop() override {}; + virtual void Stop() override { bMissionStart = false; }; virtual void Exit() override {}; FString MoviePath; TFunction OnFinished; int32 BrushCount; - FClipData ClipData; + FClipData* ClipData; bool bMissionStart = false; }; diff --git a/Source/Cut5/Widgets/DefineGlobal.h b/Source/Cut5/Widgets/DefineGlobal.h index a903f9c..df124a0 100644 --- a/Source/Cut5/Widgets/DefineGlobal.h +++ b/Source/Cut5/Widgets/DefineGlobal.h @@ -181,7 +181,7 @@ struct CUT5_API FTrackData Ar << TrackData.ClipData; Ar << TrackData.DeviceTrack; Ar << TrackData.IsMute; - Ar << TrackData.bIsEdit; + // Ar << TrackData.bIsEdit; return Ar; }; @@ -193,7 +193,7 @@ struct CUT5_API FTrackData FDeviceTrack DeviceTrack = FDeviceTrack("None", ETrackType::VideoTrack); TArray ClipData; - bool bIsEdit = false; + // bool bIsEdit = false; bool IsMute = false; }; diff --git a/Source/Cut5/Widgets/DragDropOperator/DragDropOperator.cpp b/Source/Cut5/Widgets/DragDropOperator/DragDropOperator.cpp index 7881bfb..dac1baa 100644 --- a/Source/Cut5/Widgets/DragDropOperator/DragDropOperator.cpp +++ b/Source/Cut5/Widgets/DragDropOperator/DragDropOperator.cpp @@ -125,7 +125,7 @@ void DragDropOperator::OnUpdateVideoTrack(const FClipData& VideoClipData) SCutTimeline* Timeline = SavedMainInterface->GetCutTimeline(); FTrackData* ProjectorTrack = Timeline->GetTrackDataByType(ETrackType::ProjectorTrack); - if (ProjectorTrack->bIsEdit == false) + if (true) { ProjectorTrack->ClipData.Empty(); FClipData NewClipData; @@ -152,7 +152,7 @@ void DragDropOperator::OnUpdateProjectorTrack(const FClipData& ProjectorClipData { SCutTimeline* Timeline = SavedMainInterface->GetCutTimeline(); FTrackData* ProjectorTrack = Timeline->GetTrackDataByType(ETrackType::ProjectorTrack); - ProjectorTrack->bIsEdit = true; + // ProjectorTrack->bIsEdit = true; } diff --git a/Source/Cut5/Widgets/STimelineClip.cpp b/Source/Cut5/Widgets/STimelineClip.cpp index 25de2ac..a078410 100644 --- a/Source/Cut5/Widgets/STimelineClip.cpp +++ b/Source/Cut5/Widgets/STimelineClip.cpp @@ -23,6 +23,7 @@ #include "Engine/Engine.h" #include "Engine/Texture2D.h" #include "HAL/ThreadManager.h" +#include "Kismet/KismetMathLibrary.h" #include "MicroWidgets/SNewProjectTips.h" #include "Presets/SClipCursor.h" #include "Presets/SClipVolumeCursor.h" @@ -272,19 +273,12 @@ void STimelineClip::Construct(const FArguments& InArgs) { if (!MainWidgetInterface->GetSelf()->GetThread(FUtils::GetVideoThumbnailThreadGuid(ClipData->ClipGuid))) { - FClipData& Clip = *ClipData; - FVideoThumbnailThread* ThumbnailThread = new FVideoThumbnailThread(ClipData->MoviePath, [this, &Clip](const FString& PicPath) + + FVideoThumbnailThread* ThumbnailThread = new FVideoThumbnailThread(ClipData->MoviePath, [this](const FString& PicPath) { - if (this == nullptr) - { - return; - } - Clip.MovieBrushesPath.Add(PicPath); - const FSlateDynamicImageBrush Brush = FSlateDynamicImageBrush(*ToFullPath(PicPath), FVector2f(0, 0)); - Clip.MovieBrushes.Add(Brush); - }, ClipData->MovieBrushNum, *ClipData); + }, ClipData->MovieBrushNum, ClipData); FRunnableThread::Create(ThumbnailThread, TEXT("VideoThumbnailThread")); MainWidgetInterface->GetSelf()->AddThread(FUtils::GetVideoThumbnailThreadGuid(ClipData->ClipGuid), ThumbnailThread); @@ -342,6 +336,10 @@ void STimelineClip::Construct(const FArguments& InArgs) STimelineClip::~STimelineClip() { + // if (MainWidgetInterface->GetSelf()->Threads.Contains(FUtils::GetVideoThumbnailThreadGuid(ClipData->ClipGuid))) + // { + // MainWidgetInterface->GetSelf()->GetThread(FUtils::GetVideoThumbnailThreadGuid(ClipData->ClipGuid))->Stop(); + // } } @@ -736,15 +734,16 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe CropEndFrameOffset = CropStartFrameOffset * FGlobalData::DefaultTimeTickSpace + (RangeEnd - RangeStart); } - int32 NeedDrawCount = (CropEndFrameOffset - CropStartFrameOffset) * FGlobalData::DefaultTimeTickSpace * 2; + int32 NeedDrawCount = ClipData->GetLength() * FGlobalData::DefaultTimeTickSpace; const int32 StartOffset = (ClipData->ResourcePropertyDataPtr->AudioSample / FGlobalData::GlobalFPS) * ClipData->VideoStartFrame * FUtils::GetFormatSampleBytesNum(ClipData->ResourcePropertyDataPtr->SampleFormat) * 2 / DownSample; - const int32 EndOffset = (ClipData->ResourcePropertyDataPtr->AudioSample / FGlobalData::GlobalFPS) + + const int32 EndOffset = (ClipData->ResourcePropertyDataPtr->AudioSample / FGlobalData::GlobalFPS) * ClipData->VideoEndFrame * FUtils::GetFormatSampleBytesNum(ClipData->ResourcePropertyDataPtr->SampleFormat) * 2 / DownSample; - + const int32 CropStartDataOffset = (ClipData->ResourcePropertyDataPtr->AudioSample / FGlobalData::GlobalFPS) * CropStartFrameOffset * FUtils::GetFormatSampleBytesNum(ClipData->ResourcePropertyDataPtr->SampleFormat) * 2 / DownSample; @@ -756,36 +755,34 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe NeedDrawCount = -1; } - const int32 Interval = (CropEndDataOffset - CropStartDataOffset) / NeedDrawCount; + // const int32 Interval = (CropEndDataOffset - CropStartDataOffset) / NeedDrawCount; if (CropStartFrameOffset != -1 || NeedDrawCount != -1) { - const float StartRange = CurrentStartRange - RangeStart; - const float EndRange = CurrentEndRange; + // + // const float RangeStart = MainWidgetInterface->GetCutTimeline()->TrackBodyHScrollBox->GetCachedGeometry().LocalToAbsolute(FVector2D(0, 0)).X; + // const float RangeEnd = MainWidgetInterface->GetCutTimeline()->TrackBodyHScrollBox->GetCachedGeometry().LocalToAbsolute(FVector2D(MainWidgetInterface->GetCutTimeline()->TrackBodyHScrollBox->GetCachedGeometry().GetLocalSize().X, 0)).X; + // const float CurrentStartRange = AllottedGeometry.LocalToAbsolute(FVector2D(0, 0)).X; + // const float CurrentEndRange = AllottedGeometry.LocalToAbsolute(FVector2D(AllottedGeometry.GetLocalSize().X, 0)).X; + // + + const int32 Interval = (EndOffset - StartOffset) / NeedDrawCount; for (int32 i = 0; i < NeedDrawCount / DownSample; i++) { - const int32 CurrentIndex = (CropStartDataOffset * DownSample) + (i * (Interval * DownSample * 4)); + const int32 CurrentIndex = (StartOffset * DownSample) + (i * (Interval * DownSample * 4)); if (CurrentIndex >= ClipData->ResourcePropertyDataPtr->AudioData.Num()) continue; - + float NewFloat = *reinterpret_cast(&ClipData->ResourcePropertyDataPtr->AudioData[CurrentIndex]); float Y = FMath::GetMappedRangeValueClamped(FVector2D(1.0, 0.0), FVector2D(0.0, AllottedGeometry.GetLocalSize().Y), FMath::Abs(NewFloat)); - - - TArray NewLoc; - NewLoc.Add(FVector2D((CropStartFrameOffset * FGlobalData::DefaultTimeTickSpace + i * DownSample) , AllottedGeometry.GetLocalSize().Y)); - NewLoc.Add(FVector2D((CropStartFrameOffset * FGlobalData::DefaultTimeTickSpace + i * DownSample) , Y)); - + NewLoc.Add(FVector2D(i * DownSample, AllottedGeometry.GetLocalSize().Y)); + NewLoc.Add(FVector2D(i * DownSample, Y)); FSlateDrawElement::MakeLines(OutDrawElements, LayerId + 6, AllottedGeometry.ToPaintGeometry(), NewLoc, ESlateDrawEffect::None, - FColor(45, 214, 153, 255), true, DownSample * 1.2); - - + FColor(45, 214, 153, 255), true, DownSample * 1.2); } - - // GEngine->AddOnScreenDebugMessage(-1, 0.1f, FColor::Red, FString::SanitizeFloat(StartRange)); }