Esempio n. 1
0
        private void LoadFile(string path)
        {
            try
            {
                x9aFile = ParseX9A(path);
            }
            catch (Exception ex)
            {
                TaskDialog taskDialog = new TaskDialog();

                taskDialog.MainIcon                = TaskDialogIcon.Error;
                taskDialog.Content                 = "X9A Editor cannot read this file, most likely because it was created using an unsupported CP88/CP73 firmware version.\r\n\r\nPlease report this issue on <a href=\"https://github.com/chausner/X9AEditor\">GitHub</a>.";
                taskDialog.ExpandedInformation     = ex.ToString();
                taskDialog.EnableHyperlinks        = true;
                taskDialog.AllowDialogCancellation = true;
                taskDialog.WindowTitle             = "Error opening file";
                taskDialog.Buttons.Add(new TaskDialogButton(ButtonType.Ok));
                taskDialog.HyperlinkClicked += (sender, e) => Process.Start(e.Href);

                taskDialog.ShowDialog();
                return;
            }

            LoadedFilePath = path;

            Voices.Clear();
            for (int i = 0; i < x9aFile.Voices.Length; i++)
            {
                Voices.Add(new VoiceViewModel((X9aFile.Voice)x9aFile.Voices[i].Clone(), (i / 8) + 1, (i % 8) + 1, this));
            }
        }
Esempio n. 2
0
        public void GetVoices()
        {
            var installedVoices = _synth.GetInstalledVoices();
            // Variable for debug.
            var installedVoicesCount = installedVoices.Count;

            //installedVoicesCount = 0;
            if (installedVoicesCount == 0)
            {
                throw new Exception(@"No se encontraron voces instaladas");
            }
            if (Voices == null)
            {
                Voices = new List <string>();
            }
            // Output information about all of the installed voices.
            Debug.WriteLine(@"Installed voices -");
            foreach (var voice in installedVoices)
            {
                var    info            = voice.VoiceInfo;
                var    infoDescription = info.Description;
                string auxvoice;
                if (infoDescription.StartsWith("Microsoft"))
                {
                    auxvoice = infoDescription;
                }
                else
                {
                    //auxvoice = info.Name;
                    continue;
                }
                if (!Voices.Contains(auxvoice))
                {
                    Voices.Add(auxvoice);
                }
                var audioFormats = "";
                foreach (var fmt in info.SupportedAudioFormats)
                {
                    audioFormats += $"{fmt.EncodingFormat.ToString()}\n";
                }

                Debug.WriteLine(@" Name:          " + info.Name);
                Debug.WriteLine(@" Culture:       " + info.Culture);
                Debug.WriteLine(@" Age:           " + info.Age);
                Debug.WriteLine(@" Gender:        " + info.Gender);
                Debug.WriteLine(@" Description:   " + infoDescription);
                Debug.WriteLine(@" ID:            " + info.Id);
                Debug.WriteLine(@" Enabled:       " + voice.Enabled);
                Debug.WriteLine(info.SupportedAudioFormats.Count != 0
                    ? $@" Audio formats: {audioFormats}"
                    : @" No supported audio formats found");

                Debug.WriteLine($@" Additional Info - {info.AdditionalInfo.Keys.Aggregate("", (current, key) => current + $"  {key}: {info.AdditionalInfo[key]}\n")}");
            }
        }
Esempio n. 3
0
 public Measure(Track track = null, MeasureHeader header = null) : this()
 {
     if (Voices.Count == 0)
     {
         for (int x = 0; x < MaxVoices; x++)
         {
             Voices.Add(new Voice(this));
         }
     }
     this.Header = header;
     this.Track  = track;
 }
Esempio n. 4
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (amount_voices >= 10)
     {
         MessageBox.Show("Превышено количество добавлений");
     }
     else
     {
         Legends.Add(textBox3.Text);
         Voices.Add(int.Parse(textBox2.Text));
         amount_voices++;
         LoadLegends();
     }
 }
