diff --git a/BouyomiPlugin/ConfigView.xaml b/BouyomiPlugin/ConfigView.xaml
index 1d276dea..51e61dad 100644
--- a/BouyomiPlugin/ConfigView.xaml
+++ b/BouyomiPlugin/ConfigView.xaml
@@ -21,7 +21,39 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BouyomiPlugin/ConfigViewModel.cs b/BouyomiPlugin/ConfigViewModel.cs
index 255d9182..21d22b92 100644
--- a/BouyomiPlugin/ConfigViewModel.cs
+++ b/BouyomiPlugin/ConfigViewModel.cs
@@ -7,6 +7,9 @@ namespace BouyomiPlugin
{
class ConfigViewModel : ViewModelBase
{
+ private const int VoiceTypeSapi5Offset = 10001;
+ private readonly int VoiceTypeLength = Enum.GetNames(typeof(FNF.Utility.VoiceType)).Length;
+
private readonly Options _options;
public bool IsEnabled
{
@@ -49,6 +52,36 @@ public bool IsKillBouyomiChan
set { _options.IsKillBouyomiChan = value; }
}
+ public bool IsVoiceTypeSpecfied
+ {
+ get { return _options.IsVoiceTypeSpecfied; }
+ set { _options.IsVoiceTypeSpecfied = value; }
+ }
+
+ public int VoiceTypeSelectedIndex
+ {
+ get { var index = _options.VoiceTypeIndex; return index >= VoiceTypeSapi5Offset ? (index - VoiceTypeSapi5Offset) + VoiceTypeLength : index; }
+ set { _options.VoiceTypeIndex = value < 0 ? 0 : value >= VoiceTypeLength ? VoiceTypeSapi5Offset + value - VoiceTypeLength : value; }
+ }
+
+ public int VoiceVolume
+ {
+ get { return _options.VoiceVolume; }
+ set { _options.VoiceVolume = value; }
+ }
+
+ public int VoiceSpeed
+ {
+ get { return _options.VoiceSpeed; }
+ set { _options.VoiceSpeed = value; }
+ }
+
+ public int VoiceTone
+ {
+ get { return _options.VoiceTone; }
+ set { _options.VoiceTone = value; }
+ }
+
#region YouTubeLive
///
/// YouTubeLiveの接続メッセージを読み上げるか
@@ -575,6 +608,9 @@ public ConfigViewModel(Options options)
case nameof(_options.IsReadComment):
RaisePropertyChanged(nameof(IsReadComment));
break;
+ case nameof(_options.IsVoiceTypeSpecfied):
+ RaisePropertyChanged(nameof(IsVoiceTypeSpecfied));
+ break;
}
};
ShowFilePickerCommand = new RelayCommand(ShowFilePicker);
diff --git a/BouyomiPlugin/Options.cs b/BouyomiPlugin/Options.cs
index f0afdc6c..7eb82c65 100644
--- a/BouyomiPlugin/Options.cs
+++ b/BouyomiPlugin/Options.cs
@@ -13,6 +13,11 @@ class Options : DynamicOptionsBase
public string NickTitle { get { return GetValue(); } set { SetValue(value); } }
public bool Want184Read { get { return GetValue(); } set { SetValue(value); } }
public bool IsKillBouyomiChan { get { return GetValue(); } set { SetValue(value); } }
+ public bool IsVoiceTypeSpecfied { get { return GetValue(); } set { SetValue(value); } }
+ public int VoiceTypeIndex { get { return GetValue(); } set { SetValue(value); } }
+ public int VoiceVolume { get { return GetValue(); } set { SetValue(value); } }
+ public int VoiceSpeed { get { return GetValue(); } set { SetValue(value); } }
+ public int VoiceTone { get { return GetValue(); } set { SetValue(value); } }
//YouTubeLive
public bool IsYouTubeLiveConnect { get { return GetValue(); } set { SetValue(value); } }
@@ -92,6 +97,11 @@ protected override void Init()
Dict.Add(nameof(NickTitle), new Item { DefaultValue = "さん", Predicate = s => true, Serializer = s => s, Deserializer = s => s });
Dict.Add(nameof(Want184Read), new Item { DefaultValue = true, Predicate = b => true, Serializer = b => b.ToString(), Deserializer = s => bool.Parse(s) });
Dict.Add(nameof(IsKillBouyomiChan), new Item { DefaultValue = false, Predicate = b => true, Serializer = b => b.ToString(), Deserializer = s => bool.Parse(s) });
+ Dict.Add(nameof(IsVoiceTypeSpecfied), new Item { DefaultValue = false, Predicate = b => true, Serializer = b => b.ToString(), Deserializer = s => bool.Parse(s) });
+ Dict.Add(nameof(VoiceTypeIndex), new Item { DefaultValue = 0, Predicate = n => true, Serializer = n => n.ToString(), Deserializer = n => int.Parse(n) });
+ Dict.Add(nameof(VoiceVolume), new Item { DefaultValue = 100, Predicate = n => true, Serializer = n => n.ToString(), Deserializer = n => int.Parse(n) });
+ Dict.Add(nameof(VoiceSpeed), new Item { DefaultValue = 100, Predicate = n => true, Serializer = n => n.ToString(), Deserializer = n => int.Parse(n) });
+ Dict.Add(nameof(VoiceTone), new Item { DefaultValue = 100, Predicate = n => true, Serializer = n => n.ToString(), Deserializer = n => int.Parse(n) });
//YouTubeLive
Dict.Add(nameof(IsYouTubeLiveConnect), new Item { DefaultValue = false, Predicate = b => true, Serializer = b => b.ToString(), Deserializer = s => bool.Parse(s) });
diff --git a/BouyomiPlugin/main.cs b/BouyomiPlugin/main.cs
index 108cd536..8ebdd6d3 100644
--- a/BouyomiPlugin/main.cs
+++ b/BouyomiPlugin/main.cs
@@ -108,10 +108,10 @@ public void OnCommentReceived(ICommentData data)
if (_options.IsAppendNickTitle)
nick += _options.NickTitle;
- _bouyomiChanClient.AddTalkTask2(nick);
+ TalkText(nick);
}
if (_options.IsReadComment)
- _bouyomiChanClient.AddTalkTask2(data.Comment);
+ TalkText(data.Comment);
}
catch (System.Runtime.Remoting.RemotingException)
{
@@ -534,7 +534,7 @@ public void OnMessageReceived(IMessage message, IMessageMetadata messageMetadata
}
dataToRead += comment;
}
- _bouyomiChanClient.AddTalkTask2(dataToRead);
+ TalkText(dataToRead);
}
catch (System.Runtime.Remoting.RemotingException)
{
@@ -560,6 +560,25 @@ public void OnMessageReceived(IMessage message, IMessageMetadata messageMetadata
}
}
+
+ private int TalkText(string text)
+ {
+ if (_options.IsVoiceTypeSpecfied)
+ {
+ return _bouyomiChanClient.AddTalkTask2(
+ text,
+ _options.VoiceSpeed,
+ _options.VoiceTone,
+ _options.VoiceVolume,
+ (FNF.Utility.VoiceType)Enum.ToObject(typeof(FNF.Utility.VoiceType), _options.VoiceTypeIndex)
+ );
+ }
+ else
+ {
+ return _bouyomiChanClient.AddTalkTask2(text);
+ }
+ }
+
public IPluginHost Host { get; set; }
public string GetSettingsFilePath()
{