midi-alsa 0.2 → 0.2.1
raw patch · 4 files changed
+91/−4 lines, 4 filesdep ~midi
Dependency ranges changed: midi
Files
- midi-alsa.cabal +4/−3
- src/Sound/MIDI/ALSA/Check.hs +2/−0
- src/Sound/MIDI/ALSA/Construct.hs +82/−0
- src/Sound/MIDI/ALSA/Query.hs +3/−1
midi-alsa.cabal view
@@ -1,5 +1,5 @@ Name: midi-alsa-Version: 0.2+Version: 0.2.1 License: BSD3 License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de>@@ -21,7 +21,7 @@ Cabal-Version: >=1.6 Build-Type: Simple Source-Repository this- Tag: 0.2+ Tag: 0.2.1 Type: darcs Location: http://code.haskell.org/alsa/midi/ @@ -38,7 +38,7 @@ Library Build-Depends:- midi >=0.2 && <0.3,+ midi >=0.2.1 && <0.3, alsa-seq >=0.6 && <0.7, data-accessor >=0.2.1 && <0.3, utility-ht >=0.0.5 && <0.1@@ -55,3 +55,4 @@ Sound.MIDI.ALSA Sound.MIDI.ALSA.Check Sound.MIDI.ALSA.Query+ Sound.MIDI.ALSA.Construct
src/Sound/MIDI/ALSA/Check.hs view
@@ -7,6 +7,8 @@ module Sound.MIDI.ALSA.Check ( Class.C, Class.note,+ Class.noteExplicitOff,+ Class.noteImplicitOff, Class.program, Class.anyController, Class.controller,
+ src/Sound/MIDI/ALSA/Construct.hs view
@@ -0,0 +1,82 @@+{-+The instances Class.C Event.T and Class.C Event.Data are orphan.+I could put them in package 'midi' or 'alsa-seq'+but in both of them it imposes a lot of new dependencies.+-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+module Sound.MIDI.ALSA.Construct (+ Class.C,+ Class.note,+ Class.noteExplicitOff,+ Class.noteImplicitOff,+ Class.program,+ Class.anyController,+ Class.mode,+ Class.pitchBend,+ Class.channelPressure,+ ) where++import qualified Sound.MIDI.Message.Class.Construct as Class+import qualified Sound.MIDI.Message.Channel.Mode as Mode++import qualified Sound.MIDI.ALSA as MALSA++import qualified Sound.ALSA.Sequencer.Event as Event+import qualified Sound.ALSA.Sequencer.Address as Addr++import Sound.MIDI.Message.Channel (Channel, )+import Sound.MIDI.Message.Channel.Voice+ (Pitch, Velocity, Controller, Program, toVelocity, )+++liftEvent ::+ (Channel -> a -> Event.Data) ->+ (Channel -> a -> Event.T)+liftEvent makeEvent chan param =+ Event.simple Addr.unknown $ makeEvent chan param++instance Class.C Event.T where+ note = liftEvent noteData+ program = liftEvent programData+ anyController = liftEvent anyControllerData+ mode = liftEvent modeData+ pitchBend = liftEvent pitchBendData+ channelPressure = liftEvent channelPressureData++instance Class.C Event.Data where+ note = noteData+ program = programData+ anyController = anyControllerData+ mode = modeData+ pitchBend = pitchBendData+ channelPressure = channelPressureData+++noteData ::+ Channel -> (Velocity, Pitch, Bool) -> Event.Data+noteData chan (velocity, pitch, on) =+ Event.NoteEv+ (if on then Event.NoteOn else Event.NoteOff)+ (MALSA.noteEvent chan pitch velocity (toVelocity 0) 0)++programData ::+ Channel -> Program -> Event.Data+programData chan pgm =+ Event.CtrlEv Event.PgmChange $ MALSA.programChangeEvent chan pgm++anyControllerData ::+ Channel -> (Controller, Int) -> Event.Data+anyControllerData chan (ctrl, val) =+ Event.CtrlEv Event.Controller $ MALSA.controllerEvent chan ctrl val++modeData :: Channel -> Mode.T -> Event.Data+modeData chan mode =+ Event.CtrlEv Event.Controller $ MALSA.modeEvent chan mode++pitchBendData :: Channel -> Int -> Event.Data+pitchBendData chan val =+ Event.CtrlEv Event.PitchBend $ MALSA.controllerEvent chan minBound val++channelPressureData :: Channel -> Int -> Event.Data+channelPressureData chan val =+ Event.CtrlEv Event.ChanPress $ MALSA.controllerEvent chan minBound val
src/Sound/MIDI/ALSA/Query.hs view
@@ -1,12 +1,14 @@ {- The instances Class.C Event.T and Class.C Event.Data are orphan.-I could put it in package 'midi' or 'alsa-seq'+I could put them in package 'midi' or 'alsa-seq' but in both of them it imposes a lot of new dependencies. -} {-# OPTIONS_GHC -fno-warn-orphans #-} module Sound.MIDI.ALSA.Query ( Class.C, Class.note,+ Class.noteExplicitOff,+ Class.noteImplicitOff, Class.program, Class.anyController, Class.mode,