From alsa-devel-owner@alsa.jcu.cz  Wed Feb 24 09:39:10 1999
Received: from faui45.informatik.uni-erlangen.de (root@faui45.informatik.uni-erlangen.de [131.188.2.45])
	by marvin.jcu.cz (8.9.1a/8.9.1) with ESMTP id JAA21715
	for <alsa-devel@alsa.jcu.cz>; Wed, 24 Feb 1999 09:38:37 +0100
Received: from servww1.ww.uni-erlangen.de (servww1.ww.uni-erlangen.de [131.188.142.2])
	by faui45.informatik.uni-erlangen.de (8.9.1/8.1.49-FAU) with SMTP id JAA15285
	for <alsa-devel%alsa.jcu.cz@faui45.informatik.uni-erlangen.de>; Wed, 24 Feb 1999 09:38:35 +0100 (MET)
Received: from hong.ww.uni-erlangen.de by ww.uni-erlangen.de with SMTP;
	id AA17160 (1.37.109.4/7.3m-FAU); Wed, 24 Feb 99 09:38:20 +0100
Message-Id: <9902240838.AA17160@servww1.ww.uni-erlangen.de>
Received: by hong (sSMTP sendmail emulation); Wed, 24 Feb 1999 09:40:07 +0100
From: "Takashi Iwai" <iwai@ww.uni-erlangen.de>
To: alsa-devel@alsa.jcu.cz
Subject: Re: Instrument abstract layer
In-Reply-To: <Pine.LNX.3.96.990223190734.3172B-100000@entry.jcu.cz>
References: <9902231540.AA21258@servww1.ww.uni-erlangen.de>
	<Pine.LNX.3.96.990223190734.3172B-100000@entry.jcu.cz>
Date: Wed, 24 Feb 1999 09:40:07 +0100
Reply-To: alsa-devel@alsa.jcu.cz
Sender: alsa-devel-owner@alsa.jcu.cz
Precedence: list

>>>>> On Tue, 23 Feb 1999 19:15:52 +0100 (CET), Jaroslav Kysela
<perex@jcu.cz> said: 

>>> Prg (program or preset)
>>> - MIDI / own program number
>>> - 0..127 - melodic
>>> - 128..255 - drums
>> 
>> It would be flexible that the key number can be given explicitly as
>> another parameter.
>> For example, not only drums but sfx presets have different sample per
>> key.  Most of these tones are defined in somewhere other banks but
>> possibly with different key number.  Then, we need to alias between
>> different bank/preset/key combinations.

> I mean - 0-127 melodic instruments which could be used for the melodic
> channel. 128-255 drum/fx (note based) instruments. As an extension it
> could be selected instruments 128-255 as the melodic instrument (this
> doesn't follow some MIDI standard).

Yes, I understood it.  It's just like instrument numbers of GUS patch
loading, isn't it?
What I wrote is - assume to alias bank 8 / instr 20 / note 64 to
bank 126 / instr 0 / note 48.  Both source and destination use
different note numbers.  This can't be handled easily unless we give
explicitly the note number in instrument identifier, because if we use
128-255 for key mapping, the instrument number will be ignored.  The
same problem is - how to deal with drumsets with different instrument
number like standard and jazz drums?

> If you want use own instrument numbers - you can use the high byte from
> program number. Maybe we can use 7. bit of this variable to specify "note"
> based instrument.

It sounds better idea.  This is nothing else giving an extra byte
parameter for the note key.


> If you want mix more instruments from different banks, you can use:

> 1) bank selection for the drum channel (for GS = program change)
> 2) different instrument clusters with different priorities (each
>    note for the instrument range 128-255 can be overriden).

Hmm, I didn't this understand well.. Could you explain more?


>> About bank number.
>> The bank number should be (unsigned) short, too.  XG and GS formats
>> utilize both MSB and LSB bank numbers.  But, as wellknown, both
>> formats use different way of MSB and LSB.  It's confusing.

> I extend the appropriate structure.

>> Then, using an optional parameter (like bank-map) would be nice, too.

> Already done via bitmap.

The XG format uses MSB (CC#0) for bank type selection (e.g. 127 for
drum), and LSB (CC#32) for the actual bank number.  The GS format uses 
LSB for bank type (bank-map) and MSB for the actual bank number.
Then the driver must check the different byte for the actual bank
number according to the format.
MSB for XG and LSB for GS are used only to specify the bank type, that 
is, an extra flag.  So I wrote that we can give this flag byte, and
use it for MSG/XG and LSB/GS.  Then, the bank number can be stored on
a byte parameter using LSB/XG and MSG/GS.
Anyway, this is an alternative solution and probably causes also
confusion.  The 16bit long bank number is straightforward and would be
enough for such a purpose.

-- 
Takashi Iwai / iwai@ww.uni-erlangen.de
Department of Materials Science
Friedrich-Alexander-University Erlangen-Nuernberg

