Пример #1
0
        public void AddTrack(TrackInfo track)
        {
            var data = DataArrayUtl.InsertArrayAtEnd(DataArrayUtl.FindTagArray(mData, "tracks"));

            DataArrayUtl.InsertTagIntAtEnd(data, "enabled", track.Enabled ? 1 : 0);
            DataArrayUtl.InsertTagSymAtEnd(data, "type", track.TrackType);
            DataArrayUtl.InsertTagIntAtEnd(data, "channels", track.NumChannels);
            switch (track.NumChannels)
            {
            case 1:
                DataArrayUtl.AddTagFloatAtEnd(data, "pan", track.PanLeft);
                DataArrayUtl.AddTagFloatAtEnd(data, "vol", track.VolLeft);
                break;

            case 2:
                DataArrayUtl.AddTagFloatAtEnd(data, "pan", track.PanLeft);
                DataArrayUtl.AddTagFloatAtEnd(data, "pan", track.PanRight);
                DataArrayUtl.AddTagFloatAtEnd(data, "vol", track.VolLeft);
                DataArrayUtl.AddTagFloatAtEnd(data, "vol", track.VolRight);
                break;

            default:
                throw new MagmaException("Invalid NumChannels: " + track.NumChannels);
            }
            DataArrayUtl.InsertTagStrAtEnd(data, "file", track.Filename);
            OnChangeToUnsavedData();
        }
Пример #2
0
        public void SetTrack(TrackInfo track)
        {
            var tagArray = DataArrayUtl.FindTagArray(DataArrayUtl.FindTagArray(mData, "tracks"), track.TrackType);

            DataArrayUtl.ReleaseContents(tagArray);
            DataArrayUtl.InsertTagIntAtEnd(tagArray, "enabled", track.Enabled ? 1 : 0);
            DataArrayUtl.InsertTagIntAtEnd(tagArray, "channels", track.NumChannels);
            if (track.TrackType == "vocals")
            {
                DataArrayUtl.SetTagInt(DataArrayUtl.FindTagArray(DataArrayUtl.FindTagArray(mData, "dry_vox"), "part0"), "enabled", track.Enabled ? 1 : 0);
            }
            switch (track.NumChannels)
            {
            case 0:
                DataArrayUtl.AddTagFloatAtEnd(tagArray, "pan", 0.0f);
                DataArrayUtl.AddTagFloatAtEnd(tagArray, "vol", 0.0f);
                break;

            case 1:
                DataArrayUtl.AddTagFloatAtEnd(tagArray, "pan", track.PanLeft);
                DataArrayUtl.AddTagFloatAtEnd(tagArray, "vol", track.VolLeft);
                break;

            case 2:
                DataArrayUtl.AddTagFloatAtEnd(tagArray, "pan", track.PanLeft);
                DataArrayUtl.AddTagFloatAtEnd(tagArray, "pan", track.PanRight);
                DataArrayUtl.AddTagFloatAtEnd(tagArray, "vol", track.VolLeft);
                DataArrayUtl.AddTagFloatAtEnd(tagArray, "vol", track.VolRight);
                break;

            default:
                throw new MagmaException("Invalid NumChannels: " + track.NumChannels);
            }
            DataArrayUtl.InsertTagStrAtEnd(tagArray, "file", track.Filename);
            mTrackCache[track.TrackType] = track;
            OnChangeToUnsavedData();
        }
