Exemplo n.º 1
0
        public Melody ToMelody(FingerboardInstrument instrument)
        {
            if (instrument == null)
            {
                throw new ArgumentNullException("instrument");
            }

            var notes = new List <Note>();

            this.positions.ForEach(p => notes.Add(instrument[p]));

            return(new Melody(notes));
        }
Exemplo n.º 2
0
        public static Melody Compose(FingerboardInstrument instrument, Fingering fingering)
        {
            if (instrument == null)
            {
                throw new ArgumentNullException("instrument", "FingerboardInstrument argument cannot be null");
            }
            if (fingering == null)
            {
                throw new ArgumentNullException("fingering", "Fingering argument cannot be null");
            }

            var notes = new List <Note>();

            fingering.Positions.ToList().ForEach(
                position =>
                notes.Add(instrument[position])
                );

            return(new Melody(notes));
        }
Exemplo n.º 3
0
        public static string Print(Fingering fingering, FingerboardInstrument instrument)
        {
            if (fingering == null)
            {
                throw new ArgumentNullException("fingering");
            }

            if (instrument == null)
            {
                throw new ArgumentNullException("instrument");
            }

            var builder = new StringBuilder();

            foreach (var s in instrument.Strings)
            {
                builder.Append("-");

                foreach (var f in fingering.Positions)
                {
                    if (f.String == s.Number)
                    {
                        builder.Append("-");
                        builder.Append(f.Fret);

                        if (f.Fret < 10)
                        {
                            builder.Append("-");
                        }
                    }
                    else
                    {
                        builder.Append("---");
                    }
                }

                builder.AppendLine("-");
            }

            return(builder.ToString());
        }