{-# LANGUAGE OverloadedStrings #-}

{- |
Module      : Network.MPD.Applicative.Output
Copyright   : (c) Joachim Fasting 2012
License     : MIT

Maintainer  : joachifm@fastmail.fm
Stability   : stable
Portability : unportable

Audio output devices.
-}

module Network.MPD.Applicative.Output
    ( disableOutput
    , enableOutput
    , toggleOutput
    , outputs
    ) where

import           Network.MPD.Applicative.Internal
import           Network.MPD.Commands.Arg hiding (Command)
import           Network.MPD.Commands.Parse
import           Network.MPD.Commands.Types

-- | Turn off output.
disableOutput :: Int -> Command ()
disableOutput :: Int -> Command ()
disableOutput Int
n = Parser () -> [String] -> Command ()
forall a. Parser a -> [String] -> Command a
Command Parser ()
emptyResponse [Command
"disableoutput" Command -> Int -> String
forall a. MPDArg a => Command -> a -> String
<@> Int
n]

-- | Turn on output.
enableOutput :: Int -> Command ()
enableOutput :: Int -> Command ()
enableOutput Int
n = Parser () -> [String] -> Command ()
forall a. Parser a -> [String] -> Command a
Command Parser ()
emptyResponse [Command
"enableoutput" Command -> Int -> String
forall a. MPDArg a => Command -> a -> String
<@> Int
n]

-- | Toggle output.
toggleOutput :: Int -> Command ()
toggleOutput :: Int -> Command ()
toggleOutput Int
n = Parser () -> [String] -> Command ()
forall a. Parser a -> [String] -> Command a
Command Parser ()
emptyResponse [Command
"toggleoutput" Command -> Int -> String
forall a. MPDArg a => Command -> a -> String
<@> Int
n]

-- | Get information about all available output devices.
outputs :: Command [Device]
outputs :: Command [Device]
outputs = Parser [Device] -> [String] -> Command [Device]
forall a. Parser a -> [String] -> Command a
Command (([ByteString] -> Either String [Device]) -> Parser [Device]
forall a. ([ByteString] -> Either String a) -> Parser a
liftParser [ByteString] -> Either String [Device]
parseOutputs) [String
"outputs"]