Esempio n. 5
0
        private void GetVoices()
        {
            var voices       = SpeechSynthesizer.AllVoices;
            var defaultVoice = SpeechSynthesizer.DefaultVoice;

            // Put the VoiceInformation into an VoiceModel
            foreach (VoiceInformation voice in voices)
            {
                var voiceModel = new VoiceModel(voice);
                Voices.Add(voiceModel);

                // Check for the default voice of the system and if true set it as the currently selected voice
                if (voiceModel.VoiceId == defaultVoice.Id)
                {
                    SelectedVoice = voiceModel;
                }
            }
        }
Esempio n. 6
0
 public void AddVoice(Voice voice)
 {
     voice.Bar   = this;
     voice.Index = Voices.Count;
     Voices.Add(voice);
 }
Esempio n. 7
0
 public void AddVoice(VoiceInformation.VoiceType t)
 {
     Voices.Add(t);
     IsUpdate = true;
 }
Esempio n. 8
0
        public void GetVoices()
        {
            var installedVoices = _synth.GetInstalledVoices();

            if (installedVoices.Count == 0)
            {
                throw new Exception(@"No se encontraron voces instaladas");
            }

            if (Voices == null)
            {
                Voices = new List <string>();
            }

            // Output information about all of the installed voices.
            Debug.WriteLine(@"Installed voices -");

            foreach (var voice in installedVoices)
            {
                var    info            = voice.VoiceInfo;
                var    infoDescription = info.Description;
                string auxVoice;
                if (infoDescription.StartsWith("Microsoft"))
                {
                    auxVoice = infoDescription;
                }
                else
                {
                    // For now it's only possible to use the Microsoft Voices.
                    //auxVoice = info.Name;
                    continue;
                }
                if (!Voices.Contains(auxVoice))
                {
                    Voices.Add(auxVoice);
                }

                //GetVoiceInfo(info, infoDescription, voice);
            }

            /*
             *          void GetVoiceInfo(VoiceInfo info, string infoDescription, InstalledVoice voice)
             *          {
             *              var audioFormats = info.SupportedAudioFormats.Aggregate("", (current, fmt) => current + $"{fmt.EncodingFormat}\n");
             *
             *              Debug.WriteLine(@" Name:          " + info.Name);
             *              Debug.WriteLine(@" Culture:       " + info.Culture);
             *              Debug.WriteLine(@" Age:           " + info.Age);
             *              Debug.WriteLine(@" Gender:        " + info.Gender);
             *              Debug.WriteLine(@" Description:   " + infoDescription);
             *              Debug.WriteLine(@" ID:            " + info.Id);
             *              Debug.WriteLine(@" Enabled:       " + voice.Enabled);
             *              Debug.WriteLine(info.SupportedAudioFormats.Count != 0
             *                  ? $@" Audio formats: {audioFormats}"
             *                  : @" No supported audio formats found");
             *
             *              Debug.WriteLine(
             *                  $@" Additional Info - {info.AdditionalInfo.Keys.Aggregate("", (current, key) => current + $"  {key}: {info.AdditionalInfo[key]}\n")}");
             *          }
             */
        }
        public override void Load(ExtendedBinaryReader fileReader, bool keepOpen = false)
        {
            // Read STSC
            base.Load(fileReader);

            StreamBlock block;

            // System text
            block = GetStreamBlockAndJump(0, fileReader);
            while (!EndOfBlock(fileReader, block))
            {
                SystemText.Add(fileReader.ReadStringElsewhere());
            }

            // CGs
            block = GetStreamBlockAndJump(1, fileReader);
            while (!EndOfBlock(fileReader, block))
            {
                CGs.Add(fileReader.ReadStruct <CGEntry>());
            }

            // Movies
            block = GetStreamBlockAndJump(2, fileReader);
            while (!EndOfBlock(fileReader, block))
            {
                Movies.Add(fileReader.ReadStruct <MovieEntry>());
            }

            // Memories
            block = GetStreamBlockAndJump(3, fileReader);
            while (!EndOfBlock(fileReader, block))
            {
                Memories.Add(fileReader.ReadStruct <MemoryEntry>());
            }

            // Characters
            block = GetStreamBlockAndJump(4, fileReader);
            while (!EndOfBlock(fileReader, block))
            {
                Characters.Add(fileReader.ReadStruct <CharacterEntry>());
            }

            // Unknown2
            block = GetStreamBlockAndJump(5, fileReader);
            while (!EndOfBlock(fileReader, block))
            {
                Unknown2.Add(fileReader.ReadStruct <Unknown2Entry>());
            }

            // Unknown3
            block = GetStreamBlockAndJump(6, fileReader);
            while (!EndOfBlock(fileReader, block))
            {
                Unknown3.Add(fileReader.ReadStruct <Unknown3Entry>());
            }

            // Voices
            block = GetStreamBlockAndJump(7, fileReader);
            while (!EndOfBlock(fileReader, block))
            {
                Voices.Add(fileReader.ReadStruct <VoiceEntry>());
            }

            // Unknown4
            block = GetStreamBlockAndJump(8, fileReader);
            while (!EndOfBlock(fileReader, block))
            {
                Unknown4.Add(fileReader.ReadStruct <Unknown4Entry>());
            }

            // Older versions may not include art books and drama CDs
            if (Version == 7)
            {
                // Art Book Page
                block = GetStreamBlockAndJump(9, fileReader);
                while (!EndOfBlock(fileReader, block))
                {
                    ArtBookPages.Add(fileReader.ReadStruct <ArtBookPageEntry>());
                }

                // DramaCDs
                block = GetStreamBlockAndJump(10, fileReader);
                while (!EndOfBlock(fileReader, block))
                {
                    DramaCDs.Add(fileReader.ReadStruct <DramaCDEntry>());
                }
            }
        }
