summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Trivmix.hs11
-rw-r--r--trivmix.cabal2
2 files changed, 8 insertions, 5 deletions
diff --git a/src/Trivmix.hs b/src/Trivmix.hs
index 019ee32..f7ae1eb 100644
--- a/src/Trivmix.hs
+++ b/src/Trivmix.hs
@@ -27,6 +27,7 @@ import System.INotify
27data Options = Options 27data Options = Options
28 { input :: String 28 { input :: String
29 , output :: String 29 , output :: String
30 , client :: String
30 , initialLevel :: Float 31 , initialLevel :: Float
31 , stateDir :: FilePath 32 , stateDir :: FilePath
32 } 33 }
@@ -34,10 +35,13 @@ data Options = Options
34optionParser :: Parser Options 35optionParser :: Parser Options
35optionParser = Options <$> 36optionParser = Options <$>
36 strOption ( long "input" 37 strOption ( long "input"
37 <> metavar "JACK" 38 <> metavar "STRING"
38 ) 39 )
39 <*> strOption ( long "output" 40 <*> strOption ( long "output"
40 <> metavar "JACK" 41 <> metavar "STRING"
42 )
43 <*> strOption ( long "client"
44 <> metavar "STRING"
41 ) 45 )
42 <*> (fromMaybe 0 <$> optional (option auto ( long "level" 46 <*> (fromMaybe 0 <$> optional (option auto ( long "level"
43 <> metavar "FLOAT" 47 <> metavar "FLOAT"
@@ -59,14 +63,13 @@ main = execParser opts >>= trivmix
59 63
60trivmix :: Options -> IO () 64trivmix :: Options -> IO ()
61trivmix Options{..} = do 65trivmix Options{..} = do
62 name <- getProgName
63 createDirectoryIfMissing True stateDir 66 createDirectoryIfMissing True stateDir
64 level <- newMVar initialLevel 67 level <- newMVar initialLevel
65 let levelFile = stateDir </> "level" 68 let levelFile = stateDir </> "level"
66 onLevelFile levelFile initialLevel $ withINotify $ \n -> do 69 onLevelFile levelFile initialLevel $ withINotify $ \n -> do
67 addWatch n [Modify] levelFile (const $ handleLevel level levelFile) 70 addWatch n [Modify] levelFile (const $ handleLevel level levelFile)
68 Jack.handleExceptions $ 71 Jack.handleExceptions $
69 Jack.withClientDefault name $ \client -> 72 Jack.withClientDefault client $ \client ->
70 Jack.withPort client input $ \input' -> 73 Jack.withPort client input $ \input' ->
71 Jack.withPort client output $ \output' -> 74 Jack.withPort client output $ \output' ->
72 Audio.withProcessMono client input' (mix level) output' $ 75 Audio.withProcessMono client input' (mix level) output' $
diff --git a/trivmix.cabal b/trivmix.cabal
index ae9a72e..8eee4f0 100644
--- a/trivmix.cabal
+++ b/trivmix.cabal
@@ -2,7 +2,7 @@
2-- documentation, see http://haskell.org/cabal/users-guide/ 2-- documentation, see http://haskell.org/cabal/users-guide/
3 3
4name: trivmix 4name: trivmix
5version: 0.0.0 5version: 0.1.0
6-- synopsis: 6-- synopsis:
7-- description: 7-- description:
8license: PublicDomain 8license: PublicDomain