alsa-mixer 0.2.0.3 → 0.3.0
raw patch · 4 files changed
+42/−41 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Sound.ALSA.Mixer: data CLong
+ Sound.ALSA.Mixer: data CUInt
- Sound.ALSA.Mixer: Control :: Integer -> String -> Either Switch (Maybe Switch, Maybe Switch) -> Either Volume (Maybe Volume, Maybe Volume) -> Control
+ Sound.ALSA.Mixer: Control :: CUInt -> String -> Either Switch (Maybe Switch, Maybe Switch) -> Either Volume (Maybe Volume, Maybe Volume) -> Control
- Sound.ALSA.Mixer: Volume :: IO (Integer, Integer) -> ((Integer, Integer) -> IO ()) -> IO (Integer, Integer) -> PerChannel Integer -> PerChannel Integer -> Volume
+ Sound.ALSA.Mixer: Volume :: IO (CLong, CLong) -> ((CLong, CLong) -> IO ()) -> IO (CLong, CLong) -> PerChannel CLong -> PerChannel CLong -> Volume
- Sound.ALSA.Mixer: [dB] :: Volume -> PerChannel Integer
+ Sound.ALSA.Mixer: [dB] :: Volume -> PerChannel CLong
- Sound.ALSA.Mixer: [getRangeDb] :: Volume -> IO (Integer, Integer)
+ Sound.ALSA.Mixer: [getRangeDb] :: Volume -> IO (CLong, CLong)
- Sound.ALSA.Mixer: [getRange] :: Volume -> IO (Integer, Integer)
+ Sound.ALSA.Mixer: [getRange] :: Volume -> IO (CLong, CLong)
- Sound.ALSA.Mixer: [index] :: Control -> Integer
+ Sound.ALSA.Mixer: [index] :: Control -> CUInt
- Sound.ALSA.Mixer: [setRange] :: Volume -> (Integer, Integer) -> IO ()
+ Sound.ALSA.Mixer: [setRange] :: Volume -> (CLong, CLong) -> IO ()
- Sound.ALSA.Mixer: [value] :: Volume -> PerChannel Integer
+ Sound.ALSA.Mixer: [value] :: Volume -> PerChannel CLong
Files
- Sound/ALSA/Mixer.hs +10/−7
- Sound/ALSA/Mixer/Internal.chs +25/−30
- alsa-mixer.cabal +4/−4
- changelog +3/−0
Sound/ALSA/Mixer.hs view
@@ -23,6 +23,8 @@ , PerChannel(..) , Volume(..) , Switch()+ , CUInt+ , CLong -- * Functions -- ** Mixers , controls@@ -51,6 +53,7 @@ import Control.Monad ( forM, liftM, when ) import Data.Maybe ( catMaybes ) import Foreign.C.Error ( Errno(..) )+import Foreign.C.Types import Sound.ALSA.Exception ( catchErrno ) import Sound.ALSA.Mixer.Internal @@ -59,7 +62,7 @@ -- 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 { index :: Integer+data Control = Control { index :: CUInt , name :: String , switch :: Either Switch (Maybe Switch, Maybe Switch) , volume :: Either Volume (Maybe Volume, Maybe Volume)@@ -97,16 +100,16 @@ -- | 'Volume' represents a volume capability. There may be a separate value per -- channel, but each capability has only one range.-data Volume = Volume { getRange :: IO (Integer, Integer)+data Volume = Volume { getRange :: IO (CLong, CLong) -- ^ Returns the minimum and maximum volumes (unitless).- , setRange :: (Integer, Integer) -> IO ()+ , setRange :: (CLong, CLong) -> IO () -- ^ Sets the minimum and maximum volumes (unitless).- , getRangeDb :: IO (Integer, Integer)+ , getRangeDb :: IO (CLong, CLong) -- ^ Returns the minimum and maximum volumes in -- hundredths of a decibel.- , value :: PerChannel Integer+ , value :: PerChannel CLong -- ^ Volume values for each channel.- , dB :: PerChannel Integer+ , dB :: PerChannel CLong -- ^ Volume values for each channel in hundredths of -- a decibel. }@@ -292,7 +295,7 @@ 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 :: Integer -> IO ()+> changeVolumeBy :: CLong -> IO () > changeVolumeBy i = > withMixer "default" $ \mixer -> > do Just control <- getControlByName mixer "Master"
Sound/ALSA/Mixer/Internal.chs view
@@ -204,7 +204,7 @@ -- -------------------------------------------------------------------- {#fun snd_mixer_selem_id_get_index as getIndex- { withForeignPtr* `SimpleElementId' } -> `Integer' fromIntegral #}+ { withForeignPtr* `SimpleElementId' } -> `CUInt' #} ----------------------------------------------------------------------- -- getMixerByName@@ -237,11 +237,6 @@ channelToC = toEnum . fromEnum -cToIntegral = (>>= return . fromIntegral) . peek--cFromIntegral :: Integer -> (Ptr CLong -> IO a) -> IO a-cFromIntegral = with . fromIntegral- negOne f = f $! negate 1 -----------------------------------------------------------------------@@ -299,28 +294,28 @@ {#fun snd_mixer_selem_get_playback_volume as getPlaybackVolume { withSimpleElement* `SimpleElement' , channelToC `Channel'- , alloca- `Integer' cToIntegral* } -> `Int' checkGetPlaybackVolume*- #}+ , alloca- `CLong' peek* } -> `Int' checkGetPlaybackVolume*- #} checkGetPlaybackVolume = checkResult_ "snd_mixer_selem_get_playback_volume" {#fun snd_mixer_selem_get_capture_volume as getCaptureVolume { withSimpleElement* `SimpleElement' , channelToC `Channel'- , alloca- `Integer' cToIntegral* } -> `Int' checkGetCaptureVolume*- #}+ , alloca- `CLong' peek* } -> `Int' checkGetCaptureVolume*- #} checkGetCaptureVolume = checkResult_ "snd_mixer_selem_get_capture_volume" {#fun snd_mixer_selem_get_playback_dB as getPlaybackDb { withSimpleElement* `SimpleElement' , channelToC `Channel'- , alloca- `Integer' cToIntegral* } -> `Int' checkPlaybackDb*- #}+ , alloca- `CLong' peek* } -> `Int' checkPlaybackDb*- #} checkPlaybackDb = checkResult_ "snd_mixer_selem_get_playback_dB" {#fun snd_mixer_selem_get_capture_dB as getCaptureDb { withSimpleElement* `SimpleElement' , channelToC `Channel'- , alloca- `Integer' cToIntegral* } -> `Int' checkCaptureDb*- #}+ , alloca- `CLong' peek* } -> `Int' checkCaptureDb*- #} checkCaptureDb = checkResult_ "snd_mixer_selem_get_capture_dB" @@ -342,29 +337,29 @@ {#fun snd_mixer_selem_get_playback_volume_range as getPlaybackVolumeRange { withSimpleElement* `SimpleElement'- , alloca- `Integer' cToIntegral*- , alloca- `Integer' cToIntegral* } -> `Int' checkGetPlaybackVolumeRange*- #}+ , alloca- `CLong' peek*+ , alloca- `CLong' peek* } -> `Int' checkGetPlaybackVolumeRange*- #} checkGetPlaybackVolumeRange = checkResult_ "snd_mixer_selem_get_playback_volume_range" {#fun snd_mixer_selem_get_capture_volume_range as getCaptureVolumeRange { withSimpleElement* `SimpleElement'- , alloca- `Integer' cToIntegral*- , alloca- `Integer' cToIntegral* } -> `Int' checkGetCaptureVolumeRange*- #}+ , alloca- `CLong' peek*+ , alloca- `CLong' peek* } -> `Int' checkGetCaptureVolumeRange*- #} checkGetCaptureVolumeRange = checkResult_ "snd_mixer_selem_get_capture_volume_range" {#fun snd_mixer_selem_get_playback_dB_range as getPlaybackDbRange { withSimpleElement* `SimpleElement'- , alloca- `Integer' cToIntegral*- , alloca- `Integer' cToIntegral* } -> `Int' checkGetPlaybackDbRange*- #}+ , alloca- `CLong' peek*+ , alloca- `CLong' peek* } -> `Int' checkGetPlaybackDbRange*- #} checkGetPlaybackDbRange = checkResult_ "snd_mixer_selem_get_playback_dB_range" {#fun snd_mixer_selem_get_capture_dB_range as getCaptureDbRange { withSimpleElement* `SimpleElement'- , alloca- `Integer' cToIntegral*- , alloca- `Integer' cToIntegral* } -> `Int' checkGetCaptureDbRange*- #}+ , alloca- `CLong' peek*+ , alloca- `CLong' peek* } -> `Int' checkGetCaptureDbRange*- #} checkGetCaptureDbRange = checkResult_ "snd_mixer_selem_get_capture_dB_range" @@ -375,21 +370,21 @@ {#fun snd_mixer_selem_set_playback_volume as setPlaybackVolume { withSimpleElement* `SimpleElement' , channelToC `Channel'- , fromIntegral `Integer' } -> `Int' checkSetPlaybackVolume*- #}+ , `CLong' } -> `Int' checkSetPlaybackVolume*- #} checkSetPlaybackVolume = checkResult_ "snd_mixer_selem_set_playback_volume" {#fun snd_mixer_selem_set_capture_volume as setCaptureVolume { withSimpleElement* `SimpleElement' , channelToC `Channel'- , fromIntegral `Integer' } -> `Int' checkSetCaptureVolume*- #}+ , `CLong' } -> `Int' checkSetCaptureVolume*- #} checkSetCaptureVolume = checkResult_ "snd_mixer_selem_set_capture_volume" {#fun snd_mixer_selem_set_playback_dB as setPlaybackDb { withSimpleElement* `SimpleElement' , channelToC `Channel'- , fromIntegral `Integer'+ , `CLong' , negOne- `Int' } -> `Int' checkSetPlaybackDb*- #} checkSetPlaybackDb = checkResult_ "snd_mixer_selem_set_playback_dB"@@ -397,33 +392,33 @@ {#fun snd_mixer_selem_set_capture_dB as setCaptureDb { withSimpleElement* `SimpleElement' , channelToC `Channel'- , fromIntegral `Integer'+ , `CLong' , negOne- `Int' } -> `Int' checkSetCaptureDb*- #} checkSetCaptureDb = checkResult_ "snd_mixer_selem_set_capture_dB" {#fun snd_mixer_selem_set_playback_volume_all as setPlaybackVolumeAll { withSimpleElement* `SimpleElement'- , fromIntegral `Integer' } -> `Int' checkSetPlaybackVolumeAll*- #}+ , `CLong' } -> `Int' checkSetPlaybackVolumeAll*- #} checkSetPlaybackVolumeAll = checkResult_ "snd_mixer_selem_set_playback_volume_all" {#fun snd_mixer_selem_set_capture_volume_all as setCaptureVolumeAll { withSimpleElement* `SimpleElement'- , fromIntegral `Integer' } -> `Int' checkSetCaptureVolumeAll*- #}+ , `CLong' } -> `Int' checkSetCaptureVolumeAll*- #} checkSetCaptureVolumeAll = checkResult_ "snd_mixer_selem_set_capture_volume_all" {#fun snd_mixer_selem_set_playback_dB_all as setPlaybackDbAll { withSimpleElement* `SimpleElement'- , fromIntegral `Integer'+ , `CLong' , negOne- `Int' } -> `Int' checkSetPlaybackDbAll*- #} checkSetPlaybackDbAll = checkResult_ "snd_mixer_selem_set_playback_dB_all" {#fun snd_mixer_selem_set_capture_dB_all as setCaptureDbAll { withSimpleElement* `SimpleElement'- , fromIntegral `Integer'+ , `CLong' , negOne- `Int' } -> `Int' checkSetCaptureDbAll*- #} checkSetCaptureDbAll = checkResult_ "snd_mixer_selem_set_capture_dB_all"@@ -456,15 +451,15 @@ {#fun snd_mixer_selem_set_playback_volume_range as setPlaybackVolumeRange' { withSimpleElement* `SimpleElement'- , fromIntegral `Integer'- , fromIntegral `Integer' } -> `Int' checkSetPlaybackVolumeRange*- #}+ , `CLong'+ , `CLong' } -> `Int' checkSetPlaybackVolumeRange*- #} checkSetPlaybackVolumeRange = checkResult_ "snd_mixer_selem_set_playback_volume_range" {#fun snd_mixer_selem_set_capture_volume_range as setCaptureVolumeRange' { withSimpleElement* `SimpleElement'- , fromIntegral `Integer'- , fromIntegral `Integer' } -> `Int' checkSetCaptureVolumeRange*- #}+ , `CLong'+ , `CLong' } -> `Int' checkSetCaptureVolumeRange*- #} checkSetCaptureVolumeRange = checkResult_ "snd_mixer_selem_set_capture_volume_range"
alsa-mixer.cabal view
@@ -1,12 +1,12 @@ Name: alsa-mixer-Version: 0.2.0.3+Version: 0.3.0 Synopsis: Bindings to the ALSA simple mixer API. Description: This package provides bindings to the ALSA simple mixer API. License: BSD3 License-file: LICENSE-Author: Thomas Tuegel <ttuegel@gmail.com>-Maintainer: Thomas Tuegel <ttuegel@gmail.com>-Copyright: Thomas Tuegel+Author: Thomas Tuegel <ttuegel@mailbox.org>+Maintainer: Thomas Tuegel <ttuegel@mailbox.org>+Copyright: 2014-2018 Thomas Tuegel Category: Sound Build-type: Simple Cabal-version: >=1.6
changelog view
@@ -1,3 +1,6 @@+0.3.0 Thomas Tuegel <ttuegel@mailbox.org> 2018-12-09+ * Use C types in exported interface (#6)+ 0.2.0.3 Thomas Tuegel <ttuegel@gmail.com> 2016-01-06 * Use capture channel to get capture volume (#4)