{-# LINE 1 "Bindings/Sound/SC3.hsc" #-}

{-# LINE 2 "Bindings/Sound/SC3.hsc" #-}

{-# LINE 3 "Bindings/Sound/SC3.hsc" #-}

module Bindings.Sound.SC3 where

import Foreign.Ptr (Ptr,FunPtr,plusPtr)
import Foreign.Ptr (wordPtrToPtr,castPtrToFunPtr)
import Foreign.Storable
import Foreign.C.Types
import Foreign.C.String (CString,CStringLen,CWString,CWStringLen)
import Foreign.Marshal.Alloc (alloca)
import Foreign.Marshal.Array (peekArray,pokeArray)
import Data.Int
import Data.Word

{-# LINE 7 "Bindings/Sound/SC3.hsc" #-}

-- | Synthesis engine handle.
data C'World = C'World

{-# LINE 10 "Bindings/Sound/SC3.hsc" #-}

-- | Synthesis engine options.

{-# LINE 13 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 14 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 15 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 16 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 17 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 18 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 19 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 20 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 21 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 22 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 23 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 24 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 25 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 26 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 27 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 28 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 29 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 30 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 31 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 32 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 33 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 34 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 35 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 36 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 37 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 38 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 39 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 40 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 41 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 42 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 43 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 44 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 45 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 46 "Bindings/Sound/SC3.hsc" #-}
	
{-# LINE 47 "Bindings/Sound/SC3.hsc" #-}
data C'WorldOptions = C'WorldOptions{
  c'WorldOptions'mPassword :: CString,
  c'WorldOptions'mNumBuffers :: CUInt,
  c'WorldOptions'mMaxLogins :: CUInt,
  c'WorldOptions'mMaxNodes :: CUInt,
  c'WorldOptions'mMaxGraphDefs :: CUInt,
  c'WorldOptions'mMaxWireBufs :: CUInt,
  c'WorldOptions'mNumAudioBusChannels :: CUInt,
  c'WorldOptions'mNumInputBusChannels :: CUInt,
  c'WorldOptions'mNumOutputBusChannels :: CUInt,
  c'WorldOptions'mNumControlBusChannels :: CUInt,
  c'WorldOptions'mBufLength :: CUInt,
  c'WorldOptions'mRealTimeMemorySize :: CUInt,
  c'WorldOptions'mNumSharedControls :: CInt,
  c'WorldOptions'mSharedControls :: Ptr CFloat,
  c'WorldOptions'mRealTime :: CInt,
  c'WorldOptions'mMemoryLocking :: CInt,
  c'WorldOptions'mNonRealTimeCmdFilename :: CString,
  c'WorldOptions'mNonRealTimeInputFilename :: CString,
  c'WorldOptions'mNonRealTimeOutputFilename :: CString,
  c'WorldOptions'mNonRealTimeOutputHeaderFormat :: CString,
  c'WorldOptions'mNonRealTimeOutputSampleFormat :: CString,
  c'WorldOptions'mPreferredSampleRate :: CUInt,
  c'WorldOptions'mNumRGens :: CUInt,
  c'WorldOptions'mPreferredHardwareBufferFrameSize :: CUInt,
  c'WorldOptions'mLoadGraphDefs :: CUInt,
  c'WorldOptions'mInputStreamsEnabled :: CString,
  c'WorldOptions'mOutputStreamsEnabled :: CString,
  c'WorldOptions'mInDeviceName :: CString,
  c'WorldOptions'mVerbosity :: CInt,
  c'WorldOptions'mRendezvous :: CInt,
  c'WorldOptions'mUGensPluginPath :: CString,
  c'WorldOptions'mOutDeviceName :: CString,
  c'WorldOptions'mRestrictedPath :: CString,
  c'WorldOptions'mSharedMemoryID :: CInt
} deriving (Eq,Show)
p'WorldOptions'mPassword p = plusPtr p 0
p'WorldOptions'mPassword :: Ptr (C'WorldOptions) -> Ptr (CString)
p'WorldOptions'mNumBuffers p = plusPtr p 8
p'WorldOptions'mNumBuffers :: Ptr (C'WorldOptions) -> Ptr (CUInt)
p'WorldOptions'mMaxLogins p = plusPtr p 12
p'WorldOptions'mMaxLogins :: Ptr (C'WorldOptions) -> Ptr (CUInt)
p'WorldOptions'mMaxNodes p = plusPtr p 16
p'WorldOptions'mMaxNodes :: Ptr (C'WorldOptions) -> Ptr (CUInt)
p'WorldOptions'mMaxGraphDefs p = plusPtr p 20
p'WorldOptions'mMaxGraphDefs :: Ptr (C'WorldOptions) -> Ptr (CUInt)
p'WorldOptions'mMaxWireBufs p = plusPtr p 24
p'WorldOptions'mMaxWireBufs :: Ptr (C'WorldOptions) -> Ptr (CUInt)
p'WorldOptions'mNumAudioBusChannels p = plusPtr p 28
p'WorldOptions'mNumAudioBusChannels :: Ptr (C'WorldOptions) -> Ptr (CUInt)
p'WorldOptions'mNumInputBusChannels p = plusPtr p 32
p'WorldOptions'mNumInputBusChannels :: Ptr (C'WorldOptions) -> Ptr (CUInt)
p'WorldOptions'mNumOutputBusChannels p = plusPtr p 36
p'WorldOptions'mNumOutputBusChannels :: Ptr (C'WorldOptions) -> Ptr (CUInt)
p'WorldOptions'mNumControlBusChannels p = plusPtr p 40
p'WorldOptions'mNumControlBusChannels :: Ptr (C'WorldOptions) -> Ptr (CUInt)
p'WorldOptions'mBufLength p = plusPtr p 44
p'WorldOptions'mBufLength :: Ptr (C'WorldOptions) -> Ptr (CUInt)
p'WorldOptions'mRealTimeMemorySize p = plusPtr p 48
p'WorldOptions'mRealTimeMemorySize :: Ptr (C'WorldOptions) -> Ptr (CUInt)
p'WorldOptions'mNumSharedControls p = plusPtr p 52
p'WorldOptions'mNumSharedControls :: Ptr (C'WorldOptions) -> Ptr (CInt)
p'WorldOptions'mSharedControls p = plusPtr p 56
p'WorldOptions'mSharedControls :: Ptr (C'WorldOptions) -> Ptr (Ptr CFloat)
p'WorldOptions'mRealTime p = plusPtr p 64
p'WorldOptions'mRealTime :: Ptr (C'WorldOptions) -> Ptr (CInt)
p'WorldOptions'mMemoryLocking p = plusPtr p 65
p'WorldOptions'mMemoryLocking :: Ptr (C'WorldOptions) -> Ptr (CInt)
p'WorldOptions'mNonRealTimeCmdFilename p = plusPtr p 72
p'WorldOptions'mNonRealTimeCmdFilename :: Ptr (C'WorldOptions) -> Ptr (CString)
p'WorldOptions'mNonRealTimeInputFilename p = plusPtr p 80
p'WorldOptions'mNonRealTimeInputFilename :: Ptr (C'WorldOptions) -> Ptr (CString)
p'WorldOptions'mNonRealTimeOutputFilename p = plusPtr p 88
p'WorldOptions'mNonRealTimeOutputFilename :: Ptr (C'WorldOptions) -> Ptr (CString)
p'WorldOptions'mNonRealTimeOutputHeaderFormat p = plusPtr p 96
p'WorldOptions'mNonRealTimeOutputHeaderFormat :: Ptr (C'WorldOptions) -> Ptr (CString)
p'WorldOptions'mNonRealTimeOutputSampleFormat p = plusPtr p 104
p'WorldOptions'mNonRealTimeOutputSampleFormat :: Ptr (C'WorldOptions) -> Ptr (CString)
p'WorldOptions'mPreferredSampleRate p = plusPtr p 112
p'WorldOptions'mPreferredSampleRate :: Ptr (C'WorldOptions) -> Ptr (CUInt)
p'WorldOptions'mNumRGens p = plusPtr p 116
p'WorldOptions'mNumRGens :: Ptr (C'WorldOptions) -> Ptr (CUInt)
p'WorldOptions'mPreferredHardwareBufferFrameSize p = plusPtr p 120
p'WorldOptions'mPreferredHardwareBufferFrameSize :: Ptr (C'WorldOptions) -> Ptr (CUInt)
p'WorldOptions'mLoadGraphDefs p = plusPtr p 124
p'WorldOptions'mLoadGraphDefs :: Ptr (C'WorldOptions) -> Ptr (CUInt)
p'WorldOptions'mInputStreamsEnabled p = plusPtr p 128
p'WorldOptions'mInputStreamsEnabled :: Ptr (C'WorldOptions) -> Ptr (CString)
p'WorldOptions'mOutputStreamsEnabled p = plusPtr p 136
p'WorldOptions'mOutputStreamsEnabled :: Ptr (C'WorldOptions) -> Ptr (CString)
p'WorldOptions'mInDeviceName p = plusPtr p 144
p'WorldOptions'mInDeviceName :: Ptr (C'WorldOptions) -> Ptr (CString)
p'WorldOptions'mVerbosity p = plusPtr p 152
p'WorldOptions'mVerbosity :: Ptr (C'WorldOptions) -> Ptr (CInt)
p'WorldOptions'mRendezvous p = plusPtr p 156
p'WorldOptions'mRendezvous :: Ptr (C'WorldOptions) -> Ptr (CInt)
p'WorldOptions'mUGensPluginPath p = plusPtr p 160
p'WorldOptions'mUGensPluginPath :: Ptr (C'WorldOptions) -> Ptr (CString)
p'WorldOptions'mOutDeviceName p = plusPtr p 168
p'WorldOptions'mOutDeviceName :: Ptr (C'WorldOptions) -> Ptr (CString)
p'WorldOptions'mRestrictedPath p = plusPtr p 176
p'WorldOptions'mRestrictedPath :: Ptr (C'WorldOptions) -> Ptr (CString)
p'WorldOptions'mSharedMemoryID p = plusPtr p 184
p'WorldOptions'mSharedMemoryID :: Ptr (C'WorldOptions) -> Ptr (CInt)
instance Storable C'WorldOptions where
  sizeOf _ = 192
  alignment _ = 8
  peek p = do
    v0 <- peekByteOff p 0
    v1 <- peekByteOff p 8
    v2 <- peekByteOff p 12
    v3 <- peekByteOff p 16
    v4 <- peekByteOff p 20
    v5 <- peekByteOff p 24
    v6 <- peekByteOff p 28
    v7 <- peekByteOff p 32
    v8 <- peekByteOff p 36
    v9 <- peekByteOff p 40
    v10 <- peekByteOff p 44
    v11 <- peekByteOff p 48
    v12 <- peekByteOff p 52
    v13 <- peekByteOff p 56
    v14 <- peekByteOff p 64
    v15 <- peekByteOff p 65
    v16 <- peekByteOff p 72
    v17 <- peekByteOff p 80
    v18 <- peekByteOff p 88
    v19 <- peekByteOff p 96
    v20 <- peekByteOff p 104
    v21 <- peekByteOff p 112
    v22 <- peekByteOff p 116
    v23 <- peekByteOff p 120
    v24 <- peekByteOff p 124
    v25 <- peekByteOff p 128
    v26 <- peekByteOff p 136
    v27 <- peekByteOff p 144
    v28 <- peekByteOff p 152
    v29 <- peekByteOff p 156
    v30 <- peekByteOff p 160
    v31 <- peekByteOff p 168
    v32 <- peekByteOff p 176
    v33 <- peekByteOff p 184
    return $ C'WorldOptions v0 v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 v16 v17 v18 v19 v20 v21 v22 v23 v24 v25 v26 v27 v28 v29 v30 v31 v32 v33
  poke p (C'WorldOptions v0 v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 v16 v17 v18 v19 v20 v21 v22 v23 v24 v25 v26 v27 v28 v29 v30 v31 v32 v33) = do
    pokeByteOff p 0 v0
    pokeByteOff p 8 v1
    pokeByteOff p 12 v2
    pokeByteOff p 16 v3
    pokeByteOff p 20 v4
    pokeByteOff p 24 v5
    pokeByteOff p 28 v6
    pokeByteOff p 32 v7
    pokeByteOff p 36 v8
    pokeByteOff p 40 v9
    pokeByteOff p 44 v10
    pokeByteOff p 48 v11
    pokeByteOff p 52 v12
    pokeByteOff p 56 v13
    pokeByteOff p 64 v14
    pokeByteOff p 65 v15
    pokeByteOff p 72 v16
    pokeByteOff p 80 v17
    pokeByteOff p 88 v18
    pokeByteOff p 96 v19
    pokeByteOff p 104 v20
    pokeByteOff p 112 v21
    pokeByteOff p 116 v22
    pokeByteOff p 120 v23
    pokeByteOff p 124 v24
    pokeByteOff p 128 v25
    pokeByteOff p 136 v26
    pokeByteOff p 144 v27
    pokeByteOff p 152 v28
    pokeByteOff p 156 v29
    pokeByteOff p 160 v30
    pokeByteOff p 168 v31
    pokeByteOff p 176 v32
    pokeByteOff p 184 v33
    return ()

{-# LINE 48 "Bindings/Sound/SC3.hsc" #-}

-- | Default synthesis engine options.
foreign import ccall "inline_kDefaultWorldOptions" c'kDefaultWorldOptions
  :: IO (Ptr C'WorldOptions)

{-# LINE 51 "Bindings/Sound/SC3.hsc" #-}

-- | Reply address.
data C'ReplyAddress = C'ReplyAddress

{-# LINE 54 "Bindings/Sound/SC3.hsc" #-}

-- | Access the callback data pointer in a reply address.
foreign import ccall "ReplyAddress_ReplyData" c'ReplyAddress_ReplyData
  :: Ptr C'ReplyAddress -> IO (Ptr ())
foreign import ccall "&ReplyAddress_ReplyData" p'ReplyAddress_ReplyData
  :: FunPtr (Ptr C'ReplyAddress -> IO (Ptr ()))

{-# LINE 57 "Bindings/Sound/SC3.hsc" #-}

-- | Reply function callback.
--
-- Arguments:
--
-- * 'Ptr' 'C'ReplyAddress' - Reply address handle
--
-- * 'Ptr' 'CChar' - OSC packet data
--
-- * 'CInt' - OSC packet size in bytes
type C'ReplyFunc = FunPtr (Ptr C'ReplyAddress -> Ptr CChar -> CInt -> IO ())
foreign import ccall "wrapper" mk'ReplyFunc
  :: (Ptr C'ReplyAddress -> Ptr CChar -> CInt -> IO ()) -> IO C'ReplyFunc
foreign import ccall "dynamic" mK'ReplyFunc
  :: C'ReplyFunc -> (Ptr C'ReplyAddress -> Ptr CChar -> CInt -> IO ())

{-# LINE 68 "Bindings/Sound/SC3.hsc" #-}

-- | Create a new synthesis engine.
foreign import ccall "World_New" c'World_New
  :: Ptr C'WorldOptions -> IO (Ptr C'World)
foreign import ccall "&World_New" p'World_New
  :: FunPtr (Ptr C'WorldOptions -> IO (Ptr C'World))

{-# LINE 71 "Bindings/Sound/SC3.hsc" #-}

-- | Free the synthesis engine.
--
-- This function should only be called after 'c'World_WaitForQuit' has returned.
foreign import ccall "World_Cleanup" c'World_Cleanup
  :: Ptr C'World -> IO ()
foreign import ccall "&World_Cleanup" p'World_Cleanup
  :: FunPtr (Ptr C'World -> IO ())

{-# LINE 76 "Bindings/Sound/SC3.hsc" #-}

-- | Perform non-realtime synthesis with the given 'C'WorldOptions'.
foreign import ccall "World_NonRealTimeSynthesis" c'World_NonRealTimeSynthesis
  :: Ptr C'World -> Ptr C'WorldOptions -> IO ()
foreign import ccall "&World_NonRealTimeSynthesis" p'World_NonRealTimeSynthesis
  :: FunPtr (Ptr C'World -> Ptr C'WorldOptions -> IO ())

{-# LINE 79 "Bindings/Sound/SC3.hsc" #-}

-- | Open a UDP input port for receiving OSC commands.
--
-- Returns non-zero if the call was successful.
foreign import ccall "World_OpenUDP" c'World_OpenUDP
  :: Ptr C'World -> CInt -> IO CInt
foreign import ccall "&World_OpenUDP" p'World_OpenUDP
  :: FunPtr (Ptr C'World -> CInt -> IO CInt)

{-# LINE 84 "Bindings/Sound/SC3.hsc" #-}

-- | Open a TCP input port for receiving OSC commands.
--
-- Returns non-zero if the call was successful.
foreign import ccall "World_OpenTCP" c'World_OpenTCP
  :: Ptr C'World -> CInt -> CInt -> CInt -> IO CInt
foreign import ccall "&World_OpenTCP" p'World_OpenTCP
  :: FunPtr (Ptr C'World -> CInt -> CInt -> CInt -> IO CInt)

{-# LINE 89 "Bindings/Sound/SC3.hsc" #-}

-- | Wait for the synthesis engine to quit.
--
-- In order to stop the synthesis engine, send a \"/quit\" OSC message with
-- 'c'World_SendPacket', 'c'World_SendPacketWithContext' or through an open
-- network port.
foreign import ccall "World_WaitForQuit" c'World_WaitForQuit
  :: Ptr C'World -> IO ()
foreign import ccall "&World_WaitForQuit" p'World_WaitForQuit
  :: FunPtr (Ptr C'World -> IO ())

{-# LINE 96 "Bindings/Sound/SC3.hsc" #-}

-- | Send an OSC packet to the synthesis engine.
--
-- Returns 'True' if the packet was sent successfully.
--
-- Arguments:
--
-- * 'CInt' - OSC packet size in bytes
--
-- * 'Ptr' 'CChar' - OSC packet data
--
-- * 'C'ReplyFunc' - Reply function callback.
foreign import ccall "World_SendPacket" c'World_SendPacket
  :: Ptr C'World -> CInt -> Ptr CChar -> C'ReplyFunc -> IO Bool
foreign import ccall "&World_SendPacket" p'World_SendPacket
  :: FunPtr (Ptr C'World -> CInt -> Ptr CChar -> C'ReplyFunc -> IO Bool)

{-# LINE 109 "Bindings/Sound/SC3.hsc" #-}

-- | Send an OSC packet to the synthesis engine with callback data.
--
-- Returns 'True' if the packet was sent successfully.
--
-- Arguments:
--
-- * 'CInt' - OSC packet size in bytes
--
-- * 'Ptr' 'CChar' - OSC packet data
--
-- * 'C'ReplyFunc' - Reply function callback.
--
-- * 'Ptr' () - Reply function callback data.
foreign import ccall "World_SendPacketWithContext" c'World_SendPacketWithContext
  :: Ptr C'World -> CInt -> Ptr CChar -> C'ReplyFunc -> Ptr () -> IO Bool
foreign import ccall "&World_SendPacketWithContext" p'World_SendPacketWithContext
  :: FunPtr (Ptr C'World -> CInt -> Ptr CChar -> C'ReplyFunc -> Ptr () -> IO Bool)

{-# LINE 124 "Bindings/Sound/SC3.hsc" #-}

-- | Haskell print function.
type C'HaskellPrintFunc = FunPtr (Ptr CChar -> IO ())
foreign import ccall "wrapper" mk'HaskellPrintFunc
  :: (Ptr CChar -> IO ()) -> IO C'HaskellPrintFunc
foreign import ccall "dynamic" mK'HaskellPrintFunc
  :: C'HaskellPrintFunc -> (Ptr CChar -> IO ())

{-# LINE 127 "Bindings/Sound/SC3.hsc" #-}

-- | Set the global Haskell print function.
--
-- This function, when set, is called by the synthesis engine to print
-- character strings to an appropriate output channel.
foreign import ccall "SetHaskellPrintFunc" c'SetHaskellPrintFunc
  :: C'HaskellPrintFunc -> IO ()
foreign import ccall "&SetHaskellPrintFunc" p'SetHaskellPrintFunc
  :: FunPtr (C'HaskellPrintFunc -> IO ())

{-# LINE 133 "Bindings/Sound/SC3.hsc" #-}