From 2f5f880136f3411e7e8d919631e71ef05d0ae9ad Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 9 Mar 2017 13:51:49 +0100 Subject: Allow multiple run scripts --- trivmix.cabal | 6 +----- trivmix.nix | 2 +- trivmix/Trivmix.hs | 18 +++++++----------- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/trivmix.cabal b/trivmix.cabal index c7676dd..0386561 100644 --- a/trivmix.cabal +++ b/trivmix.cabal @@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: trivmix -version: 2.6.5 +version: 2.7.0 -- synopsis: -- description: license: PublicDomain @@ -52,7 +52,3 @@ executable adjmix , trivmix hs-source-dirs: adjmix default-language: Haskell2010 - --- Local Variables: --- firestarter: "nix-shell -p haskellPackages.cabal2nix --command 'cabal2nix ./.' | tee trivmix.nix" --- End: diff --git a/trivmix.nix b/trivmix.nix index 4faa518..4230663 100644 --- a/trivmix.nix +++ b/trivmix.nix @@ -4,7 +4,7 @@ }: mkDerivation { pname = "trivmix"; - version = "2.6.5"; + version = "2.7.0"; src = ./.; isLibrary = true; isExecutable = true; diff --git a/trivmix/Trivmix.hs b/trivmix/Trivmix.hs index a13460f..cf9587f 100644 --- a/trivmix/Trivmix.hs +++ b/trivmix/Trivmix.hs @@ -43,7 +43,7 @@ data Options = Options , output :: String , client :: String , initialLevel :: Level - , run :: Maybe String + , run :: [FilePath] , levelFiles :: [FilePath] } @@ -71,11 +71,11 @@ optionParser = Options <> value def <> showDefault ) - <*> optional ( strOption ( long "run" - <> metavar "FILE" - <> help "Execute a file once setup of jacks is done (use this to autoconnect)\nThe executable gets passed the input port (including client name) as its first argument and the output as its second." - ) - ) + <*> many ( strOption ( long "run" + <> metavar "FILE" + <> help "Execute a file once setup of jacks is done (use this to autoconnect)\nThe executable gets passed the input port (including client name) as its first argument and the output as its second." + ) + ) <*> some (strArgument ( metavar "FILE..." <> help "Files that contain levels to assume and synchronize\nFor deterministic behaviour use flock(2).\nThe format used in these files is either a signed float, using ‘.’ as a decimal point or a signed float postfixed with ‘dB’.\nCaveat: ‘-InfinitydB’ exists and works as expected (i.e.: it is equal to ‘0.0’)" ) @@ -138,11 +138,7 @@ trivmix Options{..} = do Jack.withPort client' input $ \input' -> Jack.withPort client' output $ \output' -> do Trans.lift $ do - case run of - Nothing -> return () - Just run' -> do - (_, _, _, ph) <- createProcess $ (proc run' [client ++ ":" ++ input, client ++ ":" ++ output]) { delegate_ctlc = True } - return () + mapM_ (flip callProcess [client ++ ":" ++ input, client ++ ":" ++ output]) run Audio.withProcessMono client' input' (mix level') output' $ Jack.withActivation client' . forever . Trans.lift $ threadDelay 1000000 -- cgit v1.2.3