Safe Haskell | Safe-Inferred |
---|
Audio.TagLib.Internal
- newtype TagLib a = TagLib {}
- data TagLibFile = TagLibFile {
- filePtr :: Ptr File
- tagPtr :: Ptr Tag
- audioPropPtr :: Ptr AudioProperties
- newtype FileId = FileId Integer
- data File
- data Tag
- data AudioProperties
- data TagLibEnv = TagLibEnv {}
- initialEnv :: TagLibEnv
- onFilesOpen :: (Map FileId TagLibFile -> Map FileId TagLibFile) -> TagLibEnv -> TagLibEnv
- onNextId :: (Integer -> Integer) -> TagLibEnv -> TagLibEnv
- data TagLibException
- addNewFile :: FileId -> TagLibFile -> TagLib ()
- nextId :: TagLib FileId
- openFilePtrs :: TagLib [Ptr File]
- fromEnv :: (TagLibEnv -> a) -> TagLib a
- fromFile :: (TagLibFile -> a) -> FileId -> TagLib a
- io :: IO a -> TagLib a
- c_taglib_file_new :: CString -> IO (Ptr File)
- c_taglib_file_free :: Ptr File -> IO ()
- c_taglib_file_save :: Ptr File -> IO ()
- c_taglib_file_is_valid :: Ptr File -> IO CInt
- c_taglib_file_tag :: Ptr File -> IO (Ptr Tag)
- c_taglib_file_audioproperties :: Ptr File -> IO (Ptr AudioProperties)
- c_taglib_free_strings :: IO ()
- freeTagLibStrings :: IO ()
- removeFile :: FileId -> TagLib ()
- runTagLib :: TagLibEnv -> TagLib a -> IO (a, TagLibEnv)
- evalTagLib :: TagLibEnv -> TagLib a -> IO a
- closeFile :: FileId -> TagLib ()
- cleanupFile :: Ptr File -> IO ()
Documentation
Monad for performing TagLib operations
data TagLibFile Source
Internal representation of an open file
Constructors
TagLibFile | |
Fields
|
A handle for an open file
data AudioProperties Source
A collection of open files, and a generator for unique file ID's
Constructors
TagLibEnv | |
Fields |
A fresh Env
onFilesOpen :: (Map FileId TagLibFile -> Map FileId TagLibFile) -> TagLibEnv -> TagLibEnvSource
Record modify for taglibFilesOpen
data TagLibException Source
Exceptions that might be thrown
Constructors
NoSuchFileId | |
InvalidFile FilePath | |
UnableToOpen FilePath | |
FileClosed |
addNewFile :: FileId -> TagLibFile -> TagLib ()Source
Put a new file into the Env
openFilePtrs :: TagLib [Ptr File]Source
Get the list of currently opened files.
fromFile :: (TagLibFile -> a) -> FileId -> TagLib aSource
Call a function requiring a file. Throws an exception should the FileId not point to a currently open file.
c_taglib_file_free :: Ptr File -> IO ()Source
c_taglib_file_save :: Ptr File -> IO ()Source
freeTagLibStrings :: IO ()Source
Free all the strings that TagLib has allocated.
Use only when handling your own memory.
Otherwise, taglib
will take care of this for you.
removeFile :: FileId -> TagLib ()Source
Remove a file from the Env
runTagLib :: TagLibEnv -> TagLib a -> IO (a, TagLibEnv)Source
Run a TagLib
action without managing allocated resources.
Reading tags from a file will work regardless of whether
cleanupFile
is used, but writing tags will not.
TagLib's strings must still be freed if a memory leak is to
be avoided.
evalTagLib :: TagLibEnv -> TagLib a -> IO aSource
Run an unmanaged TagLib
action, discarding the final Env.
closeFile :: FileId -> TagLib ()Source
Save and close a file, in case you want to manage your own memory.
TagLib's strings are still freed by taglib
.
cleanupFile :: Ptr File -> IO ()Source
The base IO action necessary to deallocate all resources associated with a single file.