packages feed

reactive-midyim 0.2 → 0.2.1

raw patch · 3 files changed

+38/−9 lines, 3 filesdep ~reactive-banana

Dependency ranges changed: reactive-banana

Files

reactive-midyim.cabal view
@@ -1,5 +1,5 @@ Name:             reactive-midyim-Version:          0.2+Version:          0.2.1 License:          BSD3 License-File:     LICENSE Author:           Henning Thielemann <haskell@henning-thielemann.de>@@ -45,11 +45,11 @@ Source-Repository this   type:     darcs   location: http://hub.darcs.net/thielema/reactive-midyim/-  tag:      0.2+  tag:      0.2.1  Library   Build-Depends:-    reactive-banana >=0.7 && <0.8,+    reactive-banana >=0.8 && <0.9,     midi >=0.2 && <0.3,     event-list >=0.1 && < 0.2,     non-negative >=0.1 && <0.2,
src/Reactive/Banana/MIDI/Pattern.hs view
@@ -31,7 +31,7 @@ import qualified Data.Foldable as Fold  import Control.Monad (guard, )-import Control.Applicative (Applicative, pure, (<*>), )+import Control.Applicative (pure, (<*>), ) import Data.Maybe (mapMaybe, maybeToList, ) import Data.Bool.HT (if', ) import Data.Ord.HT (comparing, )
src/Reactive/Banana/MIDI/Process.hs view
@@ -109,6 +109,11 @@    RB.Event t (IO ()) -> IxMonad.Wrap reactor t () reactimate = IxMonad.Wrap . liftMoment . RBF.reactimate +reactimate' ::+   (Moment reactor, RBF.Frameworks t) =>+   RB.Event t (RBF.Future (IO ())) -> IxMonad.Wrap reactor t ()+reactimate' = IxMonad.Wrap . liftMoment . RBF.reactimate'+ liftIO ::    (Moment m, RBF.Frameworks t) =>    IO a -> IxMonad.Wrap m t a@@ -265,6 +270,11 @@ thus we need the Discrete input instead of Behaviour and we need a behaviour for the current time. -}+{-+TODO: However, the best solution specifically for ALSA would be+to reserve a queue for every beat+and alter the tempo of the queue timer.+-} beatVar ::    (Reactor reactor, RBF.Frameworks t) =>    RB.Behavior t (AbsoluteTicks reactor) ->@@ -278,13 +288,13 @@     (tempoInit, tempoChanges) <-       IxMonad.Wrap $ liftMoment $-      liftA2 (,) (RBF.initial tempo) (RBF.changes tempo)+      liftA2 (,) (RBF.initial tempo) (plainChanges tempo) -   let next t = mapSnd sendSingle <$> beatVarNext t+   let next t = mapSnd (return . sendSingle) <$> beatVarNext t         change p1 t1 = do           ta <- beatVarChange p1 t1-          return (Nothing, cancel >> sendSingle ta)+          return (Nothing, return $ cancel >> sendSingle ta)         eEchoEvent =           fst $ RBU.sequence (mempty, 0, tempoInit) $@@ -292,7 +302,7 @@              (fmap next eEcho)              (fmap (flip change) time <@> tempoChanges) -   reactimate $ fmap snd eEchoEvent+   reactimate' $ fmap snd eEchoEvent    return $ RBU.mapMaybe fst eEchoEvent  @@ -436,9 +446,28 @@    RB.Behavior t a -> moment t (RB.Event t a) uniqueChanges x = liftMoment $ do    x0 <- RBF.initial x-   xs <- RBF.changes x+   xs <- plainChanges x    return $ RB.filterJust $       flip RBU.mapAdjacent x0 (\old new -> toMaybe (new/=old) new) xs+++{-+TODO: I think we can use this for ALSA.+Can we also use it for JACK?+If not, we can create something of type++  RB.Behavior t a -> RBS.Moment t (RB.Event t ())++and attach the Behavior values using (<@).+-}+plainChanges ::+   (RBF.Frameworks t) =>+   RB.Behavior t a -> RBS.Moment t (RB.Event t a)+plainChanges x = do+   (evs, handle) <- RBF.newEvent+   xs <- RBF.changes x+   RBF.reactimate' $ fmap (fmap handle) xs+   return evs   sweep ::