예제 #1
0
 //Rekursive Factory Method
 public static FLP_Event FromEventID(FLP_File.EventID id)
 {
     FLP_Event ev = null;
     if (id < (FLP_File.EventID)FLP_File.FLP_Text) ev = FLPE_Val.FromEventID(id);
     else ev = FLPE_Data.FromEventID(id);
     return ev;
 }
예제 #2
0
        //Rekursive Factory Method, propagates to further subclasses depending on ID
        public static new FLP_Event FromEventID(FLP_File.EventID id)
        {
            //FLP_Ctrl_Init_RecChan - Initial ctrl values
            //ID_Playlist_Events - Arrangement!
            //Special classes...
            if (id == FLP_File.EventID.ID_MixerTrack_Parameters) return new FLPE_MixerTrack_Parameters(id);
            if (id == FLP_File.EventID.FLP_Ctrl_Init_RecChan) return new FLPE_Ctrl_Init_RecChan(id);
            if (id == FLP_File.EventID.ID_Playlist_Track_Info) return new ID_Playlist_Track_Info(id);
            if (id == FLP_File.EventID.ID_Channel_Delay) return new FLPE_Channel_Delay(id);
            if (id == FLP_File.EventID.ID_Channel_Levels) return new FLPE_Channel_Levels(id);
            if (id == FLP_File.EventID.ID_Channel_LevelOffsets) return new FLPE_Channel_LevelOffsets(id);
            if (id == FLP_File.EventID.ID_Channel_Tracking) return new FLPE_Channel_Tracking(id);
            if (id == FLP_File.EventID.ID_Channel_Poly) return new FLPE_Channel_Poly(id);

            if (id == FLP_File.EventID.ID_Pattern_Ctrl_Events) return new FLPE_Pattern_Ctrl_Events(id);
            if (id == FLP_File.EventID.ID_Pattern_Note_Events) return new FLPE_Pattern_Note_Events(id);
            if (id == FLP_File.EventID.ID_MixerTrack_Routing) return new FLPE_MixerTrack_Routing(id);
            if (id == FLP_File.EventID.ID_Project_Time) return new FLPE_Project_Time(id);
            if (id == FLP_File.EventID.ID_Playlist_Events) return new FLPE_Playlist_Events(id);
            //Typed generic classes...
            if (Enum.IsDefined(typeof(FLPE_Unicode.ValidIDs), (byte)id)) return new FLPE_Unicode(id);
            if (Enum.IsDefined(typeof(FLPE_Values.ValidIDs), (byte)id)) return new FLPE_Values(id);
            //Default fallback class
            //if (Enum.IsDefined(typeof(FLPE_Bytes.ValidIDs), (byte)id))
                return new FLPE_Bytes(id);
            //else
            //    throw new InvalidDataException(id + " is not a valid DATA ID.");
        }
예제 #3
0
        static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                //TODO: behavior not yet implemented.
                Console.WriteLine("Usage: FLP-XML.exe <FLP, XML or Dir> [action, action, action ...] \nwhere action:"
                    + "\n-rup : Remove Unusued Patterns"
                    + "\n-clean : Remove redundant default values"
                    + "\n-xml : Export to XML");
                return;
            }
            string filename = args[0];

            if (filename.EndsWith(".flp"))
            {
                FLP_File flp = new FLP_File(filename, null);

                // Perform various options here:


                XmlSerializer xmlserializer = new XmlSerializer(typeof(FLP_File));

                XmlWriterSettings settings = new XmlWriterSettings();
                settings.Encoding = new UnicodeEncoding(false, false);
                settings.NewLineChars = "\n";
                settings.Indent = true;
                settings.OmitXmlDeclaration = false;

                using (StringWriter textWriter = new StringWriter())
                {
                    using (XmlWriter xmlWriter = XmlWriter.Create(textWriter, settings))
                    {
                        xmlserializer.Serialize(xmlWriter, flp);
                        File.WriteAllText(filename + ".xml", textWriter.ToString(), Encoding.Unicode);
                    }
                }
            }
            else if (Directory.Exists(filename))
            {

            }
            else if (filename.EndsWith(".xml"))
            {
                using (FileStream stream = File.OpenRead(filename))
                {
                    XmlSerializer serializer = new XmlSerializer(typeof(FLP_File));
                    FLP_File loaded = (FLP_File)serializer.Deserialize(stream);
                    BinaryWriter w = new BinaryWriter(File.OpenWrite(filename + "_fromXML.flp"));
                    loaded.Serialize(w);
                    w.Close();
                }
            }

        }
