Welcome to VoxPlay, a shareware component by Giovanni Tummarello (tummarel@ascu.unian.it)

If you are into the computer telephony world then you know Dialogic and if you do then
you also know they use the .VOX format. This component will allow you to quickly
write applications that handle VOX files very conveniently.
With this component you will be able to:

* Do a Vox to Wave and Wave to Vox conversion just specifying the filename
* Encode or decode block of raw data into vox PCM,ADPCM, MULAW or ALAW (ideal for playback routines)

TO INSTALL:

This component is for DELPHI 3. the registered version will work under delphi 1 i just dont have it
for distribution yet, sorry..  there is a delphi 2 version (slightly different that is named
vox100.zip) it does not support the mu-law or a-law but does the direct recording and playing.
However contact me and i`ll let you have what you need 

Install the voxconv.dcu as a standard component and compile the test program see how everything 
is done with a single line of code once is there.

FINALLY if you decide you like it.. please read the HELP file on how to register :-)
or do it directly at this secure web site:

http://www.nstarsolutions.com/813.htm

Priece is $39 or $49 with source code.

Really hope this will save you all the time i spent myself to create my telephony
application :-)

NOTE**** this shareware version will only work while Delphi is running! 

Methods :

* Voxtowav(sourcefile, destinationfile: string; frequency: integer); 

use this to convert Vox to wav.. the way the vox is interpreted is the way you have set 
the VOXTYPE property possible valuse are VT_PCM , VT_ADPCM , VT_ALAW, VT_MULAW. the 
frequency is the one that will be written in the wave,  please note that you can decide wether
the output wave will be 16 or 8 bit by setting he waveout16bit property to true or false.

* Wavtovox(sourcefile, destinationfile: string); 

Use this to convert wav to vox.. the way the vox is interpreted is the way you have set 
the VOXTYPE property

* procedure ADPCMtoPCM16(frombuffer,tobuffer : pointer; var sspointer,xp :integer; count : integer);

This function will convert a block of ADPCM encoded VOX data to a block of standard PCM 
data (16bit mono), only thing to pay attention to is the value of the variables XP and 
SSPOINTER.. when you call  this function the first time in a VOX block (that is when 
you pass to this function the first part of a long VOX block).you must initialize these
variables like this :

xp :=2048 ;
sspointer :=0 ;

next time you call this function (like, for example , to convert the second block of 
the SAME vox file) you must use the values that this procedure returned in SSPOINTER 
and XP) ;

Note : decoded  PCM data will have a size 4 times the original ADPCM data. (take this
 into consideration when sizing the PCM buffer you are passing to this function).


Example : this will read and directly play a file using the waveout (this is a part of
 the internal PLAY code)

......
open file etc..
....
 
  sspointer:=0;
  xp:=2048;
    repeat
    blockread(fi,ADPCMbuffer,1024,howmanyread);
    if voxtype=VT_ADPCM then // if the source is a ADPCM then we convert it before playing
      begin
      ADPCMtoPCM16(@ADPCMbuffer,@PCMbuffer,sspointer,xp,letti); 
      fwaveout.playback(@PCMbuffer,howmanyread*4);
      end else fwaveout.playback(@ADPCMbuffer,howmanyread);
    until howmanyread<>1024;
  closefile(fi);


* procedure PCM16toADPCM(frombuffer,tobuffer : pointer; var sspointer,xp :integer; count : integer);

This function will convert a block of PCM encoded  data (16 bit mono)  to a block of VOX ADPCM
 data, only thing to pay attention to is the value of the variables XP and SSPOINTER.. when
 you call this function the first time in a PCM block (that is when you pass to this function 
the first part of a long PCM block).you must initialize these variables like this :

xp :=2048 ;
sspointer :=0 ;

next time you call this function (like, for example , to convert the second block of the SAME PCM file) you must use the values that this procedure returned in SSPOINTER and XP) ; much like ADPCMtoPCM (see the example there)
Note : encoded ADPCM data will have a size for time less than the original PCM data.


* PCM16toPCM8(source,destination : pointer; count : integer);
* PCM8toPCM16(source,destination : pointer; count : integer);
* PCM16toALAW(source,destination : pointer; count : integer);
* PCM16toMULAW(source,destination : pointer; count : integer);
* ALAWtoPCM16(source,destination : pointer; count : integer);
* MULAWtoPCM16(source,destination : pointer; count : integer);

these are all raw data block conversion functions.. nothing to say except that the PCM16 
size is always twice  .. i suggest you to use a SMALLINT array for the PCM16 data and a 
array of BYTE for either other format.

COUNT is always in SAMPLES (not in bytes..) 

************************************************************************************
Please visit our telephony page for VOCOM (a complete toolkit for dialogic cards) at
http://www.radsite.com/vocom

We offer a complete development package for your telephony system with 
*excellent features* and a ridiculosly low priece! *199$*  Vs. +1000$ of most competitors 

Note this component is free with any VOCOM registration.
************************************************************************************

Sincerely
Giovanni Tummarello
tummarel@ascu.unian.it