From alsa-user-owner@alsa.jcu.cz  Sat Jun 20 12:05:52 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 LAA02935;
	Sat, 20 Jun 1998 11:57:56 +0200
Date: Sat, 20 Jun 1998 11:57:56 +0200 (MET DST)
From: Jaroslav Kysela <perex@jcu.cz>
To: Jacob Jaeggli <jjaeggli@iastate.edu>
cc: alsa-user@jcu.cz, alsa-devel@jcu.cz
Subject: Re: 16 digital stereo channels
In-Reply-To: <35858831.13208794@iastate.edu>
Message-ID: <Pine.LNX.3.96.980620114220.15479G-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, 15 Jun 1998, Jacob Jaeggli wrote:

> Ben Reed wrote:
> 
> > Exyll wrote:
> > > On normal gus(max) the rate drops when the drivers reserve more then 16
> > > channels..
> > >
> > > 16 channels and lower can be played at 44k1 Hz.. Over 16 channels.. the
> > > rate drops in minor decreases..
> >
> > Actually, I think with anything using the GF1 chip from ultrasound, it's
> > 14 channels, but either way, it would be cool to have hardware mixing
> > that way.  :)  Maybe this could be done along with whoever's writing
> > esound..?
> 
>   I'm not sure, but I think that you could actually have 16 stereo channels,
> as it is a 32 channel synth.. I think that the 14 comes from several
> channels being reserved for the drums.  This may just be in the driver.  For

Both original GF1 chip and InterWave chip are able play independend sound
from 32 voices, but GF1 chip decreases mixing quality when above 14 voices
are used. ALSA driver supports 32 voice mixing for one open (this means
than one application should use 32 channel digital playback, but there
are some things to do - for example indenpendend volume settings for each
voice).

> the interwave card under the ALSA driver you have the Codec audio device...
> which can play 16-bit, 48khz audio.  This resides under the device
> /proc/sound/[device no (probably 0)]/pcm0.  If you look, you will also see
> pcm0p and pcm0r.  Look a little further and you will see pcm1 and pcm1p.
> The second sound playback device is, in fact, two channels on the GF1
> synth.  You will, of course, need the 512k dram (for the Dynasonix3D); if
> you have the GUS PnP, you already have the onboard ram.  With this device,

GUS PnP have onboard RAM only in Pro version...

> you can play over this device with an ALSA-compatible sound player (aplay).
> It's not hard to test out either.  Find some audio files that are fairly
> long and try it out:
> 
> aplay -d 0 [sound file 1] &
> aplay -d 1 [sound file 2] &

You can use '/dev/adsp' which means 'alternate DSP' for OSS compatible
programs (for example 'mpg123 -a /dev/adsp <file.mp3>'...

>   You will also notice that there is another device that shows up on your
> OSS mixer.  This is your pcm1 volume setting (or you could have used
> alsamixer and it would have told you that).

Right..

> Here is a snippet from interwave.c:
> 
> -----
> 
> struct snd_interwave {
>   int use_count;
>   int irqnum;
>   int dma1num;
>   int dma2num;
>   snd_card_t *card;
>   snd_gus_card_t *gus;
>   snd_pcm_t *pcm;
>   snd_pcm_t *pcm1;              /* GF1 compatible PCM interface */
>   snd_kmixer_t *mixer;
>   snd_rawmidi_t *midi_uart;
>   unsigned short gus_status_reg;
>   unsigned short pcm_status_reg;
> #ifdef SNDCFG_PNP
>   struct pnp_device *pnpdev;
> #endif
> };
> -----
> 
> As you will notice, it is labeled nicely there for you in the source.  Now,
> as one might imagine, pcm2, pcm3, pcm4, etc. could probably be easily added
> by a little inspection of the existing code.

It's true, but you must remember, that stereo playback over original GF1
chip eats some CPU time. Data for two or more digital channels must be
separated for each voice and transferred over DMA to onboard RAM. For
InterWave chip exist interleaved DMA, but this method of transfer isn't
used in ALSA driver (yet)..

If I'll have some time, I'll try play with existing code to extended GF1
playback to allow some (probably 4) stereo digital audio data play 
simultaneously from 4 applications... This will allow use up to 5
applications with GUS MAX/PnP/Extreme which have extra codec..

						Jaroslav

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


