/*
 * $Id: concierto.h 7.1 1999/01/18 12:15:57 olsen Exp olsen $
 *
 * :ts=8
 *
 * Copyright © 1997-1999 Village Tronic Computer
 *    All Rights Reserved
 */

#ifndef _CONCIERTO_H
#define _CONCIERTO_H 1

#ifndef _UTILITY_TAGITEM_H
#include <utility/tagitem.h>
#endif	/* _UTILITY_TAGITEM_H */

/****************************************************************************/

	/* For easy access, the name of the library. */

#define CONCIERTONAME "concierto.library"

/****************************************************************************/

	/* This defines a fixed point number, as used for sound volume
	 * values by the library.
	 *
	 * In this fixed point format, 1.0 is represented as 0x10000,
	 * 0.0 as 0x00000, 0.5 as 0x08000 and so forth.
	 */

typedef unsigned long CTO_VOLUME;

/****************************************************************************/

	/* The maximum volume value understood by all concierto.library
	 * routines. This is actually a fixed point value which
	 * equals `1.0'.
	 */

#define CTO_VOLUME_Unity (0x00010000)

	/* This special value denotes a sample length that can never
	 * be exhausted.
	 */

#define CTO_SAMPLELENGTH_Infinite (0x7FFFFFFF)

/****************************************************************************/

	/* Mixer control unit numbers. */

#define MIXERCTRL_Volume	0	/* Master volume control */
#define MIXERCTRL_LineIn	1	/* Line in (on Picasso IV main board) */
#define MIXERCTRL_AV		2	/* AV module */
#define MIXERCTRL_Switcher	3	/* Audio signal switcher */
#define MIXERCTRL_Microphone	4	/* Mono microphone (on sound "daughterboard") */
#define MIXERCTRL_Voice		5	/* Output from DSP */
#define MIXERCTRL_FMSynth	6	/* FM synthesizer */

/****************************************************************************/

	/* Recording source unit numbers. */

#define RECORDSRC_Microphone	0	/* Recording source is microphone (default). */
#define RECORDSRC_AV		1	/* Recording source is AV module. */
#define RECORDSRC_Switcher	2	/* Recording source is audio signal switcher. */
#define RECORDSRC_Mixer		3	/* Recording source is output from mixer. */

/****************************************************************************/

	/* Tags for controlling CTO_StartPlayback()
	 * and CTO_StartRecording().
	 */

#define DSPA_Base		(TAG_USER+1000)

#define DSPA_SampleData		(DSPA_Base+1)	/* Sample data for default channel (left) */
#define DSPA_SampleDataLeft	(DSPA_Base+1)	/* Sample data for left channel */
#define DSPA_SampleDataRight	(DSPA_Base+2)	/* Sample data for right channel */
#define DSPA_NumSampleBytes	(DSPA_Base+3)	/* Number of sample data bytes. */
#define DSPA_SampleInterleave	(DSPA_Base+4)	/* Number of bytes to add to a sample
						 * address to find the next sample.
						 */
#define DSPA_PlaybackRate	(DSPA_Base+5)	/* Playback rate in Hz */
#define DSPA_RecordingRate	(DSPA_Base+5)	/* Recording rate in Hz */
#define DSPA_NumChannels	(DSPA_Base+6)	/* Number of channels */
#define DSPA_NumBitsPerSample	(DSPA_Base+7)	/* Number of bits per sample */
#define DSPA_RecordingSource	(DSPA_Base+8)	/* Recording source */
#define DSPA_LeftInputVolume	(DSPA_Base+9)	/* Input volume for left channel */
#define DSPA_RightInputVolume	(DSPA_Base+10)	/* Input volume for right channel */
#define DSPA_RecordMonitorVolume (DSPA_Base+11)	/* Recording monitor volume */
#define DSPA_WakePort		(DSPA_Base+12)	/* MsgPort to send wakeup message to */
#define DSPA_WakeMessage	(DSPA_Base+13)	/* Wakeup message to send */
#define DSPA_WakeTask		(DSPA_Base+14)	/* Task to wake up */
#define DSPA_WakeSigBit		(DSPA_Base+15)	/* Signal to use when waking up the task */
#define DSPA_ReloadHook		(DSPA_Base+16)	/* Hook to call when data is exhausted */
#define DSPA_ByteSwapSamples	(DSPA_Base+17)	/* Byte-swap 16 bit samples */
#define DSPA_FilterFrequency	(DSPA_Base+18)	/* Low-pass filter frequency to use */
#define DSPA_Synchronous	(DSPA_Base+19)	/* Enable/disable synchronous operation (V7) */

/****************************************************************************/

	/* Status codes returned by CTO_VerifyCompatibility(),
	 * CTO_StartPlayback() and CTO_StartRecording().
	 */

#define DSPERROR_None			(0)	/* Nothing to complain about. */
#define DSPERROR_InvalidParameters	(-1001)	/* Something obvious is wrong. */
#define DSPERROR_InvalidSampleLength	(-1002)	/* The sample length is wrong. */
#define DSPERROR_NoLeftSampleData	(-1003)	/* No sample data for left channel. */
#define DSPERROR_NoRightSampleData	(-1004)	/* No sample data for right channel. */
#define DSPERROR_WrongNumberOfChannels	(-1005)	/* Wrong number of sound channels. */
#define DSPERROR_WrongNumberOfBits	(-1006)	/* Wrong number of bits per sample. */
#define DSPERROR_FrequencyTooLow	(-1007)	/* Sample rate is too low. */
#define DSPERROR_FrequencyTooHigh	(-1008)	/* Sample rate is too high. */
#define DSPERROR_BandwidthExhausted	(-1009)	/* The combination of channels/bits/rate
						 * is not supported by the hardware.
						 */
#define DSPERROR_HardwareBusy		(-1010)	/* The hardware is currently busy and
						 * cannot satisfy your request.
						 */

/****************************************************************************/

	/* This data structure is for querying the current
	 * DSP DAC/ADC status. Filled in are the sample
	 * pointers for left and right channel and the
	 * number of bytes to feed into the FIFO before
	 * the current job is considered done.
	 */

struct DSPQueryPacket
{
	APTR dqp_LeftChannel;	/* Current left channel data pointer. */
	APTR dqp_RightChannel;	/* Current right channel data pointer. */
	LONG dqp_NumBytesToGo;	/* Number of bytes to go before job is done. */
};

/****************************************************************************/

	/* Tags for controlling the audio signal switcher */

#define SWITCHA_Base		(TAG_USER+2000)

#define SWITCHA_Source		(SWITCHA_Base+1)	/* Signal source */
#define SWITCHA_Mute		(SWITCHA_Base+2)	/* Muting status */

/****************************************************************************/

	/* Audio signal switcher input sources */

#define SWITCHERSRC_Amiga	0	/* Switcher source is Amiga audio signal (default) */
#define SWITCHERSRC_AV		1	/* Switcher source is AV module */
#define SWITCHERSRC_LineIn	2	/* Switcher source is Line In */
#define SWITCHERSRC_CD		3	/* Switcher source is CD-DA */

/****************************************************************************/

#endif	/* _CONCIERTO_H */
