<!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] (Win95; U) [Netscape]"> <title>Func Ref 1</title> </head> <body link="#0000FF" vlink="#800080"> <h1> <b>Function Reference Part 1</b></h1> <p><br><b>vpb_disable_event</b> <br> <br> <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 only the specified <u>unsolicited </u> events while leaving the rest of the event mask unchanged.</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_disable_event(</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP WIDTH="16%"> </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%"> </td> <td VALIGN=TOP WIDTH="16%"> </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>mask</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP WIDTH="16%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td> <td VALIGN=TOP WIDTH="49%"> </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%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="24%"><u><font face="Courier"><font size=-2>mask</font></font></u></td> <td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Mask which specifies which events are disabled. Multiple events can be disabled by OR-ing together </font><font face="Courier"><font size=-2>VPB_Mxxx</font></font><font size=-1> values eg. </font><font size=-2><font face="Courier">VPB_MRING</font>, <font face="Courier">VPB_MDIGIT</font></font><font size=-1> etc.</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%"> </td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"><b>Platform</b></td> <td VALIGN=TOP COLSPAN="2" WIDTH="24%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td> </tr> </table> <br> <br> <p><b>Notes</b> <p><font size=-1>All events are enabled by default.</font> <p><font size=-1>This function affects only the events specified in the </font><u><font face="Courier"><font size=-2>mask</font></font></u><font size=-1> argument.</font> <p><font size=-1>Each channel has an independent event mask.</font> <p><b>Example</b> <p><font face="Courier"><font size=-2>include "\vpb\vpbapi.h"</font></font> <p><font face="Courier"><font size=-2>include <stdio.h</font></font> <p><font face="Courier"><font size=-2>void main() {</font></font> <br> <br> <p><font face="Courier"><font size=-2>int handle;</font></font> <br> <br> <p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// by default all events are enabled</font></font> <p><font face="Courier"><font size=-2>// get the event mask,</font></font> <br> <br> <p><font face="Courier"><font size=-2>int msk = vpb_get_event_mask(handle);</font></font> <p><font face="Courier"><font size=-2>printf("Event Mask = 0x%x",msk);</font></font> <p><font face="Courier"><font size=-2>// disable DIGIT events</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_disable_event(handle, VPB_MDIGIT);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// get the event mask</font></font> <br> <br> <p><font face="Courier"><font size=-2>msk = vpb_get_event_mask(handle);</font></font> <p><font face="Courier"><font size=-2>printf("\nEvent Mask = 0x%x\n",msk);</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><sup>The mask enables the following events:</sup></b> <br> <br> <table BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="555" > <tr> <td VALIGN=TOP WIDTH="25%"><b><font size=-1>Event</font></b></td> <td VALIGN=TOP WIDTH="27%"><b><font size=-1>Value</font></b></td> <td VALIGN=TOP WIDTH="48%"><b><font size=-1>Description</font></b></td> </tr> <tr> <td VALIGN=TOP WIDTH="25%"><font size=-1>VPB_RING</font></td> <td VALIGN=TOP WIDTH="27%"><font size=-1>VPB_MRING</font></td> <td VALIGN=TOP WIDTH="48%"><font size=-1>Detection of a ring signal.</font></td> </tr> <tr> <td VALIGN=TOP WIDTH="25%"><font size=-1>VPB_DIGIT</font></td> <td VALIGN=TOP WIDTH="27%"><font size=-1>VPB_MDIGIT</font></td> <td VALIGN=TOP WIDTH="48%"><font size=-1>Detection of a DTMF signal.</font></td> </tr> <tr> <td VALIGN=TOP WIDTH="25%"><font size=-1>VPB_TONEDETECT</font></td> <td VALIGN=TOP WIDTH="27%"><font size=-1>VPB_MTONEDETECT</font></td> <td VALIGN=TOP WIDTH="48%"><font size=-1>Detection of a programmable tone.</font></td> </tr> <tr> <td VALIGN=TOP WIDTH="25%"><font size=-1>VPB_VOXON</font></td> <td VALIGN=TOP WIDTH="27%"><font size=-1>VPB_MVOXON</font></td> <td VALIGN=TOP WIDTH="48%"><font size=-1>Detection of voice.</font></td> </tr> <tr> <td VALIGN=TOP WIDTH="25%"><font size=-1>VPB_VOXOFF</font></td> <td VALIGN=TOP WIDTH="27%"><font size=-1>VPB_MVOXOFF</font></td> <td VALIGN=TOP WIDTH="48%"><font size=-1>Detection of silence.</font></td> </tr> </table> <p><font size=-1>Multiple events may be enabled by OR-ing together the appropriate event values.</font> <br> <br> <p><b>vpb enable event</b> <br> <br> <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 only the specified <u>unsolicited</u> events while leaving the rest of the event mask unchanged.</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_enable_event(</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP WIDTH="16%"> </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%"> </td> <td VALIGN=TOP WIDTH="16%"> </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>mask</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP WIDTH="16%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td> <td VALIGN=TOP WIDTH="49%"> </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%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="24%"><u><font face="Courier"><font size=-2>mask</font></font></u></td> <td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Mask which specifies which events are enabled. Multiple events can be enabled by OR-ing together </font><font face="Courier"><font size=-2>VPB_Mxxx</font></font><font size=-1> values eg. </font><font face="Courier"><font size=-2>VPB_MRING</font></font><font size=-1>, </font><font face="Courier"><font size=-2>VPB_MDIGIT</font></font><font size=-1> etc.</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%"> </td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"><b>Platform</b></td> <td VALIGN=TOP COLSPAN="2" WIDTH="24%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td> </tr> </table> <br> <br> <p><b>Notes</b> <p><font size=-1>All events are enabled by default.</font> <p><font size=-1>This function affects only the events specified in the </font><u><font face="Courier"><font size=-2>mask</font></font></u><font size=-1> argument.</font> <p><font size=-1>Each channel has an independent event mask.</font> <p><b>Example</b> <p><font face="Courier"><font size=-2>include <stdio.h</font></font> <p><font face="Courier"><font size=-2>include "\vpb\vpbapi.h"</font></font> <br> <br> <p><font face="Courier"><font size=-2>void main() {</font></font> <br> <br> <p><font face="Courier"><font size=-2>int handle;</font></font> <br> <br> <p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// by default all events are enabled</font></font> <p><font face="Courier"><font size=-2>// disable DIGIT events</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_disable_event(handle, VPB_MDIGIT);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// get the event mask,</font></font> <br> <br> <p><font face="Courier"><font size=-2>int msk = vpb_get_event_mask(handle);</font></font> <p><font face="Courier"><font size=-2>printf("Event Mask = 0x%x",msk);</font></font> <p><font face="Courier"><font size=-2>// enable DIGIT events</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_enable_event(handle, VPB_MDIGIT);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// get the event mask</font></font> <br> <br> <p><font face="Courier"><font size=-2>msk = vpb_get_event_mask(handle);</font></font> <p><font face="Courier"><font size=-2>printf("\nEvent Mask = 0x%x\n",msk);</font></font> <p><font face="Courier"><font size=-2>vpb_close(handle);</font></font> <p><font face="Courier"><font size=-2>}</font></font> <br> <br> <p><b>vpb get event mask</b> <br> <br> <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>Function to obtain the current event mask for a given 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_event_mask(</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP WIDTH="16%"> </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%"> </td> <td VALIGN=TOP WIDTH="16%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td> <td VALIGN=TOP WIDTH="49%"> </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>returns</font></font></td> <td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Event mask for the channel.</font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"><b>Platform</b></td> <td VALIGN=TOP COLSPAN="2" WIDTH="24%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td> </tr> </table> <br> <br> <p><b>Notes</b> <p><font size=-1>Each channel has an independent event mask.</font> <p><b>Example</b> <p><font face="Courier"><font size=-2>include <stdio.h</font></font> <p><font face="Courier"><font size=-2>include "\vpb\vpbapi.h"</font></font> <br> <br> <p><font face="Courier"><font size=-2>void main() {</font></font> <br> <br> <p><font face="Courier"><font size=-2>int handle;</font></font> <br> <br> <p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// by default all events are enabled</font></font> <p><font face="Courier"><font size=-2>// disable DIGIT events</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_disable_event(handle, VPB_MDIGIT);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// get the event mask,</font></font> <br> <br> <p><font face="Courier"><font size=-2>int msk = vpb_get_event_mask(handle);</font></font> <p><font face="Courier"><font size=-2>printf("Event Mask = 0x%x",msk);</font></font> <p><font face="Courier"><font size=-2>// enable DIGIT events</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_enable_event(handle, VPB_MDIGIT);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// get the event mask</font></font> <br> <br> <p><font face="Courier"><font size=-2>msk = vpb_get_event_mask(handle);</font></font> <p><font face="Courier"><font size=-2>printf("\nEvent Mask = 0x%x\n",msk);</font></font> <p><font face="Courier"><font size=-2>vpb_close(handle);</font></font> <p><font face="Courier"><font size=-2>}</font></font> <br> <br> <p><b>vpb_set_event_mask</b> <br> <br> <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>Function to set the entire event mask for a given 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_event_mask(</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP WIDTH="16%"> </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%"> </td> <td VALIGN=TOP WIDTH="16%"> </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>mask</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP WIDTH="16%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td> <td VALIGN=TOP WIDTH="49%"> </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%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="24%"><u><font face="Courier"><font size=-2>mask</font></font></u></td> <td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Mask which specifies the event mask for the entire channel. Events are considered enabled if asserted in </font><font face="Courier"><font size=-2>mask</font></font><font size=-1>. Multiple events can be enabled by OR-ing together </font><font face="Courier"><font size=-2>VPB_Mxxx</font></font><font size=-1> values eg. </font><font face="Courier"><font size=-2>VPB_MRING</font></font><font size=-1>, </font><font face="Courier"><font size=-2>VPB_MDIGIT</font></font><font size=-1> etc.</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%"> </td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"><b>Platform</b></td> <td VALIGN=TOP COLSPAN="2" WIDTH="24%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td> </tr> </table> <br> <br> <p><b>Notes</b> <p><font size=-1>This function sets the entire event mask for the channel, unlike </font><u><font face="Courier"><font size=-2>vpb_enable_event</font></font></u><font size=-1> which only modifies the masking of specified events. Any events not included in the </font><u><font face="Courier"><font size=-2>mask</font></font></u><font size=-1> parameter are effectively disabled (see example).</font> <p><font size=-1>Each channel has an independent event mask.</font> <p><b>Example</b> <p><font face="Courier"><font size=-2>include <stdio.h</font></font> <p><font face="Courier"><font size=-2>include <conio.h</font></font> <p><font face="Courier"><font size=-2>include "\vpb\vpbapi.h"</font></font> <br> <br> <p><font face="Courier"><font size=-2>void main() {</font></font> <br> <br> <p><font face="Courier"><font size=-2>int handle;</font></font> <br> <br> <p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// enable DIGIT events</font></font> <p><font face="Courier"><font size=-2>// Note: all other events remain disabled</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_set_event_mask(handle, VPB_MDIGIT);</font></font> <p><font face="Courier"><font size=-2>// get event mask</font></font> <br> <br> <p><font face="Courier"><font size=-2>int msk = vpb_get_event_mask(handle);</font></font> <p><font face="Courier"><font size=-2>printf("Event Mask = 0x%x\n",msk);</font></font> <p><font face="Courier"><font size=-2>// wait for key to finish</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> <br> <p><b>vpb get event async</b> <br> <br> <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 an event from the API event queue. <u>Asynchronous</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_get_event_async(</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP WIDTH="16%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="21%"><u><font face="Courier"><font size=-2>VPB_EVENT</font></font></u></td> <td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*e</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP WIDTH="16%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td> <td VALIGN=TOP WIDTH="49%"> </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>E</font></font></td> <td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to event structure.</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>Returns </font><font face="Courier"><font size=-2>VPB_OK</font></font><font size=-1> if an event is available, otherwise </font><font face="Courier"><font size=-2>VPB_NO_EVENTS</font></font><font size=-1> if queue is empty.</font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"><b>Platform</b></td> <td VALIGN=TOP COLSPAN="2" WIDTH="24%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td> </tr> </table> <br> <br> <p><b>Notes</b> <p><font size=-1>This function polls the API event queue to determine if any events are present. If so, the event data is copied to the </font><u><font face="Courier"><font size=-2>VPB_EVENT</font></font></u><font size=-1> structure pointed to by e.</font> <p><font size=-1>Only enabled events are posted to the event queue.</font> <p><b>Example</b> <p><font face="Courier"><font size=-2>include <conio.h</font></font> <p><font face="Courier"><font size=-2>include <stdio.h</font></font> <p><font face="Courier"><font size=-2>include "\vpb\vpbapi.h"</font></font> <br> <br> <p><font face="Courier"><font size=-2>void main() {</font></font> <br> <br> <p><font face="Courier"><font size=-2>int handle;</font></font> <br> <br> <p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// enable VOX events</font></font> <p><font face="Courier"><font size=-2>vpb_set_event_mask(handle, VPB_MVOXON);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// wait for a VOX ON event</font></font> <p><font face="Courier"><font size=-2>VPB_EVENT e;</font></font> <p><font face="Courier"><font size=-2>do{</font></font> <p><font face="Courier"><font size=-2>vpb_get_event_async(&e);</font></font> <br> <br> <p><font face="Courier"><font size=-2>}while(e.type != VPB_VOXON);</font></font> <p><font face="Courier"><font size=-2>printf("VOXON event detected!\n");</font></font> <br> <br> <p><font face="Courier"><font size=-2>printf("Press any key when finished!");</font></font> <p><font face="Courier"><font size=-2>while(!kbhit());</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_close(handle);</font></font> <br> <br> <p><font face="Courier"><font size=-2>}</font></font> <p><font size=-1>Asynchronous functions perform the operations required to initiate processing, then return before the processing required by that function is complete. For example vpb_play_file_async() starts a file playing, then returns (almost) immediately, before the file has finished playing. Asynchronous functions perform signal completion by posting a terminate event to the API event queue, for example vpb_play_file_async() posts the VPB_PLAYEND event to the event queue when it has finished playing the file.</font> <br> <br> <p><font size=-1>Synchronous functions complete all operations before returning. For example </font><font face="Courier"><font size=-2>vpb_play_file_sync()</font></font><font size=-1> returns only when the file has finished playing.</font> <br> <br> <p><font face="Courier"><font size=-2>typedef struct {</font></font> <p><font face="Courier"><font size=-2>int type; // event type (see vpbapi.h)</font></font> <p><font face="Courier"><font size=-2>int handle; // channel that generated event</font></font> <p><font face="Courier"><font size=-2>int data; // optional data</font></font> <p><font face="Courier"><font size=-2>} VPB_EVENT;</font></font> <br> <br> <p><b>vpb get event sync</b> <br> <br> <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 an event from the API event queue. <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_get_event_sync(</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP WIDTH="16%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="21%"><u><font face="Courier"><font size=-2>VPB_EVENT</font></font></u></td> <td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*e</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP WIDTH="16%"> </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>time_out</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP WIDTH="16%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td> <td VALIGN=TOP WIDTH="49%"> </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_out</font></font></td> <td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Time limit (in ms) to get an event from the API queue.</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>e</font></font></td> <td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to event structure.</font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </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>Returns </font><font face="Courier"><font size=-2>VPB_OK</font></font><font size=-1> or </font><font face="Courier"><font size=-2>VPB_TIME_OUT</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"><b>Platform</b></td> <td VALIGN=TOP COLSPAN="2" WIDTH="24%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td> </tr> </table> <br> <br> <p><b>Notes</b> <p><font size=-1>This function waits until an event is present on the API event queue, then returns with the event data copied to the </font><u><font face="Courier"><font size=-2>VPB_EVENT</font></font></u><font size=-1> structure pointed to by e. If the function time-outs before an event is posted, it returns a </font><font face="Courier"><font size=-2>VPB_TIME_OUT</font></font><font size=-1>. If the time_out parameter being passed to the function is equal to zero, and no events are present, the function waits indefinitely.</font> <p><font size=-1>Only enabled events are posted to the event queue.</font> <p><b>Example</b> <p><font face="Courier"><font size=-2>include <conio.h</font></font> <p><font face="Courier"><font size=-2>include <stdio.h</font></font> <p><font face="Courier"><font size=-2>include "\vpb\vpbapi.h"</font></font> <br> <br> <p><font face="Courier"><font size=-2>void main() {</font></font> <br> <br> <p><font face="Courier"><font size=-2>int handle,ret;</font></font> <br> <br> <br> <br> <p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// enable VOXON events</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_set_event_mask(handle, VPB_MVOXON);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// wait for 10 second for a ring on channel 1</font></font> <br> <br> <p><font face="Courier"><font size=-2>VPB_EVENT e;</font></font> <p><font face="Courier"><font size=-2>ret = vpb_get_event_sync(&e,10000);</font></font> <p><font face="Courier"><font size=-2>if(ret == VPB_TIME_OUT)</font></font> <p><font face="Courier"><font size=-2>printf("Timed out: VOXON event not detected!\n");</font></font> <p><font face="Courier"><font size=-2>else</font></font> <p><font face="Courier"><font size=-2>printf("VOXON event detected!\n");</font></font> <p><font face="Courier"><font size=-2>printf("Press any key to end");</font></font> <p><font face="Courier"><font size=-2>while(!kbhit());</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_close(handle);</font></font> <p><font face="Courier"><font size=-2>}</font></font> <br> <br> <p><b>vpb get event ch async</b> <br> <br> <table BORDER=0 CELLSPACING=0 CELLPADDING=7 > <tr> <td VALIGN=TOP WIDTH="77"><b>Purpose</b></td> <td VALIGN=TOP COLSPAN="4" WIDTH="405"> </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_event_ch_async(</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="77"> </td> <td VALIGN=TOP WIDTH="87"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="117"><font face="Courier"><font size=-2>int</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"> </td> <td VALIGN=TOP WIDTH="87"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="117"><u><font face="Courier"><font size=-2>VPB_EVENT</font></font></u></td> <td VALIGN=TOP COLSPAN="2" WIDTH="471"><font face="Courier"><font size=-2>*e</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="77"> </td> <td VALIGN=TOP WIDTH="87"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="117"><font face="Courier"><font size=-2>);</font></font></td> <td VALIGN=TOP COLSPAN="2" WIDTH="471"> </td> </tr> <tr> <td VALIGN=TOP WIDTH="77"><b>Inputs</b></td> <td VALIGN=TOP COLSPAN="2" WIDTH="134"><font face="Courier"><font size=-2>handle</font></font></td> <td VALIGN=TOP COLSPAN="3" WIDTH="541"><font size=-1>Handle for the channel.</font></td> </tr> <tr> <td VALIGN=TOP WIDTH="77"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="134"><font face="Courier"><font size=-2>e</font></font></td> <td VALIGN=TOP COLSPAN="3" WIDTH="541"><font size=-1>Pointer to event structure.</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>returns</font></font></td> <td VALIGN=TOP COLSPAN="3" WIDTH="541"><font size=-1>Returns </font><font face="Courier"><font size=-2>VPB_OK</font></font><font size=-1> if an event is available, otherwise </font><font face="Courier"><font size=-2>VPB_NO_EVENTS</font></font><font size=-1> if queue is empty.</font></td> </tr> <tr> <td VALIGN=TOP WIDTH="77"><b>Platform</b></td> <td VALIGN=TOP COLSPAN="2" WIDTH="134"> </td> <td VALIGN=TOP COLSPAN="3" WIDTH="541"><font size=-1>VPB4, VPB8L</font></td> </tr> </table> <br> <br> <p><b>Notes</b> <p><font size=-1>This function polls the API event queue for the specified channel to determine if any events are present from the specified channel. If so, the event data is copied to the </font><u><font face="Courier"><font size=-2>VPB_EVENT</font></font></u><font size=-1> structure pointed to by e.</font> <p><font size=-1>Only enabled events are posted to the event queue.</font> <p><font size=-1>Each channel maintains an individual event queue that is separate from the global event queue. Thus the same event will be present on the global and channel specific event queues. Thus it is best to consistently use either the channel specific (</font><font face="Courier"><font size=-2>vpb_get_event_ch_async</font></font><font size=-1>, </font><font face="Courier"><font size=-2>vpb_get_event_ch_sync</font></font><font size=-1>) or global get event (</font><font face="Courier"><font size=-2>vpb_get_event_async</font></font><font size=-1>, </font><font face="Courier"><font size=-2>vpb_get_event_sync</font></font><font size=-1>) functions. Mixed use of the functions will lead to events appearing twice.</font> <p><b>Example</b> <p><font face="Courier"><font size=-2>include <conio.h</font></font> <p><font face="Courier"><font size=-2>include <stdio.h</font></font> <p><font face="Courier"><font size=-2>include "\vpb\vpbapi.h"</font></font> <br> <br> <p><font face="Courier"><font size=-2>void main() {</font></font> <br> <br> <p><font face="Courier"><font size=-2>int handle;</font></font> <br> <br> <p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// enable VOXON events</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_set_event_mask(handle, VPB_MVOXON);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// wait for ring on channel 1</font></font> <br> <br> <p><font face="Courier"><font size=-2>VPB_EVENT e;</font></font> <p><font face="Courier"><font size=-2>while(vpb_get_event_ch_async(handle,&e) == VPB_NO_EVENTS);</font></font> <p><font face="Courier"><font size=-2>printf("VOXON event detected!\n");</font></font> <br> <br> <p><font face="Courier"><font size=-2>printf("Press any key when finished!");</font></font> <p><font face="Courier"><font size=-2>while(!kbhit());</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_close(handle);</font></font> <br> <br> <p><font face="Courier"><font size=-2>}</font></font> <br> <br> <p><b>vpb get event ch sync</b> <br> <br> <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 an event from the API event queue for a specific channel. <u>Synchronous version.</u></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_event_ch_sync(</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP WIDTH="16%"> </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%"> </td> <td VALIGN=TOP WIDTH="16%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="21%"><u><font face="Courier"><font size=-2>VPB_EVENT</font></font></u></td> <td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*e</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP WIDTH="16%"> </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>time_out</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP WIDTH="16%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td> <td VALIGN=TOP WIDTH="49%"> </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 the channel.</font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>time_out</font></font></td> <td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Time limit (in ms) to get an event in the API event queue.</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>e</font></font></td> <td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to event structure.</font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </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>Returns </font><font face="Courier"><font size=-2>VPB_OK</font></font><font size=-1> or </font><font face="Courier"><font size=-2>VPB_TIME_OUT</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"><b>Platform</b></td> <td VALIGN=TOP COLSPAN="2" WIDTH="24%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td> </tr> </table> <br> <br> <p><b>Notes</b> <p><font size=-1>This function waits until an event is present on the API event queue from the specified channel, then returns with the event data copied to the </font><u><font face="Courier"><font size=-2>VPB_EVENT</font></font></u><font size=-1> structure pointed to by e. If the function time-outs before an event is posted, it returns a </font><font face="Courier"><font size=-2>VPB_TIME_OUT</font></font><font size=-1>. If the time_out parameter being passed to the function is equal to zero, and no events are present, the function waits indefinitely.</font> <p><font size=-1>Only enabled events are posted to the event queue.</font> <p><font size=-1>Each channel maintains an individual event queue that is separate from the global event queue. Thus the same event will be present on the global and channel specific event queues. Thus it is best to consistently use either the channel specific (</font><font face="Courier"><font size=-2>vpb_get_event_ch_async</font></font><font size=-1>, </font><font face="Courier"><font size=-2>vpb_get_event_ch_sync</font></font><font size=-1>) or global get event (</font><font face="Courier"><font size=-2>vpb_get_event_async</font></font><font size=-1>, </font><font face="Courier"><font size=-2>vpb_get_event_sync</font></font><font size=-1>) functions. Mixed use of the functions will lead to events appearing twice.</font> <p><b>Example</b> <p><font face="Courier"><font size=-2>include <conio.h</font></font> <p><font face="Courier"><font size=-2>include <stdio.h</font></font> <p><font face="Courier"><font size=-2>include "\vpb\vpbapi.h"</font></font> <br> <br> <p><font face="Courier"><font size=-2>void main() {</font></font> <br> <br> <p><font face="Courier"><font size=-2>int handle,ret;</font></font> <br> <br> <br> <br> <p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// enable VOXON events</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_set_event_mask(handle, VPB_MVOXON);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// wait for 1 second for a ring on channel 1</font></font> <br> <br> <p><font face="Courier"><font size=-2>VPB_EVENT e;</font></font> <p><font face="Courier"><font size=-2>ret = vpb_get_event_ch_sync(handle,&e,10000);</font></font> <p><font face="Courier"><font size=-2>if(ret == VPB_TIME_OUT)</font></font> <p><font face="Courier"><font size=-2>printf("Timed out: VOXON event not detected!\n");</font></font> <p><font face="Courier"><font size=-2>else</font></font> <p><font face="Courier"><font size=-2>printf("VOXON event detected!\n");</font></font> <p><font face="Courier"><font size=-2>printf("Press any key to end");</font></font> <p><font face="Courier"><font size=-2>while(!kbhit());</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_close(handle);</font></font> <p><font face="Courier"><font size=-2>}</font></font> <br> <br> <p><b>vpb put event</b> <br> <br> <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 an event on the API event queue. </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_put_event(</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP WIDTH="16%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="21%"><u><font face="Courier"><font size=-2>VPB_EVENT</font></font></u></td> <td VALIGN=TOP WIDTH="49%"><font face="Courier"><font size=-2>*e</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP WIDTH="16%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td> <td VALIGN=TOP WIDTH="49%"> </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>e</font></font></td> <td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Pointer to event structure.</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%"> </td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"><b>Platform</b></td> <td VALIGN=TOP COLSPAN="2" WIDTH="24%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4, VPB8L</font></td> </tr> </table> <br> <br> <p><b>Notes</b> <p><font size=-1>Useful for testing and for placing user defined events on the API event queue.</font> <p><font size=-1>The event is placed on the API event queue regardless of mask status.</font> <p><b>Example</b> <p><font face="Courier"><font size=-2>include <stdio.h</font></font> <p><font face="Courier"><font size=-2>include <conio.h</font></font> <p><font face="Courier"><font size=-2>include "\vpb\vpbapi.h"</font></font> <br> <br> <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> <br> <br> <p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// simulate ring event on channel 1</font></font> <br> <br> <p><font face="Courier"><font size=-2>e.type = VPB_RING;</font></font> <p><font face="Courier"><font size=-2>e.handle = 0;</font></font> <p><font face="Courier"><font size=-2>e.data = 0;</font></font> <p><font face="Courier"><font size=-2>vpb_put_event(&e);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// get simulated event</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_get_event_sync(&e,0);</font></font> <p><font face="Courier"><font size=-2>printf("\nRing event detected!\n");</font></font> <br> <br> <p><font face="Courier"><font size=-2>// wait for key to finish</font></font> <br> <br> <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> <br> <p><font face="Courier"><font size=-2>vpb_close(handle);</font></font> <p><font face="Courier"><font size=-2>}</font></font> <p><font face="Courier"><font size=-2>typedef struct {</font></font> <p><font face="Courier"><font size=-2>char *term_digits; // string of digits to terminate collection</font></font> <p><font face="Courier"><font size=-2>} VPB_PLAY;</font></font> <br> <br> <p><b>vpb play file sync</b> <br> <br> <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>Utility function to play a wave file to a channel. <u>Synchronous</u> version. Function returns when playing has completed.</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_play_file_sync(</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP WIDTH="16%"> </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%"> </td> <td VALIGN=TOP WIDTH="16%"> </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%"> </td> <td VALIGN=TOP WIDTH="16%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td> <td VALIGN=TOP WIDTH="49%"> </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%"> </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 file name (including path) of file to play</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%"> </td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"><b>Platform</b></td> <td VALIGN=TOP COLSPAN="2" WIDTH="24%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4 only</font></td> </tr> </table> <br> <br> <p><b>Notes</b> <p><font size=-1>None.</font> <p><b>Example</b> <p><font face="Courier"><font size=-2>include <stdio.h</font></font> <p><font face="Courier"><font size=-2>include "\vpb\vpbapi.h"</font></font> <br> <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> <br> <br> <p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// wait for someone to ring this channel</font></font> <br> <br> <p><font face="Courier"><font size=-2>do {</font></font> <p><font face="Courier"><font size=-2>vpb_get_event_sync(&e,0);</font></font> <p><font face="Courier"><font size=-2>} while((e.type != VPB_RING) || (e.handle != handle));</font></font> <br> <br> <p><font face="Courier"><font size=-2>// take channel off hook</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_sethook_async(handle, VPB_OFFHOOK);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// play wave file on channel 1</font></font> <p><font face="Courier"><font size=-2>// note: test.wav is user supplied</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_play_file_sync(handle, "test.wav");</font></font> <br> <br> <p><font face="Courier"><font size=-2>// place channel back on hook</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_sethook_sync(handle, VPB_ONHOOK);</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_close(handle);</font></font> <p><font face="Courier"><font size=-2>}</font></font> <br> <br> <p><b>vpb play file async</b> <br> <br> <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>Utility function to play a file to a channel. <u>Asynchronous</u> version. Function returns as soon as playing has started, and then places an event on the API queue when playing has finished. </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_play_file_async(</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP WIDTH="16%"> </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%"> </td> <td VALIGN=TOP WIDTH="16%"> </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%"> </td> <td VALIGN=TOP WIDTH="16%"> </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>data</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP WIDTH="16%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td> <td VALIGN=TOP WIDTH="49%"> </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%"> </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 file name (including path) of file to play.</font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="24%"><font face="Courier"><font size=-2>data</font></font></td> <td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>Optional user defined data returned in terminating event.</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%"> </td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"><b>Platform</b></td> <td VALIGN=TOP COLSPAN="2" WIDTH="24%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4 only</font></td> </tr> </table> <br> <br> <p><b>Notes</b> <p><font size=-1>The user defined </font><font face="Courier"><font size=-2>data</font></font><font size=-1> is useful to identify which file has finished playing when the </font><font face="Courier"><font size=-2>VPB_PLAYEND</font></font><font size=-1> terminate event is posted on the queue.</font> <p><b>Example</b> <p><font face="Courier"><font size=-2>include <stdio.h</font></font> <p><font face="Courier"><font size=-2>include "\vpb\vpbapi.h"</font></font> <br> <br> <p><font face="Courier"><font size=-2>void main() {</font></font> <br> <br> <p><font face="Courier"><font size=-2>int handle;</font></font> <p><font face="Courier"><font size=-2>VPB_EVENT e;</font></font> <br> <br> <p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_sethook_async(handle, VPB_OFFHOOK);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// play linear file on channel 1</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_play_file_async(handle, "test.wav", 0);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// wait for terminate event</font></font> <br> <br> <p><font face="Courier"><font size=-2>do {</font></font> <p><font face="Courier"><font size=-2>vpb_get_event_sync(&e,0);</font></font> <p><font face="Courier"><font size=-2>} while((e.type != VPB_PLAYEND) || (e.handle != handle));</font></font> <br> <br> <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> <br> <p><b>vpb play voxfile sync</b> <br> <br> <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>Utility function to play a <u>vox</u> to a channel. <u>Synchronous</u> version. Function returns when playing has completed.</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_play_voxfile_sync(</font></font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </td> <td VALIGN=TOP WIDTH="16%"> </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%"> </td> <td VALIGN=TOP WIDTH="16%"> </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%"> </td> <td VALIGN=TOP WIDTH="16%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>unsigned char</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%"> </td> <td VALIGN=TOP WIDTH="16%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="21%"><font face="Courier"><font size=-2>);</font></font></td> <td VALIGN=TOP WIDTH="49%"> </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%"> </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 file name (including path) of file to play</font></td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"> </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%"> </td> </tr> <tr> <td VALIGN=TOP WIDTH="14%"><b>Platform</b></td> <td VALIGN=TOP COLSPAN="2" WIDTH="24%"> </td> <td VALIGN=TOP COLSPAN="2" WIDTH="62%"><font size=-1>VPB4 only</font></td> </tr> </table> <br> <br> <p><b>Notes</b> <p><font size=-1>None.</font> <p><b>Example</b> <p><font face="Courier"><font size=-2>include <stdio.h</font></font> <p><font face="Courier"><font size=-2>include "\vpb\vpbapi.h"</font></font> <br> <br> <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> <br> <br> <p><font face="Courier"><font size=-2>handle = vpb_open(1,1);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// wait for someone to ring this channel</font></font> <br> <br> <p><font face="Courier"><font size=-2>do {</font></font> <p><font face="Courier"><font size=-2>vpb_get_event_sync(&e,0);</font></font> <p><font face="Courier"><font size=-2>} while((e.type != VPB_RING) || (e.handle != handle));</font></font> <br> <br> <p><font face="Courier"><font size=-2>// take channel off hook</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_sethook_async(handle, VPB_OFFHOOK);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// play vox file on channel 1</font></font> <p><font face="Courier"><font size=-2>// note: mulaw.vox is user supplied</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_play_voxfile_sync(handle, "mulaw.vox", VPB_MULAW);</font></font> <br> <br> <p><font face="Courier"><font size=-2>// place channel back on hook</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_sethook_sync(handle, VPB_ONHOOK);</font></font> <br> <br> <p><font face="Courier"><font size=-2>vpb_close(handle);</font></font> <p><font face="Courier"><font size=-2>}</font></font> <br> <br> <br> <br> </body> </html>