Re: MusicDevice instrumentIDs and presets
Re: MusicDevice instrumentIDs and presets
- Subject: Re: MusicDevice instrumentIDs and presets
- From: Bill Stewart <email@hidden>
- Date: Wed, 18 Jun 2003 21:48:20 -0700
Just to be nit-picky...
InstrumentID is defined as 3 MIDI values shifted into a UInt32:
0xMMLLPP
where MM is 0-127 of the MSB of the bank select MIDI Control message
(shifted 16 bits up)
where LL is 0-127 of the LSB of the bank select MIDI Control message
(shifted 8 bits up)
where PP is 0-127 of the MIDI Patch change message (not shifted)
Also - Chris mentioned the newly defined
kMusicNoteEvent_UseGroupInstrument for the prepare instrument and start
note calls...
The value of this define is 0xFFFFFFFF
Unless there's some compelling reason to, I would favour that the
Prepare/Release Instrument API calls just returned noErr - though I
guess as we really don't have an instrument in the "mono-timbral" case
there isn't an instrument to prepare or release.. but we should be
clear about how this is expected to work and not have synths doing
different things...
Bill
On Wednesday, June 18, 2003, at 12:31 PM, Chris Rogers wrote:
A few days ago there was a discussion about the difference between
the use of MusicDeviceInstrumentID and presets in MusicDevices.
It turns out that the MusicDevice API was designed before we had the
notion of presets, so we didn't really anticipate a problem here.
But after discussing this with Bill and Doug, we've decided on a
standard way for hosts and developers to treat MusicDevices.
Presets:
First of all, presets
should be supported by all AudioUnits. A preset is supposed to
contain (almost) the complete state of the AudioUnit/MusicDevice,
and our default implementation saves off the values for all
parameters as well as the state of a few other properties.
Any custom properties affecting the sound should be saved in the
preset.
I think there are some parameters and property values which should
not be saved in the preset, but let's leave this detail for another
discussion.
For some MusicDevice soft-synths, the notion of a preset is all that's
required to describe the sound of the synth. For the sake or argument,
I'll call these kinds of synths "monotimbral" -- there's only one kind
of sound which can be active at a time, and this sound is described
by the preset. For these types of synths, the
kMusicDeviceProperty_InstrumentCount
property should report zero instruments.
MusicDevicePrepareInstrument()
and MusicDeviceReleaseInstrument() don't need to do anything, and could
return an error if called. MIDI patch and bank select messages would
not be implemented because there's nothing to select (the preset
is already set). If someone wants to call MusicDeviceStartNote()
(instead of sending a MIDI note on using MusicDeviceMIDIEvent() )
then use the newly defined kMusicNoteEvent_UseGroupInstrument constant
as the instrumentID.
Other MusicDevices will support playing several different types of
sounds simultaneously on different MIDI channels. I'll call these
types "multi-timbral". These types of
MusicDevices should respond to MIDI patch and bank select messages
when MusicDeviceMIDIEvent() is called. The
kMusicDeviceProperty_InstrumentCount
property should report the total number of patches available in all
banks. And kMusicDeviceProperty_InstrumentNumber should report the
instrumentID given the index 0...n (instrumentID should always be
encoded as bankNumber*256 + patchNumber).
MusicDevicePrepareInstrument() and
MusicDeviceReleaseInstrument() can be called instead of sending MIDI
patch
and bank select. Remember, that multi-timbral MusicDevices still
should
support the notion of presets. Each preset would contain the state of
all the instruments and the patch/bank where they live and the
patch/bank assigned to each MIDI channel.
For the MusicDevice host, unfortunately this requires separate
approaches
to handling each type of MusicDevice. The way to distinguish the two
types would be to call the kMusicDeviceProperty_InstrumentCount
property.
If zero is returned as the count, then it's mono-timbral, and presets
are completely sufficient. Otherwise, there's more detailed
information
and the host can go on to get the instrumentIDs with
kMusicDeviceProperty_InstrumentNumber and their names with
kMusicDeviceProperty_InstrumentName. So, in both cases a host may
want to
present a popup menu showing all the presets for a given MusicDevice,
and for the multi-timbral synths may want to have menu(s) for selecting
the instrument for MIDI channel(s)....
I hope this makes sense to everybody. Please let us know if you think
we've missed something here....
Chris Rogers
Core Audio
Apple Computer
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.
--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________
__
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________
__
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.