summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2015-06-07 20:48:12 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2015-06-07 20:48:12 +0200
commit5e46af12608b35b73b7ac1f83e59585671d19e48 (patch)
tree5e220ed1866fd516aeefe991be31d80d0c1a81e3 /src
parent29f5a0340a3220b6f5ccb34c7f430df9e5ce4692 (diff)
downloadtrivmix-5e46af12608b35b73b7ac1f83e59585671d19e48.tar
trivmix-5e46af12608b35b73b7ac1f83e59585671d19e48.tar.gz
trivmix-5e46af12608b35b73b7ac1f83e59585671d19e48.tar.bz2
trivmix-5e46af12608b35b73b7ac1f83e59585671d19e48.tar.xz
trivmix-5e46af12608b35b73b7ac1f83e59585671d19e48.zip
Option for clientname
Diffstat (limited to 'src')
-rw-r--r--src/Trivmix.hs11
1 files changed, 7 insertions, 4 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' $