libvorbis-0.1.0.2: Haskell binding for libvorbis, for decoding Ogg Vorbis audio files

Safe HaskellNone
LanguageHaskell98

Codec.Audio.Vorbis.File

Contents

Description

High level API for decoding Ogg-Vorbis files or streams. This module is intended to be imported qualified, e.g.

import qualified Codec.Audio.Vorbis.File as V

Synopsis

Opening file or streams

openFile :: FilePath -> IO File Source #

Open the specified Ogg-Vorbis file for decoding.

openCallbacks Source #

Arguments

:: (Int -> Int -> IO ByteString)

Read function, taking size and nmemb

-> IO ()

Close function

-> Maybe (SeekMode -> Integer -> IO (), IO Integer)

Seek and tell functions

-> IO File 

Decode Ogg-Vorbis using the specified callbacks to do the back-end I/O. Seek and tell functions are optional.

withFile :: FilePath -> (File -> IO a) -> IO a Source #

Open the specified Ogg-Vorbis file for decoding.

Opens it using the loan pattern: Guaranteed to call close for you on completion (exception safe), so you must not call close explicitly.

withCallbacks Source #

Arguments

:: (Int -> Int -> IO ByteString)

Read function, taking size and nmemb

-> IO ()

Close function

-> Maybe (SeekMode -> Integer -> IO (), IO Integer)

Seek and tell functions

-> (File -> IO a) 
-> IO a 

Decode Ogg-Vorbis using the specified callbacks to do the back-end I/O. Seek and tell functions are optional.

Opens it using the loan pattern: Guaranteed to call close for you on completion (exception safe), so you must not call close explicitly.

File metadata

data Info Source #

Constructors

Info 

Instances

Read data from file

read Source #

Arguments

:: File 
-> Int

Maximum bytes to read (will typically return less than this)

-> Endianness

How to encode the samples as bytes

-> WordSize

Desired word size

-> Signedness

Whether you want signed or unsigned values

-> IO (Maybe (ByteString, Int)) 

Read data from the file. Returns the data block and the number of the current logical bitstream. Nothing for end of file.

data Endianness :: * #

represent the CPU endianness

Big endian system stores bytes with the MSB as the first byte. Little endian system stores bytes with the LSB as the first byte.

middle endian is purposely avoided.

Constructors

LittleEndian 
BigEndian 

getSystemEndianness :: Endianness #

return the system endianness

Close file

close :: File -> IO () Source #

Close the file once we've finished with it. Must be used with the handles returned by openFile and openCallbacks.