Table of Contents Index NMS Glossary Previous Page Next Page (Page 5 of 41 in this chapter) Version


vceConvertMessage

Description

Copies a message and translates its encoding.

Prototype

DWORD vceConvertMessage ( VCEHD srcvh,
unsigned srcmsg,
VCEHD destvh,
unsigned destmsg,
int gain)

srcvh Voice handle of source file or memory block.

srcmsg Source message number.

destvh Voice handle of destination file or memory block.

destmsg Destination message number.

gain Amplification if positive, or attenuation if negative.

Return Values

Events

Details

This function copies a message from one voice object to another, or to another message in the same voice object. The encoding of the message will be translated as needed from the source the destination. If the gain argument is not zero (0), attenuation or amplification will be applied, depending on whether gain is negative or positive.

Source and destination must belong to the same context. The destination message becomes the current message in the context.

To copy and translate all messages from the source to the destination, set the source message number (srcmsg) and the destination message number (destmsg) to VCE_ALL_MESSAGES. This replaces all messages in the destination, not just messages that exist in the source.

The gain must be in the range of -24 to +24. Otherwise, CTAERR_BAD_ARGUMENT is returned.

Depending on the type of conversion required, a long message could take many seconds to convert. During this time, the context and the queue that is associated with will be locked. For this reason, you may want to open a separate queue for performing conversions when other Natural Access functions are being used in the same process.

Converting from one mu-law, A-law, or 8 kHz PCM format to another is relatively fast. Converting between PCM and ADPCM, or converting from one sample rate to another, takes more time.

The following example shows which conversions are possible and indicates the relative amount of processing required:
Key to Diagram Below:

Value

Description

0

No conversion, or conversion between A-law, mu-law, and 8 kHz PCM.

1

Either ADPCM <--> PCM conversion or sample rate conversion.

2

Either two ADPCM <--> PCM conversions, or ADPCM <--> PCM plus sample rate conversion.

x

Not supported.

Note: kss = kilo-samples/sec (mono or stereo, 8-bit or 16-bit).

a

b

c

d

e

f

g

h

i

j

k

l

a) NMS 16/24/32

2

b) NMS 64

1

0

c) mu/A-law

1

0

0

d) PCM 8 kss

1

0

0

0

e) PCM 11 kss

2

1

1

1

0

f) PCM 22 kss

2

1

1

1

1

0

g) PCM 44 kss

2

1

1

1

1

1

0

h) OKI 24

x

x

x

x

x

x

x

x

i) OKI 32

2

1

1

1

2

2

2

x

0

j) G.726

x

x

x

x

x

x

x

x

2

0

k) IMA 24

x

x

x

x

x

x

x

x

x

x

0

l) IMA 32

2

1

1

1

2

2

2

x

2

x

x

0

See Also

vceCopyMessage

Example


/* Convert a Wave file of any encoding to a VCE file with NMS encoding */
void myWaveToVce (CTAHD ctahd, char *wavefile, char *vcefile)
{
VCEHD srcvh, destvh;

vceOpenFile (ctahd, wavefile, VCE_FILETYPE_WAVE, VCE_PLAY_ONLY, 0, &srcvh);

vceCreateFile (ctahd, vcefile, VCE_FILETYPE_FLAT,
VCE_ENCODE_NMS_24, NULL, &destvh);

vceConvertMessage (srcvh, 0, destvh, 0, 0);

vceClose (srcvh);
vceClose (destvh);
}


Table of Contents Index NMS Glossary Previous Page Next Page (Page 5 of 41 in this chapter) Version


Want to send us feedback on our documentation? Email: Tech_Pubs@nmss.com
Copyright © 2001, Natural MicroSystems, Inc. All rights reserved.