HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

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

Types

8 declarations
datadata Volume
#

Volume represents a volume capability. There may be a separate value per channel, but each capability has only one range.

Constructors

newtypenewtype CUInt
#

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.Types
  • Enum CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Eq CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Integral CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Num CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Ord CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Read CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Real CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Show CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Ix CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Bits CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • FiniteBits CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • NFData CUIntDefined in deepseq-1.5.0.0 · Control.DeepSeq
newtypenewtype CLong
#

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.Types
  • Enum CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Eq CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Integral CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Num CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Ord CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Read CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Real CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Show CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Ix CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Bits CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • FiniteBits CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • NFData CLongDefined in deepseq-1.5.0.0 · Control.DeepSeq

Functions

0 declarations

Mixers

valuewithMixer :: String -> (Mixer -> IO a) -> IO a
#

Perform an IO action with the named mixer. An exception of type T will be thrown if the named mixer cannot be found. A mixer named "default" should always exist.

Controls

valuecommon :: 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 common capability if it exists.

valueplayback :: 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.

valuecapture :: 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.

PerChannels

Examples

0 declarations

Getting 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 + i

Getting 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