5.2 File Handling
5.2.1 File Formats
Pm recognises the following file formats for I/O:
-
PM_ASCII
- Ascii format, as described in
additive, usually with file
extension .format
- PM_BIN
- Binary format, as described in
additive, usually with file
extension .fmt
- PM_SDIF
- SDIF format, usually with file extension .sdif.
With SDIF, there are several sub-formats to choose from,
described at
CNMAT's SDIF site.
-
PM_SDIF_TRACKS
- partial tracks (the default, when only
PM_SDIF is used)
- PM_SDIF_HARMONICS
- harmonic partials
- PM_SDIF_PEAKS
- picked peaks
5.2.2 PmGetExtension
Synopsis char *PmGetExtension (char *name)
Find the extension of a filename (the part after the last '.' of the
filename part of the full path).
Returns Pointer to extension (after the '.'), or NULL if no extension found
5.2.3 PmNameToFormat
Synopsis int PmNameToFormat (char *name)
Determine Pm format from string name.
Returns format.
5.2.4 PmGetFileFormat
Synopsis int PmGetFileFormat (char *name, int defnonsdif, int defsdif)
Determine Pm format from extension of file given by name, unless
it is an SDIF file (determined by the first 4 characters in the
file.
Returns formatdefsdif, if file is an SDIF file,
otherwise, the format determined by the extension in name, if none
found defnonsdif.
5.2.5 PmOpenFile
Synopsis FILE *PmOpenFile (char *name, int mode, int format)
Open file name with given mode (PM_READ,
PM_WRITE, or PM_APPEND) and format.
Note that, on systems which have a popen() function, if the extension
is (.gz), the file is automatically decompressed or compressed with
gzip, using a pipe.
Returns opened file pointer or NULL on failure. Note that in case
of an SDIF format the return value points to an Sdif file
structure and must not be used except for Pm i/o.
5.2.6 PmCloseFile
Synopsis void PmCloseFile (FILE *f, int format)
Close a file which was opened with format format.
Formatted and maintained by Diemo Schwarz --- last change