Пример #1
0
        public static async void ReadScript(Text text)
        {
            Voice = null;
            var bgm = text?.Music?.Path;
            var voice = text?.Voice?.Path;

            await Task.Run(() =>
            {
                if (Project.Current.IsMusicEnable && !String.IsNullOrEmpty(bgm))
                {
                    TStreamStatus status = new TStreamStatus();
                    BgmPlayer.GetStatus(ref status);

                    if (Bgm != bgm || !status.fPlay)
                    {
                        Bgm = bgm;
                        var bgmFile = FileHelper.FindFile(Project.Current.MusicPath, bgm);

                        if (!String.IsNullOrEmpty(bgmFile))
                        {
                            if (!Project.Current.IsMute && !Project.Current.IsMusicMute)
                            {
                                _notStop = true;
                                BgmPlayer.StopPlayback();
                                BgmPlayer.OpenFile(bgmFile, TStreamFormat.sfUnknown);
                                BgmPlayer.StartPlayback();
                            }
                        }
                    }
                }

                if (Project.Current.IsVoiceEnable  && !String.IsNullOrEmpty(voice))
                {
                    var voiceFile = FileHelper.FindFile(Project.Current.VoicePath, voice);
                    Voice = voiceFile;

                    if (!String.IsNullOrEmpty(voiceFile))
                    {
                        Voice = voiceFile;
                        if (!Project.Current.IsMute && !Project.Current.IsVoiceMute)
                        {
                            if (DateTime.Now - _createTime > TimeSpan.FromMilliseconds(500))
                            {
                                VoicePlayer.StopPlayback();
                                VoicePlayer.OpenFile(voiceFile, TStreamFormat.sfUnknown);
                                VoicePlayer.StartPlayback();
                            }
                            _createTime = DateTime.Now;
                        }
                    }
                }
            });
        }
Пример #2
0
        public static void SetMute()
        {
            if (!Project.Current.IsMute)
            {
                if (Project.Current.IsMusicEnable && !Project.Current.IsMusicMute && !String.IsNullOrEmpty(Bgm))
                {
                    var bgmFile = FileHelper.FindFile(Project.Current.MusicPath, Bgm);

                    TStreamStatus status = new TStreamStatus();
                    BgmPlayer.GetStatus(ref status);
                    if (!String.IsNullOrEmpty(bgmFile) && !status.fPlay)
                    {
                        _notStop = true;
                        BgmPlayer.StopPlayback();
                        BgmPlayer.OpenFile(bgmFile, TStreamFormat.sfUnknown);
                        BgmPlayer.StartPlayback();
                    }
                }
                else
                {
                    BgmPlayer.StopPlayback();
                }

                if (Project.Current.IsVoiceEnable && !Project.Current.IsVoiceMute)
                {
                    ReplayVoice();
                }
                else
                {
                    VoicePlayer.StopPlayback();
                }
            }
            else
            {
                _notStop = true;
                BgmPlayer.StopPlayback();
                VoicePlayer.StopPlayback();
            }
        }
Пример #3
0
 public void GetStatus(ref TStreamStatus status)
 {
     zplay_GetStatus(objptr, ref status);
 }
Пример #4
0
 public static void ReplayVoice()
 {
     if (Project.Current.IsMute || Project.Current.IsVoiceMute)
     {
         return;
     }
     
     if (!String.IsNullOrEmpty(Voice) && File.Exists(Voice))
     {
         TStreamStatus status = new TStreamStatus();
         VoicePlayer.GetStatus(ref status);
         if (!status.fPlay)
         {
             VoicePlayer.OpenFile(Voice, TStreamFormat.sfUnknown);
             VoicePlayer.StartPlayback();
         }
     }
 }
Пример #5
0
 private static extern void zplay_GetStatus(uint objptr, ref TStreamStatus pStatus);