Exemplo n.º 1
0
    void Start()
    {
        for (int i = 0; i < chordShapes.Length; i++)
        {
            chordShapes [i] = new ChordShape();
        }

        // Set the values that define the chord shapes
        Vector2[] C_shapeInfo = new Vector2[4] {
            new Vector2(1, 8), new Vector2(3, 9), new Vector2(4, 10), new Vector2(5, 10)
        };
        Vector2[] A_shapeInfo = new Vector2[3] {
            new Vector2(1, 0), new Vector2(2, 0), new Vector2(3, 0)
        };
        Vector2[] G_shapeInfo = new Vector2[4] {
            new Vector2(0, 3), new Vector2(1, 3), new Vector2(5, 3), new Vector2(4, 2)
        };
        Vector2[] E_shapeInfo = new Vector2[5] {
            new Vector2(0, 3), new Vector2(1, 3), new Vector2(2, 4), new Vector2(3, 5), new Vector2(4, 5)
        };
        Vector2[] D_shapeInfo = new Vector2[4] {
            new Vector2(0, 7), new Vector2(1, 8), new Vector2(2, 7), new Vector2(5, 7)
        };

        CAGED_shapeInfo = new Vector2[5][] { C_shapeInfo, A_shapeInfo, G_shapeInfo, E_shapeInfo, D_shapeInfo };
    }
Exemplo n.º 2
0
        public void RootingAShape_SetsTheCorrectNotes_BasedOnTheShapePositions(Note rootNote, Note[] expectedNotes)
        {
            var shape = new ChordShape("", Positions.Root, Positions.Fifth);

            var chord = shape.RootAt(rootNote);

            Assert.That(chord.Notes, Is.EquivalentTo(expectedNotes));
        }
Exemplo n.º 3
0
        public void RootingAShape_SetsTheRootedNote_AsTheRootNote(Note note)
        {
            var shape = new ChordShape("", Positions.Root);

            var chord = shape.RootAt(note);

            Assert.That(chord.RootNote, Is.EqualTo(note));
        }
Exemplo n.º 4
0
        public void NameIsWorkedOutFromTheNoteAndTheShape(Note note, string chordName, string expectedChordName)
        {
            var chordShape = new ChordShape(chordName);
            var chord      = new Chord(note, chordShape, new Note[0]);

            var name = chord.Name;

            Assert.That(name, Is.EqualTo(expectedChordName));
        }
Exemplo n.º 5
0
    public void DrawChord(ChordShape _chordShape, int _index, int _chordRootID)
    {
        float strokeColor = ((float)_chordRootID / 12.0f) - 0.1f;

        strokeOutline.color = Color.HSVToRGB(strokeColor, 0.4f, 1.0f);
        stroke.color        = Color.HSVToRGB(strokeColor, 1.0f, 1.0f);

        chordShapeLines [_index].Set(_chordShape.chordPoints, false);
        chordShapeOutlines [_index].Set(_chordShape.chordPoints, false);
    }
Exemplo n.º 6
0
    private void MakeChordShapes(int _chordRootID)
    {
        // getting the root note on the 2nd string
        List <int> currentRootFrets = strings [2].GetFrets(_scale.chords [_chordRootID].noteIDs[0]);

        // Get all of the chordPaths
        Vector2[][] chordPaths = chordShapes.GetChordShapes(currentRootFrets[0]);

        for (int i = 0; i < chordPaths.Length; i++)
        {
            ChordShape chordShape = new ChordShape();
            chordShape.SetPoints(chordPaths[i]);
            //Debug.Log ("Drawing a chord shape: " + i + ": " + chordShape.chordPoints[0].x);
            GetComponent <VectorChord> ().DrawChord(chordShape, i, _scale.chords [_chordRootID].noteIDs[0]);
        }
    }
Exemplo n.º 7
0
        public void ThePreferredNameIsTheFirstOneSpecified()
        {
            var shape = new ChordShape((ChordNames)"first name" | "second name");

            Assert.That(shape.PreferredName, Is.EqualTo("first name"));
        }