summaryrefslogtreecommitdiff
path: root/AlsaSeq.hs
diff options
context:
space:
mode:
Diffstat (limited to 'AlsaSeq.hs')
-rw-r--r--AlsaSeq.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/AlsaSeq.hs b/AlsaSeq.hs
index a3905c8..0d722e9 100644
--- a/AlsaSeq.hs
+++ b/AlsaSeq.hs
@@ -1,5 +1,5 @@
1{-# LANGUAGE NondecreasingIndentation #-} 1{-# LANGUAGE NondecreasingIndentation #-}
2module AlsaSeq (withAlsaInit, parseAlsaEvents, forwardNoteEvent, cmdlineAlsaConnect, printChordLn, showChord, pitchList, showPitch, unPitch) where 2module AlsaSeq (withAlsaInit, parseAlsaEvents, forwardNoteEvent, cmdlineAlsaConnect, printChordLn, showChord, pitchList, showPitch, unPitch, unChannel) where
3import qualified Sound.ALSA.Exception as AlsaExc 3import qualified Sound.ALSA.Exception as AlsaExc
4import qualified Sound.ALSA.Sequencer.Address as Addr 4import qualified Sound.ALSA.Sequencer.Address as Addr
5import qualified Sound.ALSA.Sequencer as SndSeq 5import qualified Sound.ALSA.Sequencer as SndSeq
@@ -27,6 +27,7 @@ import Foreign.C.Error (Errno(Errno))
27import Control.Exception.Base (try) 27import Control.Exception.Base (try)
28 28
29unPitch = Event.unPitch 29unPitch = Event.unPitch
30unChannel = Event.unChannel
30 31
31printChordLn set = printWords $ pitchWords set 32printChordLn 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.
46pitchWords set = map showPitch $ pitchList set 46pitchWords set = map showPitch $ pitchList set
47pitchList set = map Event.unPitch $ map (\ (c, n) -> n) $ filter (\ (Event.Channel c, n) -> c /= 20) $ Set.toList set 47pitchList set = map Event.unPitch $ map (\ (c, n) -> n) $ Set.toList set
48pitchLists set = map (\ (c, n) -> (Event.unChannel c, Event.unPitch n)) $ filter (\ (Event.Channel c, n) -> c /= 20) $ Set.toList set 48pitchLists set = map (\ (c, n) -> (Event.unChannel c, Event.unPitch n)) $ Set.toList set
49 49
50prettyNote :: Event.Note -> String 50prettyNote :: Event.Note -> String
51prettyNote (Event.Note noteChannel noteNote noteVelocity noteOffVelocity noteDuration) = 51prettyNote (Event.Note noteChannel noteNote noteVelocity noteOffVelocity noteDuration) =