Re: [linux-audio-dev] ALSA => OSS compatibility

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] ALSA => OSS compatibility
From: Paul Davis (pbd_AT_Op.Net)
Date: Fri Mar 15 2002 - 18:39:29 EET


>I have a default SuSE 7.1 installation which provides the alsa sound
>system.
>
>I understand that ALSA and OSS have the same programming interface, but
>the device names (given as parameters to ioctl()) are different.

You understand incorrectly.

ALSA provides support the same API as OSS (unless it was compiled to
not do this). If you wish to make the mistake of using the OSS API,
then just use it unchanged. It will work with ALSA unless you use OSS
with mmap(2).

>The following code:
>
> char *device = "/dev/dsp";
> if ( (audio_fd = open(device, O_WRONLY, 0)) == -1 ) {
> perror(device); //
> exit(1);
> }
>
>produces the following output: "/dev/dsp: No such device", probably
>because /dev/dsp is an OSS thing.

It says that because you don't have OSS support set up ...

>Do I need the snd-pcm1-oss module?

Sort of. Apparently, your SuSE installation isn't quite setup correctly -
this should get loaded automatically. Your /etc/modules should include
stuff like:

alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-12 snd-pcm-oss

Which will force loading snd-pcm-oss whenever /dev/dsp is accessed.

>How do I procede to write most portable code?

Depends on what you mean by portable. Personally, I'd recommend the
PortAudio library if portability matters to you. It will prepare your
application for future interaction with interesting audio systems much
better than OSS or ALSA API's will. http:/www.portaudio.com/

--p


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Fri Mar 15 2002 - 18:26:56 EET