midi-alsa 0.1 → 0.1.1
raw patch · 2 files changed
+48/−2 lines, 2 files
Files
- midi-alsa.cabal +2/−2
- src/Sound/MIDI/ALSA.hs +46/−0
midi-alsa.cabal view
@@ -1,5 +1,5 @@ Name: midi-alsa-Version: 0.1+Version: 0.1.1 License: BSD3 License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de>@@ -24,7 +24,7 @@ Source-Repository this type: darcs location: http://code.haskell.org/~thielema/midi-alsa/- tag: 0.1+ tag: 0.1.1 Flag splitBase description: Choose the new smaller, split-up base package.
src/Sound/MIDI/ALSA.hs view
@@ -16,6 +16,8 @@ import Data.Tuple.HT (mapSnd, ) +-- * value conversions+ toChannel :: Word8 -> Channel toChannel = ChannelMsg.toChannel . fromIntegral @@ -75,6 +77,50 @@ fromProgram = fromIntegral . ChannelMsg.fromProgram +-- * construction of event data records++noteEvent ::+ Channel -> Pitch -> Velocity -> Velocity -> Word32 ->+ Event.Note+noteEvent chan pitch velOn velOff dur =+ Event.Note+ (fromChannel chan)+ (fromPitch pitch)+ (fromVelocity velOn)+ (fromVelocity velOff)+ dur++controllerEvent ::+ Channel -> Controller -> Int32 ->+ Event.Ctrl+controllerEvent chan ctrl value =+ Event.Ctrl+ (fromChannel chan)+ (fromController ctrl)+ value++programChangeEvent ::+ Channel -> Program ->+ Event.Ctrl+programChangeEvent chan pgm =+ Event.Ctrl+ (fromChannel chan)+ 0+ (fromProgram pgm)++modeEvent ::+ Channel -> Mode.T ->+ Event.Ctrl+modeEvent chan m =+ case Mode.toControllerValue m of+ (param,value) ->+ Event.Ctrl+ (fromChannel chan)+ param+ (fromIntegral value)+++-- * accessors to event data fields noteChannel :: Acc.T Event.Note Channel noteChannel =