예제 #4
0
 //Rekursive Factory Method for fixed length values (1,2,4 bytes)
 public static new FLP_Event FromEventID(FLP_File.EventID id)
 {
     if (id == FLP_File.EventID.ID_Channel_CutCutBy) return new FLPE_CutCutBy(id);
     if (id == FLP_File.EventID.ID_Channel_Delay_ModXYChange) return new FLPE_DelayFRes(id);
     if (Enum.IsDefined(typeof(FLPE_Color.ValidIDs), (byte)id)) return new FLPE_Color(id);
     int bytelength = id < (FLP_File.EventID)FLP_File.FLP_Word ? 1 : id < (FLP_File.EventID)FLP_File.FLP_Int ? 2 : 4;
    //if (Enum.IsDefined(typeof(FLPE_Val.ValidIDs), (byte)id))
         return new FLPE_Val(id, bytelength);
    //else
    //   throw new InvalidDataException(id + " is not a valid ID.");
 }
예제 #5
0
 private void LoadAndShowFLPFile(string filename)
 {
     //Load
     TextWriter loggy = File.CreateText(filename + ".log");
     DateTime t1 = DateTime.Now;
     if (filename.EndsWith(".flp"))
     {
         this.CurrentFLPFile = new FLP_File(filename,loggy);
     }
     else if(filename.EndsWith(".fst"))
     {
         this.CurrentFLPFile = new FLP_File(filename, loggy);
     }
     else if (filename.EndsWith(".xml"))
     {
         using (FileStream stream = File.OpenRead(filename))
         {
             XmlSerializer serializer = new XmlSerializer(typeof(FLP_File));
             this.CurrentFLPFile = (FLP_File)serializer.Deserialize(stream);
         }
     }
     loggy.Close();
     DateTime t2 = DateTime.Now;
 }
 public FLPE_Channel_Tracking(FLP_File.EventID type) : base(type) { }
예제 #7
0
 public FLP_Event Seek(FLP_Event origin, FLP_File.EventID id, bool forward = true)
 {
     int i = this._events.IndexOf(origin);
     if (i == -1) return null;
     int d = forward ? 1 : -1;
     for (; i >= 0 && i < _events.Count; i += d)
     {
         if (_events[i].Id == id) return _events[i];
     }
     return null;
 }
예제 #8
0
        public FLP_File ExtractMixer()
        {

            FLP_File mixer = new FLP_File();
            mixer.FLPFormat = FLP_File.FLP_Format.FLP_Format_PlugState;
            mixer.HeaderChunkLength = this.HeaderChunkLength;
            mixer.FLPHeaderChunkID = this.FLPHeaderChunkID;
            mixer.BeatDivision = this.BeatDivision;
            mixer.DataChunkID = this.DataChunkID;
            mixer.RackChannelCount = 0;
            /*
            // TODO
            foreach (FLP_Event n in this.GetEventsWithIDs(EventID.ID_Pattern_Color, EventID.ID_Pattern_Name, EventID.ID_Pattern_Note_Events, EventID.ID_Pattern_Ctrl_Events))
                if (!used_pattern_ids.Contains(((FLPE_Val)this.Seek(n, EventID.ID_Pattern_New, false)).V))
                    _events.Remove(n);
                    */
            return mixer;
        }
예제 #9
0
 public FLPE_CutCutBy(FLP_File.EventID type) : base(type) { }
예제 #10
0
 public FLPE_Values(FLP_File.EventID type) : base(type) { }
 public FLPE_Ctrl_Init_RecChan(FLP_File.EventID type) : base(type) { }
예제 #12
0
 public FLPE_Playlist_Events(FLP_File.EventID type) : base(type) { }
예제 #13
0
 public FLPE_Project_Time(FLP_File.EventID type) : base(type) { }
 public FLPE_MixerTrack_Parameters(FLP_File.EventID type) : base(type) { }
예제 #15
0
 public FLPE_Bytes(FLP_File.EventID type) : base(type) { }
 public ID_Playlist_Track_Info(FLP_File.EventID type) : base(type) { }
 public FLPE_Channel_LevelOffsets(FLP_File.EventID type) : base(type) { }
 public FLPE_Pattern_Note_Events(FLP_File.EventID type) : base(type) { }
예제 #19
0
 private static void ProcessFLPFile(FLP_File f, string[] cmds)
 {
     throw new NotImplementedException(); //TODO
 }
예제 #20
0
 public FLPE_Channel_Poly(FLP_File.EventID type) : base(type) { }
예제 #21
0
 public FLPE_Val(FLP_File.EventID type, int bytelength) : base(type) { this.B = bytelength; }
예제 #22
0
 public FLPE_Color(FLP_File.EventID type) : base(type) { }
 public FLPE_MixerTrack_Routing(FLP_File.EventID type) : base(type) { }
예제 #24
0
 public FLPE_Data(FLP_File.EventID type) : base(type) { }
예제 #25
0
 public FLP_Event(FLP_File.EventID type) { this.Id = type; }
예제 #26
0
 public FLPE_DelayFRes(FLP_File.EventID type) : base(type) { }
예제 #27
0
 public FLPE_Unicode(FLP_File.EventID type) : base(type) { }