Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
- module SFML.Utils
- data SoundRecorderException = SoundRecorderException String
- type SoundRecorderStartCallback a = Ptr a -> IO CInt
- type SoundRecorderProcessCallback a = Ptr Word16 -> CUInt -> Ptr a -> IO Bool
- type SoundRecorderStopCallback a = Ptr a -> IO ()
- createSoundRecorder :: Ptr (SoundRecorderStartCallback a) -> Ptr (SoundRecorderProcessCallback a) -> Ptr (SoundRecorderStopCallback a) -> Ptr a -> IO (Either SoundRecorderException SoundRecorder)
- destroy :: SFResource a => a -> IO ()
- startRecording :: SFSoundRecorder a => a -> Int -> IO ()
- stopRecording :: SFSoundRecorder a => a -> IO ()
- getSampleRate :: SFSampled a => a -> IO Int
- isSoundRecorderAvailable :: IO Bool
Documentation
module SFML.Utils
type SoundRecorderStartCallback a = Ptr a -> IO CInt Source
Type of the callback used when starting a capture.
type SoundRecorderProcessCallback a = Ptr Word16 -> CUInt -> Ptr a -> IO Bool Source
Type of the callback used to process audio data.
type SoundRecorderStopCallback a = Ptr a -> IO () Source
Type of the callback used when stopping a capture.
:: Ptr (SoundRecorderStartCallback a) | (onStart) Callback function which will be called when a new capture starts (can be NULL) |
-> Ptr (SoundRecorderProcessCallback a) | (onProcess) Callback function which will be called each time there's audio data to process |
-> Ptr (SoundRecorderStopCallback a) | (onStop) Callback function which will be called when the current capture stops (can be NULL) |
-> Ptr a | Data to pass to the callback function (can be NULL) |
-> IO (Either SoundRecorderException SoundRecorder) | A new |
Construct a new sound recorder from callback functions.
destroy :: SFResource a => a -> IO () Source
Destroy the given SFML resource.
:: SFSoundRecorder a | |
=> a | |
-> Int | Desired capture rate, in number of samples per second |
-> IO () |
Start the capture of a sound recorder.
The sample rate parameter defines the number of audio samples captured per second. The higher, the better the quality (for example, 44100 samples/sec is CD quality).
This function uses its own thread so that it doesn't block the rest of the program while the capture runs.
Please note that only one capture can happen at the same time.
stopRecording :: SFSoundRecorder a => a -> IO () Source
Stop the capture of a sound recorder.
getSampleRate :: SFSampled a => a -> IO Int Source
Get the sample rate of a sound buffer.
The sample rate is the number of samples played per second. The higher, the better the quality (for example, 44100 samples/s is CD quality).
isSoundRecorderAvailable :: IO Bool Source
Check if the system supports audio capture.
This function should always be called before using
the audio capture features. If it returns false, then
any attempt to use SoundRecorder
will fail.