(Page 56 of 80 in this chapter)
typedef struct
{
DWORD size; /* size of this structure */
DWORD DTMFabort; /* abort on DTMF */
INT32 gain; /* recording gain in dB */
/*-[SLC parms (used if silence det)]----- */
DWORD novoicetime; /* length of initial silence to stop */
/* recording (ms); use 0 to deactivate */
/* initial silence detection. */
DWORD silencetime;
/* length of silence to stop recording */
/* after voice has been detected (ms); */
/* use 0 to deactivate. */
INT32 silenceampl; /* qualif level for silence (dBm) */
DWORD silencedeglitch;
/* deglitch while qualifying silence(ms) */
/*-[Beep for record]---------------------------*/
DWORD beepfreq; /* beep frequency (Hz) */
INT32 beepampl; /* beep amplitude (dBm) */
DWORD beeptime; /* beep time (ms) 0=no beep */
/*--[AGC parms]----------------------------------------*/
DWORD AGCenable; /* enable AGC; use 1 to activate */
INT32 AGCtargetampl; /* target AGC level (dBm) */
INT32 AGCsilenceampl; /* silence level (dBm) */
DWORD AGCattacktime; /* attack time (ms) */
DWORD AGCdecaytime; /* decay time (ms) */
} ADI_RECORD_PARMS;
int NMSSTDCALL writeAccess(
void *userarg,
void *buffer,
unsigned size )
{
FILE *fp = (FILE *)userarg;
fwrite( buffer, 1, size, fp );
if ( ferror( fp ) )
return -1;
return SUCCESS;
}
int myRecordFile( CTAHD ctahd, unsigned encoding, char *filename )
{
ADI_EVENT event;
FILE *fp;
/* note: binary open */
if( (fp = fopen( filename, "wb" )) == NULL )
return MYFAILURE;
if( adiStartRecording( ctahd, encoding, 0,
writeAccess, fp, NULL ) != SUCCESS )
return MYFAILURE;
do
{
myGetEvent( &event ); /* see adiFetchAndProcess example */
} while( event.id != ADIEVN_RECORD_DONE );
fclose( fp );
if( event.value == CTA_REASON_RELEASED )
return MYDISCONNECT; /* call has been terminated */
else if( IS_ADI_ERROR( event.value ) )
return MYFAILURE; /* API error */
else
return SUCCESS; /* stopped normally */
}
(Page 56 of 80 in this chapter)