• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
setting a drum kit instrument
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

setting a drum kit instrument


  • Subject: setting a drum kit instrument
  • From: Christopher Corbell <email@hidden>
  • Date: Wed, 11 Dec 2002 19:51:08 -0800

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?

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.

  • Follow-Ups:
    • Re: setting a drum kit instrument
      • From: Angelo Fraietta <email@hidden>
  • Prev by Date: Re: Denormalization
  • Next by Date: Re: setting a drum kit instrument
  • Previous by thread: Re: OT: iTunes Visuals SDK
  • Next by thread: Re: setting a drum kit instrument
  • Index(es):
    • Date
    • Thread