Esempio n. 10
0
 public void AddVoiceTTS(string text, float preGap = 0.0f, float postGap = 0.0f, string name = null, Dictionary <string, string> ttsOptions = null)
 {
     Voices.Add(new Voice(name ?? string.Empty, preGap, postGap, text, string.Empty, ttsOptions, VoiceSource.TTS));
 }
Esempio n. 11
0
 public void AddVoiceWeb(string url, float preGap = 0.0f, float postGap = 0.0f, string name = null, string text = null)
 {
     Voices.Add(new Voice(name ?? string.Empty, preGap, postGap, text, url, null, VoiceSource.Web));
 }
Esempio n. 12
0
 public void AddVoice(string name, float preGap = 0.0f, float postGap = 0.0f, string text = null, string url = null, Dictionary <string, string> ttsOptions = null, VoiceSource source = VoiceSource.Local)
 {
     Voices.Add(new Voice(name, preGap, postGap, text, url, ttsOptions, source));
 }
Esempio n. 13
0
 public void AddVoiceTTS(string text, float preGap = 0.0f, float postGap = 0.0f, string name = null, TTSConfiguration ttsConfig = null, bool useCache = true, string description = null)
 {
     Voices.Add(new Voice(name ?? string.Empty, preGap, postGap, text, string.Empty, ttsConfig, VoiceSource.TTS, useCache, description));
 }
Esempio n. 14
0
 public void AddVoiceWeb(string url, float preGap = 0.0f, float postGap = 0.0f, string name = null, string text = null, bool useCache = true, string description = null)
 {
     Voices.Add(new Voice(name ?? string.Empty, preGap, postGap, text ?? string.Empty, url ?? string.Empty, null, VoiceSource.Web, useCache, description));
 }
Esempio n. 15
0
 public void AddVoice(string name, float preGap = 0.0f, float postGap = 0.0f, string text = null, string url = null, TTSConfiguration ttsConfig = null, VoiceSource source = VoiceSource.Local, string description = null)
 {
     Voices.Add(new Voice(name, preGap, postGap, text ?? string.Empty, url ?? string.Empty, ttsConfig, source, false, description));
 }
Esempio n. 16
0
 public void AddVoice(Voice voice)
 {
     voice.Measure = this;
     Voices.Add(voice);
 }