summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2015-12-03 00:56:40 -0500
committerAndrew Cady <d@jerkface.net>2015-12-03 00:56:40 -0500
commit01df45553934d9d61f7810d49beec9419d2f1e4e (patch)
tree17b75118c0a399a489527cee1742727d84ec38ef
parent0af4a980467850b9fdfd684f82983bad58631933 (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.hs13
1 files changed, 12 insertions, 1 deletions
diff --git a/axis.hs b/axis.hs
index 95f3930..90770f0 100644
--- a/axis.hs
+++ b/axis.hs
@@ -20,6 +20,7 @@ import GHC.Word
20import Data.Bits 20import Data.Bits
21import qualified Sound.ALSA.Sequencer.Event as Event 21import qualified Sound.ALSA.Sequencer.Event as Event
22import qualified Graphics.UI.SDL.Utilities as SDL.Util 22import qualified Graphics.UI.SDL.Utilities as SDL.Util
23import qualified Data.Map as Map
23 24
24netwireIsCool :: (Monad m) => Wire (Timed NominalDiffTime ()) () m a String 25netwireIsCool :: (Monad m) => Wire (Timed NominalDiffTime ()) () m a String
25netwireIsCool = 26netwireIsCool =
@@ -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 ()
168drawKey idx videoSurface font axis_key_locations axis_key_size fillColor text channels = do 169drawKey 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'