Re: setting a drum kit instrument
Re: setting a drum kit instrument
- Subject: Re: setting a drum kit instrument
- From: Angelo Fraietta <email@hidden>
- Date: Thu, 12 Dec 2002 15:29:31 +1100
Christopher Corbell wrote:
How do I set a drum kit instrument sound? Do I -have- to use MIDI
channel 10 (I saw a previous post indicating that instrument 0 ==
standard
kit on channel 10 etc.)?
Right now I'm using the sample code where the ID returned from the
audio unit is parcelled into bank MSB, bank, LSB, and patch. Since drum
kits have IDs > 255 the patch ends up 0, 1, etc. for drum kits, and I get
piano sounds on 'regular' channels.
Is there any way to set a drum kit sound on any arbitrary channel?
Channel 10 is the drum channel for General MIDI. If you want drums on
another channel, you will have to set that on your target synthesiser first.
Here is my code, from a simple MusicDevice-wrapping Cocoa object:
Note that it assumes channel 0.
- (void) instrumentSelectEvent: (MusicDeviceInstrumentID) nInstrument
{
UInt32 nData = 0;
const UInt32 kSelectBankCmd = 0xB0;
const UInt32 kSelectPatchCmd = 0xC0;
// Select bank
// MSB:
nData = ((nInstrument >> 15) & 0x7F);
[self midiEvent:kSelectBankCmd withData1:0x00 withData2:nData
atOffset:0];
// LSB:
nData = ((nInstrument >> 7) & 0x7F);
[self midiEvent:kSelectBankCmd withData1:0x20 withData2:nData
atOffset:0];
// Select program number
nData = (nInstrument & 0x7F);
[self midiEvent:kSelectPatchCmd withData1:nData withData2:0
atOffset:0];
}
Thanks for any help,
Chris
_______________________________________________
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.
--
Angelo Fraietta
PO Box 859
Hamilton NSW 2303
Home Page
http://www.users.bigpond.com/angelo_f/
There are those who seek knowledge for the sake of knowledge - that is CURIOSITY
There are those who seek knowledge to be known by others - that is VANITY
There are those who seek knowledge in order to serve - that is LOVE
Bernard of Clairvaux (1090 - 1153)
_______________________________________________
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.