CA_Import_Voice()

Purpose

Converts voice data to Blueworx Voice Response format.

Libraries

Blueworx Voice Response library (libvae.a)

Custom Server library (libca.a)

Syntax

#include "CA_header.h"
#include "CA_access_db.h"
int CA_Import_Voice (
 INT_VOICE_ST         *int_sp,
 EXT_VOICE_ST         *ext_sp
);

Description

This subroutine converts voice data from an external source into the internal format used by Blueworx Voice Response, compressing it if required. The output data from this subroutine can be imported into the Blueworx Voice Response database using, for example, CA_Create_Segment().

The EXT_VOICE_ST structure defines the format of the input voice elements, and the INT_VOICE_ST structure defines the required format of the output voice data.

The calling routine must calculate the number of voice elements required to hold the voice data. Each voice element holds 0.2 seconds of voice, or 1600 input bytes consisting of 8-bit samples at 8000 Hz. It should then allocate the output_voice buffer large enough to hold the output voice elements, which is COMPRESSED_ELEMENT_LENGTH for compressed voice elements and is UNCOMPRESSED_ELEMENT_LENGTH for uncompressed voice elements. You can use CA_Get_Element_Count() to calculate the number of voice elements required, as it takes into account the sample width and sampling rate of the input voice data in the calculation.

The input data is checked for acceptable volume levels. Voice data with a maximum volume outside the range 8 dBm to -82 dBm is rejected.

Parameters

int_sp
A pointer to a INT_VOICE_ST input structure filled in as described in INT_VOICE_ST.
ext_sp
A pointer to a EXT_VOICE_ST input structure filled in as described in EXT_VOICE_ST.

Return codes

0
Successful; number of voice elements returned.
-1
Unsuccessful (global error number CA_errno is set to indicate the error).

Error names

CA_INV_ADDR
CA_INV_COMPRESSION_TYPE
CA_INV_SAMPLE_WIDTH
CA_INV_SAMPLING_RATE
CA_INV_VOICE_FORMAT
CA_INV_VOICE_ORDER
CA_INV_VOLUME
CA_MALLOC_FAILED
CA_NOT_INIT
CA_TERMINATING

Related information

CA_Create_Audio_Name(), CA_Create_Greeting(), CA_Create_Segment(), CA_Create_Voice_Msg(), CA_Export_Voice(), CA_Get_Element_Count().