Esempio n. 1
0
        public async Task <MastodonVoiceProfileData> GetVoiceProfile(string username, string instance,
                                                                     MastodonVoiceProfileType type, CancellationToken cancellationToken)
        {
            var ty = type switch
            {
                MastodonVoiceProfileType.Status => VoiceProfileType.MastodonStatus,
                MastodonVoiceProfileType.SensitiveStatus => VoiceProfileType.MastodonSensitiveStatus,
                MastodonVoiceProfileType.BoostedStatus => VoiceProfileType.MastodonBoostedStatus,
                MastodonVoiceProfileType.BoostedSensitiveStatus => VoiceProfileType.MastodonBoostedSensitiveStatus,
                MastodonVoiceProfileType.FollowNotification => VoiceProfileType.MastodonFollowNotification,
                MastodonVoiceProfileType.FollowRequestNotification => VoiceProfileType.MastodonFollowRequestNotification,
                MastodonVoiceProfileType.MentionNotification => VoiceProfileType.MastodonMentionNotification,
                MastodonVoiceProfileType.SensitiveMentionNotification => VoiceProfileType.MastodonSensitiveMentionNotification,
                MastodonVoiceProfileType.ReblogNotification => VoiceProfileType.MastodonReblogNotification,
                MastodonVoiceProfileType.SensitiveReblogNotification => VoiceProfileType.MastodonSensitiveReblogNotification,
                MastodonVoiceProfileType.FavoriteNotification => VoiceProfileType.MastodonFavoriteNotification,
                MastodonVoiceProfileType.SensitiveFavoriteNotification => VoiceProfileType.MastodonSensitiveFavoriteNotification,
                _ => throw new InvalidProgramException(),
            };
            var data = await _updater.GetVoiceProfile(username, instance, ty, cancellationToken);

            return(new MastodonVoiceProfileData(data.Volume, data.Speed, data.Tone, data.Alpha, data.ToneScale,
                                                data.ComponentNormal, data.ComponentHappy, data.ComponentAnger, data.ComponentSorrow,
                                                data.ComponentCalmness));
        }
Esempio n. 2
0
 public async Task PlaySampleVoice(string username, string instance, MastodonVoiceProfileType type,
                                   string sampleText, CancellationToken cancellationToken)
 {
     var ty = type switch
     {
         MastodonVoiceProfileType.Status => VoiceProfileType.MastodonStatus,
         MastodonVoiceProfileType.SensitiveStatus => VoiceProfileType.MastodonSensitiveStatus,
         MastodonVoiceProfileType.BoostedStatus => VoiceProfileType.MastodonBoostedStatus,
         MastodonVoiceProfileType.BoostedSensitiveStatus => VoiceProfileType.MastodonBoostedSensitiveStatus,
         MastodonVoiceProfileType.FollowNotification => VoiceProfileType.MastodonFollowNotification,
         MastodonVoiceProfileType.FollowRequestNotification => VoiceProfileType.MastodonFollowRequestNotification,
         MastodonVoiceProfileType.MentionNotification => VoiceProfileType.MastodonMentionNotification,
         MastodonVoiceProfileType.SensitiveMentionNotification => VoiceProfileType.MastodonSensitiveMentionNotification,
         MastodonVoiceProfileType.ReblogNotification => VoiceProfileType.MastodonReblogNotification,
         MastodonVoiceProfileType.SensitiveReblogNotification => VoiceProfileType.MastodonSensitiveReblogNotification,
         MastodonVoiceProfileType.FavoriteNotification => VoiceProfileType.MastodonFavoriteNotification,
         MastodonVoiceProfileType.SensitiveFavoriteNotification => VoiceProfileType.MastodonSensitiveFavoriteNotification,
         _ => throw new InvalidProgramException(),
     };
     await _updater.PlaySampleVoice(username, instance, ty, sampleText, cancellationToken);
 }