Safe Haskell | None |
---|
Partial binding to the DirectSound API.
- peekMaybe :: Storable a => Ptr a -> IO (Maybe a)
- withMaybe :: Storable a => Maybe a -> (Ptr a -> IO b) -> IO b
- type Method obj fun = Ptr obj -> fun
- type HWND = HANDLE
- data DSCaps
- type IID = GUID
- type RefIID = Ptr IID
- data DSFXDesc
- data DSBufferCaps = DSBufferCaps {}
- data WaveFormatTag
- marshalWaveFormatTag :: WaveFormatTag -> Word16
- data WaveFormatX = WaveFormatX {}
- data Channels
- data Format
- makeWaveFormatX :: Int -> Int -> Format -> WaveFormatX
- dsbcaps_PrimaryBuffer :: DWORD
- dsbcaps_Static :: DWORD
- dsbcaps_StickyFocus :: DWORD
- dsbcaps_GlobalFocus :: DWORD
- dsbcaps_GetCurrentPos2 :: DWORD
- dsbcaps_CtrlPositionNotify :: DWORD
- data DSBufferDesc = DSBufferDesc {}
- withSecondaryDSBufferDesc :: WaveFormatX -> Int -> (Ptr DSBufferDesc -> IO a) -> IO a
- type RefGUID = Ptr GUID
- data GUID = GUID {
- guid_chunk1 :: !Word64
- guid_chunk2 :: !Word64
- guidNull :: GUID
- data CooperativeLevel
- marshalCooperativeLevel :: CooperativeLevel -> DWORD
- type DS8Method fun = Method IDirectSound8 fun
- type QueryInterface = RefIID -> Ptr (Ptr ()) -> IO HRESULT
- type AddRef = IO ()
- type Release = IO ()
- type CreateSoundBuffer = Ptr DSBufferDesc -> Ptr (Ptr ISoundBuffer8) -> Ptr () -> IO HRESULT
- type DSGetCaps = Ptr DSCaps -> IO HRESULT
- type DuplicateSoundBuffer = Ptr ISoundBuffer8 -> Ptr (Ptr ISoundBuffer8) -> IO HRESULT
- type SetCooperativeLevel = HWND -> DWORD -> IO HRESULT
- type Compact = IO HRESULT
- type GetSpeakerConfig = Ptr DWORD -> IO HRESULT
- type SetSpeakerConfig = DWORD -> IO HRESULT
- type DSInitialize = Ptr GUID -> IO HRESULT
- type VerifyCertification = DWORD -> IO ()
- data IDirectSound8Vtbl = IDirectSound8Vtbl {
- ids8_QueryInterface :: FunPtr (Ptr IDirectSound8 -> QueryInterface)
- ids8_AddRef :: FunPtr (Ptr IDirectSound8 -> AddRef)
- ids8_Release :: FunPtr (Ptr IDirectSound8 -> Release)
- ids8_CreateSoundBuffer :: FunPtr (Ptr IDirectSound8 -> CreateSoundBuffer)
- ids8_GetCaps :: FunPtr (Ptr IDirectSound8 -> DSGetCaps)
- ids8_DuplicateSoundBuffer :: FunPtr (Ptr IDirectSound8 -> DuplicateSoundBuffer)
- ids8_SetCooperativeLevel :: FunPtr (Ptr IDirectSound8 -> SetCooperativeLevel)
- ids8_Compact :: FunPtr (Ptr IDirectSound8 -> Compact)
- ids8_GetSpeakerConfig :: FunPtr (Ptr IDirectSound8 -> GetSpeakerConfig)
- ids8_SetSpeakerConfig :: FunPtr (Ptr IDirectSound8 -> SetSpeakerConfig)
- ids8_Initialize :: FunPtr (Ptr IDirectSound8 -> DSInitialize)
- ids8_VerifyCertification :: FunPtr (Ptr IDirectSound8 -> VerifyCertification)
- newtype IDirectSound8 = IDirectSound8 {}
- data DirectSound = DirectSound8 {
- ds_directSound8object :: Ptr IDirectSound8
- ds_windowHandle :: HWND
- ds_queryInterface :: QueryInterface
- ds_addRef :: AddRef
- ds_release :: Release
- ds_createSoundBuffer :: CreateSoundBuffer
- ds_getCaps :: DSGetCaps
- ds_duplicateSoundBuffer :: DuplicateSoundBuffer
- ds_setCooperativeLevel :: SetCooperativeLevel
- ds_compact :: Compact
- ds_getSpeakerConfig :: GetSpeakerConfig
- ds_setSpeakerConfig :: SetSpeakerConfig
- ds_initialize :: DSInitialize
- ds_verifyCertification :: VerifyCertification
- mkDirectSound8 :: Ptr IDirectSound8 -> HWND -> IO DirectSound
- mkDSQueryInterfaceMethod :: FunPtr (DS8Method QueryInterface) -> DS8Method QueryInterface
- mkDSAddRefMethod :: FunPtr (DS8Method AddRef) -> DS8Method AddRef
- mkDSReleaseMethod :: FunPtr (DS8Method Release) -> DS8Method Release
- mkCreateSoundBufferMethod :: FunPtr (DS8Method CreateSoundBuffer) -> DS8Method CreateSoundBuffer
- mkDSGetCapsMethod :: FunPtr (DS8Method DSGetCaps) -> DS8Method DSGetCaps
- mkDuplicateSoundBufferMethod :: FunPtr (DS8Method DuplicateSoundBuffer) -> DS8Method DuplicateSoundBuffer
- mkSetCooperativeLevelMethod :: FunPtr (DS8Method SetCooperativeLevel) -> DS8Method SetCooperativeLevel
- mkCompactMethod :: FunPtr (DS8Method Compact) -> DS8Method Compact
- mkGetSpeakerConfigMethod :: FunPtr (DS8Method GetSpeakerConfig) -> DS8Method GetSpeakerConfig
- mkSetSpeakerConfigMethod :: FunPtr (DS8Method SetSpeakerConfig) -> DS8Method SetSpeakerConfig
- mkDSInitializeMethod :: FunPtr (DS8Method DSInitialize) -> DS8Method DSInitialize
- mkVerifyCertificationMethod :: FunPtr (DS8Method VerifyCertification) -> DS8Method VerifyCertification
- c_DirectSoundCreate8 :: Ptr GUID -> Ptr (Ptr IDirectSound8) -> Ptr () -> IO HRESULT
- setCooperativeLevel :: DirectSound -> CooperativeLevel -> IO ()
- directSoundCreate :: Maybe Driver -> HWND -> IO (Either String DirectSound)
- data Driver = Driver {}
- type DSEnumCallbackW a = Ptr GUID -> CWString -> CWString -> Ptr a -> IO Bool
- type DSEnumCallbackA a = Ptr GUID -> CString -> CString -> Ptr a -> IO Bool
- mkDSEnumCallbackW :: DSEnumCallbackW () -> IO (FunPtr (DSEnumCallbackW ()))
- c_DirectSoundEnumerateW :: FunPtr (DSEnumCallbackW a) -> Ptr a -> IO HRESULT
- enumCallbackW :: DSEnumCallbackW ()
- enumerateDrivers :: IO [Driver]
- type SB8Method fun = Method ISoundBuffer8 fun
- type SBGetCaps = Ptr DSBufferCaps -> IO HRESULT
- type GetCurrentPosition = Ptr DWORD -> Ptr DWORD -> IO HRESULT
- type GetFormat = Ptr WaveFormatX -> DWORD -> Ptr DWORD -> IO HRESULT
- type GetVolume = Ptr LONG -> IO HRESULT
- type GetPan = Ptr LONG -> IO HRESULT
- type GetFrequency = Ptr DWORD -> IO HRESULT
- type GetStatus = Ptr DWORD -> IO HRESULT
- type SBInitialize = Ptr IDirectSound8 -> Ptr DSBufferDesc -> IO HRESULT
- type SBLock = DWORD -> DWORD -> Ptr (Ptr ()) -> Ptr DWORD -> Ptr (Ptr ()) -> Ptr DWORD -> DWORD -> IO HRESULT
- type SBPlay = DWORD -> DWORD -> DWORD -> IO HRESULT
- type SetCurrentPosition = DWORD -> IO HRESULT
- type SetFormat = Ptr WaveFormatX -> IO HRESULT
- type SetVolume = LONG -> IO HRESULT
- type SetPan = LONG -> IO HRESULT
- type SetFrequency = DWORD -> IO HRESULT
- type SBStop = IO HRESULT
- type SBUnlock = Ptr () -> DWORD -> Ptr () -> DWORD -> IO HRESULT
- type SBRestore = IO HRESULT
- type SetFX = DWORD -> Ptr DSFXDesc -> Ptr DWORD -> IO HRESULT
- type AcquireResources = DWORD -> DWORD -> Ptr DWORD -> IO HRESULT
- type GetObjectInPath = RefGUID -> DWORD -> RefGUID -> Ptr (Ptr ()) -> IO HRESULT
- newtype ISoundBuffer8 = ISoundBuffer8 {}
- data ISoundBuffer8Vtbl = ISoundBuffer8Vtbl {
- isb8_QueryInterface :: FunPtr (Ptr ISoundBuffer8 -> QueryInterface)
- isb8_AddRef :: FunPtr (Ptr ISoundBuffer8 -> AddRef)
- isb8_Release :: FunPtr (Ptr ISoundBuffer8 -> Release)
- isb8_GetCaps :: FunPtr (Ptr ISoundBuffer8 -> SBGetCaps)
- isb8_GetCurrentPosition :: FunPtr (Ptr ISoundBuffer8 -> GetCurrentPosition)
- isb8_GetFormat :: FunPtr (Ptr ISoundBuffer8 -> GetFormat)
- isb8_GetVolume :: FunPtr (Ptr ISoundBuffer8 -> GetVolume)
- isb8_GetPan :: FunPtr (Ptr ISoundBuffer8 -> GetPan)
- isb8_GetFrequency :: FunPtr (Ptr ISoundBuffer8 -> GetFrequency)
- isb8_GetStatus :: FunPtr (Ptr ISoundBuffer8 -> GetStatus)
- isb8_Initialize :: FunPtr (Ptr ISoundBuffer8 -> SBInitialize)
- isb8_Lock :: FunPtr (Ptr ISoundBuffer8 -> SBLock)
- isb8_Play :: FunPtr (Ptr ISoundBuffer8 -> SBPlay)
- isb8_SetCurrentPosition :: FunPtr (Ptr ISoundBuffer8 -> SetCurrentPosition)
- isb8_SetFormat :: FunPtr (Ptr ISoundBuffer8 -> SetFormat)
- isb8_SetVolume :: FunPtr (Ptr ISoundBuffer8 -> SetVolume)
- isb8_SetPan :: FunPtr (Ptr ISoundBuffer8 -> SetPan)
- isb8_SetFrequency :: FunPtr (Ptr ISoundBuffer8 -> SetFrequency)
- isb8_Stop :: FunPtr (Ptr ISoundBuffer8 -> SBStop)
- isb8_Unlock :: FunPtr (Ptr ISoundBuffer8 -> SBUnlock)
- isb8_Restore :: FunPtr (Ptr ISoundBuffer8 -> SBRestore)
- isb8_SetFX :: FunPtr (Ptr ISoundBuffer8 -> SetFX)
- isb8_AcquireResources :: FunPtr (Ptr ISoundBuffer8 -> AcquireResources)
- isb8_GetObjectInPath :: FunPtr (Ptr ISoundBuffer8 -> GetObjectInPath)
- isb8_peekQueryInterface :: Ptr ISoundBuffer8 -> IO QueryInterface
- mkSBQueryInterface :: FunPtr (SB8Method QueryInterface) -> SB8Method QueryInterface
- mkSBAddRef :: FunPtr (SB8Method AddRef) -> SB8Method AddRef
- mkSBRelease :: FunPtr (SB8Method Release) -> SB8Method Release
- mkSBGetCaps :: FunPtr (SB8Method SBGetCaps) -> SB8Method SBGetCaps
- mkGetCurrentPosition :: FunPtr (SB8Method GetCurrentPosition) -> SB8Method GetCurrentPosition
- mkGetFormat :: FunPtr (SB8Method GetFormat) -> SB8Method GetFormat
- mkGetVolume :: FunPtr (SB8Method GetVolume) -> SB8Method GetVolume
- mkGetPan :: FunPtr (SB8Method GetPan) -> SB8Method GetPan
- mkGetFrequency :: FunPtr (SB8Method GetFrequency) -> SB8Method GetFrequency
- mkGetStatus :: FunPtr (SB8Method GetStatus) -> SB8Method GetStatus
- mkSBInitialize :: FunPtr (SB8Method SBInitialize) -> SB8Method SBInitialize
- mkSBLock :: FunPtr (SB8Method SBLock) -> SB8Method SBLock
- mkSBPlay :: FunPtr (SB8Method SBPlay) -> SB8Method SBPlay
- mkSetCurrentPosition :: FunPtr (SB8Method SetCurrentPosition) -> SB8Method SetCurrentPosition
- mkSetFormat :: FunPtr (SB8Method SetFormat) -> SB8Method SetFormat
- mkSetVolume :: FunPtr (SB8Method SetVolume) -> SB8Method SetVolume
- mkSetPan :: FunPtr (SB8Method SetPan) -> SB8Method SetPan
- mkSetFrequency :: FunPtr (SB8Method SetFrequency) -> SB8Method SetFrequency
- mkSBStop :: FunPtr (SB8Method SBStop) -> SB8Method SBStop
- mkSBUnlock :: FunPtr (SB8Method SBUnlock) -> SB8Method SBUnlock
- mkSBRestore :: FunPtr (SB8Method SBRestore) -> SB8Method SBRestore
- mkSetFX :: FunPtr (SB8Method SetFX) -> SB8Method SetFX
- mkAcquireResources :: FunPtr (SB8Method AcquireResources) -> SB8Method AcquireResources
- mkGetObjectInPath :: FunPtr (SB8Method GetObjectInPath) -> SB8Method GetObjectInPath
- data SoundBuffer = SoundBuffer8 {
- sb_soundBufer8object :: Ptr ISoundBuffer8
- sb_waveFormatX :: WaveFormatX
- sb_bufSizeInFrames :: Word32
- sb_queryInterface :: QueryInterface
- sb_addRef :: AddRef
- sb_release :: Release
- sb_getCaps :: SBGetCaps
- sb_getCurrentPosition :: GetCurrentPosition
- sb_getFormat :: GetFormat
- sb_getVolume :: GetVolume
- sb_getPan :: GetPan
- sb_getFrequency :: GetFrequency
- sb_getStatus :: GetStatus
- sb_initialize :: SBInitialize
- sb_lock :: SBLock
- sb_play :: SBPlay
- sb_setCurrentPosition :: SetCurrentPosition
- sb_setFormat :: SetFormat
- sb_setVolume :: SetVolume
- sb_setPan :: SetPan
- sb_setFrequency :: SetFrequency
- sb_stop :: SBStop
- sb_unlock :: SBUnlock
- sb_restore :: SBRestore
- sb_setFX :: SetFX
- sb_acquireResources :: AcquireResources
- sb_getObjectInPath :: GetObjectInPath
- mkSoundBuffer8 :: Ptr ISoundBuffer8 -> WaveFormatX -> Word32 -> IO SoundBuffer
- type SetNotificationPositions = DWORD -> Ptr DSBPositionNotify -> IO HRESULT
- newtype IDSNotify8 = IDSNotify8 {}
- data IDSNotify8Vtbl = IDSNotify8Vtbl {}
- idsn8_peekSetNotificationPositions :: Ptr IDSNotify8 -> IO SetNotificationPositions
- mkSetNotificationPositions :: FunPtr (Ptr IDSNotify8 -> SetNotificationPositions) -> Ptr IDSNotify8 -> SetNotificationPositions
- makeGUID :: Word32 -> Word16 -> Word16 -> [Word8] -> GUID
- iid_IDirectSoundBuffer8 :: GUID
- iid_IDirectSoundNotify :: GUID
- createSoundBuffer :: DirectSound -> WaveFormatX -> Int -> IO (Either String SoundBuffer)
- sbQueryInterface :: SoundBuffer -> GUID -> IO (Ptr a)
- getCurrentPlayWritePosition :: SoundBuffer -> IO (Word32, Word32)
- getCurrentPlayPosition :: SoundBuffer -> IO Word32
- getCurrentWritePosition :: SoundBuffer -> IO Word32
- setCurrentPosition :: SoundBuffer -> Word32 -> IO ()
- dsblock_FromWriteCursor :: DWORD
- dsblock_EntireBuffer :: DWORD
- data Portion a = Portion !(Ptr a) !Word32
- withLockedBuffer :: SoundBuffer -> Word32 -> Word32 -> (Portion a -> Maybe (Portion a) -> IO b) -> IO b
- data DSBPositionNotify = DSBPositionNotify {}
- c_CreateEventA :: Ptr () -> BOOL -> BOOL -> CString -> IO HANDLE
- data DoubleBuffering = DoubleBuffering {}
- closeDoubleBuffering :: DoubleBuffering -> IO ()
- setupDoubleBuffering :: SoundBuffer -> IO DoubleBuffering
- c_WaitForMultipleObjects :: DWORD -> Ptr HANDLE -> BOOL -> DWORD -> IO DWORD
- type FillBufferCallback a = Ptr a -> Word32 -> IO ()
- dsbplay_Looping :: DWORD
- playWithDoubleBuffering :: SoundBuffer -> FillBufferCallback a -> IO (IO ())
- c_GetConsoleTitleW :: CWString -> DWORD -> IO DWORD
- c_SetConsoleTitleW :: CWString -> IO BOOL
- getConsoleHWND_hack :: IO HWND
Documentation
data DSCaps
data DSFXDesc
data DSBufferCaps
data WaveFormatX
WaveFormatX | |
|
data Format
:: Int | sample rate |
-> Int | number of channels |
-> Format | sample format |
-> WaveFormatX |
data DSBufferDesc
withSecondaryDSBufferDesc :: WaveFormatX -> Int -> (Ptr DSBufferDesc -> IO a) -> IO a
type DS8Method fun = Method IDirectSound8 fun
type CreateSoundBuffer = Ptr DSBufferDesc -> Ptr (Ptr ISoundBuffer8) -> Ptr () -> IO HRESULT
type DuplicateSoundBuffer = Ptr ISoundBuffer8 -> Ptr (Ptr ISoundBuffer8) -> IO HRESULT
type SetCooperativeLevel = HWND -> DWORD -> IO HRESULT
type GetSpeakerConfig = Ptr DWORD -> IO HRESULT
type SetSpeakerConfig = DWORD -> IO HRESULT
type DSInitialize = Ptr GUID -> IO HRESULT
type VerifyCertification = DWORD -> IO ()
data IDirectSound8Vtbl
data DirectSound
The Haskell version of the DirectSound8
object
mkDirectSound8 :: Ptr IDirectSound8 -> HWND -> IO DirectSound
mkDuplicateSoundBufferMethod :: FunPtr (DS8Method DuplicateSoundBuffer) -> DS8Method DuplicateSoundBuffer
mkSetCooperativeLevelMethod :: FunPtr (DS8Method SetCooperativeLevel) -> DS8Method SetCooperativeLevel
mkVerifyCertificationMethod :: FunPtr (DS8Method VerifyCertification) -> DS8Method VerifyCertification
c_DirectSoundCreate8 :: Ptr GUID -> Ptr (Ptr IDirectSound8) -> Ptr () -> IO HRESULT
setCooperativeLevel :: DirectSound -> CooperativeLevel -> IO ()
directSoundCreate :: Maybe Driver -> HWND -> IO (Either String DirectSound)
mkDSEnumCallbackW :: DSEnumCallbackW () -> IO (FunPtr (DSEnumCallbackW ()))
c_DirectSoundEnumerateW :: FunPtr (DSEnumCallbackW a) -> Ptr a -> IO HRESULT
enumCallbackW :: DSEnumCallbackW ()
enumerateDrivers :: IO [Driver]
type SB8Method fun = Method ISoundBuffer8 fun
type SBGetCaps = Ptr DSBufferCaps -> IO HRESULT
type GetFrequency = Ptr DWORD -> IO HRESULT
type SBInitialize = Ptr IDirectSound8 -> Ptr DSBufferDesc -> IO HRESULT
type SBLock = DWORD -> DWORD -> Ptr (Ptr ()) -> Ptr DWORD -> Ptr (Ptr ()) -> Ptr DWORD -> DWORD -> IO HRESULT
type SetCurrentPosition = DWORD -> IO HRESULT
type SetFormat = Ptr WaveFormatX -> IO HRESULT
type SetFrequency = DWORD -> IO HRESULT
data ISoundBuffer8Vtbl
data SoundBuffer
the Haskell version of the IDirectSoundBuffer8
object
mkSoundBuffer8 :: Ptr ISoundBuffer8 -> WaveFormatX -> Word32 -> IO SoundBuffer
type SetNotificationPositions = DWORD -> Ptr DSBPositionNotify -> IO HRESULT
data IDSNotify8Vtbl
mkSetNotificationPositions :: FunPtr (Ptr IDSNotify8 -> SetNotificationPositions) -> Ptr IDSNotify8 -> SetNotificationPositions
createSoundBuffer :: DirectSound -> WaveFormatX -> Int -> IO (Either String SoundBuffer)
sbQueryInterface :: SoundBuffer -> GUID -> IO (Ptr a)
getCurrentPlayWritePosition :: SoundBuffer -> IO (Word32, Word32)
setCurrentPosition :: SoundBuffer -> Word32 -> IO ()
withLockedBuffer :: SoundBuffer -> Word32 -> Word32 -> (Portion a -> Maybe (Portion a) -> IO b) -> IO b
data DSBPositionNotify
closeDoubleBuffering :: DoubleBuffering -> IO ()
setupDoubleBuffering :: SoundBuffer -> IO DoubleBuffering
Sets up the sound buffer for double buffered continous playback
type FillBufferCallback a = Ptr a -> Word32 -> IO ()
the second argument is number of frames, not bytes!
playWithDoubleBuffering :: SoundBuffer -> FillBufferCallback a -> IO (IO ())
Forks a new lightweight thread. Returns the action for stopping the playback.
c_GetConsoleTitleW :: CWString -> DWORD -> IO DWORD
c_SetConsoleTitleW :: CWString -> IO BOOL