diff options
author | Andrew Cady <d@jerkface.net> | 2015-12-03 00:56:40 -0500 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2015-12-03 00:56:40 -0500 |
commit | 01df45553934d9d61f7810d49beec9419d2f1e4e (patch) | |
tree | 17b75118c0a399a489527cee1742727d84ec38ef | |
parent | 0af4a980467850b9fdfd684f82983bad58631933 (diff) |
filter out channel 9
This is a very old change, I'm committing now to start working on this again.
I don't actually understand how the code could have worked without this
patch. The variable "actions" is created here, but used in code that's
already committed.
Oh well.
-rw-r--r-- | axis.hs | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -20,6 +20,7 @@ import GHC.Word | |||
20 | import Data.Bits | 20 | import Data.Bits |
21 | import qualified Sound.ALSA.Sequencer.Event as Event | 21 | import qualified Sound.ALSA.Sequencer.Event as Event |
22 | import qualified Graphics.UI.SDL.Utilities as SDL.Util | 22 | import qualified Graphics.UI.SDL.Utilities as SDL.Util |
23 | import qualified Data.Map as Map | ||
23 | 24 | ||
24 | netwireIsCool :: (Monad m) => Wire (Timed NominalDiffTime ()) () m a String | 25 | netwireIsCool :: (Monad m) => Wire (Timed NominalDiffTime ()) () m a String |
25 | netwireIsCool = | 26 | netwireIsCool = |
@@ -162,7 +163,7 @@ allKeysOff colsRepeat reallyErase videoSurface font axis_key_locations axis_key_ | |||
162 | -- would choose based on the "structure" of the actual music. | 163 | -- would choose based on the "structure" of the actual music. |
163 | -- Question: how to deal with simultaneous keypresses? | 164 | -- Question: how to deal with simultaneous keypresses? |
164 | 165 | ||
165 | -- First order of business: get rid of all calls to smartDrawKeys but one | 166 | -- Next order of business: |
166 | 167 | ||
167 | --drawKey :: (Integral a1, Integral a2, Integral a) => Int -> SDL.Surface -> SDL.TTF.Font -> [(a1, a2)] -> a -> SDL.Color -> t -> Maybe String -> [Int] -> IO () | 168 | --drawKey :: (Integral a1, Integral a2, Integral a) => Int -> SDL.Surface -> SDL.TTF.Font -> [(a1, a2)] -> a -> SDL.Color -> t -> Maybe String -> [Int] -> IO () |
168 | drawKey idx videoSurface font axis_key_locations axis_key_size fillColor text channels = do | 169 | drawKey idx videoSurface font axis_key_locations axis_key_size fillColor text channels = do |
@@ -268,6 +269,16 @@ main = | |||
268 | -- textBand videoSurface videoClipRect (SDL.Rect 0 0 0 70) font x' | 269 | -- textBand videoSurface videoClipRect (SDL.Rect 0 0 0 70) font x' |
269 | -- return () | 270 | -- return () |
270 | 271 | ||
272 | let | ||
273 | chanfilter = Set.filter (\ (c, _) -> c /= (Event.Channel 9)) | ||
274 | beforeKeys = chanfilter midiKeysDown | ||
275 | nowKeys = chanfilter midiKeysDown' | ||
276 | |||
277 | changedPitches = Set.map (\ (_, p) -> p) $ Set.union (Set.difference nowKeys beforeKeys) (Set.difference beforeKeys nowKeys) | ||
278 | playingNowChans n = Set.map (\ (c, _) -> c) $ Set.filter (\ (_, p) -> p == n) nowKeys | ||
279 | actions = Set.toList $ Set.map (\p -> (p, Set.toList $ playingNowChans p)) changedPitches | ||
280 | chanPitches = Map.fromListWith (++) $ map (\ (c, p) -> (c, [p])) $ Set.toList nowKeys | ||
281 | |||
271 | Control.Monad.when (midiKeysDown' /= midiKeysDown) $ do | 282 | Control.Monad.when (midiKeysDown' /= midiKeysDown) $ do |
272 | -- let chord = showChord midiKeysDown' | 283 | -- let chord = showChord midiKeysDown' |
273 | -- let chord = show $ pitchList midiKeysDown' | 284 | -- let chord = show $ pitchList midiKeysDown' |