More...
guessFileTypeProc is invoked by Snack in order to find out if the current file is of a type which this handler recognizes. guessFileTypeProc will receive buffer filled with bytes from the header up to length and if it recognizes the format is should return formatName. If it can't make a decision after seeing only length bytes it should return the string QUE_STRING. It will subsequently be invoked again with some more bytes for a new try. If the file is clearly in another format guessFileTypeProc should return NULL.
extensionFileTypeProc takes a filename string and returns formatName if its file name extension matches its format else it return NULL. This is used when saving a sound object using a filename to guess which format it should be saved with. If no save functionality is needed and extensionFileTypeProc is specified as NULL, a raw file will be saved using filename, which could be confusing. By providing an extensionFileTypeProc for the format Snack will be able to report "unsupported save format".
typedef char *(guessFileTypeProc)(char *buf, int len);
typedef int (getHeaderProc)(Sound *s, Tcl_Interp *interp, Tcl_Channel
ch,
Tcl_Obj *obj, char *buf);
typedef char *(extensionFileTypeProc)(char *buf);
typedef int (putHeaderProc)(Sound *s, Tcl_Channel ch, Tcl_Obj
*obj,
char *buf, int len);
typedef int (openProc)(Sound *s, Tcl_Interp *interp,Tcl_Channel
*ch,char *mode);
typedef int (closeProc)(Sound *s, Tcl_Interp *interp, Tcl_Channel
*ch);
typedef int (readSamplesProc)(Sound *s, Tcl_Interp *interp, Tcl_Channel
ch, char *ibuf, char *obuf, int len);
typedef int (writeSamplesProc)(Sound *s, Tcl_Channel ch, Tcl_Obj
*obj,
char *buf, int len);
typedef int (seekProc)(Sound *s, Tcl_Interp *interp, Tcl_Channel
ch, int pos);