--------------------------------------------------------------------------------
-- |
-- Module    : Sound.ALSA.Sequencer.Client
-- Copyright : (c) Henning Thielemann, 2010
--             (c) Iavor S. Diatchki, 2007
-- License   : BSD3
--
-- Maintainer: Henning Thielemann
-- Stability : provisional
--
-- This module contains functions for working with sequencer clients.
-- Reference:
-- <http://www.alsa-project.org/alsa-doc/alsa-lib/group___seq_client.html>
--------------------------------------------------------------------------------

module Sound.ALSA.Sequencer.Client
  ( Client.T(Client.Cons)
  , Client.unknown
  , Client.system
  , Client.subscribers
  , Client.broadcast

  , getId
  , setName

  , Client.Type(..)
  ) where

import qualified Sound.ALSA.Sequencer.Client.InfoMonad as ClientInfo

import qualified Sound.ALSA.Sequencer.Marshal.Client as Client
import qualified Sound.ALSA.Sequencer.Marshal.Sequencer as Seq


-- XXX: Still missing the pool interface.

-- Convinience functions -------------------------------------------------------
-- These are part of the "middle" interface, but it seems simple to
-- define them directly in Haskell.

-- | Get the client identifier for the sequencer.
-- A convinience function.
getId :: Seq.T mode -> IO Client.T
getId :: forall mode. T mode -> IO T
getId T mode
h = forall mode a. T mode -> T a -> IO a
ClientInfo.get T mode
h T T
ClientInfo.getClient

-- cf. int snd_seq_client_id(snd_seq_t *handle);

-- | Set the name for the sequencer client.
-- A convinience function.
setName :: Seq.T mode -> String -> IO ()
setName :: forall mode. T mode -> String -> IO ()
setName T mode
h String
s = forall mode a. T mode -> T a -> IO a
ClientInfo.modify T mode
h forall a b. (a -> b) -> a -> b
$ String -> T ()
ClientInfo.setName String
s