
/* C veneer for PlayIt.

   by Rick Hudson, 1999
*/


#ifndef _playitap_h
#define _playitap_h

#include "playit.h"


/* Effectively perform the actions described in the programmers' guidelines:

   * Load's PlayIt from the resource path 'respath' if not already loaded (auto driver)
   * Checks the version against min_version
   * if the loaded major version differs from that of min_version an error is returned
   * if the version if older than min_version and PlayIt is idle PlayIt is reloaded as aboce
   * An error is returned if the version is still inappropriate
   * Checks if a driver is loaded and auto-chooses one inside 'resdir' if none present

   min_version: eg 142 for version 1.42
   resdir: path of resource directory (eg PlayIt: but not <PlayIt$Dir> etc)
   wimp: non-zero if the wimp task should be ensured to be running
   version: the returned version of PlayIt (now) loaded. NULL if not required.
*/

extern playit_error *xplayit_ensure(int min_version, char *respath, int wimp, int *version);


/* Alternative to xplayit_version. Instead of returning an error (eg if not
   loaded) a zero version number is returned. If there is no error the
   version is returned.
*/

extern int playit_read_version(void);


/* Simply opens the given file with auto-detect and plays it if there was no
   error.
*/

extern playit_error *xplayit_autoplay(const char *filename);

/* Returns a pointer to the (static) name of the file format (Wave, AIFF etc)
   enumerated by the code (as per PLAYIT_FILE_* constants). If any of bits
   16-23 are set then code is assumed to be a 32-bit format word as returned
   by PlayIt_Open etc and the code is extracted from those bits. If
   manipulation
*/

extern char *playit_file_type_name(int code);


/* Macro to return a pointer to the (static) name of the file format (as
   above) by specifying the playit_format structure. Pointers to structures
   have to be dereferences first (eg if playit_format *fmt; then
   playit_FILE_TYPE_NAME(*fmt);
*/

#define playit_FILE_TYPE_NAME(/*playit_format*/ fmt) playit_file_type_name((fmt).s.file_code)

#endif
