Ejemplo n.º 1
0
        public int AddPattern()
        {
            Pattern[] tpatz = new Pattern[Track.MaxPatterns];

            int firstnull = -1;
            for(int eogp = 0; eogp < this.Patterns.Length; eogp++)
            {
                if(Patterns[eogp] != null)
                {
                    tpatz[eogp] = Patterns[eogp];
                }
                else
                {
                    tpatz[eogp] = null;
                    if(firstnull == -1) { firstnull = eogp; }
                }
            }

            if(firstnull == -1) { firstnull = Patterns.Length; }

            tpatz[firstnull] = new Pattern(this.ChannelCount, this.DefaultPatternLength);
            Patterns = tpatz;

            return firstnull;
        }
Ejemplo n.º 2
0
        public void NewTrack()
        {
            Console.WriteLine("Generating an empty track.");
            Patterns = new Pattern[Engine.Configuration.MaxPatterns];
            Patterns[0] = new Pattern(ChannelCount, this.DefaultPatternLength);
            Samples = new Sample[Engine.Configuration.MaxSamples];

            for(int es = 0; es < Samples.Length; es++)
            {
                Samples[es] = new Sample();
            }

            ChannelMuted = new bool[ChannelCount];
            for(int ec = 0; ec < ChannelCount; ec++)
            {
                ChannelMuted[ec] = false;
            }

            Console.WriteLine("Empty track generated.");
            Console.WriteLine("End of newTrack()");
        }
Ejemplo n.º 3
0
        public Track(SerializationInfo info, StreamingContext ctxt)
        {
            Author = (string)info.GetValue("Author", typeof(string));
            Title = (string)info.GetValue("Title", typeof(string));
            Tempo = (int)info.GetValue("Tempo", typeof(int));
            Year = (int)info.GetValue("Year", typeof(int));
            ChannelCount = (int)info.GetValue("ChannelCount", typeof(int));
            ChannelMuted = (bool[])info.GetValue("ChannelMuted", typeof(bool[]));
            DefaultPatternLength = (int)info.GetValue("DefaultPatternLength", typeof(int));
            Genre = (string)info.GetValue("Genre", typeof(string));
            WebSite = (string)info.GetValue("WebSite", typeof(string));
            Email = (string)info.GetValue("Email", typeof(string));
            Comments = (string)info.GetValue("Comments", typeof(string));
            PatternSequence = (int[])info.GetValue("PatternSequence", typeof(int[]));

            //Samples = new Sample[32];
            //for(int es = 0; es < 32; es++) { Samples[es] = new Sample(); }
            Samples = (Sample[])info.GetValue("Samples", typeof(Sample[]));
            Patterns = (Pattern[])info.GetValue("Patterns", typeof(Pattern[]));

            if(Patterns == null)
            {
                Patterns = new Pattern[32];
                Patterns[0] = new Pattern(12, 128);
            }

            if(Samples == null)
            {
                Samples = new Sample[32];
                for(int es = 0; es < Samples.Length; es++)
                {
                    Samples[es] = new Sample();
                    Samples[es].ID = es;
                }
            }
        }