17c478bdstevel@tonic-gate/*
27c478bdstevel@tonic-gate * CDDL HEADER START
37c478bdstevel@tonic-gate *
47c478bdstevel@tonic-gate * The contents of this file are subject to the terms of the
57c478bdstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
67c478bdstevel@tonic-gate * (the "License").  You may not use this file except in compliance
77c478bdstevel@tonic-gate * with the License.
87c478bdstevel@tonic-gate *
97c478bdstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bdstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
117c478bdstevel@tonic-gate * See the License for the specific language governing permissions
127c478bdstevel@tonic-gate * and limitations under the License.
137c478bdstevel@tonic-gate *
147c478bdstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
157c478bdstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bdstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
177c478bdstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
187c478bdstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bdstevel@tonic-gate *
207c478bdstevel@tonic-gate * CDDL HEADER END
217c478bdstevel@tonic-gate */
227c478bdstevel@tonic-gate/*
237c478bdstevel@tonic-gate * Copyright 1992-2003 Sun Microsystems, Inc.  All rights reserved.
247c478bdstevel@tonic-gate * Use is subject to license terms.
257c478bdstevel@tonic-gate */
267c478bdstevel@tonic-gate
277c478bdstevel@tonic-gate#ifndef _MULTIMEDIA_LIBAUDIO_H
287c478bdstevel@tonic-gate#define	_MULTIMEDIA_LIBAUDIO_H
297c478bdstevel@tonic-gate
307c478bdstevel@tonic-gate#pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bdstevel@tonic-gate
327c478bdstevel@tonic-gate#include <audio_types.h>
337c478bdstevel@tonic-gate#include <audio_hdr.h>
347c478bdstevel@tonic-gate#include <audio_device.h>
357c478bdstevel@tonic-gate#include <audio_errno.h>
367c478bdstevel@tonic-gate#include <audio_encode.h>
377c478bdstevel@tonic-gate#include <audio/au.h>
387c478bdstevel@tonic-gate#include <aiff.h>
397c478bdstevel@tonic-gate#include <wav.h>
407c478bdstevel@tonic-gate
417c478bdstevel@tonic-gate#ifdef __cplusplus
427c478bdstevel@tonic-gateextern "C" {
437c478bdstevel@tonic-gate#endif
447c478bdstevel@tonic-gate
457c478bdstevel@tonic-gate/* define various constants for general use */
467c478bdstevel@tonic-gate
477c478bdstevel@tonic-gate/* Theoretical maximum length of hh:mm:ss.dd string */
487c478bdstevel@tonic-gate#define	AUDIO_MAX_TIMEVAL	(32)
497c478bdstevel@tonic-gate
507c478bdstevel@tonic-gate/* Theoretical maximum length of encoding information string */
517c478bdstevel@tonic-gate#define	AUDIO_MAX_ENCODE_INFO	(80)
527c478bdstevel@tonic-gate
537c478bdstevel@tonic-gate
547c478bdstevel@tonic-gate/* Why aren't these stupid values defined in a standard place?! */
557c478bdstevel@tonic-gate#ifndef TRUE
567c478bdstevel@tonic-gate#define	TRUE	(1)
577c478bdstevel@tonic-gate#endif
587c478bdstevel@tonic-gate#ifndef FALSE
597c478bdstevel@tonic-gate#define	FALSE	(0)
607c478bdstevel@tonic-gate#endif
617c478bdstevel@tonic-gate#ifndef NULL
627c478bdstevel@tonic-gate#define	NULL	0
637c478bdstevel@tonic-gate#endif
647c478bdstevel@tonic-gate
657c478bdstevel@tonic-gate/* Help for endian-ness */
667c478bdstevel@tonic-gate#define	SWABI(I)							\
677c478bdstevel@tonic-gate	I = (((I >> 24) & 0xff) | ((I & 0xff) << 24) |			\
687c478bdstevel@tonic-gate	((I >> 8) & 0xff00) | ((I & 0xff00) << 8))
697c478bdstevel@tonic-gate
707c478bdstevel@tonic-gate/* Defines for the audio file formats we support */
717c478bdstevel@tonic-gate#define	FILE_ERROR	0
727c478bdstevel@tonic-gate#define	FILE_AU		1
737c478bdstevel@tonic-gate#define	FILE_WAV	2
747c478bdstevel@tonic-gate#define	FILE_AIFF	3
757c478bdstevel@tonic-gate
767c478bdstevel@tonic-gate/* Declare libaudio C routines */
777c478bdstevel@tonic-gate
787c478bdstevel@tonic-gate/* File Header routines */
797c478bdstevel@tonic-gateEXTERN_FUNCTION(int audio_write_filehdr, (int, Audio_hdr *, int, char *,
807c478bdstevel@tonic-gate		    unsigned));
817c478bdstevel@tonic-gateEXTERN_FUNCTION(int audio_rewrite_filesize, (int, int, unsigned,
827c478bdstevel@tonic-gate		    unsigned, unsigned));
837c478bdstevel@tonic-gateEXTERN_FUNCTION(int audio_read_filehdr, (int, Audio_hdr*, int *, char *,
847c478bdstevel@tonic-gate		    unsigned));
857c478bdstevel@tonic-gateEXTERN_FUNCTION(int audio_isaudiofile, (char *));
867c478bdstevel@tonic-gateEXTERN_FUNCTION(int audio_decode_filehdr,
877c478bdstevel@tonic-gate		    (int, unsigned char *, int *, Audio_hdr *, int *));
887c478bdstevel@tonic-gate
897c478bdstevel@tonic-gateextern int audio_write_filehdr(int, Audio_hdr *, int, char *, unsigned);
907c478bdstevel@tonic-gateextern int audio_rewrite_filesize(int, int, unsigned int, unsigned int,
917c478bdstevel@tonic-gate	unsigned int);
927c478bdstevel@tonic-gate
937c478bdstevel@tonic-gate
947c478bdstevel@tonic-gate
957c478bdstevel@tonic-gate/* Audio Header routines */
967c478bdstevel@tonic-gateEXTERN_FUNCTION(double audio_bytes_to_secs, (Audio_hdr*, unsigned));
977c478bdstevel@tonic-gateEXTERN_FUNCTION(unsigned audio_secs_to_bytes, (Audio_hdr*, double));
987c478bdstevel@tonic-gateEXTERN_FUNCTION(double audio_str_to_secs, (char *));
997c478bdstevel@tonic-gateEXTERN_FUNCTION(char *audio_secs_to_str, (double, char *, int));
1007c478bdstevel@tonic-gateEXTERN_FUNCTION(int audio_cmp_hdr, (Audio_hdr*, Audio_hdr *));
1017c478bdstevel@tonic-gateEXTERN_FUNCTION(int audio_enc_to_str, (Audio_hdr*, char *));
1027c478bdstevel@tonic-gate
1037c478bdstevel@tonic-gate
1047c478bdstevel@tonic-gate/* Device Control routines */
1057c478bdstevel@tonic-gateEXTERN_FUNCTION(int audio_getinfo, (int, Audio_info*));
1067c478bdstevel@tonic-gateEXTERN_FUNCTION(int audio_setinfo, (int, Audio_info*));
1077c478bdstevel@tonic-gateEXTERN_FUNCTION(int audio__setplayhdr, (int, Audio_hdr *, unsigned));
1087c478bdstevel@tonic-gateEXTERN_FUNCTION(int audio__setval, (int, unsigned *, unsigned));
1097c478bdstevel@tonic-gateEXTERN_FUNCTION(int audio__setgain, (int, double *, unsigned));
1107c478bdstevel@tonic-gateEXTERN_FUNCTION(int audio__setpause, (int, unsigned));
1117c478bdstevel@tonic-gateEXTERN_FUNCTION(int audio__flush, (int, unsigned int));
1127c478bdstevel@tonic-gateEXTERN_FUNCTION(int audio_drain, (int, int));
1137c478bdstevel@tonic-gateEXTERN_FUNCTION(int audio_play_eof, (int));
1147c478bdstevel@tonic-gate
1157c478bdstevel@tonic-gate#ifdef __cplusplus
1167c478bdstevel@tonic-gate}
1177c478bdstevel@tonic-gate#endif
1187c478bdstevel@tonic-gate
1197c478bdstevel@tonic-gate#endif /* !_MULTIMEDIA_LIBAUDIO_H */
120