Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 13th, 2005, 7:40 AM   #1
Brent
Highly Adaptive Penguin
 
Brent's Avatar
 
Join Date: May 2005
Location: United States
Posts: 253
Rep Power: 6 Brent is on a distinguished road
using mic and speakers in C++

im using a windows xp, and a watcom compiler. I want to create a voice chat, and was wondering how i could implement the use of a microphone and speakers in my program.
Brent is offline   Reply With Quote
Old Nov 13th, 2005, 11:48 AM   #2
Ras Qulec
Newbie
 
Join Date: Sep 2005
Posts: 10
Rep Power: 0 Ras Qulec is on a distinguished road
You might look into the windows audio apis.
http://www.borg.com/~jglatt/tech/lowaud.htm
and into winsock.
http://www.frostbytes.com/~jimf/pape...s/winsock.html
are some sample sites.

Record data from an audio input [set up a buffer with the audio apis] and send it through a socket to a server. The server would send it out to other people where their client take the data and sends it to the speaker buffer to be played. You will have to decide how you want to mix the sound if more then one person talks at the same time.

I dont know how much help you wanted so I just gave you some links to point you in the right direction and to give you a basis to do your own research.
Ras Qulec is offline   Reply With Quote
Old Nov 13th, 2005, 11:50 AM   #3
lectricpharaoh
SEXY SHOELESS GOD OF WAR!
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Wet west coast of Canada
Posts: 1,676
Rep Power: 7 lectricpharaoh will become famous soon enough
This is a complex issue. While there are APIs for recording and playing back sound (look up MCI and/or DirectSound), you'll need more than just that. You'll want some method of compressing and decompressing the data, and you'll need to do this yourself unless you know how to make use of existing codecs (and probably a third-party library, as well).

How complex it gets depends on your needs. When using a lower-bandwidth connection, you'll want higher compression, but if you have a broadband connection, you might be able to skip compression entirely if you keep the sampling rate low enough. Do you want to be able to play multiple sounds at once, like if you're talking to two or more other people, and they both talk at the same time? How are you going to handle cases when sound is coming in while you want to talk, without causing feedback?
__________________
My microwave has settings for snake, gremlin, and puppy.
lectricpharaoh is offline   Reply With Quote
Old Nov 13th, 2005, 1:32 PM   #4
Brent
Highly Adaptive Penguin
 
Brent's Avatar
 
Join Date: May 2005
Location: United States
Posts: 253
Rep Power: 6 Brent is on a distinguished road
how do i compress the data
Brent is offline   Reply With Quote
Old Nov 13th, 2005, 2:14 PM   #5
iignotus
Professional Programmer
 
iignotus's Avatar
 
Join Date: Apr 2005
Location: Nowhere Special
Posts: 466
Rep Power: 6 iignotus is on a distinguished road
Send a message via AIM to iignotus
By using an audio codec.
__________________
% rc4 hexkey < input > output
#define S ,t=s[i],s[i]=s[j],s[j]=t /* rc4 hexkey <file */
unsigned char k[256],s[256],i,j,t;main(c,v,e)char**v;{++v;while(++i)s[ 
i]=i;for(c=0;*(*v)++;k[c++]=e)sscanf((*v)++-1,"%2x",&e);while(j+=s[i]
+k[i%c]S,++i);for(j=0;c=~getchar();putchar(~c^s[t+=s[i]]))j+=s[++i]S;}
iignotus is offline   Reply With Quote
Old Nov 13th, 2005, 2:53 PM   #6
lectricpharaoh
SEXY SHOELESS GOD OF WAR!
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Wet west coast of Canada
Posts: 1,676
Rep Power: 7 lectricpharaoh will become famous soon enough
Quote:
Originally Posted by Brent
how do i compress the data
You can use someone else's algorithm: as iignotus said, a codec (which is short for compressor/decompressor).

You could also write your own custom compression algorithm. There's lots of info on this sort of thing on the net, but it's not exactly a trivial task. Also, remember that the people who write compression algorithms for a living are going to be much better at it than you or I, so unless you're looking for the experience, I'd recommend against this route.
__________________
My microwave has settings for snake, gremlin, and puppy.
lectricpharaoh is offline   Reply With Quote
Old Nov 13th, 2005, 3:23 PM   #7
Brent
Highly Adaptive Penguin
 
Brent's Avatar
 
Join Date: May 2005
Location: United States
Posts: 253
Rep Power: 6 Brent is on a distinguished road
ok thanks
Brent is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:01 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC