Click here to Skip to main content
Licence 
First Posted 19 Jan 2002
Views 228,767
Bookmarked 55 times

Simple Voice Chat

By | 19 Jan 2002 | Article
A simple peer to peer voice chat application using sockets

Introduction

This is a simple voice chat program implemented in an ActiveX control (OVoiceChatt Control) using windows sockets in non compressed PCM format. You just need to give your name and the IP address of the computer on which you want to establish a voice chat session.

There is a simple test application (OVoiceChattClient) which has implemented the control.

Run the OVoiceChatClient.exe and enter you name and the ip address of the computer same application should be running on that computer as well. .A request for the voice chat goes to that computer and if that person accepts it then the voice chat starts.

To use in a program.

Below is some sample code that demonstrates using the control in your code.

In the header:

COVoiceChatt m_ctlVoice;

In the implementation:

BEGIN_EVENTSINK_MAP(COVoiceChattClientDlg, CDialog)
    //{{AFX_EVENTSINK_MAP(COVoiceChattClientDlg)
    ON_EVENT(COVoiceChattClientDlg, IDC_OVOICECHATTCTRL1, 1 /* GetVoiceInvitation */, \
                 OnGetVoiceInvitation, VTS_BSTR VTS_BSTR)
    ON_EVENT(COVoiceChattClientDlg, IDC_OVOICECHATTCTRL1, 2 /* GetReqStatus */, \
                 OnGetReqStatus, VTS_I4)
    ON_EVENT(COVoiceChattClientDlg, IDC_OVOICECHATTCTRL1, 3 /* GetVoiceEndNotice */, \
                 OnGetVoiceEndNoticeOvoicechattctrl1, VTS_NONE)
    //}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()

void COVoiceChattClientDlg::OnGetVoiceInvitation(LPCTSTR ip, LPCTSTR nick) 
{
    m_ip=ip;
    CString str=nick;
    str+=" wants to have voice chat with you";
    if(AfxMessageBox(str,MB_YESNO)==IDYES)
    {
        m_ctlVoice.OVoiceInvStatus(1,ip);
    }
    else
        m_ctlVoice.OVoiceInvStatus(0,ip);
}

void COVoiceChattClientDlg::OnGetReqStatus(long status) 
{
    if(status==0)
        AfxMessageBox("request rejected");
    else
    {
        m_strStatus="Connecting";
        UpdateData(FALSE);
    }
}

void COVoiceChattClientDlg::OnButton1() 
{
    m_ctlVoice.OVoiceInit();    
}

void COVoiceChattClientDlg::OnButtonEnd() 
{
    m_ctlVoice.OVoiceEnd();    
}

void COVoiceChattClientDlg::OnGetVoiceEndNoticeOvoicechattctrl1() 
{
    AfxMessageBox("Voice Conversation Has Been Ended");       
}

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

imran lodhi



United States United States

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Questionnot working for me on visual studio 2008 and windows 7 Pinmemberreimo2:36 8 Sep '11  
QuestionJust Downloaded VoiceChat plEASE EXPLAIN INSTALL PinmemberDAZMeanZit1:23 21 Aug '11  
QuestionJust Downloaded VoiceChat PinmemberDAZMeanZit1:22 21 Aug '11  
QuestionUrgent Pinmemberhina_ghazal23:31 2 Nov '08  
GeneralCxImage Version 6.00 and Demo application PinmemberMustafa Alahwel6:30 23 Oct '08  
Generalneeded help Pinmemberhariharasudhan felix23:07 23 Jul '06  
Generalis this example given file is a real time example or not Pinmembermanu90902:30 4 May '06  
QuestionHow To check the CD Writter,Printer, Download Size Status such as How Copies writted and printed Pinmemberalexmcada1:31 3 Oct '05  
AnswerRe: How To check the CD Writter,Printer, Download Size Status such as How Copies writted and printed PinmemberDuncan Edwards Jones1:54 3 Oct '05  
Generalencryption Pinmembervalroft10:00 12 May '05  
GeneralShaking Voice PinmemberSohailB3:06 27 Apr '05  
Generalthank you georgi ! Pinmembervalroft19:19 30 Mar '05  
GeneralErrors in Ole control PinmemberGeorgi Petrov0:21 5 Mar '05  
Generalerror in buliding the OVoiceChatt Control... PinmemberComVexd15:01 22 Jun '04  
GeneralRe: error in buliding the OVoiceChatt Control... PinmemberComVexd15:11 22 Jun '04  
Generalneed help Pinmembersaima4:24 11 Jun '04  
Generalneed help Pinmembersaima4:18 11 Jun '04  
QuestionHaving link error LNK2019? PinmemberDanny J15:48 6 Feb '04  
Generalhelp me PinsussAnonymous15:01 11 Aug '03  
QuestionHow OCX control into win32 aPP PinsussMarcos_Martinez22:01 2 Jul '03  
GeneralPl Help to run this app Pinmemberdharani20:45 11 Jun '03  
General[Q] error code... Pinmemberhss04214:56 7 Apr '03  
GeneralRe: [Q] error code... Pinmemberhaogege15:03 8 Mar '04  
Generalresend the whole project Pinsusspon.vignesh1:02 4 Mar '03  
GeneralVB Pinmemberfasiasharf21:58 27 Dec '02  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 20 Jan 2002
Article Copyright 2002 by imran lodhi
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid