Skip to content

Commit 2f0d361

Browse files
Update to show warning regarding post generation volume modifier
1 parent f859e22 commit 2f0d361

File tree

5 files changed

+38
-0
lines changed

5 files changed

+38
-0
lines changed

MSUScripter/Configs/Settings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class Settings
3333
public bool TrackOverviewShowHasSongIcon { get; set; }
3434
public bool TrackOverviewShowCheckCopyrightIcon { get; set; }
3535
public bool TrackOverviewShowCopyrightSafeIcon { get; set; }
36+
public bool HasShownVolumeModifierWarning { get; set; }
3637

3738
public DefaultSongPanel DefaultSongPanel { get; set; } = DefaultSongPanel.Prompt;
3839
}

MSUScripter/Services/ControlServices/MsuSongPanelService.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public class MsuSongPanelService(
2020
IAudioPlayerService audioPlayerService,
2121
AudioAnalysisService audioAnalysisService,
2222
PythonCompanionService pythonCompanionService,
23+
SettingsService settingsService,
2324
ILogger<MsuSongPanelService> logger) : ControlService
2425
{
2526
public string? GetMsuPcmInfoCopyText(MsuSongMsuPcmInfo msuPcmInfo)
@@ -289,4 +290,15 @@ public bool CanRunPyMusicLooper()
289290
{
290291
return pythonCompanionService.IsValid;
291292
}
293+
294+
public bool HasShownVolumeModifierWarning()
295+
{
296+
return settingsService.Settings.HasShownVolumeModifierWarning;
297+
}
298+
299+
public void UpdateShownVolumeModifierWarning()
300+
{
301+
settingsService.Settings.HasShownVolumeModifierWarning = true;
302+
settingsService.TrySaveSettings();
303+
}
292304
}

MSUScripter/ViewModels/MsuSongAdvancedPanelViewModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ public partial class MsuSongAdvancedPanelViewModel : SavableViewModelBase
9393
public event EventHandler? FileDragDropped;
9494

9595
public MsuSongInfo? CurrentSongInfo { get; private set; }
96+
public bool HasShownVolumeModifierWarning { get; set; }
97+
9698
private MsuSongMsuPcmInfo? _currentSongMsuPcmInfo;
9799
private MsuProjectWindowViewModelTreeData? _treeData;
98100
private MsuSongAdvancedPanelViewModelModelTreeData? _hoveredItem;

MSUScripter/Views/MsuSongAdvancedPanel.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,7 @@
510510
Grid.Column="0"
511511
Margin="3 0 3 0"
512512
Value="{Binding PostGenerateVolumeModifier}"
513+
LostFocus="VolumeModifierInputElement_OnLostFocus"
513514
/>
514515
<controls:BoolComboBox
515516
Grid.Column="1"

MSUScripter/Views/MsuSongAdvancedPanel.axaml.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ protected override void OnLoaded(RoutedEventArgs e)
6060
}
6161

6262
};
63+
_viewModel.HasShownVolumeModifierWarning = Service?.HasShownVolumeModifierWarning() ?? false;
6364
}
6465

6566
protected override void OnPointerMoved(PointerEventArgs e)
@@ -503,4 +504,25 @@ private void DetectEndingSamplesButton_OnClick(object? sender, RoutedEventArgs e
503504
// Do nothing
504505
}
505506
}
507+
508+
private async void VolumeModifierInputElement_OnLostFocus(object? sender, RoutedEventArgs e)
509+
{
510+
try
511+
{
512+
if (_viewModel is not { HasShownVolumeModifierWarning: false } || (_viewModel.PostGenerateVolumeModifier ?? 0) == 0)
513+
{
514+
return;
515+
}
516+
517+
await MessageWindow.ShowInfoDialog(
518+
"Modifying the volume here instead of the normalization option is done via the MSU Scripter rather than MsuPcm+. This means if you share the tracks.json file with others for them to generate the MSU, the volume will not match.", "Warning", TopLevel.GetTopLevel(this) as Window);
519+
520+
_viewModel.HasShownVolumeModifierWarning = true;
521+
Service?.UpdateShownVolumeModifierWarning();
522+
}
523+
catch (Exception)
524+
{
525+
// Do nothing
526+
}
527+
}
506528
}

0 commit comments

Comments
 (0)