Represents prefix.map information.
        /// <summary>
        /// コンストラクタ.
        /// </summary>
        /// <param name="singer_config"></param>
        public UtauVoiceDB(SingerConfig singer_config)
        {
            name_ = singer_config.VOICENAME;

            string oto_ini = Path.Combine(singer_config.VOICEIDSTR, "oto.ini");

            root_ = new Oto(oto_ini, singer_config.VOICEIDSTR);

            var prefixmap = Path.Combine(singer_config.VOICEIDSTR, "prefix.map");

            if (File.Exists(prefixmap))
            {
                prefixmap_ = new PrefixMap(prefixmap);
            }

            foreach (var directory in Directory.EnumerateDirectories(singer_config.VOICEIDSTR))
            {
                var maybe_oto_file = Path.Combine(directory, "oto.ini");
                if (File.Exists(maybe_oto_file))
                {
                    var oto = new Oto(maybe_oto_file, singer_config.VOICEIDSTR);
                    sub_.Add(oto);
                }
            }
        }
Example #2
0
 public void test()
 {
     var prefixmap = new PrefixMap("./fixture/utau_voice_db/prefix.map");
     var actual = prefixmap.getMappedLyric("は", 61);
     Assert.AreEqual(@"A\は↑", actual);
     Assert.AreEqual("あ", prefixmap.getMappedLyric("あ", 60));
 }
Example #3
0
        /// <summary>
        /// コンストラクタ.
        /// </summary>
        /// <param name="singer_config"></param>
        public UtauVoiceDB(SingerConfig singer_config)
        {
            name_      = singer_config.VOICENAME;
            singconfig = singer_config.VOICEIDSTR;
            string oto_ini   = Path.Combine(singer_config.VOICEIDSTR, "oto.ini");
            string oto_Cache = Path.Combine(singer_config.VOICEIDSTR, "oto.cache");

            if (System.IO.File.Exists(oto_Cache))
            {
                string S = System.IO.File.ReadAllText(oto_Cache, System.Text.Encoding.UTF8);
                root_ = XmlSerialize.DeserializeXML <Oto>(S);
            }
            else
            {
                root_ = new Oto(oto_ini, singer_config.VOICEIDSTR);
                string O = XmlSerialize.SerializeXML <Oto>(root_);
                System.IO.File.WriteAllText(oto_Cache, O, System.Text.Encoding.UTF8);
            }

            var prefixmap = Path.Combine(singer_config.VOICEIDSTR, "prefix.map");

            if (File.Exists(prefixmap))
            {
                prefixmap_ = new PrefixMap(prefixmap);
            }

            foreach (var directory in Directory.EnumerateDirectories(singer_config.VOICEIDSTR))
            {
                var maybe_oto_file  = Path.Combine(directory, "oto.ini");
                var maybe_oto_cache = Path.Combine(directory, "oto.cache");
                if (File.Exists(maybe_oto_file))
                {
                    Oto oto = null;
                    if (System.IO.File.Exists(maybe_oto_cache))
                    {
                        string S = System.IO.File.ReadAllText(maybe_oto_cache, System.Text.Encoding.UTF8);
                        oto = XmlSerialize.DeserializeXML <Oto>(S);
                    }
                    else
                    {
                        oto = new Oto(maybe_oto_file, singer_config.VOICEIDSTR);
                        string O = XmlSerialize.SerializeXML <Oto>(oto);
                        System.IO.File.WriteAllText(maybe_oto_cache, O, System.Text.Encoding.UTF8);
                    }
                    sub_.Add(oto);
                }
            }
        }
Example #4
0
        /// <summary>
        /// コンストラクタ.
        /// </summary>
        /// <param name="singer_config"></param>
        public UtauVoiceDB(SingerConfig singer_config)
        {
            name_ = singer_config.VOICENAME;
            
            string oto_ini = Path.Combine(singer_config.VOICEIDSTR, "oto.ini");
            root_ = new Oto(oto_ini, singer_config.VOICEIDSTR);

            var prefixmap = Path.Combine(singer_config.VOICEIDSTR, "prefix.map");
            if (File.Exists(prefixmap)) {
                prefixmap_ = new PrefixMap(prefixmap);
            }

            foreach (var directory in Directory.EnumerateDirectories(singer_config.VOICEIDSTR)) {
                var maybe_oto_file = Path.Combine(directory, "oto.ini");
                if (File.Exists(maybe_oto_file)) {
                    var oto = new Oto(maybe_oto_file, singer_config.VOICEIDSTR);
                    sub_.Add(oto);
                }
            }
        }