diff options
author | Andrew Cady <d@jerkface.net> | 2014-01-17 16:43:40 -0500 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2014-01-17 16:43:52 -0500 |
commit | 4a95b04896f297019f6d62b6c46c67c9f31076c9 (patch) | |
tree | 968b5edbca85db4b5c45be4aea442f2880d8a6cf /AlsaSeq.hs | |
parent | e804a2b7c210560fd6c62d689fd21367792e1080 (diff) |
keys have different colors depending on channel
this is disabled by a constant, but it does work
Diffstat (limited to 'AlsaSeq.hs')
-rw-r--r-- | AlsaSeq.hs | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | {-# LANGUAGE NondecreasingIndentation #-} | 1 | {-# LANGUAGE NondecreasingIndentation #-} |
2 | module AlsaSeq (withAlsaInit, parseAlsaEvents, forwardNoteEvent, cmdlineAlsaConnect, printChordLn, showChord, pitchList, showPitch, unPitch) where | 2 | module AlsaSeq (withAlsaInit, parseAlsaEvents, forwardNoteEvent, cmdlineAlsaConnect, printChordLn, showChord, pitchList, showPitch, unPitch, unChannel) where |
3 | import qualified Sound.ALSA.Exception as AlsaExc | 3 | import qualified Sound.ALSA.Exception as AlsaExc |
4 | import qualified Sound.ALSA.Sequencer.Address as Addr | 4 | import qualified Sound.ALSA.Sequencer.Address as Addr |
5 | import qualified Sound.ALSA.Sequencer as SndSeq | 5 | import qualified Sound.ALSA.Sequencer as SndSeq |
@@ -27,6 +27,7 @@ import Foreign.C.Error (Errno(Errno)) | |||
27 | import Control.Exception.Base (try) | 27 | import Control.Exception.Base (try) |
28 | 28 | ||
29 | unPitch = Event.unPitch | 29 | unPitch = Event.unPitch |
30 | unChannel = Event.unChannel | ||
30 | 31 | ||
31 | printChordLn set = printWords $ pitchWords set | 32 | printChordLn set = printWords $ pitchWords set |
32 | 33 | ||
@@ -42,10 +43,9 @@ showPitch x = | |||
42 | let (octave, pitch) = Haskore.Basic.Pitch.fromInt $ fromIntegral x | 43 | let (octave, pitch) = Haskore.Basic.Pitch.fromInt $ fromIntegral x |
43 | in Haskore.Basic.Pitch.classFormat pitch (show octave) | 44 | in Haskore.Basic.Pitch.classFormat pitch (show octave) |
44 | 45 | ||
45 | -- TODO: don't filter percussion here. | ||
46 | pitchWords set = map showPitch $ pitchList set | 46 | pitchWords set = map showPitch $ pitchList set |
47 | pitchList set = map Event.unPitch $ map (\ (c, n) -> n) $ filter (\ (Event.Channel c, n) -> c /= 20) $ Set.toList set | 47 | pitchList set = map Event.unPitch $ map (\ (c, n) -> n) $ Set.toList set |
48 | pitchLists set = map (\ (c, n) -> (Event.unChannel c, Event.unPitch n)) $ filter (\ (Event.Channel c, n) -> c /= 20) $ Set.toList set | 48 | pitchLists set = map (\ (c, n) -> (Event.unChannel c, Event.unPitch n)) $ Set.toList set |
49 | 49 | ||
50 | prettyNote :: Event.Note -> String | 50 | prettyNote :: Event.Note -> String |
51 | prettyNote (Event.Note noteChannel noteNote noteVelocity noteOffVelocity noteDuration) = | 51 | prettyNote (Event.Note noteChannel noteNote noteVelocity noteOffVelocity noteDuration) = |