Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <20040107051432.87218.qmail@web41407.mail.yahoo.com> Date: Wed, 7 Jan 2004 00:14:32 -0500 (EST) From: kaiduan xie Subject: Re: How to access soundcard in cygwin To: cygwin AT cygwin DOT com Cc: pechtcha AT cs DOT nyu DOT edu In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Igor, What I am going to do is to port a Voice over IP client from Linux to Cygwin. It needs to read the voice sample from soundcard, encode it using some kind encoding algorithm, such as GSM, G.711, etc, and then send out to network in real time. At the same time, read the voice data packet from network, decode it and then write to soundcard. All operation should be real time. The voice sample to/from the soundcard is of 8-bit or 16-bit linear PCM. My question is, if Cygwin doesnot support that, can I use the native Windows API to do that? In other worlds, is it possible to use native Windows API in cygwin? Thanks. kaiduan --- Igor Pechtchanski wrote: > Kaiduan, > > Please make sure your mailer respects the Reply-To: > header -- I set it for > a reason. All discussion of Cygwin-related subjects > should happen on the > Cygwin list unless specifically requested otherwise. > This automatically > makes it available to other people who care to look > (through the list > archives), and (hopefully) helps reduce the traffic > on this list. > > Cygwin allows you to send any data to the soundcard > by writing it to a > (device) file called '/dev/dsp'. You can use the > regular Unix 'open()' > and 'write()' system calls (or any other IO routines > that strike your > fancy) to do this -- Cygwin will take care of > sending the data to the > soundcard automatically. The soundcard (or, rather, > the Windows soundcard > driver) will recognize WAVE-formatted data. > > I believe the parameters you mentioned (frequency, > duplex, etc) are > incorporated into the WAVE data format, but I'm not > very familiar with it, > so it's best to double check. Once you create a > suitably-formatted data, > just write it to /dev/dsp. There are plenty of > specifications of the WAVE > format (.wav files) on the internet. > > Not knowing what the OSS API is, I'm unable to say > whether Cygwin supports > it. If all that's required is a /dev/dsp device > file that can be written > to, then Cygwin has that. I'm guessing the API is a > bit more than that, > though. > Igor > > On Tue, 6 Jan 2004, kaiduan xie wrote: > > > Igor, > > > > Thanks for reply. So if cygwin doesnot have the > API to read/write the > > soundcard, can I use the Windows API to read/write > soundcard? All I need > > to do is opening the soundcard, setting the format > (frequency, duplex > > mode, etc), and then reading from/writing to the > soundcard. > > > > Any pointer? > > > > Thanks again. > > > > kaiduan > > > > --- Igor Pechtchanski > wrote: > > > > On Tue, 6 Jan 2004, kaiduan xie wrote: > > > > > > > Hi, all, > > > > > > > > I am going to port a Linux program that > read/write the soundcard > > > > with OSS driver to Cygwin. Can anyone tell me > if it is possible to > > > > use the OSS API as in Linux to read/write the > soundcard? > > > > > > Depends on what the OSS API does. AFAIK, nobody > released an OSS > > > (whatever that is) library for Cygwin, so I > guess the answer is "no". > > > Whether it's possible to port the OSS library to > Cygwin remains to be > > > seen... FWIW, /dev/dsp *is* partially > implemented in Cygwin. > > > > > > > If not, how to do that in Cygwin? Thanks. > > > > > > How to do what? Access the soundcard? Try 'cat > a.wav > /dev/dsp' to > > > write to the soundcard. AFAICS in the code, the > 'read()' method is > > > dummied out, so I guess it's not possible to > read from the soundcard > > > (i.e., record from the microphone). This guess > is confirmed by > > > > . > > > > > > . > > > > > > You're welcome to try to add the recording > (i.e., reading) support to > > > fhandler_dsp.cc in the Cygwin sources. There > was some discussion on > > > cygwin-patches that may point you in the right > direction (notably > > > > ). > > > > > > HTH, > > > Igor > > -- > http://cs.nyu.edu/~pechtcha/ > |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu > ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com > |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, > Ph.D. > '---''(_/--' `-'\_) fL a.k.a > JaguaR-R-R-r-r-r-.-.-. Meow! > > "I have since come to realize that being between > your mentor and his route > to the bathroom is a major career booster." -- > Patrick Naughton > > -- > Unsubscribe info: > http://cygwin.com/ml/#unsubscribe-simple > Problem reports: > http://cygwin.com/problems.html > Documentation: http://cygwin.com/docs.html > FAQ: http://cygwin.com/faq/ > ______________________________________________________________________ Post your free ad now! http://personals.yahoo.ca -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/