supernova: c++11 compile fix
[supercollider.git] / platform / mac / SuperColliderAU / AUSDK / AUMIDIBase.h
blobd411992faaeaf474b936d781ee265f26e85883e7
1 /* Copyright © 2007 Apple Inc. All Rights Reserved.
3 Disclaimer: IMPORTANT: This Apple software is supplied to you by
4 Apple Inc. ("Apple") in consideration of your agreement to the
5 following terms, and your use, installation, modification or
6 redistribution of this Apple software constitutes acceptance of these
7 terms. If you do not agree with these terms, please do not use,
8 install, modify or redistribute this Apple software.
10 In consideration of your agreement to abide by the following terms, and
11 subject to these terms, Apple grants you a personal, non-exclusive
12 license, under Apple's copyrights in this original Apple software (the
13 "Apple Software"), to use, reproduce, modify and redistribute the Apple
14 Software, with or without modifications, in source and/or binary forms;
15 provided that if you redistribute the Apple Software in its entirety and
16 without modifications, you must retain this notice and the following
17 text and disclaimers in all such redistributions of the Apple Software.
18 Neither the name, trademarks, service marks or logos of Apple Inc.
19 may be used to endorse or promote products derived from the Apple
20 Software without specific prior written permission from Apple. Except
21 as expressly stated in this notice, no other rights or licenses, express
22 or implied, are granted by Apple herein, including but not limited to
23 any patent rights that may be infringed by your derivative works or by
24 other works in which the Apple Software may be incorporated.
26 The Apple Software is provided by Apple on an "AS IS" basis. APPLE
27 MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
28 THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
29 FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
30 OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
32 IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
33 OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35 INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
36 MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
37 AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
38 STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
39 POSSIBILITY OF SUCH DAMAGE.
41 /*=============================================================================
42 AUMIDIBase.h
44 =============================================================================*/
46 #ifndef __AUMIDIBase_h__
47 #define __AUMIDIBase_h__
49 #include "AUBase.h"
51 #if CA_AUTO_MIDI_MAP
52 #include "CAAUMIDIMapManager.h"
53 #endif
55 struct MIDIPacketList;
57 // ________________________________________________________________________
58 // MusicDeviceBase
60 /*! @class AUMIDIBase */
61 class AUMIDIBase {
62 public:
63 // this is NOT a copy constructor!
64 /*! @ctor AUMIDIBase */
65 AUMIDIBase(AUBase* inBase);
66 /*! @dtor ~AUMIDIBase */
67 virtual ~AUMIDIBase();
69 /*! @method MIDIEvent */
70 ComponentResult MIDIEvent( UInt32 inStatus,
71 UInt32 inData1,
72 UInt32 inData2,
73 UInt32 inOffsetSampleFrame)
75 UInt32 strippedStatus = inStatus & 0xf0;
76 UInt32 channel = inStatus & 0x0f;
78 return HandleMidiEvent(strippedStatus, channel, inData1, inData2, inOffsetSampleFrame);
81 /*! @method HandleMIDIPacketList */
82 ComponentResult HandleMIDIPacketList(const MIDIPacketList *pktlist);
84 /*! @method SysEx */
85 ComponentResult SysEx( const UInt8 * inData,
86 UInt32 inLength);
88 #if TARGET_API_MAC_OSX
89 /*! @method DelegateGetPropertyInfo */
90 virtual ComponentResult DelegateGetPropertyInfo(AudioUnitPropertyID inID,
91 AudioUnitScope inScope,
92 AudioUnitElement inElement,
93 UInt32 & outDataSize,
94 Boolean & outWritable);
96 /*! @method DelegateGetProperty */
97 virtual ComponentResult DelegateGetProperty( AudioUnitPropertyID inID,
98 AudioUnitScope inScope,
99 AudioUnitElement inElement,
100 void * outData);
102 /*! @method DelegateSetProperty */
103 virtual ComponentResult DelegateSetProperty( AudioUnitPropertyID inID,
104 AudioUnitScope inScope,
105 AudioUnitElement inElement,
106 const void * inData,
107 UInt32 inDataSize);
108 #endif
110 protected:
111 // MIDI dispatch
112 /*! @method HandleMidiEvent */
113 virtual OSStatus HandleMidiEvent( UInt8 inStatus,
114 UInt8 inChannel,
115 UInt8 inData1,
116 UInt8 inData2,
117 UInt32 inStartFrame);
119 /*! @method HandleNonNoteEvent */
120 virtual OSStatus HandleNonNoteEvent ( UInt8 status,
121 UInt8 channel,
122 UInt8 data1,
123 UInt8 data2,
124 UInt32 inStartFrame);
126 #if TARGET_API_MAC_OSX
127 /*! @method GetXMLNames */
128 virtual ComponentResult GetXMLNames(CFURLRef *outNameDocument)
129 { return kAudioUnitErr_InvalidProperty; } // if not overridden, it's unsupported
130 #endif
132 // channel messages
133 /*! @method HandleNoteOn */
134 virtual OSStatus HandleNoteOn( UInt8 inChannel,
135 UInt8 inNoteNumber,
136 UInt8 inVelocity,
137 UInt32 inStartFrame) { return noErr; }
139 /*! @method HandleNoteOff */
140 virtual OSStatus HandleNoteOff( UInt8 inChannel,
141 UInt8 inNoteNumber,
142 UInt8 inVelocity,
143 UInt32 inStartFrame) { return noErr; }
145 /*! @method HandleControlChange */
146 virtual OSStatus HandleControlChange( UInt8 inChannel,
147 UInt8 inController,
148 UInt8 inValue,
149 UInt32 inStartFrame) { return noErr; }
151 /*! @method HandlePitchWheel */
152 virtual OSStatus HandlePitchWheel( UInt8 inChannel,
153 UInt8 inPitch1,
154 UInt8 inPitch2,
155 UInt32 inStartFrame) { return noErr; }
157 /*! @method HandleChannelPressure */
158 virtual OSStatus HandleChannelPressure( UInt8 inChannel,
159 UInt8 inValue,
160 UInt32 inStartFrame) { return noErr; }
162 /*! @method HandleProgramChange */
163 virtual OSStatus HandleProgramChange( UInt8 inChannel,
164 UInt8 inValue) { return noErr; }
166 /*! @method HandlePolyPressure */
167 virtual OSStatus HandlePolyPressure( UInt8 inChannel,
168 UInt8 inKey,
169 UInt8 inValue,
170 UInt32 inStartFrame) { return noErr; }
172 /*! @method HandleResetAllControllers */
173 virtual OSStatus HandleResetAllControllers(UInt8 inChannel) { return noErr; }
175 /*! @method HandleAllNotesOff */
176 virtual OSStatus HandleAllNotesOff( UInt8 inChannel) { return noErr; }
178 /*! @method HandleAllSoundOff */
179 virtual OSStatus HandleAllSoundOff( UInt8 inChannel) { return noErr; }
182 //System messages
183 /*! @method HandleSysEx */
184 virtual OSStatus HandleSysEx( const UInt8 * inData,
185 UInt32 inLength ) { return noErr; }
187 #if CA_AUTO_MIDI_MAP
188 /* map manager */
189 CAAUMIDIMapManager *GetMIDIMapManager() {return mMapManager;};
191 #endif
194 private:
195 /*! @var mAUBaseInstance */
196 AUBase & mAUBaseInstance;
198 #if CA_AUTO_MIDI_MAP
199 /* map manager */
200 CAAUMIDIMapManager * mMapManager;
201 #endif
203 public:
204 // component dispatcher
205 /*! @method ComponentEntryDispatch */
206 static ComponentResult ComponentEntryDispatch( ComponentParameters *params,
207 AUMIDIBase *This);
210 #endif // __AUMIDIBase_h__