| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
SDL3.Sys.Bindgen.Audio
Description
Audio functionality for the SDL library.
All audio in SDL3 revolves around SDL_AudioStream. Whether you want to play or record audio, convert it, stream it, buffer it, or mix it, you're going to be passing it through an audio stream.
Audio streams are quite flexible; they can accept any amount of data at a time, in any supported format, and output it as needed in any other format, even if the data format changes on either side halfway through.
An app opens an audio device and binds any number of audio streams to it, feeding more data to the streams as available. When the device needs more data, it will pull it from all bound streams and mix them together for playback.
Audio streams can also use an app-provided callback to supply data on-demand, which maps pretty closely to the SDL2 audio model.
SDL also provides a simple .WAV loader in SDL_LoadWAV (and SDL_LoadWAV_IO if you aren't reading from a file) as a basic means to load sound data into your program.
Logical audio devices
In SDL3, opening a physical device (like a SoundBlaster 16 Pro) gives you a logical device ID that you can bind audio streams to. In almost all cases, logical devices can be used anywhere in the API that a physical device is normally used. However, since each device opening generates a new logical device, different parts of the program (say, a VoIP library, or text-to-speech framework, or maybe some other sort of mixer on top of SDL) can have their own device opens that do not interfere with each other; each logical device will mix its separate audio down to a single buffer, fed to the physical device, behind the scenes. As many logical devices as you like can come and go; SDL will only have to open the physical device at the OS level once, and will manage all the logical devices on top of it internally.
One other benefit of logical devices: if you don't open a specific physical device, instead opting for the default, SDL can automatically migrate those logical devices to different hardware as circumstances change: a user plugged in headphones? The system default changed? SDL can transparently migrate the logical devices to the correct physical device seamlessly and keep playing; the app doesn't even have to know it happened if it doesn't want to.
Simplified audio
As a simplified model for when a single source of audio is all that's needed, an app can use SDL_OpenAudioDeviceStream, which is a single function to open an audio device, create an audio stream, bind that stream to the newly-opened device, and (optionally) provide a callback for obtaining audio data. When using this function, the primary interface is the SDL_AudioStream and the device handle is mostly hidden away; destroying a stream created through this function will also close the device, stream bindings cannot be changed, etc. One other quirk of this is that the device is started in a paused state and must be explicitly resumed; this is partially to offer a clean migration for SDL2 apps and partially because the app might have to do more setup before playback begins; in the non-simplified form, nothing will play until a stream is bound to a device, so they start unpaused.
Channel layouts
Audio data passing through SDL is uncompressed PCM data, interleaved. One can provide their own decompression through an MP3, etc, decoder, but SDL does not provide this directly. Each interleaved channel of data is meant to be in a specific order.
Abbreviations:
- FRONT = single mono speaker
- FL = front left speaker
- FR = front right speaker
- FC = front center speaker
- BL = back left speaker
- BR = back right speaker
- SR = surround right speaker
- SL = surround left speaker
- BC = back center speaker
- LFE = low-frequency speaker
These are listed in the order they are laid out in memory, so "FL, FR" means "the front left speaker is laid out in memory first, then the front right, then it repeats for the next audio frame".
- 1 channel (mono) layout: FRONT
- 2 channels (stereo) layout: FL, FR
- 3 channels (2.1) layout: FL, FR, LFE
- 4 channels (quad) layout: FL, FR, BL, BR
- 5 channels (4.1) layout: FL, FR, LFE, BL, BR
- 6 channels (5.1) layout: FL, FR, FC, LFE, BL, BR (last two can also be SL, SR)
- 7 channels (6.1) layout: FL, FR, FC, LFE, BC, SL, SR
- 8 channels (7.1) layout: FL, FR, FC, LFE, BL, BR, SL, SR
This is the same order as DirectSound expects, but applied to all platforms; SDL will swizzle the channels as necessary if a platform expects something different.
SDL_AudioStream can also be provided channel maps to change this ordering to whatever is necessary, in other audio processing scenarios. Mask of bits in an SDL_AudioFormat that contains the format bit size.
Generally one should use SDL_AUDIO_BITSIZE instead of this macro directly.
Since: 3.2.0
Synopsis
- sDL_AUDIO_MASK_BITSIZE :: CUInt
- sDL_AUDIO_MASK_FLOAT :: CUInt
- sDL_AUDIO_MASK_BIG_ENDIAN :: CUInt
- sDL_AUDIO_MASK_SIGNED :: CUInt
- newtype SDL_AudioFormat = SDL_AudioFormat {}
- pattern SDL_AUDIO_UNKNOWN :: SDL_AudioFormat
- pattern SDL_AUDIO_U8 :: SDL_AudioFormat
- pattern SDL_AUDIO_S8 :: SDL_AudioFormat
- pattern SDL_AUDIO_S16LE :: SDL_AudioFormat
- pattern SDL_AUDIO_S16BE :: SDL_AudioFormat
- pattern SDL_AUDIO_S32LE :: SDL_AudioFormat
- pattern SDL_AUDIO_S32BE :: SDL_AudioFormat
- pattern SDL_AUDIO_F32LE :: SDL_AudioFormat
- pattern SDL_AUDIO_F32BE :: SDL_AudioFormat
- pattern SDL_AUDIO_S16 :: SDL_AudioFormat
- pattern SDL_AUDIO_S32 :: SDL_AudioFormat
- pattern SDL_AUDIO_F32 :: SDL_AudioFormat
- sDL_AUDIO_BITSIZE :: Bitwise a0 CUInt => a0 -> BitsRes a0 CUInt
- sDL_AUDIO_BYTESIZE :: (Div (BitsRes a0 CUInt) CInt, Bitwise a0 CUInt) => a0 -> DivRes (BitsRes a0 CUInt) CInt
- sDL_AUDIO_ISFLOAT :: Bitwise a0 CUInt => a0 -> BitsRes a0 CUInt
- sDL_AUDIO_ISBIGENDIAN :: Bitwise a0 CUInt => a0 -> BitsRes a0 CUInt
- sDL_AUDIO_ISLITTLEENDIAN :: (Not (BitsRes a0 CUInt), Bitwise a0 CUInt) => a0 -> CInt
- sDL_AUDIO_ISSIGNED :: Bitwise a0 CUInt => a0 -> BitsRes a0 CUInt
- sDL_AUDIO_ISINT :: (Not (BitsRes a0 CUInt), Bitwise a0 CUInt) => a0 -> CInt
- sDL_AUDIO_ISUNSIGNED :: (Not (BitsRes a0 CUInt), Bitwise a0 CUInt) => a0 -> CInt
- newtype SDL_AudioDeviceID = SDL_AudioDeviceID {}
- data SDL_AudioSpec = SDL_AudioSpec {}
- data SDL_AudioStream
- sDL_PROP_AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN :: ByteString
- newtype SDL_AudioStreamDataCompleteCallback_Aux = SDL_AudioStreamDataCompleteCallback_Aux {}
- newtype SDL_AudioStreamDataCompleteCallback = SDL_AudioStreamDataCompleteCallback {}
- newtype SDL_AudioStreamCallback_Aux = SDL_AudioStreamCallback_Aux {}
- newtype SDL_AudioStreamCallback = SDL_AudioStreamCallback {}
- newtype SDL_AudioPostmixCallback_Aux = SDL_AudioPostmixCallback_Aux {}
- newtype SDL_AudioPostmixCallback = SDL_AudioPostmixCallback {}
Documentation
sDL_AUDIO_MASK_BITSIZE :: CUInt Source #
- C declaration
macro SDL_AUDIO_MASK_BITSIZE, defined atSDL3/SDL_audio.h 151:9
sDL_AUDIO_MASK_FLOAT :: CUInt Source #
Mask of bits in an SDL_AudioFormat that contain the floating point flag.
Generally one should use SDL_AUDIO_ISFLOAT instead of this macro directly.
- C declaration
macro SDL_AUDIO_MASK_FLOAT, defined atSDL3/SDL_audio.h 160:9
Since: 3.2.0
sDL_AUDIO_MASK_BIG_ENDIAN :: CUInt Source #
Mask of bits in an SDL_AudioFormat that contain the bigendian flag.
Generally one should use SDL_AUDIO_ISBIGENDIAN or SDL_AUDIO_ISLITTLEENDIAN instead of this macro directly.
- C declaration
macro SDL_AUDIO_MASK_BIG_ENDIAN, defined atSDL3/SDL_audio.h 170:9
Since: 3.2.0
sDL_AUDIO_MASK_SIGNED :: CUInt Source #
Mask of bits in an SDL_AudioFormat that contain the signed data flag.
Generally one should use SDL_AUDIO_ISSIGNED instead of this macro directly.
- C declaration
macro SDL_AUDIO_MASK_SIGNED, defined atSDL3/SDL_audio.h 179:9
Since: 3.2.0
newtype SDL_AudioFormat Source #
Audio format.
- See also
sDL_AUDIO_BITSIZE,sDL_AUDIO_BYTESIZE,sDL_AUDIO_ISINT,sDL_AUDIO_ISFLOAT,sDL_AUDIO_ISBIGENDIAN,sDL_AUDIO_ISLITTLEENDIAN,sDL_AUDIO_ISSIGNED,sDL_AUDIO_ISUNSIGNED- C declaration
enum SDL_AudioFormat, defined atSDL3/SDL_audio.h 221:14
Since: 3.2.0
Constructors
| SDL_AudioFormat | |
Instances
pattern SDL_AUDIO_UNKNOWN :: SDL_AudioFormat Source #
Unspecified audio format
- C declaration
SDL_AUDIO_UNKNOWN, defined atSDL3/SDL_audio.h 223:5
pattern SDL_AUDIO_U8 :: SDL_AudioFormat Source #
Unsigned 8-bit samples
- C declaration
SDL_AUDIO_U8, defined atSDL3/SDL_audio.h 224:5
pattern SDL_AUDIO_S8 :: SDL_AudioFormat Source #
Signed 8-bit samples
- C declaration
SDL_AUDIO_S8, defined atSDL3/SDL_audio.h 226:5
pattern SDL_AUDIO_S16LE :: SDL_AudioFormat Source #
Signed 16-bit samples
- C declaration
SDL_AUDIO_S16LE, defined atSDL3/SDL_audio.h 228:5
pattern SDL_AUDIO_S16BE :: SDL_AudioFormat Source #
As above, but big-endian byte order
- C declaration
SDL_AUDIO_S16BE, defined atSDL3/SDL_audio.h 230:5
pattern SDL_AUDIO_S32LE :: SDL_AudioFormat Source #
32-bit integer samples
- C declaration
SDL_AUDIO_S32LE, defined atSDL3/SDL_audio.h 232:5
pattern SDL_AUDIO_S32BE :: SDL_AudioFormat Source #
As above, but big-endian byte order
- C declaration
SDL_AUDIO_S32BE, defined atSDL3/SDL_audio.h 234:5
pattern SDL_AUDIO_F32LE :: SDL_AudioFormat Source #
32-bit floating point samples
- C declaration
SDL_AUDIO_F32LE, defined atSDL3/SDL_audio.h 236:5
pattern SDL_AUDIO_F32BE :: SDL_AudioFormat Source #
As above, but big-endian byte order
- C declaration
SDL_AUDIO_F32BE, defined atSDL3/SDL_audio.h 238:5
pattern SDL_AUDIO_S16 :: SDL_AudioFormat Source #
- C declaration
SDL_AUDIO_S16, defined atSDL3/SDL_audio.h 243:5
pattern SDL_AUDIO_S32 :: SDL_AudioFormat Source #
- C declaration
SDL_AUDIO_S32, defined atSDL3/SDL_audio.h 244:5
pattern SDL_AUDIO_F32 :: SDL_AudioFormat Source #
- C declaration
SDL_AUDIO_F32, defined atSDL3/SDL_audio.h 245:5
sDL_AUDIO_BITSIZE :: Bitwise a0 CUInt => a0 -> BitsRes a0 CUInt Source #
Retrieve the size, in bits, from an SDL_AudioFormat.
For example, SDL_AUDIO_BITSIZE(SDL_AUDIO_S16) returns 16.
x- an
SDL_AudioFormatvalue. - Returns
- data size in bits.
- Thread safety
- It is safe to call this macro from any thread.
- C declaration
macro SDL_AUDIO_BITSIZE, defined atSDL3/SDL_audio.h 266:9
Since: 3.2.0
sDL_AUDIO_BYTESIZE :: (Div (BitsRes a0 CUInt) CInt, Bitwise a0 CUInt) => a0 -> DivRes (BitsRes a0 CUInt) CInt Source #
Retrieve the size, in bytes, from an SDL_AudioFormat.
For example, SDL_AUDIO_BYTESIZE(SDL_AUDIO_S16) returns 2.
x- an
SDL_AudioFormatvalue. - Returns
- data size in bytes.
- Thread safety
- It is safe to call this macro from any thread.
- C declaration
macro SDL_AUDIO_BYTESIZE, defined atSDL3/SDL_audio.h 280:9
Since: 3.2.0
sDL_AUDIO_ISFLOAT :: Bitwise a0 CUInt => a0 -> BitsRes a0 CUInt Source #
Determine if an SDL_AudioFormat represents floating point data.
For example, SDL_AUDIO_ISFLOAT(SDL_AUDIO_S16) returns 0.
x- an
SDL_AudioFormatvalue. - Returns
- non-zero if format is floating point, zero otherwise.
- Thread safety
- It is safe to call this macro from any thread.
- C declaration
macro SDL_AUDIO_ISFLOAT, defined atSDL3/SDL_audio.h 294:9
Since: 3.2.0
sDL_AUDIO_ISBIGENDIAN :: Bitwise a0 CUInt => a0 -> BitsRes a0 CUInt Source #
Determine if an SDL_AudioFormat represents bigendian data.
For example, SDL_AUDIO_ISBIGENDIAN(SDL_AUDIO_S16LE) returns 0.
x- an
SDL_AudioFormatvalue. - Returns
- non-zero if format is bigendian, zero otherwise.
- Thread safety
- It is safe to call this macro from any thread.
- C declaration
macro SDL_AUDIO_ISBIGENDIAN, defined atSDL3/SDL_audio.h 308:9
Since: 3.2.0
sDL_AUDIO_ISLITTLEENDIAN :: (Not (BitsRes a0 CUInt), Bitwise a0 CUInt) => a0 -> CInt Source #
Determine if an SDL_AudioFormat represents littleendian data.
For example, SDL_AUDIO_ISLITTLEENDIAN(SDL_AUDIO_S16BE) returns 0.
x- an
SDL_AudioFormatvalue. - Returns
- non-zero if format is littleendian, zero otherwise.
- Thread safety
- It is safe to call this macro from any thread.
- C declaration
macro SDL_AUDIO_ISLITTLEENDIAN, defined atSDL3/SDL_audio.h 322:9
Since: 3.2.0
sDL_AUDIO_ISSIGNED :: Bitwise a0 CUInt => a0 -> BitsRes a0 CUInt Source #
Determine if an SDL_AudioFormat represents signed data.
For example, SDL_AUDIO_ISSIGNED(SDL_AUDIO_U8) returns 0.
x- an
SDL_AudioFormatvalue. - Returns
- non-zero if format is signed, zero otherwise.
- Thread safety
- It is safe to call this macro from any thread.
- C declaration
macro SDL_AUDIO_ISSIGNED, defined atSDL3/SDL_audio.h 336:9
Since: 3.2.0
sDL_AUDIO_ISINT :: (Not (BitsRes a0 CUInt), Bitwise a0 CUInt) => a0 -> CInt Source #
Determine if an SDL_AudioFormat represents integer data.
For example, SDL_AUDIO_ISINT(SDL_AUDIO_F32) returns 0.
x- an
SDL_AudioFormatvalue. - Returns
- non-zero if format is integer, zero otherwise.
- Thread safety
- It is safe to call this macro from any thread.
- C declaration
macro SDL_AUDIO_ISINT, defined atSDL3/SDL_audio.h 350:9
Since: 3.2.0
sDL_AUDIO_ISUNSIGNED :: (Not (BitsRes a0 CUInt), Bitwise a0 CUInt) => a0 -> CInt Source #
Determine if an SDL_AudioFormat represents unsigned data.
For example, SDL_AUDIO_ISUNSIGNED(SDL_AUDIO_S16) returns 0.
x- an
SDL_AudioFormatvalue. - Returns
- non-zero if format is unsigned, zero otherwise.
- Thread safety
- It is safe to call this macro from any thread.
- C declaration
macro SDL_AUDIO_ISUNSIGNED, defined atSDL3/SDL_audio.h 364:9
Since: 3.2.0
newtype SDL_AudioDeviceID Source #
SDL Audio Device instance IDs.
Zero is used to signify an invalid/null device.
- C declaration
SDL_AudioDeviceID, defined atSDL3/SDL_audio.h 374:16
Since: 3.2.0
Constructors
| SDL_AudioDeviceID | |
Instances
| Bits SDL_AudioDeviceID Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods (.&.) :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> SDL_AudioDeviceID # (.|.) :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> SDL_AudioDeviceID # xor :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> SDL_AudioDeviceID # complement :: SDL_AudioDeviceID -> SDL_AudioDeviceID # shift :: SDL_AudioDeviceID -> Int -> SDL_AudioDeviceID # rotate :: SDL_AudioDeviceID -> Int -> SDL_AudioDeviceID # zeroBits :: SDL_AudioDeviceID # bit :: Int -> SDL_AudioDeviceID # setBit :: SDL_AudioDeviceID -> Int -> SDL_AudioDeviceID # clearBit :: SDL_AudioDeviceID -> Int -> SDL_AudioDeviceID # complementBit :: SDL_AudioDeviceID -> Int -> SDL_AudioDeviceID # testBit :: SDL_AudioDeviceID -> Int -> Bool # bitSizeMaybe :: SDL_AudioDeviceID -> Maybe Int # bitSize :: SDL_AudioDeviceID -> Int # isSigned :: SDL_AudioDeviceID -> Bool # shiftL :: SDL_AudioDeviceID -> Int -> SDL_AudioDeviceID # unsafeShiftL :: SDL_AudioDeviceID -> Int -> SDL_AudioDeviceID # shiftR :: SDL_AudioDeviceID -> Int -> SDL_AudioDeviceID # unsafeShiftR :: SDL_AudioDeviceID -> Int -> SDL_AudioDeviceID # rotateL :: SDL_AudioDeviceID -> Int -> SDL_AudioDeviceID # rotateR :: SDL_AudioDeviceID -> Int -> SDL_AudioDeviceID # popCount :: SDL_AudioDeviceID -> Int # | |||||
| FiniteBits SDL_AudioDeviceID Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio | |||||
| Bounded SDL_AudioDeviceID Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio | |||||
| Enum SDL_AudioDeviceID Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods succ :: SDL_AudioDeviceID -> SDL_AudioDeviceID # pred :: SDL_AudioDeviceID -> SDL_AudioDeviceID # toEnum :: Int -> SDL_AudioDeviceID # fromEnum :: SDL_AudioDeviceID -> Int # enumFrom :: SDL_AudioDeviceID -> [SDL_AudioDeviceID] # enumFromThen :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> [SDL_AudioDeviceID] # enumFromTo :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> [SDL_AudioDeviceID] # enumFromThenTo :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> SDL_AudioDeviceID -> [SDL_AudioDeviceID] # | |||||
| Storable SDL_AudioDeviceID Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods sizeOf :: SDL_AudioDeviceID -> Int # alignment :: SDL_AudioDeviceID -> Int # peekElemOff :: Ptr SDL_AudioDeviceID -> Int -> IO SDL_AudioDeviceID # pokeElemOff :: Ptr SDL_AudioDeviceID -> Int -> SDL_AudioDeviceID -> IO () # peekByteOff :: Ptr b -> Int -> IO SDL_AudioDeviceID # pokeByteOff :: Ptr b -> Int -> SDL_AudioDeviceID -> IO () # peek :: Ptr SDL_AudioDeviceID -> IO SDL_AudioDeviceID # poke :: Ptr SDL_AudioDeviceID -> SDL_AudioDeviceID -> IO () # | |||||
| Generic SDL_AudioDeviceID Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Associated Types
Methods from :: SDL_AudioDeviceID -> Rep SDL_AudioDeviceID x # to :: Rep SDL_AudioDeviceID x -> SDL_AudioDeviceID # | |||||
| Ix SDL_AudioDeviceID Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods range :: (SDL_AudioDeviceID, SDL_AudioDeviceID) -> [SDL_AudioDeviceID] # index :: (SDL_AudioDeviceID, SDL_AudioDeviceID) -> SDL_AudioDeviceID -> Int # unsafeIndex :: (SDL_AudioDeviceID, SDL_AudioDeviceID) -> SDL_AudioDeviceID -> Int # inRange :: (SDL_AudioDeviceID, SDL_AudioDeviceID) -> SDL_AudioDeviceID -> Bool # rangeSize :: (SDL_AudioDeviceID, SDL_AudioDeviceID) -> Int # unsafeRangeSize :: (SDL_AudioDeviceID, SDL_AudioDeviceID) -> Int # | |||||
| Num SDL_AudioDeviceID Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods (+) :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> SDL_AudioDeviceID # (-) :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> SDL_AudioDeviceID # (*) :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> SDL_AudioDeviceID # negate :: SDL_AudioDeviceID -> SDL_AudioDeviceID # abs :: SDL_AudioDeviceID -> SDL_AudioDeviceID # signum :: SDL_AudioDeviceID -> SDL_AudioDeviceID # fromInteger :: Integer -> SDL_AudioDeviceID # | |||||
| Read SDL_AudioDeviceID Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods readsPrec :: Int -> ReadS SDL_AudioDeviceID # readList :: ReadS [SDL_AudioDeviceID] # | |||||
| Integral SDL_AudioDeviceID Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods quot :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> SDL_AudioDeviceID # rem :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> SDL_AudioDeviceID # div :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> SDL_AudioDeviceID # mod :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> SDL_AudioDeviceID # quotRem :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> (SDL_AudioDeviceID, SDL_AudioDeviceID) # divMod :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> (SDL_AudioDeviceID, SDL_AudioDeviceID) # toInteger :: SDL_AudioDeviceID -> Integer # | |||||
| Real SDL_AudioDeviceID Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods toRational :: SDL_AudioDeviceID -> Rational # | |||||
| Show SDL_AudioDeviceID Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods showsPrec :: Int -> SDL_AudioDeviceID -> ShowS # show :: SDL_AudioDeviceID -> String # showList :: [SDL_AudioDeviceID] -> ShowS # | |||||
| Eq SDL_AudioDeviceID Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods (==) :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> Bool # (/=) :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> Bool # | |||||
| Ord SDL_AudioDeviceID Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods compare :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> Ordering # (<) :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> Bool # (<=) :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> Bool # (>) :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> Bool # (>=) :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> Bool # max :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> SDL_AudioDeviceID # min :: SDL_AudioDeviceID -> SDL_AudioDeviceID -> SDL_AudioDeviceID # | |||||
| Prim SDL_AudioDeviceID Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods sizeOfType# :: Proxy SDL_AudioDeviceID -> Int# # sizeOf# :: SDL_AudioDeviceID -> Int# # alignmentOfType# :: Proxy SDL_AudioDeviceID -> Int# # alignment# :: SDL_AudioDeviceID -> Int# # indexByteArray# :: ByteArray# -> Int# -> SDL_AudioDeviceID # readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, SDL_AudioDeviceID #) # writeByteArray# :: MutableByteArray# s -> Int# -> SDL_AudioDeviceID -> State# s -> State# s # setByteArray# :: MutableByteArray# s -> Int# -> Int# -> SDL_AudioDeviceID -> State# s -> State# s # indexOffAddr# :: Addr# -> Int# -> SDL_AudioDeviceID # readOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, SDL_AudioDeviceID #) # writeOffAddr# :: Addr# -> Int# -> SDL_AudioDeviceID -> State# s -> State# s # setOffAddr# :: Addr# -> Int# -> Int# -> SDL_AudioDeviceID -> State# s -> State# s # | |||||
| HasFFIType SDL_AudioDeviceID Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Associated Types
Methods toFFIType :: SDL_AudioDeviceID -> FFIType SDL_AudioDeviceID # fromFFIType :: FFIType SDL_AudioDeviceID -> SDL_AudioDeviceID # | |||||
| ReadRaw SDL_AudioDeviceID Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods | |||||
| StaticSize SDL_AudioDeviceID Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods staticSizeOf :: Proxy SDL_AudioDeviceID -> Int # | |||||
| WriteRaw SDL_AudioDeviceID Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods writeRaw :: Ptr SDL_AudioDeviceID -> SDL_AudioDeviceID -> IO () # | |||||
| Bitfield SDL_AudioDeviceID Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio | |||||
| HasCField SDL_AudioDeviceID "unwrap" Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Associated Types
| |||||
| ty ~ Uint32 => HasField "unwrap" SDL_AudioDeviceID ty Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods hasField :: SDL_AudioDeviceID -> (ty -> SDL_AudioDeviceID, ty) # | |||||
| ty ~ Uint32 => HasField "unwrap" (Ptr SDL_AudioDeviceID) (Ptr ty :: Type) Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods getField :: Ptr SDL_AudioDeviceID -> Ptr ty # | |||||
| type Rep SDL_AudioDeviceID Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio type Rep SDL_AudioDeviceID = D1 ('MetaData "SDL_AudioDeviceID" "SDL3.Sys.Bindgen.Audio" "sdl3-bindgen-sys-0.0.1.0-inplace" 'True) (C1 ('MetaCons "SDL_AudioDeviceID" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Uint32))) | |||||
| type FFIType SDL_AudioDeviceID Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio | |||||
| type CFieldType SDL_AudioDeviceID "unwrap" Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio | |||||
data SDL_AudioSpec Source #
Format specifier for audio data.
- See also
SDL_AudioFormat- C declaration
struct SDL_AudioSpec, defined atSDL3/SDL_audio.h 405:16
Since: 3.2.0
Constructors
| SDL_AudioSpec | |
Fields
| |
Instances
| Storable SDL_AudioSpec Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods sizeOf :: SDL_AudioSpec -> Int # alignment :: SDL_AudioSpec -> Int # peekElemOff :: Ptr SDL_AudioSpec -> Int -> IO SDL_AudioSpec # pokeElemOff :: Ptr SDL_AudioSpec -> Int -> SDL_AudioSpec -> IO () # peekByteOff :: Ptr b -> Int -> IO SDL_AudioSpec # pokeByteOff :: Ptr b -> Int -> SDL_AudioSpec -> IO () # peek :: Ptr SDL_AudioSpec -> IO SDL_AudioSpec # poke :: Ptr SDL_AudioSpec -> SDL_AudioSpec -> IO () # | |||||
| Generic SDL_AudioSpec Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Associated Types
| |||||
| Show SDL_AudioSpec Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods showsPrec :: Int -> SDL_AudioSpec -> ShowS # show :: SDL_AudioSpec -> String # showList :: [SDL_AudioSpec] -> ShowS # | |||||
| Eq SDL_AudioSpec Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods (==) :: SDL_AudioSpec -> SDL_AudioSpec -> Bool # (/=) :: SDL_AudioSpec -> SDL_AudioSpec -> Bool # | |||||
| ReadRaw SDL_AudioSpec Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods readRaw :: Ptr SDL_AudioSpec -> IO SDL_AudioSpec # | |||||
| StaticSize SDL_AudioSpec Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio | |||||
| WriteRaw SDL_AudioSpec Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods writeRaw :: Ptr SDL_AudioSpec -> SDL_AudioSpec -> IO () # | |||||
| IsStruct SDL_AudioSpec Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods zero :: SDL_AudioSpec # | |||||
| HasCField SDL_AudioSpec "channels" Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Associated Types
| |||||
| HasCField SDL_AudioSpec "format" Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Associated Types
| |||||
| HasCField SDL_AudioSpec "freq" Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Associated Types
| |||||
| ty ~ CInt => HasField "channels" SDL_AudioSpec ty Source # | Number of channels: 1 mono, 2 stereo, etc
| ||||
Defined in SDL3.Sys.Bindgen.Audio Methods hasField :: SDL_AudioSpec -> (ty -> SDL_AudioSpec, ty) # | |||||
| ty ~ SDL_AudioFormat => HasField "format" SDL_AudioSpec ty Source # | Audio data format
| ||||
Defined in SDL3.Sys.Bindgen.Audio Methods hasField :: SDL_AudioSpec -> (ty -> SDL_AudioSpec, ty) # | |||||
| ty ~ CInt => HasField "freq" SDL_AudioSpec ty Source # | sample rate: sample frames per second
| ||||
Defined in SDL3.Sys.Bindgen.Audio Methods hasField :: SDL_AudioSpec -> (ty -> SDL_AudioSpec, ty) # | |||||
| ty ~ CInt => HasField "channels" (Ptr SDL_AudioSpec) (Ptr ty :: Type) Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods getField :: Ptr SDL_AudioSpec -> Ptr ty # | |||||
| ty ~ SDL_AudioFormat => HasField "format" (Ptr SDL_AudioSpec) (Ptr ty :: Type) Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods getField :: Ptr SDL_AudioSpec -> Ptr ty # | |||||
| ty ~ CInt => HasField "freq" (Ptr SDL_AudioSpec) (Ptr ty :: Type) Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods getField :: Ptr SDL_AudioSpec -> Ptr ty # | |||||
| type Rep SDL_AudioSpec Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio type Rep SDL_AudioSpec = D1 ('MetaData "SDL_AudioSpec" "SDL3.Sys.Bindgen.Audio" "sdl3-bindgen-sys-0.0.1.0-inplace" 'False) (C1 ('MetaCons "SDL_AudioSpec" 'PrefixI 'True) (S1 ('MetaSel ('Just "format") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SDL_AudioFormat) :*: (S1 ('MetaSel ('Just "channels") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 CInt) :*: S1 ('MetaSel ('Just "freq") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 CInt)))) | |||||
| type CFieldType SDL_AudioSpec "channels" Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio | |||||
| type CFieldType SDL_AudioSpec "format" Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio | |||||
| type CFieldType SDL_AudioSpec "freq" Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio | |||||
data SDL_AudioStream Source #
The opaque handle that represents an audio stream.
SDL_AudioStream is an audio conversion interface.
- It can handle resampling data in chunks without generating artifacts, when it doesn't have the complete buffer available.
- It can handle incoming data in any variable size.
- It can handle input/output format changes on the fly.
- It can remap audio channels between inputs and outputs.
- You push data as you have it, and pull it when you need it; the stream will buffer data as needed.
- It can also function as a basic audio data queue even if you just have sound that needs to pass from one place to another.
- You can hook callbacks up to them when more data is added or requested, to manage data on-the-fly.
Audio streams are the core of the SDL3 audio interface. You create one or more of them, bind them to an opened audio device, and feed data to them (or for recording, consume data from them).
- See also
sDL_CreateAudioStream- C declaration
struct SDL_AudioStream, defined atSDL3/SDL_audio.h 452:16
Since: 3.2.0
sDL_PROP_AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN :: ByteString Source #
- C declaration
macro SDL_PROP_AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN, literal"SDL.audiostream.auto_cleanup", defined atSDL3/SDL_audio.h 1108:9
newtype SDL_AudioStreamDataCompleteCallback_Aux Source #
Auxiliary type used by SDL_AudioStreamDataCompleteCallback
- C declaration
SDL_AudioStreamDataCompleteCallback, defined atSDL3/SDL_audio.h 1483:24
Constructors
| SDL_AudioStreamDataCompleteCallback_Aux | |
Instances
| Generic SDL_AudioStreamDataCompleteCallback_Aux Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Associated Types
| |||||
| FromFunPtr SDL_AudioStreamDataCompleteCallback_Aux Source # | |||||
| ToFunPtr SDL_AudioStreamDataCompleteCallback_Aux Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio | |||||
| HasCField SDL_AudioStreamDataCompleteCallback_Aux "unwrap" Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Associated Types
| |||||
| ty ~ (Ptr Void -> PtrConst Void -> CInt -> IO ()) => HasField "unwrap" SDL_AudioStreamDataCompleteCallback_Aux ty Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods hasField :: SDL_AudioStreamDataCompleteCallback_Aux -> (ty -> SDL_AudioStreamDataCompleteCallback_Aux, ty) # | |||||
| ty ~ (Ptr Void -> PtrConst Void -> CInt -> IO ()) => HasField "unwrap" (Ptr SDL_AudioStreamDataCompleteCallback_Aux) (Ptr ty :: Type) Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods getField :: Ptr SDL_AudioStreamDataCompleteCallback_Aux -> Ptr ty # | |||||
| type Rep SDL_AudioStreamDataCompleteCallback_Aux Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio type Rep SDL_AudioStreamDataCompleteCallback_Aux = D1 ('MetaData "SDL_AudioStreamDataCompleteCallback_Aux" "SDL3.Sys.Bindgen.Audio" "sdl3-bindgen-sys-0.0.1.0-inplace" 'True) (C1 ('MetaCons "SDL_AudioStreamDataCompleteCallback_Aux" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Ptr Void -> PtrConst Void -> CInt -> IO ())))) | |||||
| type CFieldType SDL_AudioStreamDataCompleteCallback_Aux "unwrap" Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio type CFieldType SDL_AudioStreamDataCompleteCallback_Aux "unwrap" = Ptr Void -> PtrConst Void -> CInt -> IO () | |||||
newtype SDL_AudioStreamDataCompleteCallback Source #
A callback that fires for completed SDL_PutAudioStreamDataNoCopy() data.
When using SDL_PutAudioStreamDataNoCopy() to provide data to an SDL_AudioStream, it's not safe to dispose of the data until the stream has completely consumed it. Often times it's difficult to know exactly when this has happened.
This callback fires once when the stream no longer needs the buffer, allowing the app to easily free or reuse it.
userdata- an opaque pointer provided by the app for their personal use.
buf- the pointer provided to
SDL_PutAudioStreamDataNoCopy(). buflen- the size of buffer, in bytes, provided to
SDL_PutAudioStreamDataNoCopy(). - Thread safety
- This callbacks may run from any thread, so if you need to protect shared data, you should use SDL_LockAudioStream to serialize access; this lock will be held before your callback is called, so your callback does not need to manage the lock explicitly.
- See also
sDL_SetAudioStreamGetCallback,sDL_SetAudioStreamPutCallback- C declaration
SDL_AudioStreamDataCompleteCallback, defined atSDL3/SDL_audio.h 1483:24
Since: 3.4.0
Constructors
| SDL_AudioStreamDataCompleteCallback | |
Instances
| Storable SDL_AudioStreamDataCompleteCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods sizeOf :: SDL_AudioStreamDataCompleteCallback -> Int # alignment :: SDL_AudioStreamDataCompleteCallback -> Int # peekElemOff :: Ptr SDL_AudioStreamDataCompleteCallback -> Int -> IO SDL_AudioStreamDataCompleteCallback # pokeElemOff :: Ptr SDL_AudioStreamDataCompleteCallback -> Int -> SDL_AudioStreamDataCompleteCallback -> IO () # peekByteOff :: Ptr b -> Int -> IO SDL_AudioStreamDataCompleteCallback # pokeByteOff :: Ptr b -> Int -> SDL_AudioStreamDataCompleteCallback -> IO () # peek :: Ptr SDL_AudioStreamDataCompleteCallback -> IO SDL_AudioStreamDataCompleteCallback # poke :: Ptr SDL_AudioStreamDataCompleteCallback -> SDL_AudioStreamDataCompleteCallback -> IO () # | |||||
| Generic SDL_AudioStreamDataCompleteCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Associated Types
| |||||
| Show SDL_AudioStreamDataCompleteCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods showsPrec :: Int -> SDL_AudioStreamDataCompleteCallback -> ShowS # show :: SDL_AudioStreamDataCompleteCallback -> String # showList :: [SDL_AudioStreamDataCompleteCallback] -> ShowS # | |||||
| Eq SDL_AudioStreamDataCompleteCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio | |||||
| Ord SDL_AudioStreamDataCompleteCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods compare :: SDL_AudioStreamDataCompleteCallback -> SDL_AudioStreamDataCompleteCallback -> Ordering # (<) :: SDL_AudioStreamDataCompleteCallback -> SDL_AudioStreamDataCompleteCallback -> Bool # (<=) :: SDL_AudioStreamDataCompleteCallback -> SDL_AudioStreamDataCompleteCallback -> Bool # (>) :: SDL_AudioStreamDataCompleteCallback -> SDL_AudioStreamDataCompleteCallback -> Bool # (>=) :: SDL_AudioStreamDataCompleteCallback -> SDL_AudioStreamDataCompleteCallback -> Bool # max :: SDL_AudioStreamDataCompleteCallback -> SDL_AudioStreamDataCompleteCallback -> SDL_AudioStreamDataCompleteCallback # min :: SDL_AudioStreamDataCompleteCallback -> SDL_AudioStreamDataCompleteCallback -> SDL_AudioStreamDataCompleteCallback # | |||||
| HasFFIType SDL_AudioStreamDataCompleteCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Associated Types
| |||||
| ReadRaw SDL_AudioStreamDataCompleteCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio | |||||
| StaticSize SDL_AudioStreamDataCompleteCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio | |||||
| WriteRaw SDL_AudioStreamDataCompleteCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods writeRaw :: Ptr SDL_AudioStreamDataCompleteCallback -> SDL_AudioStreamDataCompleteCallback -> IO () # | |||||
| HasCField SDL_AudioStreamDataCompleteCallback "unwrap" Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Associated Types
| |||||
| ty ~ FunPtr SDL_AudioStreamDataCompleteCallback_Aux => HasField "unwrap" SDL_AudioStreamDataCompleteCallback ty Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods hasField :: SDL_AudioStreamDataCompleteCallback -> (ty -> SDL_AudioStreamDataCompleteCallback, ty) # | |||||
| ty ~ FunPtr SDL_AudioStreamDataCompleteCallback_Aux => HasField "unwrap" (Ptr SDL_AudioStreamDataCompleteCallback) (Ptr ty :: Type) Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods getField :: Ptr SDL_AudioStreamDataCompleteCallback -> Ptr ty # | |||||
| type Rep SDL_AudioStreamDataCompleteCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio type Rep SDL_AudioStreamDataCompleteCallback = D1 ('MetaData "SDL_AudioStreamDataCompleteCallback" "SDL3.Sys.Bindgen.Audio" "sdl3-bindgen-sys-0.0.1.0-inplace" 'True) (C1 ('MetaCons "SDL_AudioStreamDataCompleteCallback" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (FunPtr SDL_AudioStreamDataCompleteCallback_Aux)))) | |||||
| type FFIType SDL_AudioStreamDataCompleteCallback Source # | |||||
| type CFieldType SDL_AudioStreamDataCompleteCallback "unwrap" Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio | |||||
newtype SDL_AudioStreamCallback_Aux Source #
Auxiliary type used by SDL_AudioStreamCallback
- C declaration
SDL_AudioStreamCallback, defined atSDL3/SDL_audio.h 1878:24
Constructors
| SDL_AudioStreamCallback_Aux | |
Instances
| Generic SDL_AudioStreamCallback_Aux Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Associated Types
Methods from :: SDL_AudioStreamCallback_Aux -> Rep SDL_AudioStreamCallback_Aux x # to :: Rep SDL_AudioStreamCallback_Aux x -> SDL_AudioStreamCallback_Aux # | |||||
| FromFunPtr SDL_AudioStreamCallback_Aux Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio | |||||
| ToFunPtr SDL_AudioStreamCallback_Aux Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods toFunPtr :: SDL_AudioStreamCallback_Aux -> IO (FunPtr SDL_AudioStreamCallback_Aux) # | |||||
| HasCField SDL_AudioStreamCallback_Aux "unwrap" Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Associated Types
| |||||
| ty ~ (Ptr Void -> Ptr SDL_AudioStream -> CInt -> CInt -> IO ()) => HasField "unwrap" SDL_AudioStreamCallback_Aux ty Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods hasField :: SDL_AudioStreamCallback_Aux -> (ty -> SDL_AudioStreamCallback_Aux, ty) # | |||||
| ty ~ (Ptr Void -> Ptr SDL_AudioStream -> CInt -> CInt -> IO ()) => HasField "unwrap" (Ptr SDL_AudioStreamCallback_Aux) (Ptr ty :: Type) Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods getField :: Ptr SDL_AudioStreamCallback_Aux -> Ptr ty # | |||||
| type Rep SDL_AudioStreamCallback_Aux Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio type Rep SDL_AudioStreamCallback_Aux = D1 ('MetaData "SDL_AudioStreamCallback_Aux" "SDL3.Sys.Bindgen.Audio" "sdl3-bindgen-sys-0.0.1.0-inplace" 'True) (C1 ('MetaCons "SDL_AudioStreamCallback_Aux" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Ptr Void -> Ptr SDL_AudioStream -> CInt -> CInt -> IO ())))) | |||||
| type CFieldType SDL_AudioStreamCallback_Aux "unwrap" Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio type CFieldType SDL_AudioStreamCallback_Aux "unwrap" = Ptr Void -> Ptr SDL_AudioStream -> CInt -> CInt -> IO () | |||||
newtype SDL_AudioStreamCallback Source #
A callback that fires when data passes through an SDL_AudioStream.
Apps can (optionally) register a callback with an audio stream that is called when data is added with SDL_PutAudioStreamData, or requested with SDL_GetAudioStreamData.
Two values are offered here: one is the amount of additional data needed to satisfy the immediate request (which might be zero if the stream already has enough data queued) and the other is the total amount being requested. In a Get call triggering a Put callback, these values can be different. In a Put call triggering a Get callback, these values are always the same.
Byte counts might be slightly overestimated due to buffering or resampling, and may change from call to call.
This callback is not required to do anything. Generally this is useful for adding/reading data on demand, and the app will often put/get data as appropriate, but the system goes on with the data currently available to it if this callback does nothing.
Do not call SDL_DestroyAudioStream() on stream during this callback.
stream- the SDL audio stream associated with this callback.
additional_amount- the amount of data, in bytes, that is needed right now.
total_amount- the total amount of data requested, in bytes, that is requested or available.
userdata- an opaque pointer provided by the app for their personal use.
- Thread safety
- This callbacks may run from any thread, so if you need to protect shared data, you should use SDL_LockAudioStream to serialize access; this lock will be held before your callback is called, so your callback does not need to manage the lock explicitly.
- See also
sDL_SetAudioStreamGetCallback,sDL_SetAudioStreamPutCallback- C declaration
SDL_AudioStreamCallback, defined atSDL3/SDL_audio.h 1878:24
Since: 3.2.0
Constructors
| SDL_AudioStreamCallback | |
Fields | |
Instances
| Storable SDL_AudioStreamCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods sizeOf :: SDL_AudioStreamCallback -> Int # alignment :: SDL_AudioStreamCallback -> Int # peekElemOff :: Ptr SDL_AudioStreamCallback -> Int -> IO SDL_AudioStreamCallback # pokeElemOff :: Ptr SDL_AudioStreamCallback -> Int -> SDL_AudioStreamCallback -> IO () # peekByteOff :: Ptr b -> Int -> IO SDL_AudioStreamCallback # pokeByteOff :: Ptr b -> Int -> SDL_AudioStreamCallback -> IO () # peek :: Ptr SDL_AudioStreamCallback -> IO SDL_AudioStreamCallback # poke :: Ptr SDL_AudioStreamCallback -> SDL_AudioStreamCallback -> IO () # | |||||
| Generic SDL_AudioStreamCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Associated Types
Methods from :: SDL_AudioStreamCallback -> Rep SDL_AudioStreamCallback x # to :: Rep SDL_AudioStreamCallback x -> SDL_AudioStreamCallback # | |||||
| Show SDL_AudioStreamCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods showsPrec :: Int -> SDL_AudioStreamCallback -> ShowS # show :: SDL_AudioStreamCallback -> String # showList :: [SDL_AudioStreamCallback] -> ShowS # | |||||
| Eq SDL_AudioStreamCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods (==) :: SDL_AudioStreamCallback -> SDL_AudioStreamCallback -> Bool # (/=) :: SDL_AudioStreamCallback -> SDL_AudioStreamCallback -> Bool # | |||||
| Ord SDL_AudioStreamCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods compare :: SDL_AudioStreamCallback -> SDL_AudioStreamCallback -> Ordering # (<) :: SDL_AudioStreamCallback -> SDL_AudioStreamCallback -> Bool # (<=) :: SDL_AudioStreamCallback -> SDL_AudioStreamCallback -> Bool # (>) :: SDL_AudioStreamCallback -> SDL_AudioStreamCallback -> Bool # (>=) :: SDL_AudioStreamCallback -> SDL_AudioStreamCallback -> Bool # max :: SDL_AudioStreamCallback -> SDL_AudioStreamCallback -> SDL_AudioStreamCallback # min :: SDL_AudioStreamCallback -> SDL_AudioStreamCallback -> SDL_AudioStreamCallback # | |||||
| HasFFIType SDL_AudioStreamCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Associated Types
| |||||
| ReadRaw SDL_AudioStreamCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods readRaw :: Ptr SDL_AudioStreamCallback -> IO SDL_AudioStreamCallback # | |||||
| StaticSize SDL_AudioStreamCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods | |||||
| WriteRaw SDL_AudioStreamCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods writeRaw :: Ptr SDL_AudioStreamCallback -> SDL_AudioStreamCallback -> IO () # | |||||
| HasCField SDL_AudioStreamCallback "unwrap" Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Associated Types
| |||||
| ty ~ FunPtr SDL_AudioStreamCallback_Aux => HasField "unwrap" SDL_AudioStreamCallback ty Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods hasField :: SDL_AudioStreamCallback -> (ty -> SDL_AudioStreamCallback, ty) # | |||||
| ty ~ FunPtr SDL_AudioStreamCallback_Aux => HasField "unwrap" (Ptr SDL_AudioStreamCallback) (Ptr ty :: Type) Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods getField :: Ptr SDL_AudioStreamCallback -> Ptr ty # | |||||
| type Rep SDL_AudioStreamCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio type Rep SDL_AudioStreamCallback = D1 ('MetaData "SDL_AudioStreamCallback" "SDL3.Sys.Bindgen.Audio" "sdl3-bindgen-sys-0.0.1.0-inplace" 'True) (C1 ('MetaCons "SDL_AudioStreamCallback" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (FunPtr SDL_AudioStreamCallback_Aux)))) | |||||
| type FFIType SDL_AudioStreamCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio | |||||
| type CFieldType SDL_AudioStreamCallback "unwrap" Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio | |||||
newtype SDL_AudioPostmixCallback_Aux Source #
Auxiliary type used by SDL_AudioPostmixCallback
- C declaration
SDL_AudioPostmixCallback, defined atSDL3/SDL_audio.h 2095:24
Constructors
| SDL_AudioPostmixCallback_Aux | |
Instances
| Generic SDL_AudioPostmixCallback_Aux Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Associated Types
| |||||
| FromFunPtr SDL_AudioPostmixCallback_Aux Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio | |||||
| ToFunPtr SDL_AudioPostmixCallback_Aux Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods toFunPtr :: SDL_AudioPostmixCallback_Aux -> IO (FunPtr SDL_AudioPostmixCallback_Aux) # | |||||
| HasCField SDL_AudioPostmixCallback_Aux "unwrap" Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Associated Types
| |||||
| ty ~ (Ptr Void -> PtrConst SDL_AudioSpec -> Ptr CFloat -> CInt -> IO ()) => HasField "unwrap" SDL_AudioPostmixCallback_Aux ty Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods hasField :: SDL_AudioPostmixCallback_Aux -> (ty -> SDL_AudioPostmixCallback_Aux, ty) # | |||||
| ty ~ (Ptr Void -> PtrConst SDL_AudioSpec -> Ptr CFloat -> CInt -> IO ()) => HasField "unwrap" (Ptr SDL_AudioPostmixCallback_Aux) (Ptr ty :: Type) Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods getField :: Ptr SDL_AudioPostmixCallback_Aux -> Ptr ty # | |||||
| type Rep SDL_AudioPostmixCallback_Aux Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio type Rep SDL_AudioPostmixCallback_Aux = D1 ('MetaData "SDL_AudioPostmixCallback_Aux" "SDL3.Sys.Bindgen.Audio" "sdl3-bindgen-sys-0.0.1.0-inplace" 'True) (C1 ('MetaCons "SDL_AudioPostmixCallback_Aux" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Ptr Void -> PtrConst SDL_AudioSpec -> Ptr CFloat -> CInt -> IO ())))) | |||||
| type CFieldType SDL_AudioPostmixCallback_Aux "unwrap" Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio type CFieldType SDL_AudioPostmixCallback_Aux "unwrap" = Ptr Void -> PtrConst SDL_AudioSpec -> Ptr CFloat -> CInt -> IO () | |||||
newtype SDL_AudioPostmixCallback Source #
A callback that fires when data is about to be fed to an audio device.
This is useful for accessing the final mix, perhaps for writing a visualizer or applying a final effect to the audio data before playback.
This callback should run as quickly as possible and not block for any significant time, as this callback delays submission of data to the audio device, which can cause audio playback problems.
The postmix callback must be able to handle any audio data format specified in spec, which can change between callbacks if the audio device changed. However, this only covers frequency and channel count; data is always provided here in SDL_AUDIO_F32 format.
The postmix callback runs after logical device gain and audiostream gain have been applied, which is to say you can make the output data louder at this point than the gain settings would suggest.
userdata- a pointer provided by the app through SDL_SetAudioPostmixCallback, for its own use.
spec- the current format of audio that is to be submitted to the audio device.
buffer- the buffer of audio samples to be submitted. The callback can inspect and/or modify this data.
buflen- the size of
bufferin bytes. - Thread safety
- This will run from a background thread owned by SDL. The application is responsible for locking resources the callback touches that need to be protected.
- See also
sDL_SetAudioPostmixCallback- C declaration
SDL_AudioPostmixCallback, defined atSDL3/SDL_audio.h 2095:24
Since: 3.2.0
Constructors
| SDL_AudioPostmixCallback | |
Fields | |
Instances
| Storable SDL_AudioPostmixCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods sizeOf :: SDL_AudioPostmixCallback -> Int # alignment :: SDL_AudioPostmixCallback -> Int # peekElemOff :: Ptr SDL_AudioPostmixCallback -> Int -> IO SDL_AudioPostmixCallback # pokeElemOff :: Ptr SDL_AudioPostmixCallback -> Int -> SDL_AudioPostmixCallback -> IO () # peekByteOff :: Ptr b -> Int -> IO SDL_AudioPostmixCallback # pokeByteOff :: Ptr b -> Int -> SDL_AudioPostmixCallback -> IO () # peek :: Ptr SDL_AudioPostmixCallback -> IO SDL_AudioPostmixCallback # poke :: Ptr SDL_AudioPostmixCallback -> SDL_AudioPostmixCallback -> IO () # | |||||
| Generic SDL_AudioPostmixCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Associated Types
Methods from :: SDL_AudioPostmixCallback -> Rep SDL_AudioPostmixCallback x # to :: Rep SDL_AudioPostmixCallback x -> SDL_AudioPostmixCallback # | |||||
| Show SDL_AudioPostmixCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods showsPrec :: Int -> SDL_AudioPostmixCallback -> ShowS # show :: SDL_AudioPostmixCallback -> String # showList :: [SDL_AudioPostmixCallback] -> ShowS # | |||||
| Eq SDL_AudioPostmixCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods (==) :: SDL_AudioPostmixCallback -> SDL_AudioPostmixCallback -> Bool # (/=) :: SDL_AudioPostmixCallback -> SDL_AudioPostmixCallback -> Bool # | |||||
| Ord SDL_AudioPostmixCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods compare :: SDL_AudioPostmixCallback -> SDL_AudioPostmixCallback -> Ordering # (<) :: SDL_AudioPostmixCallback -> SDL_AudioPostmixCallback -> Bool # (<=) :: SDL_AudioPostmixCallback -> SDL_AudioPostmixCallback -> Bool # (>) :: SDL_AudioPostmixCallback -> SDL_AudioPostmixCallback -> Bool # (>=) :: SDL_AudioPostmixCallback -> SDL_AudioPostmixCallback -> Bool # max :: SDL_AudioPostmixCallback -> SDL_AudioPostmixCallback -> SDL_AudioPostmixCallback # min :: SDL_AudioPostmixCallback -> SDL_AudioPostmixCallback -> SDL_AudioPostmixCallback # | |||||
| HasFFIType SDL_AudioPostmixCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Associated Types
| |||||
| ReadRaw SDL_AudioPostmixCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods readRaw :: Ptr SDL_AudioPostmixCallback -> IO SDL_AudioPostmixCallback # | |||||
| StaticSize SDL_AudioPostmixCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods | |||||
| WriteRaw SDL_AudioPostmixCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods writeRaw :: Ptr SDL_AudioPostmixCallback -> SDL_AudioPostmixCallback -> IO () # | |||||
| HasCField SDL_AudioPostmixCallback "unwrap" Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Associated Types
| |||||
| ty ~ FunPtr SDL_AudioPostmixCallback_Aux => HasField "unwrap" SDL_AudioPostmixCallback ty Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods hasField :: SDL_AudioPostmixCallback -> (ty -> SDL_AudioPostmixCallback, ty) # | |||||
| ty ~ FunPtr SDL_AudioPostmixCallback_Aux => HasField "unwrap" (Ptr SDL_AudioPostmixCallback) (Ptr ty :: Type) Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio Methods getField :: Ptr SDL_AudioPostmixCallback -> Ptr ty # | |||||
| type Rep SDL_AudioPostmixCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio type Rep SDL_AudioPostmixCallback = D1 ('MetaData "SDL_AudioPostmixCallback" "SDL3.Sys.Bindgen.Audio" "sdl3-bindgen-sys-0.0.1.0-inplace" 'True) (C1 ('MetaCons "SDL_AudioPostmixCallback" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (FunPtr SDL_AudioPostmixCallback_Aux)))) | |||||
| type FFIType SDL_AudioPostmixCallback Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio | |||||
| type CFieldType SDL_AudioPostmixCallback "unwrap" Source # | |||||
Defined in SDL3.Sys.Bindgen.Audio | |||||