Problem in playing audio file using CAPI

Problem in playing audio file using CAPI

Post by Saraswath » Wed, 12 Nov 2003 17:42:06


Hello,
I've written simple IVR system using CAPI and I've AVM c4 controller.
I tested my application with single channel(1B channel). It works fine
without any problem. Now I am trying to use two channels(2 BChannel) and
I've problem in playing voice data.
In one channel voice is very clear and in other channel the voice
data is not clear. I just can't make out anything from the message.
Sometimes it's like fast forwarding and sometimes it wont play only.
Please tell me where I am wrong. My application is a multithread and
I've one one thread for each channel.
Is it threading problem or any setting do I need to take care in my
program.??.

Thanking you in advance.

Here is the code:

#define CAPI_BUF_SIZE 256
#define MIN(x,y) ((x)<(y)?(x):(y))
#define BUFLEN 32000 //Buffer for file handling

char inbuf[BUFLEN+1];
HANDLE hFileHandle =
CreateFile(L"C:\Welcome.snd",GENERIC_READ,0l, NULL, OPEN_EXISTING,
FILE_FLAG_SEQUENTIAL_SCAN, NULL);

BYTE *bufa;
DWORD bytesLeft, bytesToSend, inLength;
SetFilePointer(hFileHandle,NULL,NULL,FILE_BEGIN);
do
{
ReadFile(hFileHandle,inbuf,BUFLEN,&inLength,NULL);
bufa = (unsigned char*)inbuf;
bytesLeft = inLength;

while(bytesLeft>0)
{
bytesToSend=MIN( CAPI_BUF_SIZE, bytesLeft );
int capi_error;
CAPI_MSG put_msg;
memset(&put_msg, 0, sizeof(CAPI_MSG));
put_msg.header.ncci = pMessage->m_nNCCINr; /*
use NCCI to send data*/
put_msg.header.length = sizeof(put_msg.header) +
sizeof(_DAT_B3_REQP);
put_msg.header.command = _DATA_B3_R;
put_msg.header.controller = (BYTE) pMessage->m_nCntrlNr;
put_msg.header.plci = pMessage->m_nPLCINr;
put_msg.info.data_b3_req.Data = (DWORD) bufa ;
put_msg.info.data_b3_req.Data_Length = bytesToSend;
put_msg.info.data_b3_req.Flags = 0;
do{
put_msg.header.number = (WORD)++nMessageNr;
capi_error = PUT_CAPI_MESSAGE(1,&put_msg);
if(capi_error==QUEUE_FULL)
//Send Queue is full, wait a bit then try again
SleepEx(10,TRUE);
else if(capi_error)
}while(capi_error==QUEUE_FULL);
bufa += bytesToSend;
bytesLeft -= bytesToSend;
}

}while(inLength);
CloseHandle(hFileHandle);

Regards,
Saraswathi
 
 
 

Problem in playing audio file using CAPI

Post by Christian » Fri, 14 Nov 2003 00:17:41

Hi Saraswathi,


if you set also the DataHandle (WORD) it will work...


Kind regards



Christian
"Saraswathi" < XXXX@XXXXX.COM > schrieb im Newsbeitrag

controller.
and
my

 
 
 

Problem in playing audio file using CAPI

Post by Jochen Kle » Fri, 14 Nov 2003 01:11:17

araswathi,

well how about providing a CAPI trace?!?
You provided a C / C++ code snippset. e.g. we dont know how the struct (I
*guess* it MUST be a struct) is defined, and, and, and...
Also CAPI is totaly programming language independant. To give alle
interested useres of this NG a chance to understand the prob and migt be
even more important the solution, please base your questions and infromation
on CAPI, on just that waht the CAPI spec. covers; this is realy sufficient
and it can be understod by everyone who has the CAPI spec.


Regards,
Jochen Klein
www.servonic.de

"Saraswathi" < XXXX@XXXXX.COM > schrieb im Newsbeitrag
news:boq7da$mgi$ XXXX@XXXXX.COM ...
controller.
and
my