By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,982 Members | 1,955 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,982 IT Pros & Developers. It's quick & easy.

Audio streaming

P: n/a
skt
Hi
Can anyone tell me how I can stream audio input from a microphone input
in C/C++? I would prefer plain C/C++, rather than DirectX/Windows
programming, though those would be fine too.
Also, how can i read/write wav files using file handles?

Thanks a lot
Srikanth

Apr 10 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On 10 Apr 2006 10:19:03 -0700, sk*@xdtech.com wrote in comp.lang.c:
Hi
Can anyone tell me how I can stream audio input from a microphone input
in C/C++? I would prefer plain C/C++, rather than DirectX/Windows
programming, though those would be fine too.
There is no such language as C/C++, there is C and another, different
language C++, similar in some ways to C.

There is no standard method in either C or C++ to access any hardware
device at all. All input and output is abstracted using C FILE *
streams or C++ streams.

Any access to hardware like a microphone would need to make use of
non-standard, platform specific extensions. You need to look on
http://msdn.microsoft.com, or ask in Windows specific groups like
news:comp.os.ms-windows.programmer.win32 or those in the
news:microsoft.public.* family.
Also, how can i read/write wav files using file handles?
There are no "file handles" in C or C++. There are FILE * streams or
C++ iostreams. You can use these to read and write wav files. I
suggest you make sure to open the files in binary mode.
Thanks a lot
Srikanth


--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Apr 10 '06 #2

P: n/a
On 2006-04-10, sk*@xdtech.com <sk*@xdtech.com> wrote:
Hi
Can anyone tell me how I can stream audio input from a microphone input
in C/C++? I would prefer plain C/C++, rather than DirectX/Windows
programming, though those would be fine too.
It's not possible to actually get data from the microphone input without
using some OS specific APIs (i.e. something like DirectX/Windows
programming).

If you want to stream the data internally in your program because you're
processing it in some way (e.g. you're writing a mixer), then you can do
that in plain C or C++, probably by implementing some kind of "ring
buffer". But I'm not sure if that's really your question so I won't go
on.
Also, how can i read/write wav files using file handles?


You have to find a doc somewhere about wav file format and then
construct the header and write out the data as the format dictates. It's
quite simple to make an uncompressed wav file, so this is feasible. Or
of course find a lib etc. that can do it for you.
Apr 10 '06 #3

P: n/a
sk*@xdtech.com wrote:
Hi
Can anyone tell me how I can stream audio input from a microphone input
in C/C++? I would prefer plain C/C++, rather than DirectX/Windows
programming, though those would be fine too.


Looks like you'd be better of on a windows group, or one covering that
mythical language C/C++.

--
Ian Collins.
Apr 11 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.