/***************************************************************************
*	NAME:  VOLREAD.C
**	COPYRIGHT:
**	"Copyright (c) 1992, by FORTE
**
**       "This software is furnished under a license and may be used,
**       copied, or disclosed only in accordance with the terms of such
**       license and with the inclusion of the above copyright notice.
**       This software or any other copies thereof may not be provided or
**       otherwise made available to any other person. No title to and
**       ownership of the software is hereby transfered."
****************************************************************************
*  CREATION DATE: 11/18/92
*--------------------------------------------------------------------------*
*     VERSION	DATE	   NAME		DESCRIPTION
*>	1.0	11/18/92		Original
***************************************************************************/
#include <dos.h>
#include <conio.h>

#include "forte.h"
#include "gf1proto.h"
#include "osproto.h"
#include "gf1hware.h"
#include "gf1os.h"

extern ULTRA_DATA _gf1_data;

unsigned int 
UltraReadVolume(int voice)
{
unsigned int volume;

	ENTER_CRITICAL;

	/* Make sure we are talking to proper voice */
	outp(_gf1_data.voice_select,voice);		/* select the proper voice */
	outp(_gf1_data.reg_select,GET_VOLUME);

	volume = inpw(_gf1_data.data_low) >> 4;

	LEAVE_CRITICAL;
	return(volume);
}

void
UltraVectorVolume(int voice,unsigned int end,unsigned char rate,unsigned char mode)
// int voice;
// unsigned int end;			/* end volume to go to */
// unsigned char rate;			/* 0 to 63 */
// unsigned char mode;			/* mode to run the volume ramp in ... */
{
unsigned int cur_vol;

	UltraStopVolume(voice);
	cur_vol = UltraReadVolume(voice);

	UltraRampVolume(voice,cur_vol,end,rate,mode);

}

