SHA256
Fix Audio Sample Rate Dropdown Displaying Wrong Option
This commit is contained in:
1 file changed
+25
-53
+25
-53
@@ -117,7 +117,6 @@ namespace ADOFAIRenderer.UI
|
||||
private void OpenAdvancedConfig()
|
||||
{
|
||||
var config = RenderManager.Instance.Configuration;
|
||||
config.AdvancedConfig ??= GenerateAdvancedConfig();
|
||||
|
||||
var tempConfig = new AdvancedConfig
|
||||
{
|
||||
@@ -255,8 +254,7 @@ namespace ADOFAIRenderer.UI
|
||||
private void OpenVideoEncodingConfig()
|
||||
{
|
||||
var config = RenderManager.Instance.Configuration;
|
||||
config.VideoConfig ??= GenerateEncodingConfig();
|
||||
|
||||
|
||||
var tempConfig = new VideoEncodingConfig
|
||||
{
|
||||
Codec = config.VideoConfig.Codec,
|
||||
@@ -475,7 +473,6 @@ namespace ADOFAIRenderer.UI
|
||||
private void OpenAudioEncodingConfig()
|
||||
{
|
||||
var config = RenderManager.Instance.Configuration;
|
||||
config.AudioConfig ??= GenerateAudioEncodingConfig();
|
||||
|
||||
var tempAudioConfig = new AudioEncodingConfig
|
||||
{
|
||||
@@ -485,7 +482,7 @@ namespace ADOFAIRenderer.UI
|
||||
AudioBitrate = config.AudioConfig.AudioBitrate
|
||||
};
|
||||
|
||||
if (_audioEncodingConfigContainer != null && _root.Contains(_audioEncodingConfigContainer))
|
||||
if (_root.Contains(_audioEncodingConfigContainer))
|
||||
{
|
||||
_root.Remove(_audioEncodingConfigContainer);
|
||||
}
|
||||
@@ -530,13 +527,28 @@ namespace ADOFAIRenderer.UI
|
||||
// 3. 샘플 레이트 로우
|
||||
var sampleRateRow = CreateRow();
|
||||
var sampleRateLabel = CreateFormLabel("샘플 레이트(Hz)");
|
||||
var sampleRateStr = tempAudioConfig.AudioSampleRate.ToString();
|
||||
if (sampleRateStr != "44100" && sampleRateStr != "48000")
|
||||
var isOpus = config.VideoConfig.Codec is Codec.AV1 or Codec.VP9 or Codec.VVC;
|
||||
|
||||
List<string> sampleRateChoices;
|
||||
string sampleRateStr;
|
||||
|
||||
if (isOpus)
|
||||
{
|
||||
sampleRateStr = "44100";
|
||||
sampleRateChoices = new List<string> { "48000" };
|
||||
sampleRateStr = "48000";
|
||||
}
|
||||
else
|
||||
{
|
||||
sampleRateChoices = new List<string> { "44100", "48000" };
|
||||
sampleRateStr = tempAudioConfig.AudioSampleRate.ToString();
|
||||
if (sampleRateStr != "44100" && sampleRateStr != "48000")
|
||||
{
|
||||
sampleRateStr = "44100";
|
||||
}
|
||||
}
|
||||
|
||||
var sampleRateDropdown = new DropdownField(
|
||||
new List<string> { "44100", "48000" },
|
||||
sampleRateChoices,
|
||||
sampleRateStr
|
||||
) { name = "AudioSampleRate" };
|
||||
sampleRateRow.Add(sampleRateLabel);
|
||||
@@ -652,10 +664,6 @@ namespace ADOFAIRenderer.UI
|
||||
if (showJudgementText != null)
|
||||
config.ShowJudgementText = showJudgementText.value;
|
||||
|
||||
RenderManager.Instance.Configuration.VideoConfig ??= GenerateEncodingConfig();
|
||||
RenderManager.Instance.Configuration.AudioConfig ??= GenerateAudioEncodingConfig();
|
||||
RenderManager.Instance.Configuration.AdvancedConfig ??= GenerateAdvancedConfig();
|
||||
|
||||
RenderManager.Instance.SetupCaptureDirectory();
|
||||
RenderManager.Instance.SetupGameScene();
|
||||
}
|
||||
@@ -705,10 +713,6 @@ namespace ADOFAIRenderer.UI
|
||||
if (delayField != null) delayField.value = config.DelayAfterLevelEnd;
|
||||
if (showJudgementText != null) showJudgementText.value = config.ShowJudgementText;
|
||||
|
||||
config.VideoConfig ??= GenerateEncodingConfig();
|
||||
config.AudioConfig ??= GenerateAudioEncodingConfig();
|
||||
config.AdvancedConfig ??= GenerateAdvancedConfig();
|
||||
|
||||
RenderManager.Instance.Configuration = config;
|
||||
}
|
||||
|
||||
@@ -1048,9 +1052,9 @@ namespace ADOFAIRenderer.UI
|
||||
ShowJudgementText = showJudgementText?.value ?? true
|
||||
};
|
||||
|
||||
currentConfig.VideoConfig = RenderManager.Instance.Configuration.VideoConfig ?? GenerateEncodingConfig();
|
||||
currentConfig.AudioConfig = RenderManager.Instance.Configuration.AudioConfig ?? GenerateAudioEncodingConfig();
|
||||
currentConfig.AdvancedConfig = RenderManager.Instance.Configuration.AdvancedConfig ?? GenerateAdvancedConfig();
|
||||
currentConfig.VideoConfig = RenderManager.Instance.Configuration.VideoConfig;
|
||||
currentConfig.AudioConfig = RenderManager.Instance.Configuration.AudioConfig;
|
||||
currentConfig.AdvancedConfig = RenderManager.Instance.Configuration.AdvancedConfig;
|
||||
|
||||
PresetManager.SavePreset(presetName, currentConfig);
|
||||
nameField.value = string.Empty;
|
||||
@@ -1087,6 +1091,7 @@ namespace ADOFAIRenderer.UI
|
||||
|
||||
_root.Add(_presetConfigContainer);
|
||||
ToggleScreens(true);
|
||||
return;
|
||||
|
||||
void ToggleScreens(bool showPreset)
|
||||
{
|
||||
@@ -1129,38 +1134,5 @@ namespace ADOFAIRenderer.UI
|
||||
};
|
||||
return label;
|
||||
}
|
||||
|
||||
private VideoEncodingConfig GenerateEncodingConfig()
|
||||
{
|
||||
return new VideoEncodingConfig
|
||||
{
|
||||
Codec = Codec.H264,
|
||||
RateControlMode = RateControlMode.CBR,
|
||||
Bitrate = 30000, MaxBitrate = 50000,
|
||||
QP = 18, KeyframeInterval = 2.0,
|
||||
ForceSoftwareEncoder = false
|
||||
};
|
||||
}
|
||||
|
||||
private AudioEncodingConfig GenerateAudioEncodingConfig()
|
||||
{
|
||||
return new AudioEncodingConfig
|
||||
{
|
||||
RenderAudio = true,
|
||||
AudioSampleRate = 44100,
|
||||
AudioChannels = 2,
|
||||
AudioBitrate = 256000
|
||||
};
|
||||
}
|
||||
|
||||
private AdvancedConfig GenerateAdvancedConfig()
|
||||
{
|
||||
return new AdvancedConfig
|
||||
{
|
||||
ProcessAudio = true,
|
||||
RandomSeed = null,
|
||||
NonTile = false
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user