module Sound.Pulse.Def
where
import Data.Bits (Bits(..))
import Foreign.C.Types (CInt)
foldFlag :: (a -> CInt) -> [a] -> CInt
foldFlag fun = foldr ((.|.) . fun) 0
data SubscriptionEventFacility
= SubscriptionEventSink
| SubscriptionEventSource
| SubscriptionEventSinkInput
| SubscriptionEventSourceOutput
| SubscriptionEventModule
| SubscriptionEventClient
| SubscriptionEventSampleCache
| SubscriptionEventServer
| SubscriptionEventAutoload
| SubscriptionEventCard
| SubscriptionEventFacilityMask
deriving (Eq, Show)
subscriptionEventFacilityToInt :: SubscriptionEventFacility -> CInt
subscriptionEventFacilityToInt SubscriptionEventSink = 0
subscriptionEventFacilityToInt SubscriptionEventSource = 1
subscriptionEventFacilityToInt SubscriptionEventSinkInput = 2
subscriptionEventFacilityToInt SubscriptionEventSourceOutput = 3
subscriptionEventFacilityToInt SubscriptionEventModule = 4
subscriptionEventFacilityToInt SubscriptionEventClient = 5
subscriptionEventFacilityToInt SubscriptionEventSampleCache = 6
subscriptionEventFacilityToInt SubscriptionEventServer = 7
subscriptionEventFacilityToInt SubscriptionEventAutoload = 8
subscriptionEventFacilityToInt SubscriptionEventCard = 9
subscriptionEventFacilityToInt SubscriptionEventFacilityMask = 15
subscriptionEventFacilityFromInt :: CInt -> SubscriptionEventFacility
subscriptionEventFacilityFromInt (0) = SubscriptionEventSink
subscriptionEventFacilityFromInt (1) = SubscriptionEventSource
subscriptionEventFacilityFromInt (2) = SubscriptionEventSinkInput
subscriptionEventFacilityFromInt (3) = SubscriptionEventSourceOutput
subscriptionEventFacilityFromInt (4) = SubscriptionEventModule
subscriptionEventFacilityFromInt (5) = SubscriptionEventClient
subscriptionEventFacilityFromInt (6) = SubscriptionEventSampleCache
subscriptionEventFacilityFromInt (7) = SubscriptionEventServer
subscriptionEventFacilityFromInt (8) = SubscriptionEventAutoload
subscriptionEventFacilityFromInt (9) = SubscriptionEventCard
subscriptionEventFacilityFromInt (15) = SubscriptionEventFacilityMask
subscriptionEventFacilityFromInt x = error ("PA unexped value @subscriptionEventFacilityFromInt:" ++ show x)
data SubscriptionEventType
= SubscriptionEventNew
| SubscriptionEventChange
| SubscriptionEventRemove
| SubscriptionEventTypeMask
deriving (Eq, Show)
subscriptionEventTypeToInt :: SubscriptionEventType -> CInt
subscriptionEventTypeToInt SubscriptionEventNew = 0
subscriptionEventTypeToInt SubscriptionEventChange = 16
subscriptionEventTypeToInt SubscriptionEventRemove = 32
subscriptionEventTypeToInt SubscriptionEventTypeMask = 48
subscriptionEventTypeFromInt :: CInt -> SubscriptionEventType
subscriptionEventTypeFromInt (0) = SubscriptionEventNew
subscriptionEventTypeFromInt (16) = SubscriptionEventChange
subscriptionEventTypeFromInt (32) = SubscriptionEventRemove
subscriptionEventTypeFromInt (48) = SubscriptionEventTypeMask
subscriptionEventTypeFromInt x = error ("PA unexped value @subscriptionEventTypeFromInt:" ++ show x)
data ContextState
= ContextUnconnected
| ContextConnecting
| ContextAuthorizing
| ContextSettingName
| ContextReady
| ContextFailed
| ContextTerminated
deriving (Eq, Show)
contextStateToInt :: ContextState -> CInt
contextStateToInt ContextUnconnected = 0
contextStateToInt ContextConnecting = 1
contextStateToInt ContextAuthorizing = 2
contextStateToInt ContextSettingName = 3
contextStateToInt ContextReady = 4
contextStateToInt ContextFailed = 5
contextStateToInt ContextTerminated = 6
contextStateFromInt :: CInt -> ContextState
contextStateFromInt (0) = ContextUnconnected
contextStateFromInt (1) = ContextConnecting
contextStateFromInt (2) = ContextAuthorizing
contextStateFromInt (3) = ContextSettingName
contextStateFromInt (4) = ContextReady
contextStateFromInt (5) = ContextFailed
contextStateFromInt (6) = ContextTerminated
contextStateFromInt x = error ("PA unexped value @contextStateFromInt:" ++ show x)
data StreamState
= StreamUnconnected
| StreamCreating
| StreamReady
| StreamFailed
| StreamTerminated
deriving (Eq, Show)
streamStateToInt :: StreamState -> CInt
streamStateToInt StreamUnconnected = 0
streamStateToInt StreamCreating = 1
streamStateToInt StreamReady = 2
streamStateToInt StreamFailed = 3
streamStateToInt StreamTerminated = 4
streamStateFromInt :: CInt -> StreamState
streamStateFromInt (0) = StreamUnconnected
streamStateFromInt (1) = StreamCreating
streamStateFromInt (2) = StreamReady
streamStateFromInt (3) = StreamFailed
streamStateFromInt (4) = StreamTerminated
streamStateFromInt x = error ("PA unexped value @streamStateFromInt:" ++ show x)
data OperationState
= OperationRunning
| OperationDone
| OperationCancelled
deriving (Eq, Show)
operationStateToInt :: OperationState -> CInt
operationStateToInt OperationRunning = 0
operationStateToInt OperationDone = 1
operationStateToInt OperationCancelled = 2
operationStateFromInt :: CInt -> OperationState
operationStateFromInt (0) = OperationRunning
operationStateFromInt (1) = OperationDone
operationStateFromInt (2) = OperationCancelled
operationStateFromInt x = error ("PA unexped value @operationStateFromInt:" ++ show x)
data Direction
= DirectionOutput
| DirectionInput
deriving (Eq, Show)
directionToInt :: Direction -> CInt
directionToInt DirectionOutput = 1
directionToInt DirectionInput = 2
directionFromInt :: CInt -> Direction
directionFromInt (1) = DirectionOutput
directionFromInt (2) = DirectionInput
directionFromInt x = error ("PA unexped value @directionFromInt:" ++ show x)
data ErrorCode
= Ok
| ErrAccess
| ErrCommand
| ErrInvalid
| ErrExist
| ErrNoentity
| ErrConnectionrefused
| ErrProtocol
| ErrTimeout
| ErrAuthkey
| ErrInternal
| ErrConnectionterminated
| ErrKilled
| ErrInvalidserver
| ErrModinitfailed
| ErrBadstate
| ErrNodata
| ErrVersion
| ErrToolarge
| ErrNotsupported
| ErrUnknown
| ErrNoextension
| ErrObsolete
| ErrNotimplemented
| ErrForked
| ErrIo
| ErrBusy
| ErrMax
deriving (Eq, Show)
errorCodeToInt :: ErrorCode -> CInt
errorCodeToInt Ok = 0
errorCodeToInt ErrAccess = 1
errorCodeToInt ErrCommand = 2
errorCodeToInt ErrInvalid = 3
errorCodeToInt ErrExist = 4
errorCodeToInt ErrNoentity = 5
errorCodeToInt ErrConnectionrefused = 6
errorCodeToInt ErrProtocol = 7
errorCodeToInt ErrTimeout = 8
errorCodeToInt ErrAuthkey = 9
errorCodeToInt ErrInternal = 10
errorCodeToInt ErrConnectionterminated = 11
errorCodeToInt ErrKilled = 12
errorCodeToInt ErrInvalidserver = 13
errorCodeToInt ErrModinitfailed = 14
errorCodeToInt ErrBadstate = 15
errorCodeToInt ErrNodata = 16
errorCodeToInt ErrVersion = 17
errorCodeToInt ErrToolarge = 18
errorCodeToInt ErrNotsupported = 19
errorCodeToInt ErrUnknown = 20
errorCodeToInt ErrNoextension = 21
errorCodeToInt ErrObsolete = 22
errorCodeToInt ErrNotimplemented = 23
errorCodeToInt ErrForked = 24
errorCodeToInt ErrIo = 25
errorCodeToInt ErrBusy = 26
errorCodeToInt ErrMax = 27
errorCodeFromInt :: CInt -> ErrorCode
errorCodeFromInt (0) = Ok
errorCodeFromInt (1) = ErrAccess
errorCodeFromInt (2) = ErrCommand
errorCodeFromInt (3) = ErrInvalid
errorCodeFromInt (4) = ErrExist
errorCodeFromInt (5) = ErrNoentity
errorCodeFromInt (6) = ErrConnectionrefused
errorCodeFromInt (7) = ErrProtocol
errorCodeFromInt (8) = ErrTimeout
errorCodeFromInt (9) = ErrAuthkey
errorCodeFromInt (10) = ErrInternal
errorCodeFromInt (11) = ErrConnectionterminated
errorCodeFromInt (12) = ErrKilled
errorCodeFromInt (13) = ErrInvalidserver
errorCodeFromInt (14) = ErrModinitfailed
errorCodeFromInt (15) = ErrBadstate
errorCodeFromInt (16) = ErrNodata
errorCodeFromInt (17) = ErrVersion
errorCodeFromInt (18) = ErrToolarge
errorCodeFromInt (19) = ErrNotsupported
errorCodeFromInt (20) = ErrUnknown
errorCodeFromInt (21) = ErrNoextension
errorCodeFromInt (22) = ErrObsolete
errorCodeFromInt (23) = ErrNotimplemented
errorCodeFromInt (24) = ErrForked
errorCodeFromInt (25) = ErrIo
errorCodeFromInt (26) = ErrBusy
errorCodeFromInt (27) = ErrMax
errorCodeFromInt x = error ("PA unexped value @errorCodeFromInt:" ++ show x)
data SeekMode
= SeekRelative
| SeekAbsolute
| SeekRelativeOnRead
| SeekRelativeEnd
deriving (Eq, Show)
seekModeToInt :: SeekMode -> CInt
seekModeToInt SeekRelative = 0
seekModeToInt SeekAbsolute = 1
seekModeToInt SeekRelativeOnRead = 2
seekModeToInt SeekRelativeEnd = 3
seekModeFromInt :: CInt -> SeekMode
seekModeFromInt (0) = SeekRelative
seekModeFromInt (1) = SeekAbsolute
seekModeFromInt (2) = SeekRelativeOnRead
seekModeFromInt (3) = SeekRelativeEnd
seekModeFromInt x = error ("PA unexped value @seekModeFromInt:" ++ show x)
data SinkState
= SinkInvalidState
| SinkRunning
| SinkIdle
| SinkSuspended
| SinkInit
| SinkUnlinked
deriving (Eq, Show)
sinkStateToInt :: SinkState -> CInt
sinkStateToInt SinkInvalidState = 1
sinkStateToInt SinkRunning = 0
sinkStateToInt SinkIdle = 1
sinkStateToInt SinkSuspended = 2
sinkStateToInt SinkInit = 2
sinkStateToInt SinkUnlinked = 3
sinkStateFromInt :: CInt -> SinkState
sinkStateFromInt (1) = SinkInvalidState
sinkStateFromInt (0) = SinkRunning
sinkStateFromInt (1) = SinkIdle
sinkStateFromInt (2) = SinkSuspended
sinkStateFromInt (2) = SinkInit
sinkStateFromInt (3) = SinkUnlinked
sinkStateFromInt x = error ("PA unexped value @sinkStateFromInt:" ++ show x)
data SourceState
= SourceInvalidState
| SourceRunning
| SourceIdle
| SourceSuspended
| SourceInit
| SourceUnlinked
deriving (Eq, Show)
sourceStateToInt :: SourceState -> CInt
sourceStateToInt SourceInvalidState = 1
sourceStateToInt SourceRunning = 0
sourceStateToInt SourceIdle = 1
sourceStateToInt SourceSuspended = 2
sourceStateToInt SourceInit = 2
sourceStateToInt SourceUnlinked = 3
sourceStateFromInt :: CInt -> SourceState
sourceStateFromInt (1) = SourceInvalidState
sourceStateFromInt (0) = SourceRunning
sourceStateFromInt (1) = SourceIdle
sourceStateFromInt (2) = SourceSuspended
sourceStateFromInt (2) = SourceInit
sourceStateFromInt (3) = SourceUnlinked
sourceStateFromInt x = error ("PA unexped value @sourceStateFromInt:" ++ show x)
data PortAvailable
= PortAvailableUnknown
| PortAvailableNo
| PortAvailableYes
deriving (Eq, Show)
portAvailableToInt :: PortAvailable -> CInt
portAvailableToInt PortAvailableUnknown = 0
portAvailableToInt PortAvailableNo = 1
portAvailableToInt PortAvailableYes = 2
portAvailableFromInt :: CInt -> PortAvailable
portAvailableFromInt (0) = PortAvailableUnknown
portAvailableFromInt (1) = PortAvailableNo
portAvailableFromInt (2) = PortAvailableYes
portAvailableFromInt x = error ("PA unexped value @portAvailableFromInt:" ++ show x)
data ChannelPosition
= ChannelPositionInvalid
| ChannelPositionMono
| ChannelPositionFrontLeft
| ChannelPositionFrontRight
| ChannelPositionFrontCenter
| ChannelPositionLeft
| ChannelPositionRight
| ChannelPositionCenter
| ChannelPositionRearCenter
| ChannelPositionRearLeft
| ChannelPositionRearRight
| ChannelPositionLfe
| ChannelPositionSubwoofer
| ChannelPositionFrontLeftOfCenter
| ChannelPositionFrontRightOfCenter
| ChannelPositionSideLeft
| ChannelPositionSideRight
| ChannelPositionAux0
| ChannelPositionAux1
| ChannelPositionAux2
| ChannelPositionAux3
| ChannelPositionAux4
| ChannelPositionAux5
| ChannelPositionAux6
| ChannelPositionAux7
| ChannelPositionAux8
| ChannelPositionAux9
| ChannelPositionAux10
| ChannelPositionAux11
| ChannelPositionAux12
| ChannelPositionAux13
| ChannelPositionAux14
| ChannelPositionAux15
| ChannelPositionAux16
| ChannelPositionAux17
| ChannelPositionAux18
| ChannelPositionAux19
| ChannelPositionAux20
| ChannelPositionAux21
| ChannelPositionAux22
| ChannelPositionAux23
| ChannelPositionAux24
| ChannelPositionAux25
| ChannelPositionAux26
| ChannelPositionAux27
| ChannelPositionAux28
| ChannelPositionAux29
| ChannelPositionAux30
| ChannelPositionAux31
| ChannelPositionTopCenter
| ChannelPositionTopFrontLeft
| ChannelPositionTopFrontRight
| ChannelPositionTopFrontCenter
| ChannelPositionTopRearLeft
| ChannelPositionTopRearRight
| ChannelPositionTopRearCenter
| ChannelPositionMax
deriving (Eq, Show)
channelPositionToInt :: ChannelPosition -> CInt
channelPositionToInt ChannelPositionInvalid = 1
channelPositionToInt ChannelPositionMono = 0
channelPositionToInt ChannelPositionFrontLeft = 1
channelPositionToInt ChannelPositionFrontRight = 2
channelPositionToInt ChannelPositionFrontCenter = 3
channelPositionToInt ChannelPositionLeft = 1
channelPositionToInt ChannelPositionRight = 2
channelPositionToInt ChannelPositionCenter = 3
channelPositionToInt ChannelPositionRearCenter = 4
channelPositionToInt ChannelPositionRearLeft = 5
channelPositionToInt ChannelPositionRearRight = 6
channelPositionToInt ChannelPositionLfe = 7
channelPositionToInt ChannelPositionSubwoofer = 7
channelPositionToInt ChannelPositionFrontLeftOfCenter = 8
channelPositionToInt ChannelPositionFrontRightOfCenter = 9
channelPositionToInt ChannelPositionSideLeft = 10
channelPositionToInt ChannelPositionSideRight = 11
channelPositionToInt ChannelPositionAux0 = 12
channelPositionToInt ChannelPositionAux1 = 13
channelPositionToInt ChannelPositionAux2 = 14
channelPositionToInt ChannelPositionAux3 = 15
channelPositionToInt ChannelPositionAux4 = 16
channelPositionToInt ChannelPositionAux5 = 17
channelPositionToInt ChannelPositionAux6 = 18
channelPositionToInt ChannelPositionAux7 = 19
channelPositionToInt ChannelPositionAux8 = 20
channelPositionToInt ChannelPositionAux9 = 21
channelPositionToInt ChannelPositionAux10 = 22
channelPositionToInt ChannelPositionAux11 = 23
channelPositionToInt ChannelPositionAux12 = 24
channelPositionToInt ChannelPositionAux13 = 25
channelPositionToInt ChannelPositionAux14 = 26
channelPositionToInt ChannelPositionAux15 = 27
channelPositionToInt ChannelPositionAux16 = 28
channelPositionToInt ChannelPositionAux17 = 29
channelPositionToInt ChannelPositionAux18 = 30
channelPositionToInt ChannelPositionAux19 = 31
channelPositionToInt ChannelPositionAux20 = 32
channelPositionToInt ChannelPositionAux21 = 33
channelPositionToInt ChannelPositionAux22 = 34
channelPositionToInt ChannelPositionAux23 = 35
channelPositionToInt ChannelPositionAux24 = 36
channelPositionToInt ChannelPositionAux25 = 37
channelPositionToInt ChannelPositionAux26 = 38
channelPositionToInt ChannelPositionAux27 = 39
channelPositionToInt ChannelPositionAux28 = 40
channelPositionToInt ChannelPositionAux29 = 41
channelPositionToInt ChannelPositionAux30 = 42
channelPositionToInt ChannelPositionAux31 = 43
channelPositionToInt ChannelPositionTopCenter = 44
channelPositionToInt ChannelPositionTopFrontLeft = 45
channelPositionToInt ChannelPositionTopFrontRight = 46
channelPositionToInt ChannelPositionTopFrontCenter = 47
channelPositionToInt ChannelPositionTopRearLeft = 48
channelPositionToInt ChannelPositionTopRearRight = 49
channelPositionToInt ChannelPositionTopRearCenter = 50
channelPositionToInt ChannelPositionMax = 51
channelPositionFromInt :: CInt -> ChannelPosition
channelPositionFromInt (1) = ChannelPositionInvalid
channelPositionFromInt (0) = ChannelPositionMono
channelPositionFromInt (1) = ChannelPositionFrontLeft
channelPositionFromInt (2) = ChannelPositionFrontRight
channelPositionFromInt (3) = ChannelPositionFrontCenter
channelPositionFromInt (1) = ChannelPositionLeft
channelPositionFromInt (2) = ChannelPositionRight
channelPositionFromInt (3) = ChannelPositionCenter
channelPositionFromInt (4) = ChannelPositionRearCenter
channelPositionFromInt (5) = ChannelPositionRearLeft
channelPositionFromInt (6) = ChannelPositionRearRight
channelPositionFromInt (7) = ChannelPositionLfe
channelPositionFromInt (7) = ChannelPositionSubwoofer
channelPositionFromInt (8) = ChannelPositionFrontLeftOfCenter
channelPositionFromInt (9) = ChannelPositionFrontRightOfCenter
channelPositionFromInt (10) = ChannelPositionSideLeft
channelPositionFromInt (11) = ChannelPositionSideRight
channelPositionFromInt (12) = ChannelPositionAux0
channelPositionFromInt (13) = ChannelPositionAux1
channelPositionFromInt (14) = ChannelPositionAux2
channelPositionFromInt (15) = ChannelPositionAux3
channelPositionFromInt (16) = ChannelPositionAux4
channelPositionFromInt (17) = ChannelPositionAux5
channelPositionFromInt (18) = ChannelPositionAux6
channelPositionFromInt (19) = ChannelPositionAux7
channelPositionFromInt (20) = ChannelPositionAux8
channelPositionFromInt (21) = ChannelPositionAux9
channelPositionFromInt (22) = ChannelPositionAux10
channelPositionFromInt (23) = ChannelPositionAux11
channelPositionFromInt (24) = ChannelPositionAux12
channelPositionFromInt (25) = ChannelPositionAux13
channelPositionFromInt (26) = ChannelPositionAux14
channelPositionFromInt (27) = ChannelPositionAux15
channelPositionFromInt (28) = ChannelPositionAux16
channelPositionFromInt (29) = ChannelPositionAux17
channelPositionFromInt (30) = ChannelPositionAux18
channelPositionFromInt (31) = ChannelPositionAux19
channelPositionFromInt (32) = ChannelPositionAux20
channelPositionFromInt (33) = ChannelPositionAux21
channelPositionFromInt (34) = ChannelPositionAux22
channelPositionFromInt (35) = ChannelPositionAux23
channelPositionFromInt (36) = ChannelPositionAux24
channelPositionFromInt (37) = ChannelPositionAux25
channelPositionFromInt (38) = ChannelPositionAux26
channelPositionFromInt (39) = ChannelPositionAux27
channelPositionFromInt (40) = ChannelPositionAux28
channelPositionFromInt (41) = ChannelPositionAux29
channelPositionFromInt (42) = ChannelPositionAux30
channelPositionFromInt (43) = ChannelPositionAux31
channelPositionFromInt (44) = ChannelPositionTopCenter
channelPositionFromInt (45) = ChannelPositionTopFrontLeft
channelPositionFromInt (46) = ChannelPositionTopFrontRight
channelPositionFromInt (47) = ChannelPositionTopFrontCenter
channelPositionFromInt (48) = ChannelPositionTopRearLeft
channelPositionFromInt (49) = ChannelPositionTopRearRight
channelPositionFromInt (50) = ChannelPositionTopRearCenter
channelPositionFromInt (51) = ChannelPositionMax
channelPositionFromInt x = error ("PA unexped value @channelPositionFromInt:" ++ show x)
data ChannelMapDef
= ChannelMapAiff
| ChannelMapAlsa
| ChannelMapAux
| ChannelMapWaveex
| ChannelMapOss
| ChannelMapDefMax
| ChannelMapDefault
deriving (Eq, Show)
channelMapDefToInt :: ChannelMapDef -> CInt
channelMapDefToInt ChannelMapAiff = 0
channelMapDefToInt ChannelMapAlsa = 1
channelMapDefToInt ChannelMapAux = 2
channelMapDefToInt ChannelMapWaveex = 3
channelMapDefToInt ChannelMapOss = 4
channelMapDefToInt ChannelMapDefMax = 5
channelMapDefToInt ChannelMapDefault = 0
channelMapDefFromInt :: CInt -> ChannelMapDef
channelMapDefFromInt (0) = ChannelMapAiff
channelMapDefFromInt (1) = ChannelMapAlsa
channelMapDefFromInt (2) = ChannelMapAux
channelMapDefFromInt (3) = ChannelMapWaveex
channelMapDefFromInt (4) = ChannelMapOss
channelMapDefFromInt (5) = ChannelMapDefMax
channelMapDefFromInt (0) = ChannelMapDefault
channelMapDefFromInt x = error ("PA unexped value @channelMapDefFromInt:" ++ show x)
data SampleFormat
= SampleU8
| SampleAlaw
| SampleUlaw
| SampleS16le
| SampleS16be
| SampleFloat32le
| SampleFloat32be
| SampleS32le
| SampleS32be
| SampleS24le
| SampleS24be
| SampleS2432le
| SampleS2432be
| SampleMax
| SampleInvalid
deriving (Eq, Show)
sampleFormatToInt :: SampleFormat -> CInt
sampleFormatToInt SampleU8 = 0
sampleFormatToInt SampleAlaw = 1
sampleFormatToInt SampleUlaw = 2
sampleFormatToInt SampleS16le = 3
sampleFormatToInt SampleS16be = 4
sampleFormatToInt SampleFloat32le = 5
sampleFormatToInt SampleFloat32be = 6
sampleFormatToInt SampleS32le = 7
sampleFormatToInt SampleS32be = 8
sampleFormatToInt SampleS24le = 9
sampleFormatToInt SampleS24be = 10
sampleFormatToInt SampleS2432le = 11
sampleFormatToInt SampleS2432be = 12
sampleFormatToInt SampleMax = 13
sampleFormatToInt SampleInvalid = 1
sampleFormatFromInt :: CInt -> SampleFormat
sampleFormatFromInt (0) = SampleU8
sampleFormatFromInt (1) = SampleAlaw
sampleFormatFromInt (2) = SampleUlaw
sampleFormatFromInt (3) = SampleS16le
sampleFormatFromInt (4) = SampleS16be
sampleFormatFromInt (5) = SampleFloat32le
sampleFormatFromInt (6) = SampleFloat32be
sampleFormatFromInt (7) = SampleS32le
sampleFormatFromInt (8) = SampleS32be
sampleFormatFromInt (9) = SampleS24le
sampleFormatFromInt (10) = SampleS24be
sampleFormatFromInt (11) = SampleS2432le
sampleFormatFromInt (12) = SampleS2432be
sampleFormatFromInt (13) = SampleMax
sampleFormatFromInt (1) = SampleInvalid
sampleFormatFromInt x = error ("PA unexped value @sampleFormatFromInt:" ++ show x)
data ContextFlags
= ContextNoflags
| ContextNoautospawn
| ContextNofail
deriving (Eq, Show)
contextFlagsToInt :: ContextFlags -> CInt
contextFlagsToInt ContextNoflags = 0
contextFlagsToInt ContextNoautospawn = 1
contextFlagsToInt ContextNofail = 2
contextFlagssToInt :: [ContextFlags] -> CInt
contextFlagssToInt = foldFlag contextFlagsToInt
contextFlagssFromInt :: CInt -> [ContextFlags]
contextFlagssFromInt i =
let
t0 = if (i .&. 0 /= 0) then (ContextNoflags:) else id
t1 = if (i .&. 1 /= 0) then (ContextNoautospawn:) else id
t2 = if (i .&. 2 /= 0) then (ContextNofail:) else id
in t0 . t1 . t2 . id $ []
data SubscriptionMask
= SubscriptionMaskNull
| SubscriptionMaskSink
| SubscriptionMaskSource
| SubscriptionMaskSinkInput
| SubscriptionMaskSourceOutput
| SubscriptionMaskModule
| SubscriptionMaskClient
| SubscriptionMaskSampleCache
| SubscriptionMaskServer
| SubscriptionMaskAutoload
| SubscriptionMaskCard
| SubscriptionMaskAll
deriving (Eq, Show)
subscriptionMaskToInt :: SubscriptionMask -> CInt
subscriptionMaskToInt SubscriptionMaskNull = 0
subscriptionMaskToInt SubscriptionMaskSink = 1
subscriptionMaskToInt SubscriptionMaskSource = 2
subscriptionMaskToInt SubscriptionMaskSinkInput = 4
subscriptionMaskToInt SubscriptionMaskSourceOutput = 8
subscriptionMaskToInt SubscriptionMaskModule = 16
subscriptionMaskToInt SubscriptionMaskClient = 32
subscriptionMaskToInt SubscriptionMaskSampleCache = 64
subscriptionMaskToInt SubscriptionMaskServer = 128
subscriptionMaskToInt SubscriptionMaskAutoload = 256
subscriptionMaskToInt SubscriptionMaskCard = 512
subscriptionMaskToInt SubscriptionMaskAll = 767
subscriptionMasksToInt :: [SubscriptionMask] -> CInt
subscriptionMasksToInt = foldFlag subscriptionMaskToInt
subscriptionMasksFromInt :: CInt -> [SubscriptionMask]
subscriptionMasksFromInt i =
let
t0 = if (i .&. 0 /= 0) then (SubscriptionMaskNull:) else id
t1 = if (i .&. 1 /= 0) then (SubscriptionMaskSink:) else id
t2 = if (i .&. 2 /= 0) then (SubscriptionMaskSource:) else id
t3 = if (i .&. 4 /= 0) then (SubscriptionMaskSinkInput:) else id
t4 = if (i .&. 8 /= 0) then (SubscriptionMaskSourceOutput:) else id
t5 = if (i .&. 16 /= 0) then (SubscriptionMaskModule:) else id
t6 = if (i .&. 32 /= 0) then (SubscriptionMaskClient:) else id
t7 = if (i .&. 64 /= 0) then (SubscriptionMaskSampleCache:) else id
t8 = if (i .&. 128 /= 0) then (SubscriptionMaskServer:) else id
t9 = if (i .&. 256 /= 0) then (SubscriptionMaskAutoload:) else id
t10 = if (i .&. 512 /= 0) then (SubscriptionMaskCard:) else id
t11 = if (i .&. 767 /= 0) then (SubscriptionMaskAll:) else id
in t0 . t1 . t2 . t3 . t4 . t5 . t6 . t7 . t8 . t9 . t10 . t11 . id $ []
data SinkFlags
= SinkNoflags
| SinkHwVolumeCtrl
| SinkLatency
| SinkHardware
| SinkNetwork
| SinkHwMuteCtrl
| SinkDecibelVolume
| SinkFlatVolume
| SinkDynamicLatency
| SinkSetFormats
deriving (Eq, Show)
sinkFlagsToInt :: SinkFlags -> CInt
sinkFlagsToInt SinkNoflags = 0
sinkFlagsToInt SinkHwVolumeCtrl = 1
sinkFlagsToInt SinkLatency = 2
sinkFlagsToInt SinkHardware = 4
sinkFlagsToInt SinkNetwork = 8
sinkFlagsToInt SinkHwMuteCtrl = 16
sinkFlagsToInt SinkDecibelVolume = 32
sinkFlagsToInt SinkFlatVolume = 64
sinkFlagsToInt SinkDynamicLatency = 128
sinkFlagsToInt SinkSetFormats = 256
sinkFlagssToInt :: [SinkFlags] -> CInt
sinkFlagssToInt = foldFlag sinkFlagsToInt
sinkFlagssFromInt :: CInt -> [SinkFlags]
sinkFlagssFromInt i =
let
t0 = if (i .&. 0 /= 0) then (SinkNoflags:) else id
t1 = if (i .&. 1 /= 0) then (SinkHwVolumeCtrl:) else id
t2 = if (i .&. 2 /= 0) then (SinkLatency:) else id
t3 = if (i .&. 4 /= 0) then (SinkHardware:) else id
t4 = if (i .&. 8 /= 0) then (SinkNetwork:) else id
t5 = if (i .&. 16 /= 0) then (SinkHwMuteCtrl:) else id
t6 = if (i .&. 32 /= 0) then (SinkDecibelVolume:) else id
t7 = if (i .&. 64 /= 0) then (SinkFlatVolume:) else id
t8 = if (i .&. 128 /= 0) then (SinkDynamicLatency:) else id
t9 = if (i .&. 256 /= 0) then (SinkSetFormats:) else id
in t0 . t1 . t2 . t3 . t4 . t5 . t6 . t7 . t8 . t9 . id $ []
data SourceFlags
= SourceNoflags
| SourceHwVolumeCtrl
| SourceLatency
| SourceHardware
| SourceNetwork
| SourceHwMuteCtrl
| SourceDecibelVolume
| SourceDynamicLatency
| SourceFlatVolume
deriving (Eq, Show)
sourceFlagsToInt :: SourceFlags -> CInt
sourceFlagsToInt SourceNoflags = 0
sourceFlagsToInt SourceHwVolumeCtrl = 1
sourceFlagsToInt SourceLatency = 2
sourceFlagsToInt SourceHardware = 4
sourceFlagsToInt SourceNetwork = 8
sourceFlagsToInt SourceHwMuteCtrl = 16
sourceFlagsToInt SourceDecibelVolume = 32
sourceFlagsToInt SourceDynamicLatency = 64
sourceFlagsToInt SourceFlatVolume = 128
sourceFlagssToInt :: [SourceFlags] -> CInt
sourceFlagssToInt = foldFlag sourceFlagsToInt
sourceFlagssFromInt :: CInt -> [SourceFlags]
sourceFlagssFromInt i =
let
t0 = if (i .&. 0 /= 0) then (SourceNoflags:) else id
t1 = if (i .&. 1 /= 0) then (SourceHwVolumeCtrl:) else id
t2 = if (i .&. 2 /= 0) then (SourceLatency:) else id
t3 = if (i .&. 4 /= 0) then (SourceHardware:) else id
t4 = if (i .&. 8 /= 0) then (SourceNetwork:) else id
t5 = if (i .&. 16 /= 0) then (SourceHwMuteCtrl:) else id
t6 = if (i .&. 32 /= 0) then (SourceDecibelVolume:) else id
t7 = if (i .&. 64 /= 0) then (SourceDynamicLatency:) else id
t8 = if (i .&. 128 /= 0) then (SourceFlatVolume:) else id
in t0 . t1 . t2 . t3 . t4 . t5 . t6 . t7 . t8 . id $ []