Control 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.
Modulealsa-mixer-0.3.0.1Haskell2010
Sound.ALSA.Mixer
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 T on failure.
- 8 types
- 12 values
- Packagealsa-mixer-0.3.0.1
- Exports20
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceMixer.hs
Types
8 declarationsInstances4Enum, Eq, Read, Show
PerChannel represents a capability that with either a separate value for each channel or with a common value for all channels.
Constructors
JoinedPerChannelgetPerChannel :: IO [(Channel, e)]setPerChannel :: [(Channel, e)] -> IO ()perChannels :: [Channel]
Volume represents a volume capability. There may be a separate value per channel, but each capability has only one range.
Constructors
VolumegetRange :: IO (CLong, CLong)Returns the minimum and maximum volumes (unitless).
setRange :: (CLong, CLong) -> IO ()Sets the minimum and maximum volumes (unitless).
getRangeDb :: IO (CLong, CLong)Returns the minimum and maximum volumes in hundredths of a decibel.
value :: PerChannel CLongVolume values for each channel.
dB :: PerChannel CLongVolume values for each channel in hundredths of a decibel.
Switch represents a switch capability for controls and channels that can be muted and unmuted.
Haskell type representing the C unsigned int type.
(The concrete types of Foreign.C.Types#platform are platform-specific.)
Instances14Bounded, Enum, Eq, Integral, Num, Ord, …
Bounded CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIntegral CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesOrd CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIx CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesBits CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesFiniteBits CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesStorable CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNFData CUIntDefined in deepseq-1.5.0.0 · Control.DeepSeq
Haskell type representing the C long type.
(The concrete types of Foreign.C.Types#platform are platform-specific.)
Instances14Bounded, Enum, Eq, Integral, Num, Ord, …
Bounded CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEnum CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesEq CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIntegral CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNum CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesOrd CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesRead CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesReal CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesShow CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesIx CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesBits CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesFiniteBits CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesStorable CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.TypesNFData CLongDefined in deepseq-1.5.0.0 · Control.DeepSeq
Functions
0 declarationsMixers
Controls
For a given capability, which may be for either playback or capture, or common to both, return the common capability if it exists.
For a given capability, which may be for either playback or capture, or common to both, return the playback capability if it exists.
For a given capability, which may be for either playback or capture, or common to both, return the capture capability if it exists.
PerChannels
All channels supported by a PerChannel object.
True if the PerChannel object has a common value for all channels.
True if the PerChannel object has a separate value for each channel.
Get the value associated with a particular channel, if that channel exists.
Set the value associated with a particular channel, if that channel exists.
Examples
0 declarationsGetting and setting the volume of a Control
This example demonstrates the method of accessing the volume of a Control. The example function reads the volume and increases it by the value supplied.
changeVolumeBy :: CLong -> IO ()
changeVolumeBy i =
withMixer "default" $ \mixer ->
do Just control <- getControlByName mixer "Master"
let Just playbackVolume = playback $ volume control
(min, max) <- getRange playbackVolume
Just vol <- getChannel FrontLeft $ value $ playbackVolume
when ((i > 0 && vol < max) || (i < 0 && vol > min))
$ setChannel FrontLeft (value $ playbackVolume) $ vol + iGetting and setting the switch of a Control
This example demonstrates the method of accessing the switch of a Control. The example function reads the value of the switch and toggles it.
toggleMute :: IO ()
toggleMute =
withMixer "default" $ \mixer ->
do Just control <- getControlByName mixer "Master"
let Just playbackSwitch = playback $ switch control
Just sw <- getChannel FrontLeft playbackSwitch
setChannel FrontLeft playbackSwitch $ not sw