Re: [genuine] Re: reading Midi from AU
Re: [genuine] Re: reading Midi from AU
- Subject: Re: [genuine] Re: reading Midi from AU
- From: Marc Poirier <email@hidden>
- Date: Sun, 11 Jan 2004 13:33:20 -0600 (CST)
On Sun, 11 Jan 2004, jacques couzteau wrote:
>
Am 11.01.2004 um 18:14 schrieb Marc Poirier:
>
>
> This isn't an answer to your question, but do you really want to do
>
> this,
>
> or could you accomplish what you want by simply making your effect a
>
> MusicEffect (component type kAudioUnitType_MusicEffect, build with
>
> AUMIDIEffectBase.* and AUMIDIBase.*, etc.)?
>
>
What do i need to do?
>
>
Simply change the line
>
#define COMP_TYPE kAudioUnitType_Effect
>
to
>
#define COMP_TYPE kAudioUnitType_MusicEffect
Correct.
>
and include
>
#include "AUEffectBase.*"
>
#include "AUMIDIBase.*"
No, replace:
#include "AUEffectBase.h"
with:
#include "AUMIDIEffectBase.h"
Also, your class will now inherit from AUMIDIEffectBase, not AUEffectBase,
so change that in your class definition and class constructor.
Finally, you will need to add the source files AUMIDIEffectBase.cpp and
AUMIDIBase.cpp to your project. Keep AUEffectBase.cpp in there
(AUMIDIEffectBase inherits from AUEffectBase, so you still need that
source code).
>
What does it mean or change when i do that? How do i access midi? is
>
there samplecode?
A bunch of my DFX AUs are MusicEffects:
http://destroyfx.org/audiounits.html
You'll want to look in the dfxplugin-audiounit.cpp for the interfacing
with the MIDI stuff (we have most of the AU-specific stuff abstracted
there and use our own plugin meta-format for each specific plugin).
But it is really really simple, too. Just look at the virtual functions
in AUMIDIBase.h. You can override whichever you want to do
(HandleMidiEvent is a catch-all for any MIDI event, and then the others
are useful for each specific type of MIDI event):
virtual OSStatus HandleMidiEvent
virtual void HandleNoteOn
virtual void HandleNoteOff
virtual void HandleControlChange
virtual void HandlePitchWheel
virtual void HandleChannelPressure
virtual void HandleProgramChange
virtual void HandlePolyPressure
virtual void HandleResetAllControllers
virtual void HandleAllNotesOff
virtual void HandleAllSoundOff
virtual void HandleSysEx
>
PS: reading midi with my previous approach now works. But I'd hate to
>
get such an important designdecision wrong. So I'd rathe do it your
>
way.
Doing a MusicEffect is definitely the standard way to publish a MIDI
capable effect, though there is one advantage with your method: it will
allow MIDI in hosts that don't support MIDI to effects. However, the
hosts that don't support MIDI to effects also tend to not support MIDI at
all, so maybe that's kind of a non-issue anyway.
Marc
_______________________________________________
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.