Exemplo n.º 1
0
        public IEnumerable <ChordsItemViewModel> GetChords(NoteName name)
        {
            string s = @"IV
E|---|---|-x-|---|
B|---|---|---|---|
G|---|---|-x-|---|
D|-x-|---|---|---|
A|---|---|-x-|---|
E|---|---|---|---|";



            var fingering = Fingering.Parse(s);

            Func <string, ChordsItemViewModel> createChord = str => new ChordsItemViewModel(new Chord
            {
                RootNote   = name,
                Name       = name.Name + str,
                Fingerings = new[]
                {
                    fingering
                    ,
                    fingering
                    ,
                    fingering
                    ,
                }
            });

            return(new[]
            {
                createChord(""), createChord("m"), createChord("7"), createChord("m7"), createChord("9"),
                createChord("6"), createChord("sus4")
            });
        }
Exemplo n.º 2
0
        private Chord ParseChord(XElement chordElement)
        {
            var chordName = chordElement.Attribute("name").Value;

            return(new Chord
            {
                Name = chordName,
                RootNote = GetRootNoteFromChordName(chordName),
                Fingerings = chordElement.Elements("fingering")
                             .Select(e => Fingering.Parse(e.Value))
                             .ToArray()
            });
        }
Exemplo n.º 3
0
        public void Parse_Fingering2()
        {
            string s = @"IV
E|---|---|-x-|---|
B|---|---|---|---|
G|---|---|-x-|---|
D|-x-|---|---|---|
A|---|---|-x-|---|
E|---|---|---|---|";

            var fingering = Fingering.Parse(s);

            fingering.ToString().Should().Be(s);
        }
Exemplo n.º 4
0
        public void Parse_Fingering3()
        {
            string s0 = @"VIII
E|-x-|---|---|---|
B|-x-|---|---|---|
G|-x-|-x-|---|---|
D|-x-|---|-x-|---|
A|-x-|---|-x-|---|
E|-x-|---|---|---|";
            string s1 = @"VIII
E|-x-|---|---|---|
B|-x-|---|---|---|
G|---|-x-|---|---|
D|---|---|-x-|---|
A|---|---|-x-|---|
E|-x-|---|---|---|";

            var fingering = Fingering.Parse(s0);

            fingering.ToString().Should().Be(s1);
        }
        public IEnumerable <Chord> GetChords(NoteName name)
        {
            string s = @"IV
E|---|---|-x-|---|
B|---|---|---|---|
G|---|---|-x-|---|
D|-x-|---|---|---|
A|---|---|-x-|---|
E|---|---|---|---|";

            var fingering = Fingering.Parse(s);
            var chord1    = new Chord
            {
                RootNote   = name,
                Name       = name.Name,
                Fingerings = new Fingering[]
                {
                    fingering,
                    fingering,
                    fingering,
                }
            };

            var chord2 = new Chord
            {
                RootNote   = name,
                Name       = name.Name + "m",
                Fingerings = new Fingering[]
                {
                    fingering,
                    fingering,
                    fingering,
                }
            };

            return(new[] { chord1, chord2 });
        }