/* > arutils.h

 * SJ Middleton, 1992

 * A collection of miscellaneous useful routines, needed by the ARLib library.

 */

#ifndef __arutils_h
# define __arutils_h

#ifndef __armovie_h
# include "armovie.h"
#endif

/* From arsnd.c */

extern int arsnd_bytes_per_sec(const armovie_soundstr *sp);
extern double arsnd_realsamplerate(const armovie_soundstr *sp);

extern int arsnd_s2b(const armovie_soundstr *sp, int nsamples);
extern int arsnd_b2s(const armovie_soundstr *sp, int nbytes);
extern int arsnd_chunksize(armovie_hdr *hdr);

extern void arsnd_setprefix(const char *prefix);
extern char *arsnd_varval(const char *suffix);
extern BOOL arsnd_opt(int c);

typedef enum
{
    arsnd_Seekable      = 0x01,     /* start from, 1 = any sample, 0 = chunk start only */
    arsnd_VariableSize  = 0x02,     /* compression ratio, 1 = is variable, 0 = is fixed */
    arsnd_FromCode      = 0x04,
    arsnd_ToCode        = 0x08
} arsnd_flag;

typedef struct
{
    char        *description;
    char        *author;
    int         nbits;              /* nbits of space per sample needed in arsound play buffers */
    double      max_size;           /* max bits used per sample */
    int         channel_overhead;   /* byte overhead per channel in From16 */
    arsnd_flag  flags;
} arsnd_info;

extern os_error *arsnd_readinfo_path(const char *path, const char *name, arsnd_info *info, BOOL read_names);
extern os_error *arsnd_readinfo(const char *name, arsnd_info *info, BOOL read_names);
extern void arsnd_freeinfo(arsnd_info *info);

#endif

/* eof arutils.h */