Пример #3
0
        protected bool PatchPreviousProjectVersions()
        {
            var flag = false;

            if (GetProjectVersion() < 3)
            {
                return(false);
            }
            switch (GetProjectVersion())
            {
            case 3:
                DataArrayUtl.InsertTagStrAtEnd(mData, "destination_file", GetDefaultDestination());
                flag = true;
                break;

            case 4:
                DataArrayUtl.InsertTagIntAtEnd(DataArrayUtl.FindTagArray(mData, "metadata"), "has_album", 1);
                if (TrackNumber == 0)
                {
                    TrackNumber = 1;
                }
                flag = true;
                break;
            }
            if (GetProjectVersion() < 20)
            {
                var tagArray1 = DataArrayUtl.FindTagArray(mData, "gamedata");
                DataArrayUtl.InsertTagIntAtEnd(tagArray1, "rank_keys", 1);
                DataArrayUtl.InsertTagIntAtEnd(tagArray1, "rank_pro_keys", 1);
                var tagArray2 = DataArrayUtl.FindTagArray(mData, "dry_vox");
                var tagStr    = DataArrayUtl.FindTagStr(tagArray2, "file");
                DataArrayUtl.InsertTagStrAtEnd(DataArrayUtl.InsertTagArrayAtEnd(tagArray2, "part0"), "file", tagStr);
                DataArrayUtl.InsertTagStrAtEnd(DataArrayUtl.InsertTagArrayAtEnd(tagArray2, "part1"), "file", "");
                DataArrayUtl.InsertTagStrAtEnd(DataArrayUtl.InsertTagArrayAtEnd(tagArray2, "part2"), "file", "");
                DataArrayUtl.RemoveTagArray(tagArray2, "file");
                DataArrayUtl.InsertTagIntAtEnd(tagArray1, "vocal_parts", tagStr.Length > 0 ? 1 : 0);
                var data = DataArrayUtl.InsertTagArrayAtEnd(DataArrayUtl.FindTagArray(mData, "tracks"), "keys");
                DataArrayUtl.InsertTagIntAtEnd(data, "enabled", 0);
                DataArrayUtl.InsertTagIntAtEnd(data, "channels", 0);
                DataArrayUtl.InsertTagArrayAtEnd(data, "pan");
                DataArrayUtl.InsertTagArrayAtEnd(data, "vol");
                DataArrayUtl.InsertTagStrAtEnd(data, "file", "");
                flag = true;
            }
            if (GetProjectVersion() < 21)
            {
                DataArrayUtl.InsertTagStrAtEnd(DataArrayUtl.FindTagArray(mData, "midi"), "autogen_theme", "");
                flag = true;
            }
            if (GetProjectVersion() < 22)
            {
                var tagArray = DataArrayUtl.FindTagArray(mData, "languages");
                DataArrayUtl.InsertTagIntAtEnd(tagArray, "german", 0);
                DataArrayUtl.InsertTagIntAtEnd(tagArray, "japanese", 0);
                flag = true;
            }
            if (GetProjectVersion() < 23)
            {
                DataArrayUtl.AddTagFloatAtEnd(DataArrayUtl.FindTagArray(mData, "gamedata"), "guide_pitch_volume", -3f);
                flag = true;
            }
            if (GetProjectVersion() < 24)
            {
                var tagArray1 = DataArrayUtl.FindTagArray(mData, "dry_vox");
                var tagArray2 = DataArrayUtl.FindTagArray(tagArray1, "part0");
                var tagArray3 = DataArrayUtl.FindTagArray(tagArray1, "part1");
                var tagArray4 = DataArrayUtl.FindTagArray(tagArray1, "part2");
                var tagStr1   = DataArrayUtl.FindTagStr(tagArray2, "file");
                var tagStr2   = DataArrayUtl.FindTagStr(tagArray3, "file");
                var tagStr3   = DataArrayUtl.FindTagStr(tagArray4, "file");
                DataArrayUtl.InsertTagIntAtEnd(tagArray2, "enabled", tagStr1.Length > 0 ? 1 : 0);
                DataArrayUtl.InsertTagIntAtEnd(tagArray3, "enabled", tagStr2.Length > 0 ? 1 : 0);
                DataArrayUtl.InsertTagIntAtEnd(tagArray4, "enabled", tagStr3.Length > 0 ? 1 : 0);
                flag = true;
            }
            return(flag || GetProjectVersion() == 24);
        }