Re: setting a drum kit instrument
Re: setting a drum kit instrument
- Subject: Re: setting a drum kit instrument
- From: <email@hidden>
- Date: Thu, 12 Dec 2002 15:24:36 -0800
On Wednesday, December 11, 2002, at 08:29 PM, Angelo Fraietta wrote:
>
>
Christopher Corbell wrote:
>
>[...]
>
>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.
Sorry, I think I may have been unclear: I'm using the default MusicDevice
soft-synth,
not an external synthesizer. So what I'm trying to figure out is how to set
the instrument
to a drum kit on any midi channel for this virtual target synthesizer. In
addition to playing
a MusicDevice directly I'm trying to sort out some multi-instrument,
multi-track issues with
the MusicPlayer/MusicSequence API.
The code I posted (using the instrument ID to set bank & patch, adapted from
the sample code)
will not set a drum set sound for channel 0. When you say "set that on your
target synthesizer",
I'm guessing there's a way to accomplish this if the target synthesizer is the
Apple software synth.
How does one do this? Or is it truly necessary to use channel 10, and
therefore also
necessary to use multiple MusicDevice objects if the user wants two tracks
with different drum
set sounds?
TIA,
Chris
Here again is the code that doesn't do it:
void instrumentSelectEvent: (MusicDeviceInstrumentID) nInstrument
{
UInt32 nData = 0;
const UInt32 kSelectBankCmd = 0xB0; // default to channel 0 for now
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];
}
_______________________________________________
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.