Esempio n. 1
0
        public void Register(EffectBand effectBand)
        {
            var freeSlot = GetOrCreateSlot(effectBand);

            freeSlot.Update(effectBand);
            _effectSlot[effectBand.Info.EffectId] = freeSlot;
        }
Esempio n. 2
0
        protected override void CreateBeatGlyphs()
        {
            _bands     = new EffectBand[_infos.Length];
            BandLookup = new FastDictionary <string, EffectBand>();
            for (int i = 0; i < _infos.Length; i++)
            {
                _bands[i]          = new EffectBand(_infos[i]);
                _bands[i].Renderer = this;
                _bands[i].DoLayout();
                BandLookup[_infos[i].EffectId] = _bands[i];
            }

            foreach (var voice in Bar.Voices)
            {
                if (HasVoiceContainer(voice))
                {
                    CreateVoiceGlyphs(voice);
                }
            }

            foreach (var effectBand in _bands)
            {
                if (effectBand.IsLinkedToPrevious)
                {
                    IsLinkedToPrevious = true;
                }
            }
        }
Esempio n. 3
0
        public EffectBandSlot GetOrCreateSlot(EffectBand band)
        {
            // first check preferrable slot depending on type
            if (_effectSlot.ContainsKey(band.Info.EffectId))
            {
                var slot = _effectSlot[band.Info.EffectId];
                if (slot.CanBeUsed(band))
                {
                    return(slot);
                }
            }

            // find any slot that can be used
            foreach (var slot in Slots)
            {
                if (slot.CanBeUsed(band))
                {
                    return(slot);
                }
            }

            // create a new slot if required
            var newSlot = new EffectBandSlot();

            Slots.Add(newSlot);
            return(newSlot);
        }
Esempio n. 4
0
        protected override void CreateBeatGlyphs()
        {
            _bands      = new FastList <EffectBand>();
            _bandLookup = new FastDictionary <string, EffectBand>();
            foreach (var voice in Bar.Voices)
            {
                if (HasVoiceContainer(voice))
                {
                    foreach (var info in _infos)
                    {
                        var band = new EffectBand(voice, info);
                        band.Renderer = this;
                        band.DoLayout();
                        _bands.Add(band);
                        _bandLookup[voice.Index + "." + info.EffectId] = band;
                    }
                }
            }

            foreach (var voice in Bar.Voices)
            {
                if (HasVoiceContainer(voice))
                {
                    CreateVoiceGlyphs(voice);
                }
            }

            foreach (var effectBand in _bands)
            {
                if (effectBand.IsLinkedToPrevious)
                {
                    IsLinkedToPrevious = true;
                }
            }
        }
Esempio n. 5
0
 public bool CanBeUsed(EffectBand band)
 {
     return
         // if the current band is marked as unique, only merge with same effect,
         // if the current band is shared, only merge with same effect
         (((UniqueEffectId == null && band.Info.CanShareBand) || band.Info.EffectId == UniqueEffectId)
          // only merge if there is space for the new band before or after the current beat
          && (FirstBeat == null || LastBeat.Index < band.FirstBeat.Index || band.LastBeat.Index < FirstBeat.Index));
 }
Esempio n. 6
0
 public void Update(EffectBand effectBand)
 {
     // lock band to particular effect if needed
     if (!effectBand.Info.CanShareBand)
     {
         UniqueEffectId = effectBand.Info.EffectId;
     }
     Bands.Add(effectBand);
     if (effectBand.Height > Height)
     {
         Height = effectBand.Height;
     }
     if (FirstBeat == null || FirstBeat.Index > effectBand.FirstBeat.Index)
     {
         FirstBeat = effectBand.FirstBeat;
     }
     if (LastBeat == null || LastBeat.Index < effectBand.LastBeat.Index)
     {
         LastBeat = effectBand.LastBeat;
     }
 }
Esempio n. 7
0
        public void Update(EffectBand effectBand)
        {
            // lock band to particular effect if needed
            if (!effectBand.Info.CanShareBand)
            {
                Shared.UniqueEffectId = effectBand.Info.EffectId;
            }

            effectBand.Slot = this;
            Bands.Add(effectBand);

            if (effectBand.Height > Shared.Height)
            {
                Shared.Height = effectBand.Height;
            }
            if (Shared.FirstBeat == null || effectBand.FirstBeat.IsBefore(Shared.FirstBeat))
            {
                Shared.FirstBeat = effectBand.FirstBeat;
            }
            if (Shared.LastBeat == null || effectBand.LastBeat.IsAfter(Shared.LastBeat))
            {
                Shared.LastBeat = effectBand.LastBeat;
            }
        }