Voice Chat program implementation (INDY, ACM, DELPHI)

Source: Internet
Author: User

<?xml:namespace prefix = o ns = "Urn:schemas-microsoft-com:office:office"/>

The design, implementation and introduction of the chat program

Zhou Baofeng

Xi ' an Jiaotong University Software Institute MSE 2002

2005.01


Cable Primer

1 . Program Design ... 3

2 . Program Use ... 4

2.1 Use of the server ... 5

2.2 The use of the client ... 5

3. Reference Documents ... 6


1. Program Design

Programming Environment:

Using the Borland company Delphi 7 Enterprise Edition in the Windows 2000 Professional Edition development.

Other design Details:

TCP Server:

Use tidtcpserver <?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml"/> implementation. The interaction for text.

For each client's TCP connection, start a threading process. The structure diagram is as follows:

Main thread

Listener Threads

Accept Client 1

Accept Client 1

Accept Client 1

...

Client1.thread

Client2.thread

Client3.thread


Thread management is managed with Tidthreadmgrdefault .

UDP Server:

Adopt the tidudpserver implementation in INDY. When the UDP packet is received, the Udpread event is triggered, where the sound data is played.

UDP client:

Adopt the Tidudpclient implementation in Indy. When the collected sound data exceeds the buffer
Size (2048 bytes), call its Sendbuffer method to emit the data.

Extraction of Sound:

Using the Tacmin control to collect sounds, the acmin control is primarily called the Windows API waveinopen function. function declaration:

function Waveinopen; External mmsyst name ' Waveinopen ';

(Mmsystem.pas)

Sound coding:

The default is GSM6.10 encoding, detailed coding support:

GSM 6.10 8kHz, mono– default

11.025kHz, Mono

22.050kHz, Mono

44.100 KHz, Mono

Micorsoft g.723.1 8 kHz Mono, 6400 bit/s

8 kHz Mono, 5333 bit/s

PCM 8/11/12/16/22/24/32/44/48 kHz, 8/16/bit, Mono

Mpet Layer–3

56/40/48/32/20/24/12/16/8 kbit/s, 24,000/22,000/16,000/8,000 Hz, Stereo

.....

Sound output:

When the UDP server receives the data, it plays with Acmout.

Adata.read (audioarray,adata.size);

If not audioout.active then BEGIN

With M_playaudioformat.format do begin

wFormatTag: = 1;

Nchannels: = 1;

Nsamplespersec: = 22050;

Navgbytespersec:= 22050;

Nblockalign:=1;

wBitsPerSample: = 8;

cbsize: = SizeOf (Tacmwaveformat);

End;

Adioout.open (Audioconvertor.formatin);

Audioout.open (M_playaudioformat);

End

Audioout.play (Audioarray, adata.size);

2. Program use

Note: Server programs and client programs cannot run on the same machine (avoid sound playback and collection conflicts), and a single machine can run only one server program or one client program at a time.
Server-side log files: CharSvr.log

Log file for client: ClientError.log

2.1 Use of the server

2.2 Use of clients

Select the online user before you can speak. 3. Reference documents

[1] Indy in Depth atozed Software

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.