/[svn]/linuxsampler/trunk/src/hostplugins/au/PluginAU.h
ViewVC logotype

Contents of /linuxsampler/trunk/src/hostplugins/au/PluginAU.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1845 - (show annotations) (download) (as text)
Tue Feb 24 17:41:02 2009 UTC (15 years, 1 month ago) by iliev
File MIME type: text/x-c++hdr
File size: 6169 byte(s)
* AU plugin, work in progress: added the source files

1 /***************************************************************************
2 * *
3 * LinuxSampler - modular, streaming capable sampler *
4 * *
5 * Copyright (C) 2009 Grigor Iliev *
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the Free Software *
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
20 * MA 02111-1307 USA *
21 ***************************************************************************/
22
23 #ifndef __PLUGIN_AU_H__
24 #define __PLUGIN_AU_H__
25
26 #include "PluginAUVersion.h"
27
28 #include <AudioUnit/AudioUnit.h>
29 #include <CoreAudio/CoreAudio.h>
30 #include <MusicDeviceBase.h>
31
32 #include "../../drivers/Plugin.h"
33
34 using namespace LinuxSampler;
35
36 //namespace LinuxSampler {
37
38 class PluginAU : public MusicDeviceBase, public LinuxSampler::Plugin {
39 public:
40 PluginAU(ComponentInstance inComponentInstance);
41 virtual ~PluginAU();
42 virtual OSStatus Version() { return kPluginAUVersion; }
43 virtual UInt32 SupportedNumChannels(const AUChannelInfo** outInfo);
44 virtual bool StreamFormatWritable(AudioUnitScope scope, AudioUnitElement element);
45 virtual ComponentResult Initialize();
46
47 virtual ComponentResult GetPropertyInfo (
48 AudioUnitPropertyID inID,
49 AudioUnitScope inScope,
50 AudioUnitElement inElement,
51 UInt32& outDataSize,
52 Boolean& outWritable
53 );
54
55 virtual ComponentResult GetProperty (
56 AudioUnitPropertyID inID,
57 AudioUnitScope inScope,
58 AudioUnitElement inElement,
59 void* outData
60 );
61
62 virtual ComponentResult SetProperty (
63 AudioUnitPropertyID inID,
64 AudioUnitScope inScope,
65 AudioUnitElement inElement,
66 const void* inData,
67 UInt32 inDataSize
68 );
69
70 virtual ComponentResult Render (
71 AudioUnitRenderActionFlags& ioActionFlags,
72 const AudioTimeStamp& inTimeStamp,
73 UInt32 inNumberFrames
74 );
75
76 virtual ComponentResult StartNote (
77 MusicDeviceInstrumentID inInstrument,
78 MusicDeviceGroupID inGroupID,
79 NoteInstanceID* outNoteInstanceID,
80 UInt32 inOffsetSampleFrame,
81 const MusicDeviceNoteParams &inParams
82 ) { return noErr; }
83
84 virtual ComponentResult StopNote (
85 MusicDeviceGroupID inGroupID,
86 NoteInstanceID inNoteInstanceID,
87 UInt32 inOffsetSampleFrame
88 ) { return noErr; }
89
90 virtual OSStatus HandleMidiEvent (
91 UInt8 inStatus, UInt8 inChannel,
92 UInt8 inData1, UInt8 inData2,
93 UInt32 inStartFrame
94 );
95
96 virtual void PropertyChanged (
97 AudioUnitPropertyID inID,
98 AudioUnitScope inScope,
99 AudioUnitElement inElement
100 );
101
102 virtual OSStatus NewFactoryPresetSet (const AUPreset& inNewFactoryPreset);
103 virtual OSStatus GetInstrumentCount(UInt32 &outInstCount) const;
104 virtual ComponentResult GetPresets(CFArrayRef* outData) const;
105 virtual ComponentResult SaveState(CFPropertyListRef* outData);
106 virtual ComponentResult RestoreState(CFPropertyListRef inData);
107
108 private:
109 enum {
110 kOneSamplerChannel = 0,
111 k16SamplerChannels = 1
112 };
113
114 static const midi_chan_t midiChns[16];
115 static const UInt32 kDefaultPreset = kOneSamplerChannel;
116 static const UInt32 kFactoryPresetCount = 2;
117 static AUPreset factoryPresets[kFactoryPresetCount];
118
119 static void PropertyListenerCallback (
120 void* inRefCon,
121 AudioUnit ci,
122 AudioUnitPropertyID inID,
123 AudioUnitScope inScope,
124 AudioUnitElement inElement
125 );
126
127 std::string hostName;
128 char* charBuf;
129 UInt32 charBufSize;
130
131 std::string GetStr(CFStringRef s);
132 void InstallListeners();
133 void UninstallListeners();
134 std::string GetHostNameByID(std::string Identifier);
135 std::string GetHostBundleID();
136 void Set16SamplerChannelsPreset();
137 void AddSamplerChannel(const char* engine, midi_chan_t midiChn);
138 };
139
140 //} // namespace LinuxSampler
141
142 #endif /* __AU_PLUGIN_H__ */
143

  ViewVC Help
Powered by ViewVC