This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to access soundcard in cygwin


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 <pechtcha@cs.nyu.edu> 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
> > <http://cygwin.com/ml/cygwin/2002-07/msg00628.html>.
> >
> > <http://cygwin.com/acronyms/#PTC>.
> >
> > 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
> > <http://cygwin.com/ml/cygwin-patches/2002-q3/msg00112.html>).
> >
> > HTH,
> > 	Igor

-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]