about summary refs log tree commit diff
path: root/website/sandbox/chord-drill-sergeant/src/Piano.elm
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-04-11T22·11+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-04-11T22·11+0100
commit730aecc076fd21c48884201f59c9b1fce8c7a23a (patch)
tree3601dd6d816b13e01def59eaa299d4c7c70b77e3 /website/sandbox/chord-drill-sergeant/src/Piano.elm
parent808e6ee4847a92cb763f8776149e97575d9c1961 (diff)
Support NoteClass
Remodel application to support the scientific pitch notation for notes. Instead
of supporting simply "C", support "C4". This change created cascading
changes. After refactoring for around an hour, I restored the app to a working
state. The current state is not desirable, but it compiles. More changes on the
way.
Diffstat (limited to 'website/sandbox/chord-drill-sergeant/src/Piano.elm')
-rw-r--r--website/sandbox/chord-drill-sergeant/src/Piano.elm40
1 files changed, 12 insertions, 28 deletions
diff --git a/website/sandbox/chord-drill-sergeant/src/Piano.elm b/website/sandbox/chord-drill-sergeant/src/Piano.elm
index 0533492123fc..048208c1f556 100644
--- a/website/sandbox/chord-drill-sergeant/src/Piano.elm
+++ b/website/sandbox/chord-drill-sergeant/src/Piano.elm
@@ -62,36 +62,20 @@ octave highlight =
   let
     isHighlit note = List.member note highlight
   in
-    [ natural    0    (isHighlit Theory.C)
-    , accidental 25   (isHighlit Theory.C_sharp)
-    , natural    40   (isHighlit Theory.D)
-    , accidental 65   (isHighlit Theory.D_sharp)
-    , natural    80   (isHighlit Theory.E)
-    , natural    120  (isHighlit Theory.F)
-    , accidental 145  (isHighlit Theory.F_sharp)
-    , natural    160  (isHighlit Theory.G)
-    , accidental 185  (isHighlit Theory.G_sharp)
-    , natural    200  (isHighlit Theory.A)
-    , accidental 225  (isHighlit Theory.A_sharp)
-    , natural    240  (isHighlit Theory.B)
+    [ natural    0    (isHighlit Theory.C4)
+    , accidental 25   (isHighlit Theory.C_sharp4)
+    , natural    40   (isHighlit Theory.D4)
+    , accidental 65   (isHighlit Theory.D_sharp4)
+    , natural    80   (isHighlit Theory.E4)
+    , natural    120  (isHighlit Theory.F4)
+    , accidental 145  (isHighlit Theory.F_sharp4)
+    , natural    160  (isHighlit Theory.G4)
+    , accidental 185  (isHighlit Theory.G_sharp4)
+    , natural    200  (isHighlit Theory.A4)
+    , accidental 225  (isHighlit Theory.A_sharp4)
+    , natural    240  (isHighlit Theory.B4)
     ]
 
-indexForNote : Theory.Note -> Int
-indexForNote note =
-  case note of
-    Theory.C       -> 0
-    Theory.C_sharp -> 1
-    Theory.D       -> 2
-    Theory.D_sharp -> 3
-    Theory.E       -> 4
-    Theory.F       -> 5
-    Theory.F_sharp -> 6
-    Theory.G       -> 7
-    Theory.G_sharp -> 8
-    Theory.A       -> 9
-    Theory.A_sharp -> 10
-    Theory.B       -> 11
-
 {-| Return the HTML that renders a piano representation. -}
 render : { highlight : List Theory.Note } -> Html a
 render {highlight} =