From alsa-user-owner@alsa.jcu.cz  Mon May  4 12:22:51 1998
Received: from entry.jcu.cz (perex@entry.jcu.cz [160.217.1.111])
	by marvin.jcu.cz (8.8.8/8.8.8) with SMTP id MAA04830;
	Mon, 4 May 1998 12:20:52 +0200
Date: Mon, 4 May 1998 12:20:52 +0200 (MET DST)
From: Jaroslav Kysela <perex@jcu.cz>
To: Rodolphe Suescun <Rodolphe.Suescun@imag.fr>
cc: alsa-user@alsa.jcu.cz
Subject: Re: Question about ALSA's sound.h
In-Reply-To: <354D84D0.2F652FD0@imag.fr>
Message-ID: <Pine.LNX.3.96.980504114356.618A-100000@entry.jcu.cz>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Reply-To: alsa-user@alsa.jcu.cz
Sender: alsa-user-owner@alsa.jcu.cz
Precedence: list

On Mon, 4 May 1998, Rodolphe Suescun wrote:

> Greetings.
> 
> I'm planning to rewrite part of a mixer proggy I coded a while ago to
> make it
> ALSA compliant ( and keep OSS compatibility for people who don't have
> ALSA compiled
> on their machine ). Is it possible to "recognize" that the sound.h file
> is the ALSA
> one at compilation time ( possibly some #define ALSADRIVER line in the
> sound.h file ) ?

Better way is detect interface with use SND_*_VERSION defines.

#ifdef SND_MIXER_VERSION
... ALSA part ...
#else
... another part ...
#endif

or if you know, that some header file for ALSA is broken for you:

#if SND_MIXER_VERSION < SND_PROTOCOL_VERSION( 1, 0, 0 )
#error "Please, upgrade ALSA driver!!!"
#else
... ok part ...
#endif

Note: I don't like use directly ioctl's and open/close/read/write
functions. You should use alsalib rather which covers and hides these
low-level interface.

> Another question : I tried ( and failed ) to configure ALSA to handle 2
> sound
> cards simultaneously : an old sb16 and a gus PnP. I was able to handle
> only
> one card at a time ( it was with 0.1.0pre3 ).
> As I don't intend to use kerneld ( I *always* use sound when under Linux
> ;), I
> just tried "insert sb16; insert iw".
> Did I do something wrong ?
>

Yep.. Script insert removes all sound modules before is modules for new
configuration loaded - thus second insert removes SB16 driver. You should
look to p1 or p2 configuration which I use for debugging:

p1) SB AWE 64 + GUS Classic
p2) GUS MAX + GUS Extreme

You should add or change above configuration for your use, but you must
know which modules must be loaded for appropriate soundcard (modprobe does
it automaticaly).

Insert script is only for debugging. Modify rather /etc/conf.modules and
try modprobe (look to utils/alsasound or utils/sound.init script).

Here is my /etc/conf.modules for p1 configuration:

alias char-major-14 off
alias snd-minor-oss-0 snd-mixer
alias snd-minor-oss-3 snd-pcm-oss
alias snd-minor-oss-4 snd-pcm-oss
alias snd-minor-oss-5 snd-pcm-oss
alias snd-card-0 snd-sb16
alias snd-card-1 snd-gusclassic
options snd snd_major=14 snd_cards_limit=2
options snd-sb16 snd_index=1 snd_port=0x220 snd_irq=5 snd_dma8=1 snd_dma16=5
options snd-gusclassic snd_index=2 snd_irq=11 snd_dma1=6 snd_dma2=7

 
> The mixer app can be found at
> http://fox.unixville.com/projects/infopages/mixer.html.
> I'll update the sources whenever I can fix the above mentionned
> problems...

Looks good. Please, notify your release with first ALSA code.

> 
> Thanx in advance for your help.
> 
> Rod.

-----
Jaroslav Kysela <perex@jcu.cz>
Academic Computer Centre, University of South Bohemia
Branisovska 31, C. Budejovice, CZ-370 05 Czech Republic




