| @@ -478,8 +478,8 @@ public: | |||||
| resetBusses(); | resetBusses(); | ||||
| prepared = (AudioUnitInitialize (audioUnit) == noErr); | |||||
| jassert (prepared); | |||||
| jassert (! prepared); | |||||
| initialiseAudioUnit(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -499,6 +499,14 @@ public: | |||||
| incomingMidi.clear(); | incomingMidi.clear(); | ||||
| } | } | ||||
| bool initialiseAudioUnit() | |||||
| { | |||||
| if (! prepared) | |||||
| prepared = (AudioUnitInitialize (audioUnit) == noErr); | |||||
| return prepared; | |||||
| } | |||||
| void resetBusses() | void resetBusses() | ||||
| { | { | ||||
| for (int i = 0; i < numInputBusses; ++i) AudioUnitReset (audioUnit, kAudioUnitScope_Input, i); | for (int i = 0; i < numInputBusses; ++i) AudioUnitReset (audioUnit, kAudioUnitScope_Input, i); | ||||
| @@ -1351,12 +1359,13 @@ private: | |||||
| bool createView (const bool createGenericViewIfNeeded) | bool createView (const bool createGenericViewIfNeeded) | ||||
| { | { | ||||
| if (! plugin.initialiseAudioUnit()) | |||||
| return false; | |||||
| NSView* pluginView = nil; | NSView* pluginView = nil; | ||||
| UInt32 dataSize = 0; | UInt32 dataSize = 0; | ||||
| Boolean isWritable = false; | Boolean isWritable = false; | ||||
| AudioUnitInitialize (plugin.audioUnit); | |||||
| if (AudioUnitGetPropertyInfo (plugin.audioUnit, kAudioUnitProperty_CocoaUI, kAudioUnitScope_Global, | if (AudioUnitGetPropertyInfo (plugin.audioUnit, kAudioUnitProperty_CocoaUI, kAudioUnitScope_Global, | ||||
| 0, &dataSize, &isWritable) == noErr | 0, &dataSize, &isWritable) == noErr | ||||
| && dataSize != 0 | && dataSize != 0 | ||||
| @@ -1523,16 +1532,10 @@ private: | |||||
| Float32Point pos = { 0, 0 }; | Float32Point pos = { 0, 0 }; | ||||
| Float32Point size = { 250, 200 }; | Float32Point size = { 250, 200 }; | ||||
| HIViewRef pluginView = 0; | HIViewRef pluginView = 0; | ||||
| AudioUnitCarbonViewCreate (carbonView, | |||||
| owner.getAudioUnit(), | |||||
| windowRef, | |||||
| rootView, | |||||
| &pos, | |||||
| &size, | |||||
| (ControlRef*) &pluginView); | |||||
| AudioUnitCarbonViewCreate (carbonView, owner.getAudioUnit(), windowRef, rootView, | |||||
| &pos, &size, (ControlRef*) &pluginView); | |||||
| return pluginView; | return pluginView; | ||||
| } | } | ||||