![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Highly Adaptive Penguin
Join Date: May 2005
Location: United States
Posts: 253
Rep Power: 6
![]() |
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.
|
|
|
|
|
|
#2 |
|
Newbie
Join Date: Sep 2005
Posts: 10
Rep Power: 0
![]() |
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. |
|
|
|
|
|
#3 |
|
SEXY SHOELESS GOD OF WAR!
![]() Join Date: Jun 2005
Location: Wet west coast of Canada
Posts: 1,676
Rep Power: 7
![]() |
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. |
|
|
|
|
|
#4 |
|
Highly Adaptive Penguin
Join Date: May 2005
Location: United States
Posts: 253
Rep Power: 6
![]() |
how do i compress the data
|
|
|
|
|
|
#5 |
|
Professional Programmer
|
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;} |
|
|
|
|
|
#6 | |
|
SEXY SHOELESS GOD OF WAR!
![]() Join Date: Jun 2005
Location: Wet west coast of Canada
Posts: 1,676
Rep Power: 7
![]() |
Quote:
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. |
|
|
|
|
|
|
#7 |
|
Highly Adaptive Penguin
Join Date: May 2005
Location: United States
Posts: 253
Rep Power: 6
![]() |
ok thanks
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|