summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2014-04-05 01:53:44 -0400
committerAndrew Cady <d@jerkface.net>2014-04-05 01:53:44 -0400
commit00a8d88b26818c1dd3a8a5fa7e73fcabecf27f62 (patch)
tree390750deaa41175d849f52fb23117b576785ebb7
parent9613cab22070d4a1c08df24e789737aeefe847c8 (diff)
change default to 2 keyboards; minor reorg
-rw-r--r--axis.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/axis.hs b/axis.hs
index f4a2032..e51b6cb 100644
--- a/axis.hs
+++ b/axis.hs
@@ -42,7 +42,7 @@ _LABEL_ALL_KEYS = False
42 42
43_AXIS_ROWS = 7 + 4 43_AXIS_ROWS = 7 + 4
44_AXIS_UNIQUE_COLS = 7 44_AXIS_UNIQUE_COLS = 7
45_AXIS_COLS_REPEAT = 1 45_AXIS_COLS_REPEAT = 2
46_AXIS_TOPLEFT_PITCH = 81 + (7 * (_AXIS_ROWS - 7) `div` 2) 46_AXIS_TOPLEFT_PITCH = 81 + (7 * (_AXIS_ROWS - 7) `div` 2)
47_AXIS_BOTTOMLEFT_PITCH = _AXIS_TOPLEFT_PITCH - (_AXIS_ROWS * 7) 47_AXIS_BOTTOMLEFT_PITCH = _AXIS_TOPLEFT_PITCH - (_AXIS_ROWS * 7)
48_AXIS_TOPRIGHT_PITCH = _AXIS_TOPLEFT_PITCH + _AXIS_UNIQUE_COLS `div` 2 48_AXIS_TOPRIGHT_PITCH = _AXIS_TOPLEFT_PITCH + _AXIS_UNIQUE_COLS `div` 2
@@ -117,7 +117,7 @@ pitchToColor p =
117 x | inMajorC x -> (SDL.Color 0xE0 0xE0 0xE0) -- _CGA !! 7 117 x | inMajorC x -> (SDL.Color 0xE0 0xE0 0xE0) -- _CGA !! 7
118 _ -> _CGA !! 8 118 _ -> _CGA !! 8
119 119
120--smartDrawKeys :: (Integral a, Integral a2, Integral a1) => Bool -> Set.Set (Event.Channel, Event.Pitch) -> Set.Set (Event.Channel, Event.Pitch) -> SDL.Surface -> SDL.TTF.Font -> [(a1, a2)] -> a -> IO () 120smartDrawKeys :: (Enum a, Integral a1, Integral a3, Integral a2, Num a) => a -> Bool -> Set.Set (Event.Channel, Event.Pitch) -> Set.Set (Event.Channel, Event.Pitch) -> SDL.Surface -> SDL.TTF.Font -> [(a2, a3)] -> a1 -> IO ()
121smartDrawKeys colsRepeat reallyErase beforeKeys_ nowKeys_ videoSurface font axis_key_locations axis_key_size = do 121smartDrawKeys colsRepeat reallyErase beforeKeys_ nowKeys_ videoSurface font axis_key_locations axis_key_size = do
122 let 122 let
123 chanfilter = Set.filter (\ (c, _) -> c /= (Event.Channel 9)) 123 chanfilter = Set.filter (\ (c, _) -> c /= (Event.Channel 9))
@@ -131,8 +131,10 @@ smartDrawKeys colsRepeat reallyErase beforeKeys_ nowKeys_ videoSurface font axis
131 forM_ actions $ \ (n, chans) -> do 131 forM_ actions $ \ (n, chans) -> do
132 let text = smartShowPitch (unPitch n) 132 let text = smartShowPitch (unPitch n)
133 pitch = unPitch n 133 pitch = unPitch n
134 forM_ (elemIndices pitch $ pitchIndex colsRepeat) $ \idx -> do 134 indices = elemIndices pitch $ pitchIndex colsRepeat
135 let showLabel = (not reallyErase) && (_LABEL_ALL_KEYS || (_LABEL_WHILE_PLAYING && (length chans /= 0))) 135 off = length chans == 0
136 forM_ indices $ \idx -> do
137 let showLabel = (not reallyErase) && (_LABEL_ALL_KEYS || (_LABEL_WHILE_PLAYING && (not off)))
136 drawKey idx videoSurface font axis_key_locations axis_key_size 138 drawKey idx videoSurface font axis_key_locations axis_key_size
137 (if reallyErase then _KB_BG_COLOR else pitchToColor pitch) 139 (if reallyErase then _KB_BG_COLOR else pitchToColor pitch)
138 (if showLabel then (Just text) else Nothing) 140 (if showLabel then (Just text) else Nothing)