packages feed

reactive-jack 0.4 → 0.4.1

raw patch · 3 files changed

+19/−13 lines, 3 filesdep +semigroups

Dependencies added: semigroups

Files

reactive-jack.cabal view
@@ -1,12 +1,11 @@ Name:             reactive-jack-Version:          0.4+Version:          0.4.1 License:          BSD3 License-File:     LICENSE Author:           Henning Thielemann <haskell@henning-thielemann.de> Maintainer:       Henning Thielemann <haskell@henning-thielemann.de> Homepage:         http://www.haskell.org/haskellwiki/Reactive-balsa Category:         Sound, Music-Build-Type:       Simple Synopsis:         Process MIDI events via reactive-banana and JACK Description:    MIDI is the Musical Instrument Digital Interface,@@ -45,10 +44,7 @@ Source-Repository this   type:     darcs   location: http://hub.darcs.net/thielema/reactive-jack/-  tag:      0.4--Flag splitBase-  description: Choose the new smaller, split-up base package.+  tag:      0.4.1  Library   Build-Depends:@@ -62,6 +58,7 @@     utility-ht >=0.0.8 && <0.1,     containers >=0.2 && <0.6,     transformers >=0.2 && <0.6,+    semigroups >=0.1 && <1.0,     explicit-exception >=0.1.7 && <0.2,     extensible-exceptions >=0.1 && <0.2,     random >=1 && <2,
src/Reactive/Banana/JACK/Common.hs view
@@ -18,8 +18,8 @@  with :: ReaderT Handle (Sync.ExceptionalT JackExc.All IO) () -> IO () with f =-    Jack.handleExceptions $-        Jack.withClientDefault "Haskell-MIDI-Filter" $ \c ->-        Jack.withPort c "input" $ \input ->-        Jack.withPort c "output" $ \output ->-        runReaderT f $ Handle c input output+   Jack.handleExceptions $+      Jack.withClientDefault "Haskell-MIDI-Filter" $ \c ->+      Jack.withPort c "input" $ \input ->+      Jack.withPort c "output" $ \output ->+      runReaderT f $ Handle c input output
src/Reactive/Banana/JACK/Process.hs view
@@ -39,6 +39,7 @@ import Data.IORef (IORef, newIORef, readIORef, writeIORef, modifyIORef, ) import Data.Foldable (forM_, ) import Data.Monoid (Monoid, mappend, mempty, )+import Data.Semigroup (Semigroup, (<>), )  import Prelude hiding (sequence, ) @@ -81,10 +82,13 @@ data InEvent =    InEvent (Map Schedule [Handler AbsoluteTicks]) [MidiMsg.T] +instance Semigroup InEvent where+   InEvent xs0 ys0 <> InEvent xs1 ys1 =+      InEvent (Map.unionWith (++) xs0 xs1) (ys0++ys1)+ instance Monoid InEvent where    mempty = InEvent Map.empty []-   mappend (InEvent xs0 ys0) (InEvent xs1 ys1) =-      InEvent (Map.unionWith (++) xs0 xs1) (ys0++ys1)+   mappend = (<>)  inEventBeat :: Acc.T InEvent (Map Schedule [Handler AbsoluteTicks]) inEventBeat =@@ -179,6 +183,11 @@       Map.fromListWith (++) $ EventListAbs.toPairList $       fmap (:[]) evs +   {-+   ToDo:+   How to handle overflow properly?+   jack.h does not give an advice.+   -}    cycleStart <- MT.lift $ Jack.lastFrameTime $ Common.client h    let cycleStartTicks = absTicksFromNFrames cycleStart    MT.lift $ writeIORef cycleStartRef cycleStartTicks