module Sound.Alsa.Sequencer.Sequencer where
import Foreign.C.Types(CInt,CSize)
import Foreign.C.String(CString,withCAString,peekCString)
import Foreign.Ptr(Ptr)
import Foreign.Marshal.Alloc(alloca)
import Foreign.Storable
import Data.Word
import Sound.Alsa.Sequencer.Marshal
import Sound.Alsa.Sequencer.Errors
open
:: String
-> OpenMode
-> BlockMode
-> IO SndSeq
open t om bm = alloca $ \p -> withCAString t $ \s ->
do check_error_ =<< snd_seq_open p s (exp_OpenMode om) (exp_BlockMode bm)
SndSeq `fmap` peek p
foreign import ccall "alsa/asoundlib.h snd_seq_open"
snd_seq_open :: Ptr (Ptr SndSeq_) -> CString -> CInt -> CInt -> IO CInt
close
:: SndSeq
-> IO ()
close (SndSeq s) = check_error_ =<< snd_seq_close s
foreign import ccall "alsa/asoundlib.h snd_seq_close"
snd_seq_close :: Ptr SndSeq_ -> IO CInt
get_seq_name
:: SndSeq
-> IO String
get_seq_name (SndSeq h) = peekCString =<< snd_seq_name h
foreign import ccall "alsa/asoundlib.h snd_seq_name"
snd_seq_name :: Ptr SndSeq_ -> IO CString
set_blocking
:: SndSeq
-> BlockMode
-> IO ()
set_blocking (SndSeq h) m = check_error_ =<< snd_seq_nonblock h(exp_BlockMode m)
foreign import ccall "alsa/asoundlib.h snd_seq_nonblock"
snd_seq_nonblock :: Ptr SndSeq_ -> CInt -> IO CInt
get_output_buffer_size
:: SndSeq
-> IO Word
get_output_buffer_size (SndSeq h) =
fromIntegral `fmap` snd_seq_get_output_buffer_size h
foreign import ccall "alsa/asoundlib.h snd_seq_get_output_buffer_size"
snd_seq_get_output_buffer_size :: Ptr SndSeq_ -> IO CSize
set_output_buffer_size
:: SndSeq
-> Word
-> IO ()
set_output_buffer_size (SndSeq h) x =
check_error_ =<< snd_seq_set_output_buffer_size h (fromIntegral x)
foreign import ccall "alsa/asoundlib.h snd_seq_set_output_buffer_size"
snd_seq_set_output_buffer_size :: Ptr SndSeq_ -> CSize -> IO CInt
get_input_buffer_size
:: SndSeq
-> IO Word
get_input_buffer_size (SndSeq h) =
fromIntegral `fmap` snd_seq_get_input_buffer_size h
foreign import ccall "alsa/asoundlib.h snd_seq_get_input_buffer_size"
snd_seq_get_input_buffer_size :: Ptr SndSeq_ -> IO CSize
set_input_buffer_size
:: SndSeq
-> Word
-> IO ()
set_input_buffer_size (SndSeq h) x =
check_error_ =<< snd_seq_set_input_buffer_size h (fromIntegral x)
foreign import ccall "alsa/asoundlib.h snd_seq_set_input_buffer_size"
snd_seq_set_input_buffer_size :: Ptr SndSeq_ -> CSize -> IO CInt
set_pool_output
:: SndSeq
-> Word
-> IO ()
set_pool_output (SndSeq h) x =
check_error_ =<< snd_seq_set_client_pool_output h (fromIntegral x)
foreign import ccall "alsa/asoundlib.h snd_seq_set_client_pool_output"
snd_seq_set_client_pool_output :: Ptr SndSeq_ -> CSize -> IO CInt
set_pool_output_room
:: SndSeq
-> Word
-> IO ()
set_pool_output_room (SndSeq h) x =
check_error_ =<< snd_seq_set_client_pool_output_room h (fromIntegral x)
foreign import ccall "alsa/asoundlib.h snd_seq_set_client_pool_output_room"
snd_seq_set_client_pool_output_room :: Ptr SndSeq_ -> CSize -> IO CInt
reset_pool_output
:: SndSeq
-> IO ()
reset_pool_output (SndSeq h) =
check_error_ =<< snd_seq_reset_pool_output h
foreign import ccall "alsa/asoundlib.h snd_seq_reset_pool_output"
snd_seq_reset_pool_output :: Ptr SndSeq_ -> IO CInt
set_pool_input
:: SndSeq
-> Word
-> IO ()
set_pool_input (SndSeq h) x =
check_error_ =<< snd_seq_set_client_pool_input h (fromIntegral x)
foreign import ccall "alsa/asoundlib.h snd_seq_set_client_pool_input"
snd_seq_set_client_pool_input :: Ptr SndSeq_ -> CSize -> IO CInt
reset_pool_input
:: SndSeq
-> IO ()
reset_pool_input (SndSeq h) =
check_error_ =<< snd_seq_reset_pool_input h
foreign import ccall "alsa/asoundlib.h snd_seq_reset_pool_input"
snd_seq_reset_pool_input :: Ptr SndSeq_ -> IO CInt
connect_from :: SndSeq -> Port -> Addr -> IO ()
connect_from (SndSeq h) me a =
check_error_ =<< snd_seq_connect_from h (exp_Port me) c p
where (c,p) = exp_Addr a
foreign import ccall "alsa/asoundlib.h snd_seq_connect_from"
snd_seq_connect_from :: Ptr SndSeq_ -> CInt -> CInt -> CInt -> IO CInt
connect_to :: SndSeq -> Port -> Addr -> IO ()
connect_to (SndSeq h) me a =
check_error_ =<< snd_seq_connect_to h (exp_Port me) c p
where (c,p) = exp_Addr a
foreign import ccall "alsa/asoundlib.h snd_seq_connect_to"
snd_seq_connect_to :: Ptr SndSeq_ -> CInt -> CInt -> CInt -> IO CInt
disconnect_from :: SndSeq -> Port -> Addr -> IO ()
disconnect_from (SndSeq h) me a =
check_error_ =<< snd_seq_disconnect_from h (exp_Port me) c p
where (c,p) = exp_Addr a
foreign import ccall "alsa/asoundlib.h snd_seq_disconnect_from"
snd_seq_disconnect_from :: Ptr SndSeq_ -> CInt -> CInt -> CInt -> IO CInt
disconnect_to :: SndSeq -> Port -> Addr -> IO ()
disconnect_to (SndSeq h) me a =
check_error_ =<< snd_seq_disconnect_to h (exp_Port me) c p
where (c,p) = exp_Addr a
foreign import ccall "alsa/asoundlib.h snd_seq_disconnect_to"
snd_seq_disconnect_to :: Ptr SndSeq_ -> CInt -> CInt -> CInt -> IO CInt
parse_address
:: SndSeq
-> String
-> IO Addr
parse_address (SndSeq h) s =
alloca $ \pa ->
withCAString s $ \ps ->
do check_error =<< snd_seq_parse_address h pa ps
peek pa
foreign import ccall "alsa/asoundlib.h snd_seq_parse_address"
snd_seq_parse_address :: Ptr SndSeq_ -> Ptr Addr -> CString -> IO CInt