diff options
-rw-r--r-- | src/Trivstream/Options.hs | 3 | ||||
-rw-r--r-- | src/Trivstream/Options/Utils.hs | 1 | ||||
-rw-r--r-- | src/Trivstream/Types.hs | 9 |
3 files changed, 8 insertions, 5 deletions
diff --git a/src/Trivstream/Options.hs b/src/Trivstream/Options.hs index a777942..1762f60 100644 --- a/src/Trivstream/Options.hs +++ b/src/Trivstream/Options.hs | |||
@@ -8,6 +8,7 @@ module Trivstream.Options | |||
8 | import Trivstream.Types | 8 | import Trivstream.Types |
9 | import Trivstream.Options.Utils | 9 | import Trivstream.Options.Utils |
10 | import Paths_trivstream (version) | 10 | import Paths_trivstream (version) |
11 | import Development.GitRev | ||
11 | 12 | ||
12 | 13 | ||
13 | import Options.Applicative | 14 | import Options.Applicative |
@@ -16,7 +17,7 @@ import Control.Monad.Reader | |||
16 | import Control.Monad.IO.Class | 17 | import Control.Monad.IO.Class |
17 | 18 | ||
18 | 19 | ||
19 | withOptions :: MonadIO m => ReaderT Configuration a -> IO a | 20 | withOptions :: MonadIO m => ReaderT Configuration m a -> m a |
20 | withOptions f = liftIO (execParser options) >>= runReaderT f | 21 | withOptions f = liftIO (execParser options) >>= runReaderT f |
21 | where | 22 | where |
22 | options = options' `info` mconcat [ header $ concat [ "trivstream " | 23 | options = options' `info` mconcat [ header $ concat [ "trivstream " |
diff --git a/src/Trivstream/Options/Utils.hs b/src/Trivstream/Options/Utils.hs index 30694d8..bab27b3 100644 --- a/src/Trivstream/Options/Utils.hs +++ b/src/Trivstream/Options/Utils.hs | |||
@@ -8,6 +8,7 @@ import Options.Applicative | |||
8 | 8 | ||
9 | import Data.Char | 9 | import Data.Char |
10 | import Data.Maybe | 10 | import Data.Maybe |
11 | import Text.Read (readMaybe) | ||
11 | 12 | ||
12 | import Network.Socket | 13 | import Network.Socket |
13 | 14 | ||
diff --git a/src/Trivstream/Types.hs b/src/Trivstream/Types.hs index 8cdd592..6dbd949 100644 --- a/src/Trivstream/Types.hs +++ b/src/Trivstream/Types.hs | |||
@@ -7,6 +7,7 @@ module Trivstream.Types | |||
7 | , SampleRate(..) | 7 | , SampleRate(..) |
8 | , Configuration(..) | 8 | , Configuration(..) |
9 | , Mode (..) | 9 | , Mode (..) |
10 | , module Data.Default.Class | ||
10 | ) where | 11 | ) where |
11 | 12 | ||
12 | 13 | ||
@@ -32,7 +33,7 @@ instance Serialize ChannelPosition | |||
32 | 33 | ||
33 | 34 | ||
34 | data AudioBackend = Pulse | Jack | 35 | data AudioBackend = Pulse | Jack |
35 | deriving (Enum, Eq, Generic) | 36 | deriving (Enum, Eq, Generic, Show, Read) |
36 | 37 | ||
37 | instance Default AudioBackend where | 38 | instance Default AudioBackend where |
38 | def = Pulse | 39 | def = Pulse |
@@ -54,7 +55,7 @@ instance Serialize SampleRate | |||
54 | data AudioConfig = AudioConfig | 55 | data AudioConfig = AudioConfig |
55 | { _aBackend :: AudioBackend | 56 | { _aBackend :: AudioBackend |
56 | , _aChannels :: [Maybe ChannelPosition] | 57 | , _aChannels :: [Maybe ChannelPosition] |
57 | , _aRate :: SampleRate | 58 | , _aRate :: Maybe SampleRate |
58 | } deriving (Generic) | 59 | } deriving (Generic) |
59 | makeLenses ''AudioConfig | 60 | makeLenses ''AudioConfig |
60 | 61 | ||
@@ -62,14 +63,14 @@ instance Default AudioConfig where | |||
62 | def = AudioConfig | 63 | def = AudioConfig |
63 | { _aBackend = def | 64 | { _aBackend = def |
64 | , _aChannels = [Just $ ChannelNormal PanLeft, Just $ ChannelNormal PanRight] | 65 | , _aChannels = [Just $ ChannelNormal PanLeft, Just $ ChannelNormal PanRight] |
65 | , _aRate = def | 66 | , _aRate = Just def |
66 | } | 67 | } |
67 | 68 | ||
68 | instance Serialize AudioConfig | 69 | instance Serialize AudioConfig |
69 | 70 | ||
70 | 71 | ||
71 | data Mode = Server | Client | 72 | data Mode = Server | Client |
72 | deriving (Enum, Eq, Generic, Show) | 73 | deriving (Enum, Eq, Generic, Show, Read) |
73 | 74 | ||
74 | instance Default Mode where | 75 | instance Default Mode where |
75 | def = Server | 76 | def = Server |