-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfrmTabEdit.vb
More file actions
98 lines (76 loc) · 3.77 KB
/
frmTabEdit.vb
File metadata and controls
98 lines (76 loc) · 3.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
Public Class frmTabEdit
Private Sub frmTabEdit_Load(sender As Object, e As EventArgs) Handles MyBase.Load
chkOnTop.Checked = oOnTop
End Sub
Public Sub GenerateTabScale(WhatNotes As String)
'First, split string text in to notes
'Grab last note and add tab line first
'process through 24 semitones, placing tab/fret values when they apply
Dim ScaleNotes(), TuningNotes() As String
Dim CurString, CurNote As Integer
Dim StringTuning, FretPitch As String
ScaleNotes = Split(WhatNotes, ",")
TuningNotes = Split(Tuning, ",")
StringNo = UBound(TuningNotes) + 1
For CurString = 1 To StringNo 'For each string on instrument
StringTuning = TuningNotes(StringNo - CurString) 'Current Tuning of String
StringTuning = Replace(StringTuning, vbNewLine, "")
If Len(StringTuning) > 1 Then
txtTab.Text = txtTab.Text & Trim(StringTuning) & "|-"
Else
txtTab.Text = txtTab.Text & Trim(StringTuning) & "-|-"
End If
For CurFret = FretMin To FretMax 'Search each fret open to 24
FretPitch = Fret2Note(StringTuning, CurFret) 'Current pitch of current fret
If CurFret > 9 Then
txtTab.Text += "--"
Else
txtTab.Text += "-"
End If
If oTabroot = True And Not FretPitch = RootNote Then
txtTab.Text += "-"
End If
For CurNote = LBound(ScaleNotes) To UBound(ScaleNotes) '- 1 'Search each note of the scale to see if it matches the fret
'ScaleNote(CurNote) = note in scale to look for
If FretPitch = ScaleNotes(CurNote) Then 'If the current note is in the scale [GUITAR MONEY MAKER]
If CurFret > 9 Then
txtTab.Text = Mid(txtTab.Text, 1, Len(txtTab.Text) - 2)
Else
txtTab.Text = Mid(txtTab.Text, 1, Len(txtTab.Text) - 1)
End If
If oTabroot = True And FretPitch = RootNote Then
txtTab.Text += "[" & Replace(Str(CurFret), " ", "") & "]" 'Add the Fret
Else
txtTab.Text += Replace(Str(CurFret), " ", "") 'Add the Fret
End If
End If
Next CurNote
If CurFret > 9 Then
txtTab.Text += "--"
Else
txtTab.Text += "-"
End If
If oTabroot = True And Not FretPitch = RootNote Then
txtTab.Text += "-"
End If
Next CurFret
txtTab.Text += vbNewLine
Next CurString
txtTab.Text += vbNewLine
End Sub
Private Sub cmdDraw_Click(sender As Object, e As EventArgs) Handles cmdDraw.Click
txtTab.Text += "Generating " & CurrentKey & " " & CurrentMode & " as tab:" & vbNewLine
GenerateTabScale(CurrentNotes)
End Sub
Private Sub cmdAddChord_Click(sender As Object, e As EventArgs) Handles cmdAddChord.Click
Dim TempRoot() As String
TempRoot = Split(CurrentChord, ",")
RootNote = TempRoot(0)
txtTab.Text += "Generating " & CurrentKey & " " & CurrentMode & " degree " & Str(LastChord) & " chord:" & vbNewLine
GenerateTabScale(CurrentChord)
RootNote = CurrentKey
End Sub
Private Sub chkOnTop_CheckedChanged(sender As Object, e As EventArgs) Handles chkOnTop.CheckedChanged
Me.TopMost = chkOnTop.Checked
End Sub
End Class