예제 #1
0
        public static ITimedWave Get
        (
            UInt32[] tones,
            Int32 instrumentNumber,
            SByte volume                    = 96,
            UInt32 SampleRate               = 44100,
            Boolean doFadeout               = false,
            Double fadeoutStrength          = 1.0,
            Double fadeoutPosition          = 1.0,
            Boolean keepVolumeBeforeFadeout = true
        )
        {
            List <ITimedWave> l = new List <ITimedWave>();

            foreach (UInt32 x in tones)
            {
                l.Add(Instruments.GetTimedWave(x, instrumentNumber, volume, SampleRate, doFadeout, fadeoutStrength, fadeoutPosition, keepVolumeBeforeFadeout));
            }

            Polyphony p = new Polyphony(l[0], ((UInt16)(l.Count * 8)));

            for (int i = 1; i < l.Count; i++)
            {
                p += l[i];
            }

            return(new Mixer(p, 128));
        }
예제 #2
0
        public static Polyphony parseLine(String path)
        {
            Polyphony polyphony = new Polyphony();

            StreamReader reader = File.OpenText(path);
            string       line;

            while ((line = reader.ReadLine()) != null)
            {
                string[] items  = line.ToLower().Trim().Split(' ');
                String   startX = null;
                String   startY = null;
                String   endX   = null;
                String   endY   = null;
                for (int i = 0; i < items.Length; i++)
                {
                    if (items[i].Equals("startx"))
                    {
                        startX = items[i + 2];
                    }
                    else if (items[i].Equals("starty"))
                    {
                        startY = items[i + 2];
                    }
                    if (items[i].Equals("endx"))
                    {
                        endX = items[i + 2];
                    }
                    else if (items[i].Equals("endy"))
                    {
                        endY = items[i + 2];
                    }
                }
                if ((startX != null && startY != null) || (endX != null && endY != null))
                {
                    polyphony.Polyphonys.Add(new Line(new Point(int.Parse(startX), int.Parse(startY)), new Point(int.Parse(endX), int.Parse(endY))));
                }
            }


            return(polyphony);
        }