reactive-balsa 0.1 → 0.1.1
raw patch · 3 files changed
+27/−11 lines, 3 filesdep ~reactive-banana
Dependency ranges changed: reactive-banana
Files
- reactive-balsa.cabal +3/−3
- src/Reactive/Banana/ALSA/Example.hs +2/−0
- src/Reactive/Banana/ALSA/Sequencer.hs +22/−8
reactive-balsa.cabal view
@@ -1,5 +1,5 @@ Name: reactive-balsa-Version: 0.1+Version: 0.1.1 License: BSD3 License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de>@@ -45,14 +45,14 @@ Source-Repository this type: darcs location: http://code.haskell.org/~thielema/reactive-balsa/- tag: 0.1+ tag: 0.1.1 Flag splitBase description: Choose the new smaller, split-up base package. Library Build-Depends:- reactive-banana >=0.5 && <0.6,+ reactive-banana >=0.7 && <0.8, midi-alsa >=0.2 && <0.3, midi >=0.2 && <0.3, alsa-seq >=0.6 && <0.7,
src/Reactive/Banana/ALSA/Example.hs view
@@ -13,6 +13,7 @@ import qualified Reactive.Banana.ALSA.Utility as RBU +import qualified Reactive.Banana.Frameworks as RBF import qualified Reactive.Banana.Combinators as RB import Reactive.Banana.Combinators ((<@>), ) @@ -97,6 +98,7 @@ (KeySet.C set) => set -> (forall t.+ (RBF.Frameworks t) => RB.Behavior t set -> RB.Event t Time.Abs -> RB.Event t [NoteBoundary]) ->
src/Reactive/Banana/ALSA/Sequencer.hs view
@@ -10,6 +10,7 @@ import qualified Reactive.Banana.Combinators as RB import qualified Reactive.Banana.Frameworks as RBF+import qualified Reactive.Banana.Switch as RBS import Reactive.Banana.Combinators ((<@>), ) import qualified Sound.ALSA.Sequencer.Event.RemoveMonad as Remove@@ -63,12 +64,12 @@ runReactor :: MR.ReaderT (RBF.AddHandler Event.T, Common.Handle)- (MS.StateT Schedule (RBF.NetworkDescription t))+ (MS.StateT Schedule (RBS.Moment t)) a } deriving (Functor, Applicative, Monad, MonadIO, MonadFix) -liftNetworkDescription :: RBF.NetworkDescription t a -> Reactor t a+liftNetworkDescription :: RBS.Moment t a -> Reactor t a liftNetworkDescription act = Reactor $ MT.lift $ MT.lift act @@ -106,7 +107,9 @@ run :: (Common.Events ev) =>- (forall t. RB.Event t Event.Data -> RB.Event t ev) ->+ (forall t.+ (RBF.Frameworks t) =>+ RB.Event t Event.Data -> RB.Event t ev) -> ReaderT Common.Handle IO () run f = runM (\ _ts xs -> return $ f xs)@@ -114,6 +117,7 @@ runM :: (Common.Events ev) => (forall t.+ (RBF.Frameworks t) => RB.Behavior t Time.Abs -> RB.Event t Event.Data -> Reactor t (RB.Event t ev)) -> ReaderT Common.Handle IO ()@@ -161,7 +165,9 @@ Event.CustomEv Event.Echo _ <- Just $ Event.body echo return $ Event.tag echo -reactimate :: RB.Event t (IO ()) -> Reactor t ()+reactimate ::+ (RBF.Frameworks t) =>+ RB.Event t (IO ()) -> Reactor t () reactimate evs = Reactor $ MT.lift $ MT.lift $ RBF.reactimate evs @@ -182,6 +188,7 @@ Remove.setTag sched reserveSchedule ::+ (RBF.Frameworks t) => Reactor t (RB.Event t Time.Abs, [Time.Abs] -> IO (), IO ()) reserveSchedule = Reactor $ ReaderT $ \(addH,h) -> do sched <- MS.get@@ -194,7 +201,8 @@ return (eEcho, sendEchos h sched, cancelEchos h sched) -scheduleQueue :: Show a =>+scheduleQueue ::+ (RBF.Frameworks t, Show a) => RB.Behavior t Time.Abs -> RB.Event t (Common.Bundle a) -> Reactor t (RB.Event t a) scheduleQueue times e = do@@ -278,6 +286,7 @@ since this uses precisely timed delivery by ALSA. -} delaySchedule ::+ (RBF.Frameworks t) => Time.T -> RB.Behavior t Time.Abs -> RB.Event t Event.Data -> Reactor t (RB.Event t Event.Data)@@ -303,6 +312,7 @@ The output events hold the times, where they occur. -} beat ::+ (RBF.Frameworks t) => RB.Behavior t Time.T -> Reactor t (RB.Event t Time.Abs) beat tempo = do (eEcho, send, _) <- reserveSchedule@@ -331,6 +341,7 @@ and thus may miss some tempo changes. -} beatQuant ::+ (RBF.Frameworks t) => Time.T -> RB.Behavior t Time.T -> Reactor t (RB.Event t Time.Abs) beatQuant maxDur tempo = do@@ -364,6 +375,7 @@ and we need a behaviour for the current time. -} beatVar ::+ (RBF.Frameworks t) => RB.Behavior t Time.Abs -> RB.Behavior t Time.T -> Reactor t (RB.Event t Time.Abs)@@ -642,6 +654,7 @@ The Reactor monad is only needed for sending the initial notes. -} trainer ::+ (RBF.Frameworks t) => Channel -> Time.T -> Time.T -> [([Pitch], [Pitch])] ->@@ -699,6 +712,7 @@ sweep ::+ (RBF.Frameworks t) => Time.T -> (Double -> Double) -> RB.Behavior t Double ->@@ -742,11 +756,11 @@ The disadvantage is that there a distinct distances between the pitches. -} snapSelect ::- (KeySet.C set) =>+ (RBF.Frameworks t, KeySet.C set) => RB.Behavior t set -> RB.Behavior t Int -> Reactor t (RB.Event t [Event.Data])--- RBF.NetworkDescription t (RB.Event t [Event.Data])+-- RBS.Moment t (RB.Event t [Event.Data]) snapSelect set ctrl = liftNetworkDescription $ fmap (fst . RB.mapAccum Nothing .@@ -775,7 +789,7 @@ if' (x>127) (x-12) x uniqueChanges ::- (Eq a) =>+ (RBF.Frameworks t, Eq a) => RB.Behavior t a -> Reactor t (RB.Event t a) uniqueChanges x = liftNetworkDescription $ do x0 <- RBF.initial x