summaryrefslogtreecommitdiff
path: root/src/Trivstream
diff options
context:
space:
mode:
authorGregor Kleen <pngwjpgh@users.noreply.github.com>2016-08-02 22:46:52 +0200
committerGregor Kleen <pngwjpgh@users.noreply.github.com>2016-08-02 22:46:52 +0200
commit3989c89f0f3945f949d2929cc0af3994910a2771 (patch)
tree9c656c781ec4fa054befa4b9e0b2c2d671fc9170 /src/Trivstream
parentf31a65bcd1642b3f042bd906674f4064cfc9362c (diff)
downloadtrivstream-3989c89f0f3945f949d2929cc0af3994910a2771.tar
trivstream-3989c89f0f3945f949d2929cc0af3994910a2771.tar.gz
trivstream-3989c89f0f3945f949d2929cc0af3994910a2771.tar.bz2
trivstream-3989c89f0f3945f949d2929cc0af3994910a2771.tar.xz
trivstream-3989c89f0f3945f949d2929cc0af3994910a2771.zip
minor cleanupHEADmaster
Diffstat (limited to 'src/Trivstream')
-rw-r--r--src/Trivstream/Options.hs3
-rw-r--r--src/Trivstream/Options/Utils.hs1
-rw-r--r--src/Trivstream/Types.hs9
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
8import Trivstream.Types 8import Trivstream.Types
9import Trivstream.Options.Utils 9import Trivstream.Options.Utils
10import Paths_trivstream (version) 10import Paths_trivstream (version)
11import Development.GitRev
11 12
12 13
13import Options.Applicative 14import Options.Applicative
@@ -16,7 +17,7 @@ import Control.Monad.Reader
16import Control.Monad.IO.Class 17import Control.Monad.IO.Class
17 18
18 19
19withOptions :: MonadIO m => ReaderT Configuration a -> IO a 20withOptions :: MonadIO m => ReaderT Configuration m a -> m a
20withOptions f = liftIO (execParser options) >>= runReaderT f 21withOptions 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
9import Data.Char 9import Data.Char
10import Data.Maybe 10import Data.Maybe
11import Text.Read (readMaybe)
11 12
12import Network.Socket 13import 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
34data AudioBackend = Pulse | Jack 35data AudioBackend = Pulse | Jack
35 deriving (Enum, Eq, Generic) 36 deriving (Enum, Eq, Generic, Show, Read)
36 37
37instance Default AudioBackend where 38instance Default AudioBackend where
38 def = Pulse 39 def = Pulse
@@ -54,7 +55,7 @@ instance Serialize SampleRate
54data AudioConfig = AudioConfig 55data 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)
59makeLenses ''AudioConfig 60makeLenses ''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
68instance Serialize AudioConfig 69instance Serialize AudioConfig
69 70
70 71
71data Mode = Server | Client 72data Mode = Server | Client
72 deriving (Enum, Eq, Generic, Show) 73 deriving (Enum, Eq, Generic, Show, Read)
73 74
74instance Default Mode where 75instance Default Mode where
75 def = Server 76 def = Server