Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > c870e8e4b8db0e40e7f5488a777bd032 > files > 20

vpb-2.1.8-1mdk.i586.rpm

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="GENERATOR" content="Mozilla/4.73 [en] (X11; U; Linux 2.2.14 i586) [Netscape]">
   <title>Func Ref 3</title>
</head>
<body link="#0000FF" vlink="#800080">

<h1>
<b>Function Reference Part 3</b></h1>

<p><br><b>vpb_timer_open</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Creates a timer. Once
started, a </font><font face="Courier"><font size=-2>VPB_TIMER</font></font><font size=-1>
event is placed by a timer in the event queue after its period has expired.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_timer_open(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>void</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>**timer</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>int&nbsp;</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>handle,</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>int</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>id,</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>unsigned
long&nbsp;</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>period</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><u><font face="Courier"><font size=-2>handle</font></font></u></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Handle for this channel.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>id</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Identifier of timer,
this value is placed in the </font><font face="Courier"><font size=-2>data</font></font><font size=-1>
element of the </font><u><font face="Courier"><font size=-2>VPB_EVENT</font></font></u><font size=-1>
structure when a timer event is posted.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>period</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Period of timer in
ms.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>timer</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to pointer
to state variables for this timer.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>The </font><font face="Courier"><font size=-2>id</font></font><font size=-1>
parameter can be used to uniquely identify a timer from other timers on
the same channel.</font>
<p><b>Example</b>
<p><font face="Courier"><font size=-2>#include &lt;stdio.h></font></font>
<p><font face="Courier"><font size=-2>#include &lt;conio.h></font></font>
<p><font face="Courier"><font size=-2>#include "\vpb\vpbapi.h"</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>void main() {</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>int handle;</font></font>
<p><font face="Courier"><font size=-2>void *timer;</font></font>
<p><font face="Courier"><font size=-2>VPB_EVENT e;</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// open and close a timer with id
0, 1000 ms period</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_timer_open(&amp;timer, handle,
0, 1000);</font></font>
<p><font face="Courier"><font size=-2>// start timer</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_timer_start(timer);</font></font>
<p><font face="Courier"><font size=-2>printf("Timer started, waiting, .....\n");</font></font>
<p><font face="Courier"><font size=-2>// wait for a VPB_TIMER event</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>do{</font></font>
<p><font face="Courier"><font size=-2>vpb_get_event_sync(&amp;e,0);</font></font>
<p><font face="Courier"><font size=-2>}while((e.handle != handle) || (e.type
!= VPB_TIMEREXP));</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>printf("Timer expired!\n");</font></font>
<p><font face="Courier"><font size=-2>printf("Press any key to finish!");</font></font>
<p><font face="Courier"><font size=-2>while(!kbhit());</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// shut down</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_timer_close(timer);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_close(handle);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_timer_close</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Closes a timer.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_timer_close(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>void</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*timer</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>timer</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to state variables
for this timer.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>None.</font>
<p><b>Example</b>
<p><font size=-1>See </font><u><font face="Courier"><font size=-2>vpb_timer_open()</font></font>.</u>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_timer_start</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Starts a timer.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_timer_start(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>void</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*timer</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>timer</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to state variables
for this timer.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>Timer must have been opened by </font><u><font face="Courier"><font size=-2>vpb_timer_open()</font></font></u><font size=-1>before
calling this function.</font>
<p><font size=-1>After this function is called, a </font><font face="Courier"><font size=-2>VPB_TIMER</font></font><font size=-1>
event is posted on the event queue after the timer?s period expires.</font>
<p><font size=-1>If the timer is already running an error occurs.</font>
<p><b>Example</b>
<p><font face="Courier"><font size=-2>#include &lt;conio.h></font></font>
<p><font face="Courier"><font size=-2>#include &lt;stdio.h></font></font>
<p><font face="Courier"><font size=-2>#include "\vpb\vpbapi.h"</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>#define TIMER_ID 0</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>void main() {</font></font>
<p><font face="Courier"><font size=-2>int handle;</font></font>
<p><font face="Courier"><font size=-2>void *timer;</font></font>
<p><font face="Courier"><font size=-2>VPB_EVENT e;</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// open and start a timer with 1000
ms period</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_timer_open(&amp;timer, handle,
TIMER_ID, 1000);</font></font>
<p><font face="Courier"><font size=-2>vpb_timer_start(timer);</font></font>
<p><font face="Courier"><font size=-2>printf("Timer started, waiting, .....\n");</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// wait for timer event</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>do {</font></font>
<p><font face="Courier"><font size=-2>vpb_get_event_sync(&amp;e,0);</font></font>
<p><font face="Courier"><font size=-2>} while((e.type != VPB_TIMEREXP)
|| (e.data != TIMER_ID));</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>printf("Timer expired!\n");</font></font>
<p><font face="Courier"><font size=-2>printf("Press any key to finish!");</font></font>
<p><font face="Courier"><font size=-2>while(!kbhit());</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// shut down</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_timer_close(timer);</font></font>
<p><font face="Courier"><font size=-2>vpb_close(handle);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_timer_stop</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Stops a timer without
posting an event.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_timer_stop(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>void</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*timer</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>timer</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to state variables
for this timer.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>Timer must have been opened by </font><u><font face="Courier"><font size=-2>vpb_timer_open()</font></font></u><font size=-1>before
calling this function.</font>
<p><b>Example</b>
<p><font face="Courier"><font size=-2>#include &lt;stdio.h></font></font>
<p><font face="Courier"><font size=-2>#include "\vpb\vpbapi.h"</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>#define TIMER_ID 0</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>void main() {</font></font>
<p><font face="Courier"><font size=-2>int handle;</font></font>
<p><font face="Courier"><font size=-2>void *timer;</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// open and start a timer with 1000
ms period</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_timer_open(&amp;timer, handle,
TIMER_ID, 1000);</font></font>
<p><font face="Courier"><font size=-2>vpb_timer_start(timer);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// stop timer prematurely</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_timer_stop(timer);</font></font>
<p><font face="Courier"><font size=-2>printf("Timer stopped!\n");</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// shut down</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_timer_close(timer);</font></font>
<p><font face="Courier"><font size=-2>vpb_close(handle);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_timer_restart</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Restarts a currently
running timer. The timer "clock" restarts from 0.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_timer_restart(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>void</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*timer</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>timer</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to state variables
for this timer.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>Timer must have been opened by </font><u><font face="Courier"><font size=-2>vpb_timer_open()</font></font></u><font size=-1>before
calling this function.</font>
<p><font size=-1>If the timer has stopped, this function performs the same
function as </font><u><font face="Courier"><font size=-2>vpb_timer_start()</font></font></u><font size=-1>.</font>
<p><b>Example</b>
<p><font face="Courier"><font size=-2>#include &lt;conio.h></font></font>
<p><font face="Courier"><font size=-2>#include &lt;stdio.h></font></font>
<p><font face="Courier"><font size=-2>#include "\vpb\vpbapi.h"</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>#define TIMER_ID 0</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>void main() {</font></font>
<p><font face="Courier"><font size=-2>int handle;</font></font>
<p><font face="Courier"><font size=-2>void *timer;</font></font>
<p><font face="Courier"><font size=-2>VPB_EVENT e;</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// open and start a timer with 1000
ms period</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_timer_open(&amp;timer, handle,
TIMER_ID, 1000);</font></font>
<p><font face="Courier"><font size=-2>vpb_timer_start(timer);</font></font>
<p><font face="Courier"><font size=-2>printf("Timer started!\n");</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// wait a little while</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_sleep(500);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// restart the timer</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_timer_restart(timer);</font></font>
<p><font face="Courier"><font size=-2>printf("Timer restarted!\n");</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// wait for timer event</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>do {</font></font>
<p><font face="Courier"><font size=-2>vpb_get_event_sync(&amp;e,0);</font></font>
<p><font face="Courier"><font size=-2>} while((e.type != VPB_TIMEREXP)
|| (e.data != TIMER_ID));</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>printf("Timer expired!\n");</font></font>
<p><font face="Courier"><font size=-2>printf("Press any key to finish");</font></font>
<p><font face="Courier"><font size=-2>while(!kbhit());</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// shut down</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_timer_close(timer);</font></font>
<p><font face="Courier"><font size=-2>vpb_close(handle);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_timer_get_unique_timer_id</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Obtains a unique timer
ID.&nbsp;</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_timer_get_unique_timer_id(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>returns</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>A unique timer id.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>This function is useful when multiple timers are required
for a given channel, this function can be used to automatically allocate
a unique ID to each of them.</font>
<p><b>Example</b>
<p><font face="Courier"><font size=-2>void main() {</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>int handle;</font></font>
<p><font face="Courier"><font size=-2>void *timer;</font></font>
<p><font face="Courier"><font size=-2>int id;</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// obtain a TIMER ID</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>id = vpb_timer_get_unique_timer_id();</font></font>
<p><font face="Courier"><font size=-2>printf("TIMER ID = %d\n",id);</font></font>
<p><font face="Courier"><font size=-2>// open a timer with 1000 ms period</font></font>
<p><font face="Courier"><font size=-2>vpb_timer_open(&amp;timer, handle,
id, 1000);</font></font>
<p><font face="Courier"><font size=-2>// close timer</font></font>
<p><font face="Courier"><font size=-2>vpb_timer_close(timer);</font></font>
<p><font face="Courier"><font size=-2>vpb_close(handle);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_timer_change_period</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Changes the time out
period of an already open timer.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_timer_change_period(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>void</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*timer</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>unsigned
long&nbsp;</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>newperiod</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>timer</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to timer state
variables.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>newperiod</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>New timer period in
ms.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>The new period becomes valid immediately after calling
this function.</font>
<p><font size=-1>This function affects the timer period in both the stopped
and running states.</font>
<p><b>Example</b>
<p><font face="Courier"><font size=-2>#include &lt;stdio.h></font></font>
<p><font face="Courier"><font size=-2>#include "\vpb\vpbapi.h"</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>#include &lt;stdio.h></font></font>
<p><font face="Courier"><font size=-2>#include "\vpb\vpbapi.h"</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>void main() {</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>int handle;</font></font>
<p><font face="Courier"><font size=-2>void *timer;</font></font>
<p><font face="Courier"><font size=-2>VPB_EVENT e;</font></font>
<p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// open a timer with 2000 ms period</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_timer_open(&amp;timer, handle,
0, 2000);</font></font>
<p><font face="Courier"><font size=-2>// start timer</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_timer_start(timer);</font></font>
<p><font face="Courier"><font size=-2>printf("start timer....\n");</font></font>
<p><font face="Courier"><font size=-2>// change to 3000 ms period</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_timer_change_period(timer, 3000);</font></font>
<p><font face="Courier"><font size=-2>printf("change timer period\n");</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>do{</font></font>
<p><font face="Courier"><font size=-2>vpb_get_event_sync(&amp;e,0);</font></font>
<p><font face="Courier"><font size=-2>}while((e.type!=VPB_TIMEREXP) ||
(e.data!=0));</font></font>
<p><font face="Courier"><font size=-2>printf("timer stopped\n");</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// shut down</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_timer_close(timer);</font></font>
<p><font face="Courier"><font size=-2>vpb_close(handle);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_flush_digits</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Clears the user digit
buffer.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_flush_digits(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>int</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>handle</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><u><font face="Courier"><font size=-2>handle</font></font></u></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Handle for this channel.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>This function should be used before </font><u><font face="Courier"><font size=-2>vpb_get_digits_sync()</font></font></u><font size=-1>and
</font><u><font face="Courier"><font size=-2>vpb_get_digits_async()</font></font></u><font size=-1>to
clear the user digit buffer of any digits that may have resulted from previous
actions on the channel.</font>
<p><b>Example</b>
<p><font face="Courier"><font size=-2>#include &lt;stdio.h></font></font>
<p><font face="Courier"><font size=-2>#include &lt;string.h></font></font>
<p><font face="Courier"><font size=-2>#include "\vpb\vpbapi.h"</font></font>
<p><font face="Courier"><font size=-2>#include &lt;conio.h></font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>static char *term_str[] = {</font></font>
<p><font face="Courier"><font size=-2>"Terminating Digit",</font></font>
<p><font face="Courier"><font size=-2>"Maximum Digits",</font></font>
<p><font face="Courier"><font size=-2>"Time Out",</font></font>
<p><font face="Courier"><font size=-2>"Inter-Digit Time Out",</font></font>
<p><font face="Courier"><font size=-2>};</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>void main(){</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>int handle;</font></font>
<p><font face="Courier"><font size=-2>VPB_DIGITS vd;</font></font>
<p><font face="Courier"><font size=-2>char buf[VPB_MAX_STR];</font></font>
<p><font face="Courier"><font size=-2>int ret;</font></font>
<p><font face="Courier"><font size=-2>char str[VPB_MAX_STR];</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vd.term_digits = "#*";</font></font>
<p><font face="Courier"><font size=-2>vd.max_digits = 3;</font></font>
<p><font face="Courier"><font size=-2>vd.digit_time_out = 20000;</font></font>
<p><font face="Courier"><font size=-2>vd.inter_digit_time_out = 10000;</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// open channel 1</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_get_model(str);</font></font>
<p><font face="Courier"><font size=-2>if(strcmp(str,"VPB4")==0)</font></font>
<p><font face="Courier"><font size=-2>vpb_sethook_async(handle,VPB_OFFHOOK);</font></font>
<p><font face="Courier"><font size=-2>printf("press any key, then press
any digit\n");</font></font>
<p><font face="Courier"><font size=-2>while(!kbhit());</font></font>
<p><font face="Courier"><font size=-2>getch();</font></font>
<p><font face="Courier"><font size=-2>// flush the user digit buffer</font></font>
<p><font face="Courier"><font size=-2>vpb_flush_digits(handle);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>ret = vpb_get_digits_sync(handle,
&amp;vd, buf);</font></font>
<p><font face="Courier"><font size=-2>// The terminating code will be inter-digit
time out</font></font>
<p><font face="Courier"><font size=-2>// and the digit buffer empty</font></font>
<p><font face="Courier"><font size=-2>printf("ret code: %s , digit str:
'%s'\n",term_str[ret],buf);</font></font>
<p><font face="Courier"><font size=-2>printf("press no digits\n");</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_flush_digits(handle);</font></font>
<p><font face="Courier"><font size=-2>ret = vpb_get_digits_sync(handle,
&amp;vd, buf);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>printf("ret code: %s , digit str:
'%s'\n",term_str[ret],buf);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>if(strcmp(str,"VPB4")==0)</font></font>
<p><font face="Courier"><font size=-2>vpb_sethook_sync(handle,VPB_ONHOOK);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// close channel</font></font>
<p><font face="Courier"><font size=-2>vpb_close(handle);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_get_digits_sync</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 >
<tr>
<td VALIGN=TOP WIDTH="77"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="405">&nbsp;</td>

<td></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="77"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="5" WIDTH="676"><font face="Courier"><font size=-2>int
WINAPI vpb_get_digits_sync(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="77">&nbsp;</td>

<td VALIGN=TOP WIDTH="87">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="117"><font face="Courier"><font size=-2>int&nbsp;</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="471"><font face="Courier"><font size=-2>handle,</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="77">&nbsp;</td>

<td VALIGN=TOP WIDTH="87">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="117"><u><font face="Courier"><font size=-2>VPB_DIGITS</font></font>IDH_VPB_DIGITS</u></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="471"><font face="Courier"><font size=-2>*digits</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="77">&nbsp;</td>

<td VALIGN=TOP WIDTH="87">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="117"><font face="Courier"><font size=-2>char</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="471"><font face="Courier"><font size=-2>*digbuf</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="77">&nbsp;</td>

<td VALIGN=TOP WIDTH="87">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="117"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="471">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="77"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="134"><u><font face="Courier"><font size=-2>handle</font></font></u></td>

<td VALIGN=TOP COLSPAN="3" WIDTH="541"><font size=-1>Handle for this channel.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="77">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="134"><font face="Courier"><font size=-2>digits</font></font></td>

<td VALIGN=TOP COLSPAN="3" WIDTH="541"><font size=-1>Pointer to terminating
conditions for the user digit buffer.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="77"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="134"><font face="Courier"><font size=-2>digbuf</font></font></td>

<td VALIGN=TOP COLSPAN="3" WIDTH="541"><font size=-1>Pointer to local buffer
where digits are collected.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="77">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="134"><font face="Courier"><font size=-2>returns</font></font></td>

<td VALIGN=TOP COLSPAN="3" WIDTH="541"><font size=-1>Appropriate <u>termination</u>
code.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="77"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="134">&nbsp;</td>

<td VALIGN=TOP COLSPAN="3" WIDTH="541"><font size=-1>VPB4 only</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>Make sure that the</font><u><font face="Courier"><font size=-2>vpb_flush_digits()</font></font></u><font size=-1>is
called before this function to clear the user digit buffer.</font>
<p><font size=-1>Ensure that the local buffer where the digits are collected
remains in scope for the duration of the function.</font>
<p><b>Example</b>
<p><font face="Courier"><font size=-2>#include &lt;stdio.h></font></font>
<p><font face="Courier"><font size=-2>#include &lt;conio.h></font></font>
<p><font face="Courier"><font size=-2>#include &lt;string.h></font></font>
<p><font face="Courier"><font size=-2>#include "\vpb\vpbapi.h"</font></font>
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// translation of VPB_DIGIT termination
return codes</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>static char *term_str[] = {</font></font>
<p><font face="Courier"><font size=-2>"Terminating Digit",</font></font>
<p><font face="Courier"><font size=-2>"Maximum Digits",</font></font>
<p><font face="Courier"><font size=-2>"Time Out",</font></font>
<p><font face="Courier"><font size=-2>"Inter-Digit Time Out",</font></font>
<p><font face="Courier"><font size=-2>};</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>void main(){</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>int handle;</font></font>
<p><font face="Courier"><font size=-2>VPB_DIGITS vd;</font></font>
<p><font face="Courier"><font size=-2>char buf[VPB_MAX_STR];</font></font>
<p><font face="Courier"><font size=-2>char str[VPB_MAX_STR];</font></font>
<p><font face="Courier"><font size=-2>int ret;</font></font>
<p><font face="Courier"><font size=-2>vd.term_digits = "#*";</font></font>
<p><font face="Courier"><font size=-2>vd.max_digits = 3;</font></font>
<p><font face="Courier"><font size=-2>vd.digit_time_out = 20000;</font></font>
<p><font face="Courier"><font size=-2>vd.inter_digit_time_out = 10000;</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_get_model(str);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// open channel 1</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font>
<p><font face="Courier"><font size=-2>if(strcmp(str,"VBP4")==0)</font></font>
<p><font face="Courier"><font size=-2>vpb_sethook_async(handle,VPB_OFFHOOK);</font></font>
<p><font face="Courier"><font size=-2>printf("press some digits, then press
any key\n");</font></font>
<p><font face="Courier"><font size=-2>while(!kbhit());</font></font>
<p><font face="Courier"><font size=-2>getch();</font></font>
<p><font face="Courier"><font size=-2>// obtain digits from channel</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>ret = vpb_get_digits_sync(handle,
&amp;vd, buf);</font></font>
<p><font face="Courier"><font size=-2>printf("ret code: %s , digit str:
'%s'\n",term_str[ret],buf);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// close channel</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>if(strcmp(str,"VBP4")==0)</font></font>
<p><font face="Courier"><font size=-2>vpb_sethook_sync(handle,VPB_ONHOOK);</font></font>
<p><font face="Courier"><font size=-2>vpb_close(handle);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_get_digits_async</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Collects digits from
the channel. <u>Asynchronous v</u>ersion.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_get_digits_async(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>int&nbsp;</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>handle,</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><u><font face="Courier"><font size=-2>VPB_DIGITS</font></font>IDH_VPB_DIGITS</u></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*digits</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>char</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*digbuf</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><u><font face="Courier"><font size=-2>handle</font></font></u></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Handle for this channel.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>digits</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to terminating
conditions for the user digit buffer.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>digbuf</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to local buffer
where digits are collected.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4 only</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>Make sure that the </font><u><font face="Courier"><font size=-2>vpb_flush_digits()</font></font></u><font size=-1>is
called before this function to clear the user digit buffer.</font>
<p><font size=-1>Ensure that the local buffer where the digits are collected
remains in scope for the duration of the function.</font>
<p><font size=-1>The function posts a completion event when the digits
have been collected, with the terminating condition passed to the data
field of the </font><u><font face="Courier"><font size=-2>VPB_EVENT</font></font></u><font size=-1>structure.</font>
<p><font size=-1>If this function is called while already collecting digits
(by a previous call to this function), the user digit buffer is reset,
discarding digits collected so far.</font>
<p><b>Example</b>
<p><font face="Courier"><font size=-2>#include &lt;stdio.h></font></font>
<p><font face="Courier"><font size=-2>#include &lt;conio.h></font></font>
<p><font face="Courier"><font size=-2>#include &lt;string.h></font></font>
<p><font face="Courier"><font size=-2>#include "\vpb\vpbapi.h"</font></font>
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// translation of VPB_DIGIT termination
return codes</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>static char *term_str[] = {</font></font>
<p><font face="Courier"><font size=-2>"Terminating Digit",</font></font>
<p><font face="Courier"><font size=-2>"Maximum Digits",</font></font>
<p><font face="Courier"><font size=-2>"Time Out",</font></font>
<p><font face="Courier"><font size=-2>"Inter-Digit Time Out",</font></font>
<p><font face="Courier"><font size=-2>};</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>void main(){</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>int handle;</font></font>
<p><font face="Courier"><font size=-2>VPB_DIGITS vd;</font></font>
<p><font face="Courier"><font size=-2>VPB_EVENT e;</font></font>
<p><font face="Courier"><font size=-2>char buf[VPB_MAX_STR];</font></font>
<p><font face="Courier"><font size=-2>char str[VPB_MAX_STR];</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vd.term_digits = "#*";</font></font>
<p><font face="Courier"><font size=-2>vd.max_digits = 3;</font></font>
<p><font face="Courier"><font size=-2>vd.digit_time_out = 20000;</font></font>
<p><font face="Courier"><font size=-2>vd.inter_digit_time_out = 10000;</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// open channel 1</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font>
<p><font face="Courier"><font size=-2>vpb_get_model(str);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>if(strcmp(str,"VPB4")==0)</font></font>
<p><font face="Courier"><font size=-2>vpb_sethook_async(handle,VPB_OFFHOOK);</font></font>
<p><font face="Courier"><font size=-2>printf("press some digits, then press
any key\n");</font></font>
<p><font face="Courier"><font size=-2>while(!kbhit());</font></font>
<p><font face="Courier"><font size=-2>getch();</font></font>
<p><font face="Courier"><font size=-2>// obtain digits collected from the
channel</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_get_digits_async(handle, &amp;vd,
buf);</font></font>
<p><font face="Courier"><font size=-2>do{</font></font>
<p><font face="Courier"><font size=-2>vpb_get_event_sync(&amp;e,0);</font></font>
<p><font face="Courier"><font size=-2>}while((e.handle!=handle) || (e.type
!= VPB_DIGIT));</font></font>
<p><font face="Courier"><font size=-2>printf("term. code: %s , digit str:
'%s'\n",term_str[e.data],buf);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// close channel</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>if(strcmp(str,"VPB4")==0)</font></font>
<p><font face="Courier"><font size=-2>vpb_sethook_sync(handle,VPB_ONHOOK);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_close(handle);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_wave_open_write</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Opens a wave file
that will be written to.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_wave_open_write(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>void&nbsp;</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>**ppv,</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>char</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>file_name[],</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>int</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>mode</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>ppv</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to pointer
to storage required by the wave function.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>file_name</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to string
containing name of wave file (including path).</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><u><font face="Courier"><font size=-2>mode</font></font></u></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Compression mode.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>This function does not require any VPB hardware to run.
If using this function in conjunction with the <u>user defined record</u>
functions, ensure that the compression modes are the same.</font>
<p><b>Example</b>
<p><font size=-1>See </font><u><font face="Courier"><font size=-2>vpb_wave_write()</font></font></u><font size=-1>.</font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_wave_write</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Writes a block of
samples to a wave file.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_wave_write(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>void&nbsp;</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*wv,</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>char</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>buf[],</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>long</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>n</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>wv</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to wave file.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>buf</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to source
buffer.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>n</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Number of bytes to
write.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>returns</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Number of bytes written.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>This function does not require any VPB hardware to run.
The </font><u><font face="Courier"><font size=-2>vpb_wave_open_write()</font></font></u><font size=-1>is
required to be called before this function.</font>
<p><b>Example</b>
<p><font face="Courier"><font size=-2>#include &lt;conio.h></font></font>
<p><font face="Courier"><font size=-2>#include &lt;stdio.h></font></font>
<p><font face="Courier"><font size=-2>#include &lt;string.h></font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>#include "\vpb\vpbapi.h"</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>#define N 8000 // length of buffer
(1 second)</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>void main() {</font></font>
<p><font face="Courier"><font size=-2>int handle;</font></font>
<p><font face="Courier"><font size=-2>char buf[N];</font></font>
<p><font face="Courier"><font size=-2>void *ws;</font></font>
<p><font face="Courier"><font size=-2>char str[VPB_MAX_STR];</font></font>
<p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_get_model(str);</font></font>
<p><font face="Courier"><font size=-2>// prompt user to dial</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>printf("Dial the extension connected
to channel 1...\n");</font></font>
<p><font face="Courier"><font size=-2>printf("Press any key to continue....\n");</font></font>
<p><font face="Courier"><font size=-2>while(!kbhit());</font></font>
<p><font face="Courier"><font size=-2>getch();</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// open wave file to write</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_wave_open_write(&amp;ws,"test2.wav",VPB_ALAW);</font></font>
<p><font face="Courier"><font size=-2>// save handle and wave file state
variables</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>if(strcmp(str,"VPB4")==0){</font></font>
<p><font face="Courier"><font size=-2>// take channel 1 off hook</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_sethook_async(handle, VPB_OFFHOOK);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<p><font face="Courier"><font size=-2>// initialise user defined record
routine</font></font>
<p><font face="Courier"><font size=-2>vpb_record_buf_start(handle,VPB_ALAW);</font></font>
<p><font face="Courier"><font size=-2>printf("\nrecording........press
any key to stop");</font></font>
<p><font face="Courier"><font size=-2>while(!kbhit()){</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// record buffer using user defined
play routine</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_record_buf_sync(handle, buf,
N);</font></font>
<p><font face="Courier"><font size=-2>// save to wave file</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_wave_write(ws,buf,N);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// close user defined play routine</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_record_buf_finish(handle);</font></font>
<p><font face="Courier"><font size=-2>// close wave file</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_wave_close_write(ws);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// prompt user to hangup</font></font>
<p><font face="Courier"><font size=-2>if(strcmp(str,"VPB4")==0){</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>printf("\nPress any key to hangup....\n");</font></font>
<p><font face="Courier"><font size=-2>while(!kbhit());</font></font>
<p><font face="Courier"><font size=-2>getch();</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// hangup</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_sethook_sync(handle, VPB_ONHOOK);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<p><font face="Courier"><font size=-2>vpb_close(handle);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_wave_close_write</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Closes the wave file
that has been written to.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_wave_close_write(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>void&nbsp;</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*wv</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>wv</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to wave file.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>This function does not require any VPB hardware to run.
The function releases any memory that has been used by the </font><u><font face="Courier"><font size=-2>vpb_wave_open_write()</font></font></u><font size=-1>.</font>
<p><b>Example</b>
<p><font size=-1>See </font><u><font face="Courier"><font size=-2>vpb_wave_write()</font></font></u><font size=-1>.</font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_wave_open_read</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Opens a wave file
that will be read from.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_wave_open_read(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>void&nbsp;</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>**ppv,</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>char</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>file_name[]</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>ppv</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to pointer
to storage required by the wave function.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>file_name</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to string
containing name of wave file (including path).</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>This function does not require any VPB hardware to run.</font>
<p><b>Example</b>
<p><font size=-1>See </font><u><font face="Courier"><font size=-2>vpb_wave_read()</font></font></u><font size=-1>.</font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_wave_read</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Reads a block of samples
from a wave file.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_wave_read(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>void</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*wv,</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>char</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>buf[],</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>long</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>N</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>wv</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to wave file.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>buf</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to destination
buffer.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>n</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Number of bytes to
read.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>returns</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Number of bytes read.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>This function does not require any VPB hardware to run.</font>
<p><font size=-1>The </font><u><font face="Courier"><font size=-2>vpb_wave_open_read()</font></font></u><font size=-1>is
required to be called before this function.</font>
<p><b>Example</b>
<p><font face="Courier"><font size=-2>#include &lt;conio.h></font></font>
<p><font face="Courier"><font size=-2>#include &lt;stdio.h></font></font>
<p><font face="Courier"><font size=-2>#include "\vpb\vpbapi.h"</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>#define N 8000 // length of buffer
(1 second)</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>void main() {</font></font>
<p><font face="Courier"><font size=-2>int handle;</font></font>
<p><font face="Courier"><font size=-2>char buf[N];</font></font>
<p><font face="Courier"><font size=-2>unsigned short n;</font></font>
<p><font face="Courier"><font size=-2>void *ws;</font></font>
<p><font face="Courier"><font size=-2>unsigned short mode;</font></font>
<p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// prompt user to dial</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>printf("Dial the extension connected
to channel 1...\n");</font></font>
<p><font face="Courier"><font size=-2>printf("Press any key to continue....\n");</font></font>
<p><font face="Courier"><font size=-2>while(!kbhit());</font></font>
<p><font face="Courier"><font size=-2>getch();</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// open wave file to read</font></font>
<p><font face="Courier"><font size=-2>// Note: test.wav is a user supplied
file</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_wave_open_read(&amp;ws,"test.wav");</font></font>
<p><font face="Courier"><font size=-2>// obtain the compression mode of
the wave file</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_wave_get_mode(ws,&amp;mode);</font></font>
<p><font face="Courier"><font size=-2>// take channel 1 off hook</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_sethook_async(handle, VPB_OFFHOOK);</font></font>
<p><font face="Courier"><font size=-2>// initialise user defined play routine</font></font>
<p><font face="Courier"><font size=-2>vpb_play_buf_start(handle,mode);</font></font>
<p><font face="Courier"><font size=-2>// continuously play wave file until
keyboard hit</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>printf("Play wave file continuously
until key pressed");</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>while(!kbhit()){</font></font>
<p><font face="Courier"><font size=-2>if((n=vpb_wave_read(ws,buf,N)) ==
NULL){</font></font>
<p><font face="Courier"><font size=-2>vpb_wave_seek(ws,0);</font></font>
<p><font face="Courier"><font size=-2>n=vpb_wave_read(ws,buf,N);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<p><font face="Courier"><font size=-2>// play buffer using user defined
play routine</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_play_buf_sync(handle, buf, n);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// close user defined play routine</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_play_buf_finish(handle);</font></font>
<p><font face="Courier"><font size=-2>// close wave file</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_wave_close_read(ws);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// prompt user to hangup</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>printf("\nPress any key to hangup....\n");</font></font>
<p><font face="Courier"><font size=-2>while(!kbhit());</font></font>
<p><font face="Courier"><font size=-2>getch();</font></font>
<p><font face="Courier"><font size=-2>// hangup</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_sethook_sync(handle, VPB_ONHOOK);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_close(handle);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_wave_close_read</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Closes the wave file
that has been read from.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_wave_close_read(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>Void</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*wv</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>wv</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to wave file.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>This function does not require any VPB hardware to run.
The function releases any memory that has been used by the </font><u><font face="Courier"><font size=-2>vpb_wave_open_read()</font></font></u><font size=-1>.</font>
<p><b>Example</b>
<p><font size=-1>See </font><u><font face="Courier"><font size=-2>vpb_wave_read()</font></font></u><font size=-1>.</font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_wave_set_sample_rate</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Changes the sample
rate parameter of a wave file.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_wave_set_sample_rate(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>void</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*wv,</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>unsigned
int</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>rate</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>wv</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to wave file.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>rate</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Sampling rate of the
wave file.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB8L only</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>This function is used on the VPB8L platform (where it
has a 6 or 8 ksamples/s sampling rate option). It sets the sampling rate
of the wave file when using the <u>user-defined</u> record routines.</font>
<p><b>Example</b>
<p><font face="Courier"><font size=-2>// This VPB8L test program demonstrates
sampling of 24 kbit/s</font></font>
<p><font face="Courier"><font size=-2>// APDCM, which is sampled at 6 kHz.
The ADPCM is decoded and</font></font>
<p><font face="Courier"><font size=-2>// saved as 6 kHz linear data to
a wave file.</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>#include &lt;assert.h></font></font>
<p><font face="Courier"><font size=-2>#include &lt;stdlib.h></font></font>
<p><font face="Courier"><font size=-2>#include &lt;stdio.h></font></font>
<p><font face="Courier"><font size=-2>#include &lt;conio.h></font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>#include "\vpb\vpbapi.h"</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>#define N 160</font></font>
<p><font face="Courier"><font size=-2>void main(void)</font></font>
<p><font face="Courier"><font size=-2>{</font></font>
<p><font face="Courier"><font size=-2>int h;</font></font>
<p><font face="Courier"><font size=-2>int i;</font></font>
<p><font face="Courier"><font size=-2>char adpcm[N/2];</font></font>
<p><font face="Courier"><font size=-2>void *w, *adpcm_states;</font></font>
<p><font face="Courier"><font size=-2>unsigned short nlinear;</font></font>
<p><font face="Courier"><font size=-2>short linear[N];</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>h = vpb_open(1, 1);</font></font>
<p><font face="Courier"><font size=-2>vpb_wave_open_write(&amp;w, "adpcm24.wav",VPB_LINEAR);</font></font>
<p><font face="Courier"><font size=-2>vpb_wave_set_sample_rate(w, 6000);</font></font>
<p><font face="Courier"><font size=-2>vpb_adpcm_open(&amp;adpcm_states);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// record until key pressed</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_record_buf_start(h,VPB_OKIADPCM24);</font></font>
<p><font face="Courier"><font size=-2>i= 0;</font></font>
<p><font face="Courier"><font size=-2>while(!kbhit()) {</font></font>
<p><font face="Courier"><font size=-2>vpb_record_buf_sync(h, adpcm, N/2);</font></font>
<p><font face="Courier"><font size=-2>vpb_adpcm_decode(adpcm_states, linear,
&amp;nlinear, adpcm, N/2);</font></font>
<p><font face="Courier"><font size=-2>vpb_wave_write(w, (char*)linear,
nlinear*sizeof(short));</font></font>
<p><font face="Courier"><font size=-2>printf("frames: %d\r",i++);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_adpcm_close(adpcm_states);</font></font>
<p><font face="Courier"><font size=-2>vpb_wave_close_write(w);</font></font>
<p><font face="Courier"><font size=-2>vpb_record_buf_finish(h);</font></font>
<p><font face="Courier"><font size=-2>vpb_close(h);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_wave_seek</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Moves the wave pointer
to a specified location in samples with respect to the beginning of the
wave file.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_wave_seek(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>void</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*wv,</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>long</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>offset</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>wv</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to wave file.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>offset</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Number of bytes from
beginning of wave file.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>None.</font>
<p><b>Example</b>
<p><font size=-1>See </font><u><font face="Courier"><font size=-2>vpb_wave_read()</font></font></u><font size=-1>.</font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_wave_get_mode</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Determines the compression
mode of the wave file.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_wave_get_mode(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>void</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*wv</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>unsigned
short</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*mode</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>wv</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to wave file.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>mode</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to compression
mode of the wave file.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L&nbsp;</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>See <u>mode</u> for the compression mode options available
for each platform.</font>
<p><b>Example</b>
<p><font size=-1>See </font><u><font face="Courier"><font size=-2>vpb_wave_read()</font></font></u><font size=-1>.</font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_get_call</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Obtains the call progress
parameters for a channel.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_get_call(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>int</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>handle</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><u><font face="Courier"><font size=-2>VPB_CALL</font></font>IDH_VPB_CALL</u></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*vpb_call</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><u><font face="Courier"><font size=-2>handle</font></font></u></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Handle for this channel.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>vpb_call</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to structure
containing call progress parameters.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4&nbsp;</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>See </font><u><font face="Courier"><font size=-2>VPB_CALL</font></font>IDH_VPB_CALL</u><font size=-1>
for the default values of the call progress parameters. The time duration
for the parameters are in <i>ms </i>(milliseconds).</font>
<p><b>Example</b>
<p><font size=-1>See </font><u><font face="Courier"><font size=-2>vpb_call_sync()</font></font></u><font size=-1>.</font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_set_call</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Sets the call progress
parameters for a channel.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_set_call(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>int</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>handle</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><u><font face="Courier"><font size=-2>VPB_CALL</font></font>IDH_VPB_CALL</u></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*vpb_call</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><u><font face="Courier"><font size=-2>handle</font></font></u></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Handle for this channel.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>vpb_call</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to structure
containing call progress parameters.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4&nbsp;</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>See </font><u><font face="Courier"><font size=-2>VPB_CALL</font></font>IDH_VPB_CALL
</u><font size=-1>for
the default values of the call progress parameters. The time duration for
the parameters are in <i>ms </i>(milliseconds). If only modifying some
of the call progress parameters, make sure the rest of the parameters have
the default values. This may be accomplished by the </font><u><font face="Courier"><font size=-2>vpb_get_call()</font></font></u><font size=-1>.</font>
<p><b>Example</b>
<p><font size=-1>See </font><u><font face="Courier"><font size=-2>vpb_call_sync()</font></font></u><font size=-1>.</font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_call_sync</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Places a call using
the call progress algorithm. <u>Synchronous </u>version.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_call_sync(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>int</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>handle</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>char</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*dialstr</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><u><font face="Courier"><font size=-2>handle</font></font></u></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Handle for this channel.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>dialstr</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to string
of chars that correspond to tones to dial.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>returns</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><u><font size=-1>Call progress return
code</font>.</u></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4&nbsp;</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>Ensure dial tone has not been detected before the function
is called.</font>
<p><b>Example</b>
<p><font face="Courier"><font size=-2>#include &lt;conio.h></font></font>
<p><font face="Courier"><font size=-2>#include &lt;stdio.h></font></font>
<p><font face="Courier"><font size=-2>#include "\vpb\vpbapi.h"</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// description of call progress result
codes</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>static char *call_str[] = {</font></font>
<p><font face="Courier"><font size=-2>"Connected",</font></font>
<p><font face="Courier"><font size=-2>"No Dial Tone",</font></font>
<p><font face="Courier"><font size=-2>"No Ring Back",</font></font>
<p><font face="Courier"><font size=-2>"Busy",</font></font>
<p><font face="Courier"><font size=-2>"No Answer",</font></font>
<p><font face="Courier"><font size=-2>"Disconnected",</font></font>
<p><font face="Courier"><font size=-2>"Invalid Data"</font></font>
<p><font face="Courier"><font size=-2>};</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>void main() {</font></font>
<p><font face="Courier"><font size=-2>int handle,ret;</font></font>
<p><font face="Courier"><font size=-2>VPB_CALL cpp;</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// get default call progress parameters</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_get_call(handle,&amp;cpp);</font></font>
<p><font face="Courier"><font size=-2>printf("number of dial tones = %d\n
\</font></font>
<p><font face="Courier"><font size=-2>time limit for dial tone = %dms\n
\</font></font>
<p><font face="Courier"><font size=-2>wait time for initial ringback =
%dms\n \</font></font>
<p><font face="Courier"><font size=-2>time limit when call is considered
connected = %dms\n \</font></font>
<p><font face="Courier"><font size=-2>time limit when call is answered
after ringback = %dms\n",\</font></font>
<p><font face="Courier"><font size=-2>cpp.dialtones,cpp.dialtone_timeout,cpp.ringback_timeout,\</font></font>
<p><font face="Courier"><font size=-2>cpp.inter_ringback_timeout,cpp.answer_timeout);</font></font>
<p><font face="Courier"><font size=-2>// change time limit for dial tone
parameter to 2.5 sec</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>cpp.dialtone_timeout = 2500;</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// set call progress parameters</font></font>
<p><font face="Courier"><font size=-2>vpb_set_call(handle,&amp;cpp);</font></font>
<p><font face="Courier"><font size=-2>printf("time limit for dial tone
= %dms\n",cpp.dialtone_timeout);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// place channel off hook</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_sethook_sync(handle,VPB_OFFHOOK);</font></font>
<p><font face="Courier"><font size=-2>// sync call and print result</font></font>
<p><font face="Courier"><font size=-2>// Note: user specified number for
dial string</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>ret = vpb_call_sync(handle, "13");</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>printf("\n->>>>>>>>>>>>Call result
sync: %s\n",call_str[ret]);</font></font>
<p><font face="Courier"><font size=-2>// hang up</font></font>
<p><font face="Courier"><font size=-2>vpb_sethook_sync(handle,VPB_ONHOOK);</font></font>
<p><font face="Courier"><font size=-2>vpb_close(handle);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_call_async</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 >
<tr>
<td VALIGN=TOP COLSPAN="5" WIDTH="487"></td>

<td VALIGN=CENTER>&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="85"><b>PurposeSyntax</b></td>

<td VALIGN=TOP COLSPAN="5" WIDTH="538"><font face="Courier"><font size=-2>int
WINAPI vpb_call_async(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="85">&nbsp;</td>

<td VALIGN=TOP WIDTH="106">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="166"><font face="Courier"><font size=-2>int</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="266"><font face="Courier"><font size=-2>handle</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="85">&nbsp;</td>

<td VALIGN=TOP WIDTH="106">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="166"><font face="Courier"><font size=-2>char</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="266"><font face="Courier"><font size=-2>*dialstr</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="85">&nbsp;</td>

<td VALIGN=TOP WIDTH="106">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="166"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="266">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="85"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="174"><u><font face="Courier"><font size=-2>handle</font></font></u></td>

<td VALIGN=TOP COLSPAN="3" WIDTH="364"><font size=-1>Handle for this channel.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="85">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="174"><font face="Courier"><font size=-2>dialstr</font></font></td>

<td VALIGN=TOP COLSPAN="3" WIDTH="364"><font size=-1>Pointer to string
of chars that correspond to tones to dial.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="85"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="174"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="3" WIDTH="364">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="85"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="174">&nbsp;</td>

<td VALIGN=TOP COLSPAN="3" WIDTH="364"><font size=-1>VPB4&nbsp;</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>Ensure dial tone has not been detected before the function
is called.</font>
<p><b>Example</b>
<p><font face="Courier"><font size=-2>#include &lt;conio.h></font></font>
<p><font face="Courier"><font size=-2>#include &lt;stdio.h></font></font>
<p><font face="Courier"><font size=-2>#include "\vpb\vpbapi.h"</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>void main() {</font></font>
<p><font face="Courier"><font size=-2>int handle;</font></font>
<p><font face="Courier"><font size=-2>VPB_EVENT e;</font></font>
<p><font face="Courier"><font size=-2>char s[VPB_MAX_STR];</font></font>
<p><font face="Courier"><font size=-2>int finished = 0;</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font>
<p><font face="Courier"><font size=-2>vpb_sethook_sync(handle,VPB_OFFHOOK);</font></font>
<p><font face="Courier"><font size=-2>while(!kbhit()) {</font></font>
<p><font face="Courier"><font size=-2>// call async</font></font>
<p><font face="Courier"><font size=-2>// Note: user specified number for
dial string</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_call_async(handle, "12");</font></font>
<p><font face="Courier"><font size=-2>do {</font></font>
<p><font face="Courier"><font size=-2>vpb_get_event_sync(&amp;e, 0);</font></font>
<p><font face="Courier"><font size=-2>vpb_translate_event(&amp;e, s);</font></font>
<p><font face="Courier"><font size=-2>printf("%s",s);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// try again by hanging up and going
off hook!</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>if (e.type == VPB_CALLEND) {</font></font>
<p><font face="Courier"><font size=-2>vpb_sethook_sync(handle,VPB_ONHOOK);</font></font>
<p><font face="Courier"><font size=-2>vpb_sethook_sync(handle,VPB_OFFHOOK);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<p><font face="Courier"><font size=-2>} while(e.type != VPB_CALLEND);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// hang up</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_sethook_sync(handle,VPB_ONHOOK);</font></font>
<p><font face="Courier"><font size=-2>vpb_close(handle);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<p><b>&nbsp;vpb_getvox</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Gets the VOX parameters
from a particular channel.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_getvox(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>int</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>handle</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><u><font face="Courier"><font size=-2>VPB_VOX</font></font>IDH_VPB_VOX</u></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*vox</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><u><font face="Courier"><font size=-2>handle</font></font></u></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Handle for this channel.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>vox</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to structure
containing the VOX parameters.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L&nbsp;</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>The on-level and off-level thresholds in the firmware
lack some precision (to two decimal places) due to the float to integer
conversions. For example, instead of -12 dB as the default value for the
VOX on-level, it may contain -12.00173 dB.</font>
<p><b>Example</b>
<p><font face="Courier"><font size=-2>#include "\vpb\vpbapi.h"</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>void main(){</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>int handle;</font></font>
<p><font face="Courier"><font size=-2>VPB_VOX params;</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// open channel 1</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font>
<p><font face="Courier"><font size=-2>// obtain default VOX parameters</font></font>
<p><font face="Courier"><font size=-2>vpb_getvox(handle,&amp;params);</font></font>
<p><font face="Courier"><font size=-2>printf("onlevel threshold = %f dB
&lt;default>\n", params.onlevel);</font></font>
<p><font face="Courier"><font size=-2>printf("offlevel threshold = %f dB
&lt;default>\n", params.offlevel);</font></font>
<p><font face="Courier"><font size=-2>printf("run off time = %d (ms) &lt;default>\n",
params.runon);</font></font>
<p><font face="Courier"><font size=-2>// set VOX paramters, VOX off level
-24dB run on 3 s</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>params.offlevel = -24.0;</font></font>
<p><font face="Courier"><font size=-2>params.runon = 3000;</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_setvox(handle,&amp;params);</font></font>
<p><font face="Courier"><font size=-2>// obtain new VOX parameters</font></font>
<p><font face="Courier"><font size=-2>vpb_getvox(handle,&amp;params);</font></font>
<p><font face="Courier"><font size=-2>printf("onlevel threshold = %f dB\n",params.onlevel);</font></font>
<p><font face="Courier"><font size=-2>printf("offlevel threshold = %f dB\n",params.offlevel);</font></font>
<p><font face="Courier"><font size=-2>printf("run off time = %d (ms)\n",params.runon);</font></font>
<p><font face="Courier"><font size=-2>vpb_close(handle);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_setvox</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Sets the VOX parameters
for a particular channel.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_setvox(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>int</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>handle</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><u><font face="Courier"><font size=-2>VPB_VOX</font></font>IDH_VPB_VOX</u></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*vox</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><u><font face="Courier"><font size=-2>handle</font></font></u></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Handle for this channel.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>vox</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to structure
containing the VOX parameters.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L&nbsp;</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>The on-level and off-level thresholds in the firmware
lack precision (to two decimal places) due to the float to integer conversions.
For example, instead of -12 dB as the default value for the VOX on-level,
it may contain -12.00173 dB.</font>
<p><b>Example</b>
<p><font size=-1>See</font><font face="Courier"><font size=-2> <u>vpb_getvox()</u></font></font><font size=-1>.</font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_get_pip</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Gets the pip parameters.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_get_pip(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><u><font face="Courier"><font size=-2>VPB_PIP</font></font>IDH_VPB_PIP</u></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*vpb_pip</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>vpb_pip</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to structure
containing the pip parameters.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB8L only&nbsp;</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>The default value for the width of the pulse is 425 ms.
The default value for the period between pulses is 15s.</font>
<p><b>Example</b>
<p><font size=-1>See </font><u><font face="Courier"><font size=-2>vpb_pip_on()</font></font></u><font size=-1>.</font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_set_pip</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Sets the pip parameters.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_set_pip(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><u><font face="Courier"><font size=-2>VPB_PIP</font></font>IDH_VPB_PIP</u></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*vpb_pip</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>vpb_pip</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to structure
containing the pip parameters.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB8L only&nbsp;</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>The default value for the width of the pulse is 425 ms.
The default value for the period between pulses is 15s.</font>
<p><b>Example</b>
<p><font size=-1>See</font><font face="Courier"><font size=-2> <u>vpb_pip_on()</u></font></font><font size=-1>.</font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_pip_on</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Enables the pip signal
of a channel.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_pip_on(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>int</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>handle</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><u><font face="Courier"><font size=-2>handle</font></font></u></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Handle for this channel.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB8L only&nbsp;</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>The default value for the width of the pulse is 425 ms.
The default value for the period between pulses is 15s.</font>
<p><b>Example</b>
<p><font face="Courier"><font size=-2>#include &lt;stdio.h></font></font>
<p><font face="Courier"><font size=-2>#include "\vpb\vpbapi.h"</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>void main() {</font></font>
<p><font face="Courier"><font size=-2>int handle;</font></font>
<p><font face="Courier"><font size=-2>VPB_EVENT e;</font></font>
<p><font face="Courier"><font size=-2>VPB_PIP vpb_pip;</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// open channel</font></font>
<p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// get pip parameters</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_get_pip(&amp;vpb_pip);</font></font>
<p><font face="Courier"><font size=-2>printf("width of pip = %d ms",vpb_pip.width);</font></font>
<p><font face="Courier"><font size=-2>printf("period between pip pulse
= %d ms",vpb_pip.period);</font></font>
<p><font face="Courier"><font size=-2>// set pip period to 20 sec</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_pip.period = 20000;</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_set_pip(&amp;vpb_pip);</font></font>
<p><font face="Courier"><font size=-2>printf("width of pip = %d ms",vpb_pip.width);</font></font>
<p><font face="Courier"><font size=-2>printf("period between pip pulse
= %d ms",vpb_pip.period);</font></font>
<p><font face="Courier"><font size=-2>// enable pip</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_pip_on(handle);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// wait for a vox on event</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>do{</font></font>
<p><font face="Courier"><font size=-2>vpb_get_event_sync(&amp;e,0);</font></font>
<p><font face="Courier"><font size=-2>}while((e.handle != handle) || (e.type
!= VPB_VOXON));</font></font>
<p><font face="Courier"><font size=-2>// record</font></font>
<p><font face="Courier"><font size=-2>printf("Recording linear on ch 1
: ");</font></font>
<p><font face="Courier"><font size=-2>vpb_record_file_async(handle, "log.wav",
VPB_LINEAR);</font></font>
<p><font face="Courier"><font size=-2>// wait for a vox off event</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>do{</font></font>
<p><font face="Courier"><font size=-2>vpb_get_event_sync(&amp;e,0);</font></font>
<p><font face="Courier"><font size=-2>}while((e.handle != handle) || (e.type
!= VPB_VOXOFF));</font></font>
<p><font face="Courier"><font size=-2>// terminate recordings</font></font>
<p><font face="Courier"><font size=-2>vpb_record_terminate(handle);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// stop recording disable pip and
shut down</font></font>
<p><font face="Courier"><font size=-2>vpb_pip_off(handle);</font></font>
<p><font face="Courier"><font size=-2>vpb_close(handle);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_pip_off</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Disables the pip signal
of a channel.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_pip_off(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>int</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>handle</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><u><font face="Courier"><font size=-2>handle</font></font></u></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Handle for this channel.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB8L only&nbsp;</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>None.</font>
<p><b>Example</b>
<p><font size=-1>See </font><u><font face="Courier"><font size=-2>vpb_pip_on()</font></font></u>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_sleep</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Puts the current thread
to sleep for a specified time.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_sleep(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>long</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>time_ms</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>time_ms</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Time for thread to
sleep.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>This function is useful for introducing a delay when polling
for events using </font><u><font face="Courier"><font size=-2>vpb_get_event_async()</font></font></u><font size=-1>
to reduce the load on the PC. As events happen relatively slowly, small
delays in processing do not affect the functioning of computer telephony
programs.</font>
<p><b>Example</b>
<p><font face="Courier"><font size=-2>#include &lt;stdio.h></font></font>
<p><font face="Courier"><font size=-2>#include &lt;conio.h></font></font>
<p><font face="Courier"><font size=-2>#include "\vpb\vpbapi.h"</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>void main() {</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>int handle;</font></font>
<p><font face="Courier"><font size=-2>VPB_EVENT e;</font></font>
<p><font face="Courier"><font size=-2>char s[VPB_MAX_STR];</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// enable VOXON events only</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_set_event_mask(handle, VPB_MVOXON);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// poll for VOXON events</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>printf("Press any key to exit\n");</font></font>
<p><font face="Courier"><font size=-2>while(!kbhit()) {</font></font>
<p><font face="Courier"><font size=-2>if(vpb_get_event_async(&amp;e) ==
VPB_OK){</font></font>
<p><font face="Courier"><font size=-2>vpb_translate_event(&amp;e,s);</font></font>
<p><font face="Courier"><font size=-2>printf("event: %s\n",s);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<p><font face="Courier"><font size=-2>vpb_sleep(20);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_close(handle);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_get_model</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Returns a string containing
the VPB model.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_get_model(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>char</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*s</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>s</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to string
containing the model of VPB card</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>None.</font>
<p><b>Example</b>
<p><font size=-1>See </font><u><font face="Courier"><font size=-2>vpb_record_file_sync()</font></font></u><font size=-1>.</font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_sethook_sync</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Sets the hook status
of a channel (with an internal delay of 300 ms).</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_sethook_sync(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>int&nbsp;</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>handle,</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>Int</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>hookstate</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><u><font face="Courier"><font size=-2>handle</font></font></u></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Handle for this channel.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>hookstate</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font face="Courier"><font size=-2>VPB_ONHOOK</font></font><font size=-1>
or </font><font face="Courier"><font size=-2>VPB_OFFHOOK.</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4 only</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>There is a small delay (less than 100 ms) between calling
this function and the completion of the function. When placing a line on
hook this function allows for a delay (300ms) to guarantee the line is
placed on hook before exiting the function. This is conveniently used when
exiting the programme and shutting down the VPB.</font>
<p><b>Example</b>
<p><font face="Courier"><font size=-2>#include &lt;stdio.h></font></font>
<p><font face="Courier"><font size=-2>#include &lt;conio.h></font></font>
<p><font face="Courier"><font size=-2>#include "\vpb\vpbapi.h"</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>void main() {</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>int handle;</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// take channel off hook</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>printf("Press any key to take off
hook\n");</font></font>
<p><font face="Courier"><font size=-2>while(!kbhit());</font></font>
<p><font face="Courier"><font size=-2>getch();</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_sethook_async(handle, VPB_OFFHOOK);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// place channel on hook</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>printf("Press any key to place on
hook\n");</font></font>
<p><font face="Courier"><font size=-2>while(!kbhit());</font></font>
<p><font face="Courier"><font size=-2>getch();</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_sethook_sync(handle, VPB_ONHOOK);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_close(handle);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_sethook_async</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Sets the hook status
of a channel (with no delay).</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_sethook_async(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>int&nbsp;</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>handle,</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>int</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>hookstate</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><u><font face="Courier"><font size=-2>handle</font></font></u></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Handle for this channel.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>hookstate</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font face="Courier"><font size=-2>VPB_ONHOOK</font></font><font size=-1>
or </font><font face="Courier"><font size=-2>VPB_OFFHOOK.</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4 only</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>If the line is placed on hook well before the program
exits a delay is not necessary.</font>
<p><b>Example</b>
<p><font size=-1>See </font><u><font face="Courier"><font size=-2>vpb_sethook_sync()</font></font></u><font size=-1>.</font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_translate_event</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 >
<tr>
<td VALIGN=TOP COLSPAN="5" WIDTH="487"></td>

<td VALIGN=CENTER>&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="85"><b>Purpose&nbsp;</b>
<p><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="5" WIDTH="538"><font face="Courier"><font size=-2>int
WINAPI vpb_translate_event(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="85">&nbsp;</td>

<td VALIGN=TOP WIDTH="106">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="166"><u><font face="Courier"><font size=-2>VPB_EVENT</font></font></u></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="266"><font face="Courier"><font size=-2>*e,</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="85">&nbsp;</td>

<td VALIGN=TOP WIDTH="106">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="166"><font face="Courier"><font size=-2>char&nbsp;</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="266"><font face="Courier"><font size=-2>s[]</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="85">&nbsp;</td>

<td VALIGN=TOP WIDTH="106">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="166"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="266">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="85"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="174"><font face="Courier"><font size=-2>e</font></font></td>

<td VALIGN=TOP COLSPAN="3" WIDTH="364"><font size=-1>Pointer to event to
translate.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="85">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="174"><font face="Courier"><font size=-2>s</font></font></td>

<td VALIGN=TOP COLSPAN="3" WIDTH="364"><font size=-1>Pointer to string
with at least </font><font face="Courier"><font size=-2>VPB_MAX_CHAR</font></font><font size=-1>
characters.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="85"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="174"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="3" WIDTH="364">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="85"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="174">&nbsp;</td>

<td VALIGN=TOP COLSPAN="3" WIDTH="364"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>None.</font>
<p><b>Example</b>
<p><font face="Courier"><font size=-2>#include &lt;conio.h></font></font>
<p><font face="Courier"><font size=-2>#include &lt;stdio.h></font></font>
<p><font face="Courier"><font size=-2>#include "\vpb\vpbapi.h"</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>void main() {</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>int handle;</font></font>
<p><font face="Courier"><font size=-2>char s[VPB_MAX_STR];</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// unmask (enable) events</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>vpb_set_event_mask(handle, VPB_MVOXON);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// wait for VOXON on channel 1</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>VPB_EVENT e;</font></font>
<p><font face="Courier"><font size=-2>vpb_get_event_sync(&amp;e,0);</font></font>
<p><font face="Courier"><font size=-2>vpb_translate_event(&amp;e, s);</font></font>
<p><font face="Courier"><font size=-2>printf("event: %s\n",s);</font></font>
<p><font face="Courier"><font size=-2>printf("Press any key to finish");</font></font>
<p><font face="Courier"><font size=-2>while(!kbhit());</font></font>
<p><font face="Courier"><font size=-2>vpb_close(handle);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_open</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Opens a channel on
the VPB.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_open(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>unsigned
int</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>board,</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>unsigned
int</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>channel</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>board</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>The VPB to open channel
on, numbering starts at 1</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>channel</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Channel on the VPB
to open, from 1 to 4.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><u><font face="Courier"><font size=-2>handle</font></font></u></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Handle for this channel.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>A channel must be opened before any other operations may
be performed with it.</font>
<p><font size=-1>The first time this function is called it initialises
the driver software and the VPB firmware. This may cause a slight delay
(around 1 second).</font>
<p><font size=-1>This function should not be called simultaneously by different
threads (multitasking not supported). Instead, use a single thread to initialise
all channels.</font>
<p><b>Example</b>
<p><font face="Courier"><font size=-2>#include &lt;stdio.h></font></font>
<p><font face="Courier"><font size=-2>#include "\vpb\vpbapi.h"</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>void main() {</font></font>
<p><font face="Courier"><font size=-2>int handle;</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>// open (and close) channel 4 of
board 1</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>handle = vpb_open(1,4);</font></font>
<p><font face="Courier"><font size=-2>vpb_close(handle);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_close</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Closes a channel on
the VPB.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_close(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>int</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>handle</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><u><font face="Courier"><font size=-2>handle</font></font></u></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Handle for this channel.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>This function should not be called simultaneously by different
threads.</font>
<p><b>Example</b>
<p><font size=-1>See </font><u><font face="Courier"><font size=-2>vpb_open()</font></font></u><font size=-1>.</font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_seterrormode</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Determines the way
run time errors are handled.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_seterrormode(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>int</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>mode</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>mode</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font face="Courier"><font size=-2>VPB_DEVELOPMENT</font></font><font size=-1>,</font><font face="Courier"><font size=-2>
VPB_ERROR_CODE</font></font><font size=-1>, or </font><font face="Courier"><font size=-2>VPB_EXCEPTION</font></font><font size=-1>.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>See the discussion on <u>error handling</u>.</font>
<p><b>Example</b>
<p><font size=-1>See the discussion on <u>error handling</u>.</font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_adpcm_open</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Opens an OKI ADPCM
decoder.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_adpcm_open(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>void</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>**adpcm</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>adpcm</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font face="Courier"><font size=-2>Ptr
to state variables for ADPCM decoder</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>There should be one ADPCM decoder opened for each channel
that you wish to decode concurrently.</font>
<p><font size=-1>Opening a new ADPCM decoder resets the ADPCM decoder?s
state variables to an initial state, this should be done every time a new
sequence of data is decoded.</font>
<p><b>Example</b>
<p><font size=-1>See </font><u><font face="Courier"><font size=-2>vpb_adpcm_decode</font></font></u><font size=-1>.</font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_adpcm_close</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Closes an OKI ADPCM
decoder.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_adpcm_close(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>void</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*adpcm</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>adpcm</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font face="Courier"><font size=-2>Ptr
to state variables for ADPCM decoder</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>none</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>Call after ADPCM decoding is complete.</font>
<p><b>Example</b>
<p><font size=-1>See </font><u><font face="Courier"><font size=-2>vpb_adpcm_decode</font></font></u><font size=-1>.</font>
<br>&nbsp;
<br>&nbsp;
<p><b>vpb_adpcm_decode</b>
<br>&nbsp;
<table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="553" >
<tr>
<td VALIGN=TOP WIDTH="14%"><b>Purpose</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font size=-1>Decodes a buffer of
OKI ADPCM samples to 16 bit linear samples.</font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Syntax</b></td>

<td VALIGN=TOP COLSPAN="4" WIDTH="86%"><font face="Courier"><font size=-2>int
WINAPI vpb_adpcm_decode(</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>void</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*adpcm,</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>short</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>linearbuf[]</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>unsigned
short</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*nlinear</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>char</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>Adpcmbuf[]</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>unsigned
short</font></font></td>

<td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>nadpcmbytes</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP WIDTH="16%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td>

<td VALIGN=TOP WIDTH="49%">&nbsp;</td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Inputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>adpcm</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font face="Courier"><font size=-2>Pointer
to state variables for ADPCM decoder</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>adpcmbuf</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font face="Courier"><font size=-2>Buffer
of compressed OKI-APDCM samples, 2 4-bit samples per byte</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>nadpcmbytes</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font face="Courier"><font size=-2>Number
of bytes in ADPCM buffer</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Outputs</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>linearbuf</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font face="Courier"><font size=-2>Buffer
of decoder linear samples, one sample per 16 bit word</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>*nlinear</font></font></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font face="Courier"><font size=-2>Number
of decoded linear samples returned in linearbuf</font></font></td>
</tr>

<tr>
<td VALIGN=TOP WIDTH="14%"><b>Platform</b></td>

<td VALIGN=TOP COLSPAN="2" WIDTH="24%">&nbsp;</td>

<td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td>
</tr>
</table>

<br>&nbsp;
<p><b>Notes</b>
<p><font size=-1>This function can be used to decode OKI ADPCM samples
recorded using the VPB ADPCM recording mode.</font>
<p><b>Example</b>
<p><font face="Courier"><font size=-2>// This program converts an ADPCM
VOX (raw) file to</font></font>
<p><font face="Courier"><font size=-2>// a linear wave file, useful for
replaying vox files</font></font>
<p><font face="Courier"><font size=-2>// over a sound blaster, as OKI-ADPCM
is not supported</font></font>
<p><font face="Courier"><font size=-2>// by many Windows multimedia sound
players.</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>#include &lt;assert.h></font></font>
<p><font face="Courier"><font size=-2>#include &lt;conio.h></font></font>
<p><font face="Courier"><font size=-2>#include &lt;stdio.h></font></font>
<p><font face="Courier"><font size=-2>#include "\vpb\vpbapi.h"</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>#define N 160 // 20 ms frames</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>void main(void)</font></font>
<p><font face="Courier"><font size=-2>{</font></font>
<p><font face="Courier"><font size=-2>FILE *fvox;</font></font>
<p><font face="Courier"><font size=-2>void *wave;</font></font>
<p><font face="Courier"><font size=-2>char adpcm[N/2]; // two samples per
byte</font></font>
<p><font face="Courier"><font size=-2>short linear[N]; // one sample per
short</font></font>
<p><font face="Courier"><font size=-2>unsigned short nlinear;</font></font>
<p><font face="Courier"><font size=-2>void *states; // adpcm decoder states</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>fvox = fopen("adpcm.vox","rb");</font></font>
<p><font face="Courier"><font size=-2>assert(fvox);</font></font>
<p><font face="Courier"><font size=-2>vpb_wave_open_write(&amp;wave, "adpcm.wav",
VPB_LINEAR);</font></font>
<p><font face="Courier"><font size=-2>vpb_adpcm_open(&amp;states);</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>while(fread(adpcm, sizeof(char),
N/2, fvox) == N/2) {</font></font>
<p><font face="Courier"><font size=-2>vpb_adpcm_decode(states, linear,
&amp;nlinear, adpcm, N/2);</font></font>
<p><font face="Courier"><font size=-2>vpb_wave_write(wave, (char*)linear,
sizeof(short)*N);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<p><font face="Courier"><font size=-2>fclose(fvox);</font></font>
<p><font face="Courier"><font size=-2>vpb_wave_close_write(wave);</font></font>
<p><font face="Courier"><font size=-2>vpb_adpcm_close(states);</font></font>
<p><font face="Courier"><font size=-2>}</font></font>
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
</body>
</html>