Example #1
0
        private Dictionary <int, List <MetaEventAffecterBase> > ReadMetaTrack(List <MetaEventBase> aMetaEventList)
        {
            Dictionary <int, List <MetaEventAffecterBase> > lListDictionary = new Dictionary <int, List <MetaEventAffecterBase> >();

            for (int i = 0; i < aMetaEventList.Count; i++)
            {
                MetaEventBase         lMetaEvent     = aMetaEventList[i];
                MetaEventAffecterBase lEventAffecter = null;

                if (lListDictionary.ContainsKey(lMetaEvent.GetDelta()) == false)
                {
                    lListDictionary.Add(lMetaEvent.GetDelta(), new List <MetaEventAffecterBase>());
                }

                switch (lMetaEvent.GetCode())
                {
                case 0x06:
                    MetaEventText lTextEvent = ( MetaEventText )lMetaEvent;

                    if (lTextEvent.GetText() == "LoopEnd")
                    {
                        for (int j = 0; j < aMetaEventList.Count && j < i; j++)
                        {
                            if (aMetaEventList[j].GetCode() == 0x06)
                            {
                                MetaEventText lTextEventStart = ( MetaEventText )aMetaEventList[j];

                                if (lTextEventStart.GetText() == "LoopStart")
                                {
                                    lEventAffecter = new MetaEventAffecterText(lTextEvent, lTextEventStart.GetDelta());
                                }
                            }
                        }
                    }
                    break;

                case 0x51:
                    lEventAffecter = new MetaEventAffecterTempo(( MetaEventTempo )lMetaEvent);
                    break;

                case 0x58:
                    lEventAffecter = new MetaEventAffecterTimeSignature(( MetaEventTimeSignature )lMetaEvent);
                    break;

                default:
                    //Logger.LogWarning( "Null" );
                    break;
                }

                lListDictionary[lMetaEvent.GetDelta()].Add(lEventAffecter);
            }

            return(lListDictionary);
        }
Example #2
0
 public byte GetCode()
 {
     return(metaEvent.GetCode());
 }