-- GENERATED by C->Haskell Compiler, version 0.20.1 The shapeless maps, 31 Oct 2014 (Haskell)
-- Edit the ORIGNAL .chs file instead!


{-# LINE 1 "./Sound/ProteaAudio.chs" #-}
{-#LANGUAGE ForeignFunctionInterface#-}

module Sound.ProteaAudio (
    initAudio,
    finishAudio,
    loaderAvailable,
    volume,
    sampleFromFile,
    soundActive,
    soundStopAll,
    soundLoop,
    soundPlay,
    soundUpdate,
    soundStop,
    Sample()
 ) where

import Foreign
import Foreign.C

newtype Sample = Sample (CInt)
{-# LINE 21 "./Sound/ProteaAudio.chs" #-}


toSample s = Sample s
fromSample (Sample s) = s

initAudio :: (Int) -> (Int) -> (Int) -> IO ((Bool))
initAudio a1 a2 a3 =
  let {a1' = fromIntegral a1} in 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  initAudio'_ a1' a2' a3' >>= \res ->
  let {res' = toBool res} in
  return (res')

{-# LINE 26 "./Sound/ProteaAudio.chs" #-}

finishAudio :: IO ()
finishAudio =
  finishAudio'_ >>
  return ()

{-# LINE 27 "./Sound/ProteaAudio.chs" #-}

loaderAvailable :: (String) -> IO ((Bool))
loaderAvailable a1 =
  withCString a1 $ \a1' -> 
  loaderAvailable'_ a1' >>= \res ->
  let {res' = toBool res} in
  return (res')

{-# LINE 28 "./Sound/ProteaAudio.chs" #-}

sampleFromFile :: (String) -> (Float) -> IO ((Sample))
sampleFromFile a1 a2 =
  withCString a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  sampleFromFile'_ a1' a2' >>= \res ->
  let {res' = toSample res} in
  return (res')

{-# LINE 29 "./Sound/ProteaAudio.chs" #-}

volume :: (Float) -> (Float) -> IO ()
volume a1 a2 =
  let {a1' = realToFrac a1} in 
  let {a2' = realToFrac a2} in 
  volume'_ a1' a2' >>
  return ()

{-# LINE 30 "./Sound/ProteaAudio.chs" #-}

soundActive :: IO ((Int))
soundActive =
  soundActive'_ >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 31 "./Sound/ProteaAudio.chs" #-}

soundStopAll :: IO ()
soundStopAll =
  soundStopAll'_ >>
  return ()

{-# LINE 32 "./Sound/ProteaAudio.chs" #-}


soundLoop :: (Sample) -> (Float) -> (Float) -> (Float) -> (Float) -> IO ()
soundLoop a1 a2 a3 a4 a5 =
  let {a1' = fromSample a1} in 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  let {a4' = realToFrac a4} in 
  let {a5' = realToFrac a5} in 
  soundLoop'_ a1' a2' a3' a4' a5' >>
  return ()

{-# LINE 34 "./Sound/ProteaAudio.chs" #-}

soundPlay :: (Sample) -> (Float) -> (Float) -> (Float) -> (Float) -> IO ()
soundPlay a1 a2 a3 a4 a5 =
  let {a1' = fromSample a1} in 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  let {a4' = realToFrac a4} in 
  let {a5' = realToFrac a5} in 
  soundPlay'_ a1' a2' a3' a4' a5' >>
  return ()

{-# LINE 35 "./Sound/ProteaAudio.chs" #-}

soundUpdate :: (Sample) -> (Float) -> (Float) -> (Float) -> (Float) -> IO ((Bool))
soundUpdate a1 a2 a3 a4 a5 =
  let {a1' = fromSample a1} in 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  let {a4' = realToFrac a4} in 
  let {a5' = realToFrac a5} in 
  soundUpdate'_ a1' a2' a3' a4' a5' >>= \res ->
  let {res' = toBool res} in
  return (res')

{-# LINE 36 "./Sound/ProteaAudio.chs" #-}

soundStop :: (Sample) -> IO ((Bool))
soundStop a1 =
  let {a1' = fromSample a1} in 
  soundStop'_ a1' >>= \res ->
  let {res' = toBool res} in
  return (res')

{-# LINE 37 "./Sound/ProteaAudio.chs" #-}


foreign import ccall safe "Sound/ProteaAudio.chs.h initAudio"
  initAudio'_ :: (CInt -> (CInt -> (CInt -> (IO CInt))))

foreign import ccall safe "Sound/ProteaAudio.chs.h finishAudio"
  finishAudio'_ :: (IO ())

foreign import ccall safe "Sound/ProteaAudio.chs.h loaderAvailable"
  loaderAvailable'_ :: ((Ptr CChar) -> (IO CInt))

foreign import ccall safe "Sound/ProteaAudio.chs.h sampleFromFile"
  sampleFromFile'_ :: ((Ptr CChar) -> (CFloat -> (IO CInt)))

foreign import ccall safe "Sound/ProteaAudio.chs.h volume"
  volume'_ :: (CFloat -> (CFloat -> (IO ())))

foreign import ccall safe "Sound/ProteaAudio.chs.h soundActive"
  soundActive'_ :: (IO CInt)

foreign import ccall safe "Sound/ProteaAudio.chs.h soundStopAll"
  soundStopAll'_ :: (IO ())

foreign import ccall safe "Sound/ProteaAudio.chs.h soundLoop"
  soundLoop'_ :: (CInt -> (CFloat -> (CFloat -> (CFloat -> (CFloat -> (IO ()))))))

foreign import ccall safe "Sound/ProteaAudio.chs.h soundPlay"
  soundPlay'_ :: (CInt -> (CFloat -> (CFloat -> (CFloat -> (CFloat -> (IO ()))))))

foreign import ccall safe "Sound/ProteaAudio.chs.h soundUpdate"
  soundUpdate'_ :: (CInt -> (CFloat -> (CFloat -> (CFloat -> (CFloat -> (IO CInt))))))

foreign import ccall safe "Sound/ProteaAudio.chs.h soundStop"
  soundStop'_ :: (CInt -> (IO CInt))