1 /*
2      File: MusicDeviceBase.h
3  Abstract: Part of CoreAudio Utility Classes
4   Version: 1.2
5 
6  Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple
7  Inc. ("Apple") in consideration of your agreement to the following
8  terms, and your use, installation, modification or redistribution of
9  this Apple software constitutes acceptance of these terms.  If you do
10  not agree with these terms, please do not use, install, modify or
11  redistribute this Apple software.
12 
13  In consideration of your agreement to abide by the following terms, and
14  subject to these terms, Apple grants you a personal, non-exclusive
15  license, under Apple's copyrights in this original Apple software (the
16  "Apple Software"), to use, reproduce, modify and redistribute the Apple
17  Software, with or without modifications, in source and/or binary forms;
18  provided that if you redistribute the Apple Software in its entirety and
19  without modifications, you must retain this notice and the following
20  text and disclaimers in all such redistributions of the Apple Software.
21  Neither the name, trademarks, service marks or logos of Apple Inc. may
22  be used to endorse or promote products derived from the Apple Software
23  without specific prior written permission from Apple.  Except as
24  expressly stated in this notice, no other rights or licenses, express or
25  implied, are granted by Apple herein, including but not limited to any
26  patent rights that may be infringed by your derivative works or by other
27  works in which the Apple Software may be incorporated.
28 
29  The Apple Software is provided by Apple on an "AS IS" basis.  APPLE
30  MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
31  THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
32  FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
33  OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
34 
35  IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
36  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
37  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
38  INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
39  MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
40  AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
41  STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
42  POSSIBILITY OF SUCH DAMAGE.
43 
44  Copyright (C) 2012 Apple Inc. All Rights Reserved.
45 
46 */
47 #ifndef __MusicDeviceBase_h__
48 #define __MusicDeviceBase_h__
49 
50 #include "AUMIDIBase.h"
51 
52 // ________________________________________________________________________
53 //	MusicDeviceBase
54 //
55 
56 /*! @class MusicDeviceBase */
57 class MusicDeviceBase : public AUBase, public AUMIDIBase {
58 public:
59 	/*! @ctor MusicDeviceBase */
60 								MusicDeviceBase(		AudioComponentInstance			inInstance,
61 														UInt32							numInputs,
62 														UInt32							numOutputs,
63 														UInt32							numGroups = 0);
64 
65 
MIDIEvent(UInt32 inStatus,UInt32 inData1,UInt32 inData2,UInt32 inOffsetSampleFrame)66 	virtual OSStatus	MIDIEvent(		UInt32 						inStatus,
67 										UInt32 						inData1,
68 										UInt32 						inData2,
69 										UInt32 						inOffsetSampleFrame)
70 	{
71 		return AUMIDIBase::MIDIEvent (inStatus, inData1, inData2, inOffsetSampleFrame);
72 	}
73 
74 	/*! @method SysEx */
SysEx(const UInt8 * inData,UInt32 inLength)75 	virtual OSStatus	SysEx(			const UInt8 *				inData,
76 										UInt32 						inLength)
77 	{
78 		return AUMIDIBase::SysEx (inData, inLength);
79 	}
80 
81 	/*! @method GetPropertyInfo */
82 	virtual OSStatus			GetPropertyInfo(AudioUnitPropertyID			inID,
83 												AudioUnitScope				inScope,
84 												AudioUnitElement			inElement,
85 												UInt32 &					outDataSize,
86 												Boolean &					outWritable);
87 
88 	/*! @method GetProperty */
89 	virtual OSStatus			GetProperty(	AudioUnitPropertyID 		inID,
90 												AudioUnitScope 				inScope,
91 												AudioUnitElement		 	inElement,
92 												void *						outData);
93 
94 	/*! @method SetProperty */
95 	virtual OSStatus			SetProperty(			AudioUnitPropertyID 			inID,
96 														AudioUnitScope 					inScope,
97 														AudioUnitElement 				inElement,
98 														const void *					inData,
99 														UInt32 							inDataSize);
100 
101 	/*! @method HandleNoteOn */
102 	virtual OSStatus			HandleNoteOn(	UInt8 	inChannel,
103 												UInt8 	inNoteNumber,
104 												UInt8 	inVelocity,
105 												UInt32 	inStartFrame);
106 
107 	/*! @method HandleNoteOff */
108 	virtual OSStatus			HandleNoteOff(	UInt8 	inChannel,
109 												UInt8 	inNoteNumber,
110 												UInt8 	inVelocity,
111 												UInt32 	inStartFrame);
112 
113 	/*! @method GetInstrumentCount */
114 	virtual OSStatus			GetInstrumentCount (	UInt32 &outInstCount) const;
115 
116 #if !TARGET_OS_IPHONE
117 	// component dispatcher
118 	/*! @method ComponentEntryDispatch */
119 	static OSStatus			ComponentEntryDispatch(	ComponentParameters *			params,
120 														MusicDeviceBase *				This);
121 #endif
122 private:
123 	OSStatus				HandleStartNoteMessage (MusicDeviceInstrumentID inInstrument, MusicDeviceGroupID inGroupID, NoteInstanceID *outNoteInstanceID, UInt32 inOffsetSampleFrame, const MusicDeviceNoteParams *inParams);
124 };
125 
126 #endif // __MusicDeviceBase_h__
127