about summary refs log tree commit diff
path: root/website/sandbox/learnpianochords/src/State.elm
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-04-19T17·36+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-04-19T17·36+0100
commit4a8f750ba8b7aa9663be2753cd6e25aa5e18d535 (patch)
tree9d9a2ef1c74501be3c9c55ddc2298b56d83a14fb /website/sandbox/learnpianochords/src/State.elm
parent14f11823ff9b08d627460bee96964dc64ae22dff (diff)
Restore support for whitelisted chord inversions
Allow users to include or exclude chord inversions.
Diffstat (limited to 'website/sandbox/learnpianochords/src/State.elm')
-rw-r--r--website/sandbox/learnpianochords/src/State.elm14
1 files changed, 5 insertions, 9 deletions
diff --git a/website/sandbox/learnpianochords/src/State.elm b/website/sandbox/learnpianochords/src/State.elm
index 0c23d3a5a988..3b9d29c34443 100644
--- a/website/sandbox/learnpianochords/src/State.elm
+++ b/website/sandbox/learnpianochords/src/State.elm
@@ -51,7 +51,7 @@ init =
             ( Theory.C3, Theory.C6 )
 
         inversions =
-            Theory.allInversions
+            [ Theory.Root ]
 
         chordTypes =
             Theory.allChordTypes
@@ -73,7 +73,7 @@ init =
     , tempo = 10
     , firstNote = firstNote
     , lastNote = lastNote
-    , view = Overview
+    , view = Preferences
     , showFlashCard = True
     }
 
@@ -158,13 +158,9 @@ update msg model =
             ( { model
                 | whitelistedInversions = inversions
                 , whitelistedChords =
-                    Theory.allChords
-                        { start = model.firstNote
-                        , end = model.lastNote
-                        , inversions = inversions
-                        , chordTypes = model.whitelistedChordTypes
-                        , pitchClasses = model.whitelistedPitchClasses
-                        }
+                    model.whitelistedKeys
+                        |> List.concatMap Theory.chordsForKey
+                        |> List.filter (\chord -> List.member chord.chordInversion inversions)
               }
             , Cmd.none
             )