Ejemplo n.º 1
0
 public void RereadLastPhrase()
 {
     if (ItalianXml == null)
     {
         return;
     }
     if (PhraseIndex >= ItalianXml.Segments.Count)
     {
         return;
     }
     if (ItalianXml.CurSegment == null)
     {
         return;
     }
     Mp3Utils.PlayPieceOfAFile(ItalianMp3,
                               ItalianXml.CurSegment.TimeIn.TotalSeconds,
                               ItalianXml.CurSegment.TimeOut.TotalSeconds
                               );
 }
Ejemplo n.º 2
0
        private void readCurLang1Phrase()
        {
            if (Lang1CurSegment == null)
            {
                return;
            }
            var fname = Lang1CurSegment.Filename;

            if (fname == null)
            {
                return;
            }
            if (Lang1CurSegment.Type == WavEventType.WavRecording1)
            {
                WavUtils.PlayAllOfFile(AudioBooker.classes.UtilsCore.GetFullPathWithoutExtension(Lang1Mp3) + "/" + fname);
            }
            else
            {
                Mp3Utils.PlayPieceOfAFile(
                    Lang1Mp3,
                    Lang1CurSegment.TimeIn.TotalSeconds,
                    Lang1CurSegment.TimeOut.TotalSeconds);
            }
        }
Ejemplo n.º 3
0
        public void NextPhrase()
        {
            if (ItalianXml == null)
            {
                return;
            }
            if (PhraseIndex >= ItalianXml.Segments.Count)
            {
                PurgePendingSentences();
                return;
            }
            if (curSentence != null && curSegment == null)
            {
                if (PrematureAdvancement != null)
                {
                    PrematureAdvancement();
                }
                return;
            }

            commitTheLastItalianSegment();

            // goto next italian segment
            ItalianXml.CurSegment = ItalianXml.Segments.Skip(PhraseIndex).FirstOrDefault();
            if (ItalianXml.CurSegment == null)
            {
                curSentence = null;
                if (CurSentenceUpdated != null)
                {
                    CurSentenceUpdated();
                }
                return;
            }

            // ...if it exists, ADVANCE!!!
            curSentence = new XmlAbookEvent_OneSentence()
            {
                ItalianSegment  = ItalianXml.CurSegment,
                ItalianSegments = new List <XmlSegment> {
                    ItalianXml.CurSegment
                }
            };
            xml.Events.Add(curSentence);
            curSegment = null;
            PhraseIndex++;
            Mp3Utils.PlayPieceOfAFile(ItalianMp3,
                                      ItalianXml.CurSegment.TimeIn.TotalSeconds,
                                      ItalianXml.CurSegment.TimeOut.TotalSeconds
                                      );

            // events;
            if (CurSentenceUpdated != null)
            {
                CurSentenceUpdated();
            }
            if (CurSegmentUpdated != null)
            {
                CurSegmentUpdated();
            }
            if (ItalianXmlUpdated != null)
            {
                ItalianXmlUpdated();
            }
        }