-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Bindings to the ALSA simple mixer API.
--   
--   This package provides bindings to the ALSA simple mixer API.
@package alsa-mixer
@version 0.3.0.1


-- | This library provides bindings to the Advanced Linux Sound
--   Architecture (ALSA) library API. The portability of this library is
--   limited to systems with ALSA (i.e., Linux systems). The functions in
--   this library throw errors of type <a>T</a> on failure.
module Sound.ALSA.Mixer

-- | <a>Control</a> represents one of the controls belonging to an ALSA
--   mixer element. Each control has a number of playback and capture
--   channels. The control may also have a switch and/or a volume
--   capability associated with it. The capability can be common to both
--   playback and capture, or there can be separate capabilities for each.
data Control
Control :: CUInt -> String -> Either Switch (Maybe Switch, Maybe Switch) -> Either Volume (Maybe Volume, Maybe Volume) -> Control
[index] :: Control -> CUInt
[name] :: Control -> String
[switch] :: Control -> Either Switch (Maybe Switch, Maybe Switch)
[volume] :: Control -> Either Volume (Maybe Volume, Maybe Volume)
data Mixer
data Channel
Unknown :: Channel
FrontLeft :: Channel
SND_MIXER_SCHN_MONO :: Channel
FrontRight :: Channel
RearLeft :: Channel
RearRight :: Channel
FrontCenter :: Channel
Woofer :: Channel
SideLeft :: Channel
SideRight :: Channel
RearCenter :: Channel
Last :: Channel

-- | <a>PerChannel</a> represents a capability that with either a separate
--   value for each channel or with a common value for all channels.
data PerChannel e
Joined :: IO e -> (e -> IO ()) -> [Channel] -> PerChannel e
[getJoined] :: PerChannel e -> IO e
[setJoined] :: PerChannel e -> e -> IO ()
[joinedChannels] :: PerChannel e -> [Channel]
PerChannel :: IO [(Channel, e)] -> ([(Channel, e)] -> IO ()) -> [Channel] -> PerChannel e
[getPerChannel] :: PerChannel e -> IO [(Channel, e)]
[setPerChannel] :: PerChannel e -> [(Channel, e)] -> IO ()
[perChannels] :: PerChannel e -> [Channel]

-- | <a>Volume</a> represents a volume capability. There may be a separate
--   value per channel, but each capability has only one range.
data Volume
Volume :: IO (CLong, CLong) -> ((CLong, CLong) -> IO ()) -> IO (CLong, CLong) -> PerChannel CLong -> PerChannel CLong -> Volume

-- | Returns the minimum and maximum volumes (unitless).
[getRange] :: Volume -> IO (CLong, CLong)

-- | Sets the minimum and maximum volumes (unitless).
[setRange] :: Volume -> (CLong, CLong) -> IO ()

-- | Returns the minimum and maximum volumes in hundredths of a decibel.
[getRangeDb] :: Volume -> IO (CLong, CLong)

-- | Volume values for each channel.
[value] :: Volume -> PerChannel CLong

-- | Volume values for each channel in hundredths of a decibel.
[dB] :: Volume -> PerChannel CLong

-- | <a>Switch</a> represents a switch capability for controls and channels
--   that can be muted and unmuted.
type Switch = PerChannel Bool

-- | Haskell type representing the C <tt>unsigned int</tt> type. <i>(The
--   concrete types of <a>Foreign.C.Types#platform</a> are
--   platform-specific.)</i>
data () => CUInt

-- | Haskell type representing the C <tt>long</tt> type. <i>(The concrete
--   types of <a>Foreign.C.Types#platform</a> are platform-specific.)</i>
data () => CLong

-- | All the <a>Control</a> objects associated with a particular
--   <a>Mixer</a>.
controls :: Mixer -> IO [Control]

-- | Perform an <a>IO</a> action with the named mixer. An exception of type
--   <a>T</a> will be thrown if the named mixer cannot be found. A mixer
--   named "default" should always exist.
withMixer :: String -> (Mixer -> IO a) -> IO a

-- | Get the named <a>Control</a>, if it exists, from the named
--   <a>Mixer</a>.
getControlByName :: Mixer -> String -> IO (Maybe Control)

-- | For a given capability, which may be for either playback or capture,
--   or common to both, return the common capability if it exists.
common :: Either a (Maybe a, Maybe a) -> Maybe a

-- | For a given capability, which may be for either playback or capture,
--   or common to both, return the playback capability if it exists.
playback :: Either a (Maybe a, Maybe a) -> Maybe a

-- | For a given capability, which may be for either playback or capture,
--   or common to both, return the capture capability if it exists.
capture :: Either a (Maybe a, Maybe a) -> Maybe a

-- | All channels supported by a <a>PerChannel</a> object.
channels :: PerChannel e -> [Channel]
allChannels :: [Channel]

-- | True if the <a>PerChannel</a> object has a common value for all
--   channels.
joined :: PerChannel e -> Bool

-- | True if the <a>PerChannel</a> object has a separate value for each
--   channel.
perChannel :: PerChannel e -> Bool

-- | Get the value associated with a particular channel, if that channel
--   exists.
getChannel :: Channel -> PerChannel x -> IO (Maybe x)

-- | Set the value associated with a particular channel, if that channel
--   exists.
setChannel :: Channel -> PerChannel x -> x -> IO ()
