public void Serialize(ref Arpeggio arpeggio)
        {
            int arpeggioId = -1;

            Serialize(ref arpeggioId, true);
            arpeggio = project.GetArpeggio(arpeggioId);
        }
Exemple #2
0
        public void Clear(bool preserveFx = true)
        {
            val        = NoteInvalid;
            instrument = null;
            arpeggio   = null;
            slide      = 0;
            flags      = 0;
            duration   = 0;
            release    = 0;

            if (!preserveFx)
            {
                effectMask  = 0;
                volume      = 0;
                volumeSlide = 0;
                vibrato     = 0;
                speed       = 0;
                finePitch   = 0;
                fdsModDepth = 0;
                fdsModSpeed = 0;
                dutyCycle   = 0;
                noteDelay   = 0;
                cutDelay    = 0;
            }
        }
        private static bool LoadAndMergeArpeggioList(ProjectLoadBuffer serializer, bool checkOnly = false, bool createMissing = true)
        {
            int numArpeggios = 0;

            serializer.Serialize(ref numArpeggios);

            var arpeggioIdNameMap = new List <Tuple <int, string> >();

            for (int i = 0; i < numArpeggios; i++)
            {
                var arpId   = 0;
                var arpName = "";
                serializer.Serialize(ref arpId);
                serializer.Serialize(ref arpName);
                arpeggioIdNameMap.Add(new Tuple <int, string>(arpId, arpName));
            }

            var dummyArpeggio = new Arpeggio();
            var needMerge     = false;

            // Match arpeggios by name, create missing ones and remap IDs.
            for (int i = 0; i < numArpeggios; i++)
            {
                var arpId   = arpeggioIdNameMap[i].Item1;
                var arpName = arpeggioIdNameMap[i].Item2;

                var existingArpeggio = serializer.Project.GetArpeggio(arpName);

                if (existingArpeggio != null)
                {
                    serializer.RemapId(arpId, existingArpeggio.Id);
                    dummyArpeggio.SerializeState(serializer); // Skip
                }
                else
                {
                    needMerge = true;

                    if (!checkOnly && createMissing)
                    {
                        var instrument = serializer.Project.CreateArpeggio(arpName);
                        serializer.RemapId(arpId, instrument.Id);
                        instrument.SerializeState(serializer);
                    }
                    else
                    {
                        serializer.RemapId(arpId, -1);
                        dummyArpeggio.SerializeState(serializer); // Skip
                    }
                }
            }

            serializer.Project.SortArpeggios();

            return(needMerge);
        }
Exemple #4
0
        public void Clear(bool preserveFx = true)
        {
            Value      = NoteInvalid;
            Instrument = null;
            Arpeggio   = null;
            Slide      = 0;
            Flags      = 0;

            if (!preserveFx)
            {
                EffectMask    = 0;
                FxVolume      = 0;
                FxVibrato     = 0;
                FxSpeed       = 0;
                FxFinePitch   = 0;
                FxFdsModDepth = 0;
                FxFdsModSpeed = 0;
            }
        }
        public void Serialize(ref Arpeggio arpeggio)
        {
            int arpeggioId = arpeggio == null ? -1 : arpeggio.Id;

            Serialize(ref arpeggioId);
        }