<sect1>
<title>Function Reference</title>

<sect2 id="vpb-set-call">
<title><function>vpb_set_call()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_set_call(int handle, VPB_CALL *vpb_call)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Function to set call progress parameters.

</para>

</sect2>

<sect2 id="vpb-get-call">
<title><function>vpb_get_call()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_get_call(int handle, VPB_CALL *vpb_call)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Function to get current call progress parameters.

</para>

</sect2>

<sect2 id="vpb-call-sync">
<title><function>vpb_call_sync()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_call_sync(int handle, char *dialstr)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Place a call using call progress algorithm.

	Note: when this function is called, make sure dial tone has not
	been detected yet.

</para>

</sect2>

<sect2 id="vpb-call-async">
<title><function>vpb_call_async()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_call_async(int handle, char *dialstr)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Place a call using call progress algorithm, async version.

	Note: when this function is called, make sure dial tone has not
	been detected yet.

</para>

</sect2>

<sect2 id="vpb-cid-debug-on">
<title><function>vpb_cid_debug_on()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
void WINAPI vpb_cid_debug_on(char debug_file_name[]) {
</screen>

<para><emphasis>Function</emphasis></para>

<para>

  Call this function to enable debugging of the CID module.  Causes lots of
  debug info to be written to the text file "debug_file_name".
  
</para>

</sect2>

<sect2 id="vpb-cid-decode">
<title><function>vpb_cid_decode()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_cid_decode(
		          char  *number,
			  short *in,
			  int   n
			  )
</screen>

<para><emphasis>Function</emphasis></para>

<para>

  As per cid-demodulate() but parse out all CID fields.

</para>

</sect2>

<sect2 id="vpb-open">
<title><function>vpb_open()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_open(unsigned int board, unsigned int channel)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Opens a VPB device (channel), and returns a handle to that device.
	
</para>

</sect2>

<sect2 id="vpb-close">
<title><function>vpb_close()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_close(int devhandle)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Closes a device.  If this is the last device remaining, then the
	API is closed down (memory free-ed, DSP stopped etc).

</para>

</sect2>

<sect2 id="vpb-stop">
<title><function>vpb_stop()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_stop()
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	API is closed down (memory free-ed, DSP stopped etc).
	Only used for "bayonne" mode.

</para>

</sect2>

<sect2 id="vpb-set-event-callback">
<title><function>vpb_set_event_callback()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_set_event_callback(int handle, void (WINAPI *event_callback)(VPB_EVENT *e, void *context), void *context)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Sets the event callback function for each channel.  By default no
	event callback functions are set, in this case events are posted
	to the API event Q.  If this function has been called with a
	non-null function pointer, the event callback funcion is called with
	the event as an argument rather than posting the event to the API
	Q.
	
	The user defined event callback function should be of the form:

	void event_callback(VPB_EVENT *e);

	To disable the event callback, call this function with a NULL 
	pointer for the function argument.

</para>

</sect2>

<sect2 id="vpb-set-event-mask">
<title><function>vpb_set_event_mask()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_set_event_mask(int handle, unsigned short mask)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Function to set the event mask for each device.  Each call to this
	function overwrites the previous event mask.

</para>

</sect2>

<sect2 id="vpb-get-event-mask">
<title><function>vpb_get_event_mask()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_get_event_mask(int handle)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Function to return the current event mask for a given device.

</para>

</sect2>

<sect2 id="vpb-enable-event">
<title><function>vpb_enable_event()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_enable_event(int handle, unsigned short mask)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Function to unmask (enable) only the specified events while leaving the
	rest of the event masks unchanged.

</para>

</sect2>

<sect2 id="vpb-disable-event">
<title><function>vpb_disable_event()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_disable_event(int handle, unsigned short mask)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Function to mask out (disable) specified events only, while leaving the
	rest of the event masks unchanged.

</para>

</sect2>

<sect2 id="vpb-put-event">
<title><function>vpb_put_event()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_put_event(VPB_EVENT *e)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Function to place an event on the API event queue exported API version.

</para>

</sect2>

<sect2 id="vpb-get-event-async">
<title><function>vpb_get_event_async()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_get_event_async(VPB_EVENT *e)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Function to get an event from the API event queue.  Returns VPB_OK
	if an event available, other wise VPB_NO_EVENTS if Q empty.

</para>

</sect2>

<sect2 id="vpb-get-event-sync">
<title><function>vpb_get_event_sync()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_get_event_sync(VPB_EVENT *e, unsigned int time_out)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	This function waits until an event is available on the API Q, then 
	returns.  The thread is put to sleep until the event becomes
	available.

	Function returns VPB_OK if event returned, else VPB_TIME_OUT if
	sync function times out.  Use tme_out = 0 for no timeout.

</para>

</sect2>

<sect2 id="vpb-get-event-ch-sync">
<title><function>vpb_get_event_ch_sync()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_get_event_ch_sync(int h, VPB_EVENT *e, unsigned int time_out)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	This function waits until an event is available on the API Q, then 
	returns.  The thread is put to sleep until the event becomes
	available.  This version only returns events from a specified channel.

</para>

</sect2>

<sect2 id="vpb-get-event-ch-async">
<title><function>vpb_get_event_ch_async()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_get_event_ch_async(int h, VPB_EVENT *e)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	This reads an event on a channels event queue if available.

</para>

</sect2>

<sect2 id="vpb-sethook-async">
<title><function>vpb_sethook_async()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_sethook_async(int chdev, int hookstate)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Function to set the hook status of a particular chnnel device.  This
	version returns immediately.

</para>

</sect2>

<sect2 id="vpb-sethook-sync">
<title><function>vpb_sethook_sync()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_sethook_sync(int chdev, int hookstate)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Function to set the hook status of a particular chnnel device.  This
	version returns after the hook status has been changed.

</para>

</sect2>

<sect2 id="vpb-ring-station-async">
<title><function>vpb_ring_station_async()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_ring_station_async(int chdev, int state)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Function to start/stop a station port ringing.  This version rings
	stations with a pre-defined cadence.

</para>

</sect2>

<sect2 id="vpb-ring-station-sync">
<title><function>vpb_ring_station_sync()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_ring_station_sync(int chdev, int state)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Function to start/stop a station port ringing.

</para>

</sect2>

<sect2 id="vpb-sleep">
<title><function>vpb_sleep()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
void WINAPI vpb_sleep(long time)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Function to put the current thread to sleep for a certain time in ms.
        Used during testing to reduce the amount of time program spends in main
	polling loop so that the computational load of the timer callback
	can be measured.

</para>

</sect2>

<sect2 id="vpb-adpcm-open">
<title><function>vpb_adpcm_open()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_adpcm_open(void **pv)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Sets up the state variables for ADPCM opertaions.  Must be called before 
	any other ADPCM functions.

</para>

</sect2>

<sect2 id="vpb-adpcm-close">
<title><function>vpb_adpcm_close()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
void WINAPI vpb_adpcm_close(void *pv)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Closes down the ADPCM state variables, freeing memory.  Call after all
	ADPCM operations have finished.

</para>

</sect2>

<sect2 id="vpb-adpcm-reset">
<title><function>vpb_adpcm_reset()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
void WINAPI vpb_adpcm_reset(void *pv)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Resets the ADPCM state variables.

</para>

</sect2>

<sect2 id="vpb-adpcm-decode">
<title><function>vpb_adpcm_decode()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_adpcm_decode(
	void			*pv,	   // ADPCM state variables
	short			linear[],  // linear output samples
	unsigned short  *size_lin,	   // number of 16 bit samples out
	char			adpcm[],   // packed ADPCM samples
	unsigned short	size_adpcm	   // number of bytes in (must be even)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Converts a buffer of compressed OKI ADPCM samples to a buffer of 16 bit
	linear samples.

</para>

</sect2>

<sect2 id="vpb-adpcm-encode">
<title><function>vpb_adpcm_encode()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_adpcm_encode(
	void		*pv,	     // ADPCM state variables
	char		adpcm[],     // output packed ADPCM samples
	unsigned short	*size_adpcm, // number of bytes out
	short		linear[],    // linear input samples
	unsigned short  size_linear  // number of 16 bit samples in
)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Converts a buffer of 16 bit linear samples to a buffer of compressed 
	OKI ADPCM samples.

</para>

</sect2>

<sect2 id="vpb-comp-load">
<title><function>vpb_comp_load()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_comp_load(unsigned short board)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Interrogates the DSP to determine the computational loading.
	Causes a comp load statement to be printed if mprintf's are
	enabled.

	Dont expose the function to the punters, keep it as undocumented
	for our use only.

</para>

</sect2>

<sect2 id="vpb-echo-canc-force-adapt-on">
<title><function>vpb_echo_canc_force_adapt_on()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_echo_canc_force_adapt_on()
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Forces the echo cancellers to adapt all of the time, ie switches
	off near end speech detector.  Used to determine maximum 
	computational load.

</para>

</sect2>

<sect2 id="vpb-echo-canc-force-adapt-off">
<title><function>vpb_echo_canc_force_adapt_off()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_echo_canc_force_adapt_off()
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Stops forced adaptation.

</para>

</sect2>

<sect2 id="vpb-echo-canc-enable">
<title><function>vpb_echo_canc_enable()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_echo_canc_enable()
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Enables the echo cancellers.

</para>

</sect2>

<sect2 id="vpb-echo-canc-disable">
<title><function>vpb_echo_canc_disable()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_echo_canc_disable()
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Disables the echo cancellers, but keeps adaptation on.

</para>

</sect2>

<sect2 id="vpb-echo-canc-get-sup-thresh">
<title><function>vpb_echo_canc_get_sup_thresh()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_echo_canc_get_sup_thresh(short *thresh)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Gets the current echo suppressor threshold.  This threshold is
	the same for all channels on all cards.

</para>

</sect2>

<sect2 id="vpb-echo-canc-set-sup-thresh">
<title><function>vpb_echo_canc_set_sup_thresh()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_echo_canc_set_sup_thresh(short *thresh)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Sets the current echo suppressor threshold.  This threshold is
	the same for all channels on all cards.

	0x1000 (4096) -18dB
	0x800  (2048) -24dB
	0      0      no supressor

</para>

</sect2>

<sect2 id="vpb-get-model">
<title><function>vpb_get_model()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_get_model(char *s) {
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Returns a string containing the VPB model, driver should be started
	first by at least one call to vpb_open().

</para>

</sect2>

<sect2 id="vpb-get-ports-per-card">
<title><function>vpb_get_ports_per_card()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_get_ports_per_card() {
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Returns the number of ports on each card.

</para>

</sect2>

<sect2 id="vpb-set-codec-reg">
<title><function>vpb_set_codec_reg()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
void WINAPI vpb_set_codec_reg(int chdev,    // channel handle
		              USHORT addr,  // 8-bit address of codec register
		              USHORT data   // 8-bit data to write to register
)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Used to set a register of the TS5070 codecs, allows driver-level config
	of codec, rather than hard-coding in DSP firmware.

</para>

</sect2>

<sect2 id="vpb-get-num-cards">
<title><function>vpb_get_num_cards()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_get_num_cards()
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Returns the number of cards in the system.  In current implemention
	need to call vpb_open() before calling this function.
	This means e.g. one channel should be opened before determining how 
	many cards there are! This is very silly and should be fixed some 
	time!

</para>

</sect2>

<sect2 id="vpb-bridge">
<title><function>vpb_bridge()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_bridge(
		       int h1,      // handle of first channel
		       int h2,      // handle of second channel
		       int mode,    // VPB_BRIDGE_ON | VPB_BRIDGE_OFF
		       int resource // bridge resource 1 or 2 (V4PCI only)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Bridges two ports using the driver, to allow 2-way conferencing. The
	bridging is implemented at a low level (firmware and/or hardware) by 
	the driver to ensure a low delay connection between the ports.  Note
	that only ports on the same physical card can be bridged using this
	method on the V4PCI and ISA boards.

	Two bridging resources are available on the V4PCI (1 & 2).

	V4PCI: For 3 or more way conferencing (or bridging between ports on 
	different cards) use "software bridging" using the play and record 
	buf API functions.  This results in a higher delay (20ms or so), 
	however this does not cause a problem due to the echo canceller on 
	each VPB port.

	OpenSwitch: This will auto-magically switch to a kernel-mode driver
	version of bridging when bridging across boards. For more information
	on this look at the vpb_listen function.
</para>

</sect2>

<sect2 id="vpb-listen">
<title><function>vpb_listen()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_listen(
		       int h1,      // handle of first channel
		       int h2,      // handle of second channel
		       int mode    // VPB_BRIDGE_ON | VPB_BRIDGE_OFF
)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Software bridge/listen for OpenSwitch boards.  Starts a half duplex bridge
	between two handles. For a full duplex bridge, both handles will need to
	listen between each other. This currently only works on OpenSwitch boards.

</para>

</sect2>

<sect2 id="vpb-conf">
<title><function>vpb_conf()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_conf(
		int h,		// Handle of channel/port
		int resource,	// Conference/party resource to use (0-9)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Multi party conferencing. Can be used across any number of OpenSwitch
       	boards.  There is a maximum of 10 conferences with a max of 10 people
	each.
	You may need to reduce the HW-record gain if you experiance excesive
	feed back.

</para>

</sect2>

<sect2 id="vpb-get-card-info">
<title><function>vpb_get_card_info()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_get_card_info(
			int 		board,	// Board number
	       		VPB_CARD_INFO 	*detail // Card Info Structure to fill.
)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Returns the card details in a structure VPB_CARD_INFO.
	Includes:	Model name,
			Serial number, 
			Revision number,
			Manufacture Date
			
	All strings are null terminated.

	Note: Only supported under Linux at this time!
	
</para>

</sect2>

<sect2 id="vpb-get-digits-async">
<title><function>vpb_get_digits_async()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_get_digits_async(int handle, VPB_DIGITS *newdig, char *buf)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Gets a buffer of digits based on the conditions passed to the function.
	Returns immediately, and posts a comletetion event when the buffer
	has been obtained.

	If this function is called while already collecting digits (by a
	prvious call to this function), the digit collection is reset, 
	and digits collected so far are discarded.

</para>

</sect2>

<sect2 id="vpb-get-digits-sync">
<title><function>vpb_get_digits_sync()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_get_digits_sync(int handle, VPB_DIGITS *newdig, char *buf)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Gets a buffer of digits based on the conditions passed to the function.
	Returns when digit buffer has been obtained, with appropriate
	VPB_DIGIT_XXX return code.

</para>

</sect2>

<sect2 id="vpb-flush-digits">
<title><function>vpb_flush_digits()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_flush_digits(int handle)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Clears the internal digit buffer, often called before 
	vpb_get_digits_xxxx.

</para>

</sect2>

<sect2 id="vpb-wave-open-write">
<title><function>vpb_wave_open_write()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_wave_open_write(void **ppv, char filename[], int mode)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Opens a RIFF Wave file.

</para>

</sect2>

<sect2 id="vpb-wave-open-read">
<title><function>vpb_wave_open_read()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_wave_open_read(void **ppv, char filename[])
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Opens a RIFF Wave file for reading.

</para>

</sect2>

<sect2 id="vpb-wave-close-write">
<title><function>vpb_wave_close_write()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
void WINAPI vpb_wave_close_write(void *wv)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Closes a RIFF Wave file after writing.

</para>

</sect2>

<sect2 id="vpb-wave-close-read">
<title><function>vpb_wave_close_read()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
void WINAPI vpb_wave_close_read(void *wv)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Closes a RIFF Wave file after reading.

</para>

</sect2>

<sect2 id="vpb-wave-write">
<title><function>vpb_wave_write()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_wave_write(void *wv, char buf[], long n)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Writes a block of speech samples to a RIFF Wave file.

</para>

</sect2>

<sect2 id="vpb-wave-read">
<title><function>vpb_wave_read()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_wave_read(void *wv, char buf[], long n)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Reads a block of speech samples from a RIFF Wave file.  Returns
	the number of bytes read.

</para>

</sect2>

<sect2 id="vpb-wave-seek">
<title><function>vpb_wave_seek()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_wave_seek(void *wv, long offset)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Moves wave pointer to a specified location in samples, with respect
	to the beginning of the file.

</para>

</sect2>

<sect2 id="vpb-wave-set-sample-rate">
<title><function>vpb_wave_set_sample_rate()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
void WINAPI vpb_wave_set_sample_rate(void *wv, unsigned short rate)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Changes the sample rate of a wave file.

</para>

</sect2>

<sect2 id="vpb-wave-get-mode">
<title><function>vpb_wave_get_mode()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_wave_get_mode(void *wv, unsigned short *mode)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Determines the compression mode of a wave file.

</para>

</sect2>

<sect2 id="vpb-play-set">
<title><function>vpb_play_set()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_play_set(int handle, VPB_PLAY *vpb_play)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Sets play parameters or this channel.

</para>

</sect2>

<sect2 id="vpb-play-buf-start">
<title><function>vpb_play_buf_start()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_play_buf_start(int handle, unsigned short mode)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	API callable version of play_buf_start.

</para>

</sect2>

<sect2 id="vpb-play-buf-sync">
<title><function>vpb_play_buf_sync()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_play_buf_sync(int handle, char *buf, unsigned short length)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	API version of play_buf_sync().  Returns VPB_FINISH if playing
	should finish, else returns VPB_OK.

</para>

</sect2>

<sect2 id="vpb-play-buf-finish">
<title><function>vpb_play_buf_finish()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_play_buf_finish(int handle)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Completes the playing of a channel.

</para>

</sect2>

<sect2 id="vpb-play-file-sync">
<title><function>vpb_play_file_sync()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_play_file_sync(int handle, char file_name[])
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Utility function to play a file to a channel.  Function returns when
	playing is finished.

</para>

</sect2>

<sect2 id="vpb-play-voxfile-sync">
<title><function>vpb_play_voxfile_sync()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_play_voxfile_sync(int handle, char file_name[], 
				 unsigned short mode)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Function to play a vox file to a channel.  Function returns when
	playing is finished.

</para>

</sect2>

<sect2 id="vpb-play-file-async">
<title><function>vpb_play_file_async()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_play_file_async(int handle, char file_name[], int data)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Utility function to play a file to a channel.  Function returns as soon
	as playing has started, and places an event on the API Q when playing
	has finished.

</para>

</sect2>

<sect2 id="vpb-play-voxfile-async">
<title><function>vpb_play_voxfile_async()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_play_voxfile_async(int handle, char file_name[], 
				  unsigned short mode,int data)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Utility function to play a vox file to a channel.  Function returns as
	soon as playing has started, and places an event on the API Q when 
	playing has finished.

</para>

</sect2>

<sect2 id="vpb-play-terminate">
<title><function>vpb_play_terminate()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_play_terminate(int handle)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Stops playing immediately. Does nothing if we are not playing.
	NOTE: this doesnt have to be in the same thread context as 
	vpb_play_buf_xxxx
	
</para>

</sect2>

<sect2 id="vpb-record-set">
<title><function>vpb_record_set()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_record_set(int handle, VPB_RECORD *vpb_record)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Sets record parameters or this channel.

</para>

</sect2>

<sect2 id="vpb-record-buf-start">
<title><function>vpb_record_buf_start()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_record_buf_start(int handle, unsigned short mode)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	API callable version of record_buf_start.
	NOTE: All vpb_record_buf_xxxx functions for a given channel must be
	executed in the same thread context.

</para>

</sect2>

<sect2 id="vpb-record-buf-sync">
<title><function>vpb_record_buf_sync()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_record_buf_sync(int handle, char *buf, unsigned short length)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	API version of record_buf_sync().
	NOTE: All vpb_record_buf_xxxx functions for a given channel must be
	executed in the same thread context.

</para>

</sect2>

<sect2 id="vpb-record-buf-finish">
<title><function>vpb_record_buf_finish()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_record_buf_finish(int handle)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Completes the recording of a channel.
	NOTE: All vpb_record_buf_xxxx functions for a given channel must be
	executed in the same thread context.

</para>

</sect2>

<sect2 id="vpb-record-file-sync">
<title><function>vpb_record_file_sync()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_record_file_sync(int handle, char file_name[], unsigned short mode)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Utility function to record a file to a channel.  Function returns when
	recording is finished.

</para>

</sect2>

<sect2 id="vpb-record-voxfile-sync">
<title><function>vpb_record_voxfile_sync()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_record_voxfile_sync(int handle, char file_name[], unsigned short mode)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Utility function to record a vox file to a channel.  Function returns 
	when recording is finished.

</para>

</sect2>

<sect2 id="vpb-record-file-async">
<title><function>vpb_record_file_async()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_record_file_async(int handle, char file_name[], 
				 unsigned short mode)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Utility function to record a file from a channel.  Function returns as 
	soon as recording has started, and places an event on the API Q when 
	recording has finished.

</para>

</sect2>

<sect2 id="vpb-record-voxfile-async">
<title><function>vpb_record_voxfile_async()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_record_voxfile_async(int handle, char file_name[], 
				    unsigned short mode)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Utility function to record a vox file from a channel.  Function 
	returns as soon as recording has started, and places an event on the 
	API Q when recording has finished.

</para>

</sect2>

<sect2 id="vpb-record-terminate">
<title><function>vpb_record_terminate()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_record_terminate(int handle)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Stops recording immediately. Does nothing if we are not recording.
	NOTE: this doesnt have to be in the same thread context as 
	vpb_record_buf_xxxx
	
</para>

</sect2>

<sect2 id="vpb-play-set-gain">
<title><function>vpb_play_set_gain()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_play_set_gain(int handle, float gain) 
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Sets the gain of the play channel, using the hardware gain of the
	TS5070 codec on the VPB4.
	JK: 9/4/02 Modified to only set software gain and not the hardware 
	gain of the TS5050 codec.

</para>

</sect2>

<sect2 id="vpb-play-set-hw-gain">
<title><function>vpb_play_set_hw_gain()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_play_set_hw_gain(int handle, float gain) 
</screen>

<para><emphasis>Function</emphasis></para>

<para>

    Externally accessible wrapper around play_set_hw_gain.

</para>

</sect2>

<sect2 id="vpb-play-get-gain">
<title><function>vpb_play_get_gain()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_play_get_gain(int handle, float *gain) 
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Gets the total gain of the play channel. It comprising of a softare 
	and hardware component (TS5070 codec) on the VPB4/V4PCI.
	
</para>

</sect2>

<sect2 id="vpb-record-get-gain">
<title><function>vpb_record_get_gain()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_record_get_gain(int handle, float *gain) 
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Gets the total gain of the play channel. It comprising of a softare 
	and hardware component (TS5070 codec) on the VPB4/V4PCI.
	
</para>

</sect2>

<sect2 id="vpb-record-set-gain">
<title><function>vpb_record_set_gain()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_record_set_gain(int handle, float gain) 
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Sets the total gain of the record channel. The total gain is comprised
        of a software and hardware component (TS5070 codec). Previously it 
	only comprised of the hardware component. 
	JK 9/4/02 Modified to only set sofware record gain. Disabled 
        hardware configured record gain.

</para>

</sect2>

<sect2 id="vpb-record-set-hw-gain">
<title><function>vpb_record_set_hw_gain()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_record_set_hw_gain(int handle, float gain) 
</screen>

<para><emphasis>Function</emphasis></para>

<para>

    Externally accessible wrapper around record_set_hw_gain.

</para>

</sect2>

<sect2 id="vpb-settonedet">
<title><function>vpb_settonedet()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_settonedet(int chdev, VPB_DETECT *d)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Enables user to set a user programmed tone, or replace an exisiting 
	tone.  Performs translation of user parameters to VPB message.  The
	tones are defined on a per channel basis.

	This version (for the API), stops the config mamanger before download-
	ing a tone to prevent computational overoad probs.

</para>

</sect2>

<sect2 id="vpb-gettonedet">
<title><function>vpb_gettonedet()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_gettonedet(int chdev, int id, VPB_DETECT *d)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Enables user to extract a tone detectors parameters.

</para>

</sect2>

<sect2 id="vpb-debug-tonedet">
<title><function>vpb_debug_tonedet()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_debug_tonedet(int chdev, int id, char file_name[], int sec)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Instructs API to produce a debug file of tone detector parameters for
	one channel. 

</para>

</sect2>

<sect2 id="vpb-dial-async">
<title><function>vpb_dial_async()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_dial_async(
			  int  chdev,      // handle
			  char *dialstring // string to dial
)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Sends a DTMF string down a channel device, accepts the following 
	characters by default, plus user defined chars if defined:

	0 1 2 3 4 5 6 7 8 9 0 * # A B C D

	and:

	&	(hook flash)
	,	(pause)

</para>

</sect2>

<sect2 id="vpb-dial-sync">
<title><function>vpb_dial_sync()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_dial_sync(
			 int  chdev,      // handle
			 char *dialstring // string to dial
)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Sends a DTMF string down a channel device, accepts the following 
	characters by default, plus user defined chars if defined:

	0 1 2 3 4 5 6 7 8 9 0 * # A B C D

	and:

	&	(hook flash)
	,	(pause)

</para>

</sect2>

<sect2 id="vpb-settone">
<title><function>vpb_settone()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_settone(
		       char ident, // single char that identifies tone
		       VPB_TONE *t // structure containing tone parameters
)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Enables user to set a user programmed tone, or replace an existing 
	tone.  Performs translation of user parameters to VPB message.

</para>

</sect2>

<sect2 id="vpb-gettone">
<title><function>vpb_gettone()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_gettone(
		       char ident, // single char that identifies tone
		       VPB_TONE *t // structure containing tone parameters
)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Enables user to retrieve the parameters of a tone.  Performs 
	translation of user parameters from VPB message.

</para>

</sect2>

<sect2 id="vpb-playtone-async">
<title><function>vpb_playtone_async()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_playtone_async(int handle, VPB_TONE *vpb_tone)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Plays a user defined tone immediately, API version.

</para>

</sect2>

<sect2 id="vpb-playtone-sync">
<title><function>vpb_playtone_sync()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_playtone_sync(int handle, VPB_TONE *vpb_tone)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Plays a user defined tone immediately, API version.

</para>

</sect2>

<sect2 id="vpb-tone-terminate">
<title><function>vpb_tone_terminate()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_tone_terminate(int handle)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Terminates playing of tones (programmable or DTMFs).

</para>

</sect2>

<sect2 id="vpb-setvox">
<title><function>vpb_setvox()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_setvox(int handle, VPB_VOX *vox)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Sets the vox parameters for a specified channel.

</para>

</sect2>

<sect2 id="vpb-getvox">
<title><function>vpb_getvox()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_getvox(int handle, VPB_VOX *vox)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Gets the vox parameters for a specified channel.

</para>

</sect2>

<sect2 id="vpb-cid-set">
<title><function>vpb_cid_set()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_cid_set(VPB_CID *cid_struct, int type, void *value)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	VPBAPI function to load valid data of 'type' and 'value' into the
	passed CID structure.  Loading some fields will set associated
	fields to NULL automaticly as the fiedls are exclusive
 
	Return:	Error if invalid type of value out of range, else OK

</para>

</sect2>

<sect2 id="vpb-cid-compose-dlp ">
<title><function>vpb_cid_compose_dlp ()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_cid_compose_dlp(VPB_CID *MESG, char *dlp)
</screen>

<para><emphasis>Function</emphasis></para>

<para>
 
	Build the message dlp from the VPB_CID structure.
 
</para>

</sect2>

<sect2 id="vpb-cid-compose-wav  ">
<title><function>vpb_cid_compose_wav  ()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_cid_compose_wav(char *DLP, int DLP_LEN, short *BUFF_WAV, 
			       int *BUFF_PTR)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Encodes the Data Link Packet recived into a CP-FSK wave
	including CSS & MSS bit headers.  Returns *BUFF_WAV containing
	*BUFF_PTR samples.

</para>

</sect2>

<sect2 id="vpb-throw-exception">
<title><function>vpb_throw_exception()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
void WINAPI vpb_throw_exception(int c, char trans[], char api_function[])
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Helper function that throws a VpbException.

</para>

</sect2>

<sect2 id="vpb-timer-open">
<title><function>vpb_timer_open()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_timer_open
(
 void **ppv,          // ptr to timer state variables
 int chdev,           // channel device handle
 int timer_id,        // Optional ID for this timer
 unsigned long period // period in ms before posting event
)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Initialises a timer object for the specified channel device.

</para>

</sect2>

<sect2 id="vpb-timer-close">
<title><function>vpb_timer_close()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_timer_close
(
 void *timer // ptr to timer state variables
)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Deletes a timer object.

</para>

</sect2>

<sect2 id="vpb-timer-start">
<title><function>vpb_timer_start()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_timer_start
(
 void *pv // ptr to timer state variables
)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Starts a timer.  When the period specified in vpb_timer_open expires,
	and event for this channel device is generated.  If timer is already
	active, this function throws a wobbly.

</para>

</sect2>

<sect2 id="vpb-timer-restart">
<title><function>vpb_timer_restart()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_timer_restart
(
 void *pv // ptr to timer state variables
)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	ReStarts an already active timer.
	
</para>

</sect2>

<sect2 id="vpb-timer-stop">
<title><function>vpb_timer_stop()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_timer_stop
(
 void *pv // ptr to timer state variables
)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Stops an active timer by removing it from the active list.  This
	function allows the timer to be stopped from the API.
	
</para>

</sect2>

<sect2 id="vpb-timer-change-period">
<title><function>vpb_timer_change_period()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_timer_change_period
(
 void *pv,              // ptr to timer state variables
unsigned long newperiod // period in ms before posting event
)
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Changes the time out value of a timer that has already been
	initialised.
	
</para>

</sect2>

<sect2 id="vpb-timer-get-unique-timer-id">
<title><function>vpb_timer_get_unique_timer_id()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
int WINAPI vpb_timer_get_unique_timer_id() {
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Allows the timer module to generate unique IDs for all of the VPB 
	timer objects in the system.

</para>

</sect2>

<sect2 id="vpb-translate-event">
<title><function>vpb_translate_event()</function></title>

<para><emphasis>Synopsis</emphasis></para>

<screen>
void WINAPI vpb_translate_event(VPB_EVENT *e, char s[])
</screen>

<para><emphasis>Function</emphasis></para>

<para>

	Function to translate the current event into a string.

</para>

</sect2>


</sect1>
