其他bug

This commit is contained in:
Sch 2023-09-09 22:08:20 +08:00
parent bf23595bb5
commit 1a593553f7
7 changed files with 60 additions and 9 deletions

View File

@ -49,6 +49,17 @@ uint32 FSoundThread::Run()
SeekedFrame = 0;
continue;
}
// // if float
// TArray<float> MultiVolume;
// MultiVolume.SetNum(Size);
// for (int32 i = 0; i < Size; i++)
// {
// float NewFloat = *reinterpret_cast<float*>(Audio.GetData() + Offset + i * ByteNum);
// // NewFloat *= VolumeMultiplier;j
// MultiVolume[i] = NewFloat;
// }
if (Pa_WriteStream(Stream, Audio.GetData() + Offset, Size) == paOutputUnderflowed)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Underflowed"));
@ -134,6 +145,12 @@ bool FSoundThread::SeekFrame(int32 SeekFrameLoc)
return true;
}
bool FSoundThread::UpdateVolume(const float Volume)
{
VolumeMultiplier = Volume;
return true;
}
void FSoundThread::StartPlay()
{
bIsPlaying = true;

View File

@ -30,10 +30,16 @@ public:
bool CopyAudio(const uint8* Data, int32 Size, ESoundSolveType SolveType);
bool SeekFrame(int32 SeekFrameLoc);
bool UpdateVolume(float Volume);
float VolumeMultiplier = 1.0f;
int32 SeekedFrame = 0;
TArray<uint8> Audio;
void StartPlay();
void StopPlay();
bool bIsPlaying = false;
};

View File

@ -329,12 +329,12 @@ TArray<FEncodeVideoInfo> FUtils::TrackEncodeVideo(const FTrackData& TrackData, c
int32 StartFrame = (TempClipData.VideoStartFrame) % static_cast<int>(FGlobalData::GlobalFPS);;
int32 EndFrame = (TempClipData.VideoEndFrame) % static_cast<int>(FGlobalData::GlobalFPS);
FString Command = FString::Printf(TEXT("-y -i %s -ss %s -to %s -c copy %s"),
FString Command = FString::Printf(TEXT("-y -i %s -ss %s -to %s %s"),
*InputFile, *StartTime, *EndTime, *OutputFile);
FPlatformProcess::CreateProc(*GetFfmepg(), *Command, true, false, false, nullptr, 0, nullptr, nullptr);
FProcHandle Handle = FPlatformProcess::CreateProc(*GetFfmepg(), *Command, true, false, false, nullptr, 0, nullptr, nullptr);
while(FPlatformProcess::IsProcRunning(Handle)) { FPlatformProcess::Sleep(0.1f); };
EncodeVideoInfo.EncodedVideoTimeCode = FGlobalData::GetTimeData(TempClipData.ClipStartFrame);
EncodeVideoInfo.EncodedVideoName = ExportPath + FString::FromInt(i) + TEXT(".mp4");
EncodeVideoInfo.ClipStartFrame = TempClipData.ClipStartFrame;
@ -552,8 +552,14 @@ TArray<FEncodeVideoInfo> FUtils::ExportPsaf(FTrackData TrackData, const FString&
frames.Empty();
VideoCapture capture;
bool ret = capture.open(TCHAR_TO_UTF8(*TempPath));
bool ret = false;
FString Command = FString::Printf(TEXT("-i \"%s\" -y \"%s\""), *TempPath, TEXT("C:/temp/Temp.mp4"));
FPlatformProcess::ExecProcess(*FUtils::GetFfmepg(), *Command, nullptr, nullptr, nullptr);
FPlatformProcess::Sleep(2.0f);
ret = capture.open("C:\\temp\\Temp.mp4");
if (!ret)
check(false)
//setNumThreads(2);
@ -813,6 +819,9 @@ FString FUtils::GetMsFromString(FString TimeString)
FString FUtils::Color2Hex3(FColor Color)
{
Color.R = FMath::GetMappedRangeValueClamped(FVector2D(0, 0xFF), FVector2D(0, 0x64), Color.R);
Color.G = FMath::GetMappedRangeValueClamped(FVector2D(0, 0xFF), FVector2D(0, 0x64), Color.R);
Color.B = FMath::GetMappedRangeValueClamped(FVector2D(0, 0xFF), FVector2D(0, 0x64), Color.R);
return FString::Printf(TEXT("%02X%02X%02X"), Color.R, Color.G, Color.B);
}

View File

@ -127,7 +127,9 @@ enum class EPresetType
Video,
DisableProjector,
EnableProjector,
Custom, // Use Preset Custom Data
Custom, // Use Preset Custom Data
Over = 100,
};
struct FClipData;
@ -263,7 +265,7 @@ struct CUT5_API FPresetsCustomData
TArray<FLinearColor> Colors = { FLinearColor(1, 1 , 1) };
int32 Times = 1;
float Angle = 0.0;
float Time = 0.3;
float Time = 1.0f;
EPresetCustomType PresetCustomType = EPresetCustomType::None;
TArray<FCursorData> Cursors;

View File

@ -325,6 +325,7 @@ void SCustomInputPanel::Construct(const FArguments& InArgs)
// AddPreset(TEXT("结束后常亮"), TEXT(""), EPresetType::Custom);
AddPreset(TEXT("此处结束"), TEXT(""), EPresetType::Over);
AddPreset(TEXT("渐变"), TEXT(""), EPresetType::Custom, FPresetsCustomData::EPresetCustomType::Gradient);
AddPreset(TEXT("亮白"), TEXT("亮白.dat"), EPresetType::Custom);
AddPreset(TEXT("红色"), TEXT("红色.dat"), EPresetType::Custom);

View File

@ -387,7 +387,7 @@ void SCutTimeline::Construct(const FArguments& InArgs)
FTickCursorTimeThread* TickCursorTimeThread = new FTickCursorTimeThread(FGlobalData::GlobalFPS, [this]()
TickCursorTimeThread = new FTickCursorTimeThread(FGlobalData::GlobalFPS, [this]()
{
UpdateCursorPosition(GetCursorPosition() + 1);
});
@ -464,9 +464,22 @@ void SCutTimeline::SetAutoPlay(bool bStart)
}
TArray<FClipData> SCutTimeline::GetClipData()
{
TArray<FClipData> ResultClipData;
for (int32 i = 0; i < TrackGroupInstances.Num(); i++)
{
for (FClipData& ClipData : StaticCastSharedPtr<STrackHead>(TrackGroupInstances[i].Head)->TrackData.ClipData)
{
ResultClipData.Add(ClipData);
}
}
return ResultClipData;
}
int32 SCutTimeline::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect,
FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle,
bool bParentEnabled) const
FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle,
bool bParentEnabled) const
{
const FSlateBrush Brush;
FPaintGeometry PaintGeometry = AllottedGeometry.ToPaintGeometry(

View File

@ -18,6 +18,7 @@
*/
class FTickCursorTimeThread;
static inline std::atomic<bool> ClockRun = false;
struct FTrackGroup
@ -72,7 +73,9 @@ public:
float LastTime = 0.1f;
void AddNewTrackToGroup(FString GroupName, FTrackData TrackData, ETrackType GroupType = ETrackType::None);
void SetAutoPlay(bool bStart);
FTickCursorTimeThread* TickCursorTimeThread = nullptr;
TArray<FClipData> GetClipData();
FTimerHandle TimerHandle;
bool AutoPlaying = false;
virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override;