Skip to content

Commit

Permalink
refactor: remove debug code
Browse files Browse the repository at this point in the history
  • Loading branch information
InuInu2022 committed Oct 19, 2024
1 parent 1de1b6c commit 0b7ac62
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/YMM4VoiSonaPlugin/VoiSonaTalkParameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.Text.Json.Serialization;

using YukkuriMovieMaker.Controls;
using YukkuriMovieMaker.Plugin.Voice;
Expand All @@ -19,13 +20,27 @@ public partial class VoiSonaTalkParameter : VoiceParameterBase

ImmutableList<VoiSonaTalkStyleParameter> _styles = [];
string _voice = "";
int _preset;
IReadOnlyList<(string Name, object Value)> _presets = [];

public string Voice
{
get => _voice;
set => Set(ref _voice, value);
}

/*
[Display(Name = "プリセット", Description = "プリセットを選択")]
[CommonComboBox("Name", "Value", nameof(Presets))]
public int Preset {get => _preset; set => Set(ref _preset, value); }
[JsonIgnore]
public IReadOnlyList<(string Name, object Value)> Presets{
get => _presets;
set => Set(ref _presets, value);
}
*/

[Display(Name = nameof(Speed), Description = "話速を調整")]
[TextBoxSlider("F2", "", 0.2, 5, Delay = -1)]
[Range(0.2, 5)]
Expand Down Expand Up @@ -92,23 +107,12 @@ public ImmutableList<VoiSonaTalkStyleParameter> ItemsCollection
get => _styles;
set
{
GetCaller(value);
UnsubscribeFromItems(_styles);
Set(ref _styles, value);
SubscribeToItems(_styles);
}
}

[Conditional("DEBUG")]
void GetCaller(ImmutableList<VoiSonaTalkStyleParameter> value)
{
var dump = value.Select(v => $"{v.DisplayName}:{v.Value}");
var stackTrace = new StackTrace();
var callerMethod = stackTrace.GetFrame(3)?.GetMethod();
var caller = callerMethod?.Name ?? "unknown";
Debug.WriteLine($"from: {caller} {_voice} {string.Join(",",dump)}");
}

// 個々のアイテムの PropertyChanged イベントに登録
void SubscribeToItems(ImmutableList<VoiSonaTalkStyleParameter> newItems)
{
Expand Down

0 comments on commit 0b7ac62

Please sign in to comment.