diff options
Diffstat (limited to 'axis.hs')
-rw-r--r-- | axis.hs | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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 () | 120 | smartDrawKeys :: (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 () |
121 | smartDrawKeys colsRepeat reallyErase beforeKeys_ nowKeys_ videoSurface font axis_key_locations axis_key_size = do | 121 | smartDrawKeys 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) |