mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-27 02:20:05 +00:00
Fixed some JUCE_AUTORELEASEPOOL syntax
This commit is contained in:
parent
ef19327996
commit
7afc21cbab
8 changed files with 483 additions and 460 deletions
|
|
@ -273,8 +273,10 @@ struct AAXClasses
|
|||
if (component != nullptr)
|
||||
{
|
||||
JUCE_AUTORELEASEPOOL
|
||||
component->removeFromDesktop();
|
||||
component = nullptr;
|
||||
{
|
||||
component->removeFromDesktop();
|
||||
component = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -258,15 +258,16 @@ public:
|
|||
#endif
|
||||
{
|
||||
JUCE_AUTORELEASEPOOL
|
||||
{
|
||||
static JuceUICreationClass cls;
|
||||
|
||||
static JuceUICreationClass cls;
|
||||
// (NB: this may be the host's bundle, not necessarily the component's)
|
||||
NSBundle* bundle = [NSBundle bundleForClass: cls.cls];
|
||||
|
||||
// (NB: this may be the host's bundle, not necessarily the component's)
|
||||
NSBundle* bundle = [NSBundle bundleForClass: cls.cls];
|
||||
|
||||
AudioUnitCocoaViewInfo* info = static_cast <AudioUnitCocoaViewInfo*> (outData);
|
||||
info->mCocoaAUViewClass[0] = (CFStringRef) [juceStringToNS (class_getName (cls.cls)) retain];
|
||||
info->mCocoaAUViewBundleLocation = (CFURLRef) [[NSURL fileURLWithPath: [bundle bundlePath]] retain];
|
||||
AudioUnitCocoaViewInfo* info = static_cast <AudioUnitCocoaViewInfo*> (outData);
|
||||
info->mCocoaAUViewClass[0] = (CFStringRef) [juceStringToNS (class_getName (cls.cls)) retain];
|
||||
info->mCocoaAUViewBundleLocation = (CFURLRef) [[NSURL fileURLWithPath: [bundle bundlePath]] retain];
|
||||
}
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
|
@ -1204,33 +1205,34 @@ public:
|
|||
ComponentResult CreateUI (Float32 /*inXOffset*/, Float32 /*inYOffset*/)
|
||||
{
|
||||
JUCE_AUTORELEASEPOOL
|
||||
|
||||
if (juceFilter == nullptr)
|
||||
{
|
||||
void* pointers[2];
|
||||
UInt32 propertySize = sizeof (pointers);
|
||||
if (juceFilter == nullptr)
|
||||
{
|
||||
void* pointers[2];
|
||||
UInt32 propertySize = sizeof (pointers);
|
||||
|
||||
AudioUnitGetProperty (GetEditAudioUnit(),
|
||||
juceFilterObjectPropertyID,
|
||||
kAudioUnitScope_Global,
|
||||
0,
|
||||
pointers,
|
||||
&propertySize);
|
||||
AudioUnitGetProperty (GetEditAudioUnit(),
|
||||
juceFilterObjectPropertyID,
|
||||
kAudioUnitScope_Global,
|
||||
0,
|
||||
pointers,
|
||||
&propertySize);
|
||||
|
||||
juceFilter = (AudioProcessor*) pointers[0];
|
||||
}
|
||||
juceFilter = (AudioProcessor*) pointers[0];
|
||||
}
|
||||
|
||||
if (juceFilter != nullptr)
|
||||
{
|
||||
deleteUI();
|
||||
if (juceFilter != nullptr)
|
||||
{
|
||||
deleteUI();
|
||||
|
||||
AudioProcessorEditor* editorComp = juceFilter->createEditorIfNeeded();
|
||||
editorComp->setOpaque (true);
|
||||
windowComp = new ComponentInHIView (editorComp, mCarbonPane);
|
||||
}
|
||||
else
|
||||
{
|
||||
jassertfalse // can't get a pointer to our effect
|
||||
AudioProcessorEditor* editorComp = juceFilter->createEditorIfNeeded();
|
||||
editorComp->setOpaque (true);
|
||||
windowComp = new ComponentInHIView (editorComp, mCarbonPane);
|
||||
}
|
||||
else
|
||||
{
|
||||
jassertfalse // can't get a pointer to our effect
|
||||
}
|
||||
}
|
||||
|
||||
return noErr;
|
||||
|
|
@ -1279,56 +1281,58 @@ private:
|
|||
recursive (false)
|
||||
{
|
||||
JUCE_AUTORELEASEPOOL
|
||||
{
|
||||
jassert (editor_ != nullptr);
|
||||
addAndMakeVisible (&editor);
|
||||
setOpaque (true);
|
||||
setVisible (true);
|
||||
setBroughtToFrontOnMouseClick (true);
|
||||
|
||||
jassert (editor_ != nullptr);
|
||||
addAndMakeVisible (&editor);
|
||||
setOpaque (true);
|
||||
setVisible (true);
|
||||
setBroughtToFrontOnMouseClick (true);
|
||||
setSize (editor.getWidth(), editor.getHeight());
|
||||
SizeControl (parentHIView, (SInt16) editor.getWidth(), (SInt16) editor.getHeight());
|
||||
|
||||
setSize (editor.getWidth(), editor.getHeight());
|
||||
SizeControl (parentHIView, (SInt16) editor.getWidth(), (SInt16) editor.getHeight());
|
||||
WindowRef windowRef = HIViewGetWindow (parentHIView);
|
||||
hostWindow = [[NSWindow alloc] initWithWindowRef: windowRef];
|
||||
|
||||
WindowRef windowRef = HIViewGetWindow (parentHIView);
|
||||
hostWindow = [[NSWindow alloc] initWithWindowRef: windowRef];
|
||||
[hostWindow retain];
|
||||
[hostWindow setCanHide: YES];
|
||||
[hostWindow setReleasedWhenClosed: YES];
|
||||
|
||||
[hostWindow retain];
|
||||
[hostWindow setCanHide: YES];
|
||||
[hostWindow setReleasedWhenClosed: YES];
|
||||
updateWindowPos();
|
||||
|
||||
updateWindowPos();
|
||||
#if ! JucePlugin_EditorRequiresKeyboardFocus
|
||||
addToDesktop (ComponentPeer::windowIsTemporary | ComponentPeer::windowIgnoresKeyPresses);
|
||||
setWantsKeyboardFocus (false);
|
||||
#else
|
||||
addToDesktop (ComponentPeer::windowIsTemporary);
|
||||
setWantsKeyboardFocus (true);
|
||||
#endif
|
||||
|
||||
#if ! JucePlugin_EditorRequiresKeyboardFocus
|
||||
addToDesktop (ComponentPeer::windowIsTemporary | ComponentPeer::windowIgnoresKeyPresses);
|
||||
setWantsKeyboardFocus (false);
|
||||
#else
|
||||
addToDesktop (ComponentPeer::windowIsTemporary);
|
||||
setWantsKeyboardFocus (true);
|
||||
#endif
|
||||
setVisible (true);
|
||||
toFront (false);
|
||||
|
||||
setVisible (true);
|
||||
toFront (false);
|
||||
addSubWindow();
|
||||
|
||||
addSubWindow();
|
||||
NSWindow* pluginWindow = [((NSView*) getWindowHandle()) window];
|
||||
[pluginWindow setNextResponder: hostWindow];
|
||||
|
||||
NSWindow* pluginWindow = [((NSView*) getWindowHandle()) window];
|
||||
[pluginWindow setNextResponder: hostWindow];
|
||||
|
||||
attachWindowHidingHooks (this, (WindowRef) windowRef, hostWindow);
|
||||
attachWindowHidingHooks (this, (WindowRef) windowRef, hostWindow);
|
||||
}
|
||||
}
|
||||
|
||||
~ComponentInHIView()
|
||||
{
|
||||
JUCE_AUTORELEASEPOOL
|
||||
{
|
||||
removeWindowHidingHooks (this);
|
||||
|
||||
removeWindowHidingHooks (this);
|
||||
NSWindow* pluginWindow = [((NSView*) getWindowHandle()) window];
|
||||
[hostWindow removeChildWindow: pluginWindow];
|
||||
removeFromDesktop();
|
||||
|
||||
NSWindow* pluginWindow = [((NSView*) getWindowHandle()) window];
|
||||
[hostWindow removeChildWindow: pluginWindow];
|
||||
removeFromDesktop();
|
||||
|
||||
[hostWindow release];
|
||||
hostWindow = nil;
|
||||
[hostWindow release];
|
||||
hostWindow = nil;
|
||||
}
|
||||
}
|
||||
|
||||
void updateWindowPos()
|
||||
|
|
|
|||
|
|
@ -51,77 +51,79 @@ void initialiseMacRTAS()
|
|||
void* attachSubWindow (void* hostWindowRef, Component* comp)
|
||||
{
|
||||
JUCE_AUTORELEASEPOOL
|
||||
|
||||
#if 0
|
||||
// This was suggested as a way to improve passing keypresses to the host, but
|
||||
// a side-effect seems to be occasional rendering artifacts.
|
||||
HIWindowChangeClass ((WindowRef) hostWindowRef, kFloatingWindowClass);
|
||||
#endif
|
||||
|
||||
NSWindow* hostWindow = [[NSWindow alloc] initWithWindowRef: hostWindowRef];
|
||||
[hostWindow retain];
|
||||
[hostWindow setCanHide: YES];
|
||||
[hostWindow setReleasedWhenClosed: YES];
|
||||
NSRect oldWindowFrame = [hostWindow frame];
|
||||
|
||||
NSView* content = [hostWindow contentView];
|
||||
NSRect f = [content frame];
|
||||
f.size.width = comp->getWidth();
|
||||
f.size.height = comp->getHeight();
|
||||
[content setFrame: f];
|
||||
|
||||
const int mainScreenHeight = [[[NSScreen screens] objectAtIndex: 0] frame].size.height;
|
||||
|
||||
#if WINDOWPOSITION_BODGE
|
||||
{
|
||||
Rect winBounds;
|
||||
GetWindowBounds ((WindowRef) hostWindowRef, kWindowContentRgn, &winBounds);
|
||||
NSRect w = [hostWindow frame];
|
||||
w.origin.x = winBounds.left;
|
||||
w.origin.y = mainScreenHeight - winBounds.bottom;
|
||||
[hostWindow setFrame: w display: NO animate: NO];
|
||||
#if 0
|
||||
// This was suggested as a way to improve passing keypresses to the host, but
|
||||
// a side-effect seems to be occasional rendering artifacts.
|
||||
HIWindowChangeClass ((WindowRef) hostWindowRef, kFloatingWindowClass);
|
||||
#endif
|
||||
|
||||
NSWindow* hostWindow = [[NSWindow alloc] initWithWindowRef: hostWindowRef];
|
||||
[hostWindow retain];
|
||||
[hostWindow setCanHide: YES];
|
||||
[hostWindow setReleasedWhenClosed: YES];
|
||||
NSRect oldWindowFrame = [hostWindow frame];
|
||||
|
||||
NSView* content = [hostWindow contentView];
|
||||
NSRect f = [content frame];
|
||||
f.size.width = comp->getWidth();
|
||||
f.size.height = comp->getHeight();
|
||||
[content setFrame: f];
|
||||
|
||||
const int mainScreenHeight = [[[NSScreen screens] objectAtIndex: 0] frame].size.height;
|
||||
|
||||
#if WINDOWPOSITION_BODGE
|
||||
{
|
||||
Rect winBounds;
|
||||
GetWindowBounds ((WindowRef) hostWindowRef, kWindowContentRgn, &winBounds);
|
||||
NSRect w = [hostWindow frame];
|
||||
w.origin.x = winBounds.left;
|
||||
w.origin.y = mainScreenHeight - winBounds.bottom;
|
||||
[hostWindow setFrame: w display: NO animate: NO];
|
||||
}
|
||||
#endif
|
||||
|
||||
NSPoint windowPos = [hostWindow convertBaseToScreen: f.origin];
|
||||
windowPos.x = windowPos.x + jmax (0.0f, (oldWindowFrame.size.width - f.size.width) / 2.0f);
|
||||
windowPos.y = mainScreenHeight - (windowPos.y + f.size.height);
|
||||
|
||||
comp->setTopLeftPosition ((int) windowPos.x, (int) windowPos.y);
|
||||
|
||||
#if ! JucePlugin_EditorRequiresKeyboardFocus
|
||||
comp->addToDesktop (ComponentPeer::windowIsTemporary | ComponentPeer::windowIgnoresKeyPresses);
|
||||
#else
|
||||
comp->addToDesktop (ComponentPeer::windowIsTemporary);
|
||||
#endif
|
||||
|
||||
comp->setVisible (true);
|
||||
|
||||
NSView* pluginView = (NSView*) comp->getWindowHandle();
|
||||
NSWindow* pluginWindow = [pluginView window];
|
||||
|
||||
[hostWindow addChildWindow: pluginWindow
|
||||
ordered: NSWindowAbove];
|
||||
[hostWindow orderFront: nil];
|
||||
[pluginWindow orderFront: nil];
|
||||
|
||||
attachWindowHidingHooks (comp, (WindowRef) hostWindowRef, hostWindow);
|
||||
|
||||
return hostWindow;
|
||||
}
|
||||
#endif
|
||||
|
||||
NSPoint windowPos = [hostWindow convertBaseToScreen: f.origin];
|
||||
windowPos.x = windowPos.x + jmax (0.0f, (oldWindowFrame.size.width - f.size.width) / 2.0f);
|
||||
windowPos.y = mainScreenHeight - (windowPos.y + f.size.height);
|
||||
|
||||
comp->setTopLeftPosition ((int) windowPos.x, (int) windowPos.y);
|
||||
|
||||
#if ! JucePlugin_EditorRequiresKeyboardFocus
|
||||
comp->addToDesktop (ComponentPeer::windowIsTemporary | ComponentPeer::windowIgnoresKeyPresses);
|
||||
#else
|
||||
comp->addToDesktop (ComponentPeer::windowIsTemporary);
|
||||
#endif
|
||||
|
||||
comp->setVisible (true);
|
||||
|
||||
NSView* pluginView = (NSView*) comp->getWindowHandle();
|
||||
NSWindow* pluginWindow = [pluginView window];
|
||||
|
||||
[hostWindow addChildWindow: pluginWindow
|
||||
ordered: NSWindowAbove];
|
||||
[hostWindow orderFront: nil];
|
||||
[pluginWindow orderFront: nil];
|
||||
|
||||
attachWindowHidingHooks (comp, (WindowRef) hostWindowRef, hostWindow);
|
||||
|
||||
return hostWindow;
|
||||
}
|
||||
|
||||
void removeSubWindow (void* nsWindow, Component* comp)
|
||||
{
|
||||
JUCE_AUTORELEASEPOOL
|
||||
{
|
||||
NSView* pluginView = (NSView*) comp->getWindowHandle();
|
||||
NSWindow* hostWindow = (NSWindow*) nsWindow;
|
||||
NSWindow* pluginWindow = [pluginView window];
|
||||
|
||||
NSView* pluginView = (NSView*) comp->getWindowHandle();
|
||||
NSWindow* hostWindow = (NSWindow*) nsWindow;
|
||||
NSWindow* pluginWindow = [pluginView window];
|
||||
|
||||
removeWindowHidingHooks (comp);
|
||||
[hostWindow removeChildWindow: pluginWindow];
|
||||
comp->removeFromDesktop();
|
||||
[hostWindow release];
|
||||
removeWindowHidingHooks (comp);
|
||||
[hostWindow removeChildWindow: pluginWindow];
|
||||
comp->removeFromDesktop();
|
||||
[hostWindow release];
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
|
|
|
|||
|
|
@ -161,28 +161,29 @@ public:
|
|||
~JucePlugInProcess()
|
||||
{
|
||||
JUCE_AUTORELEASEPOOL
|
||||
|
||||
if (mLoggedIn)
|
||||
MIDILogOut();
|
||||
|
||||
midiBufferNode = nullptr;
|
||||
midiTransport = nullptr;
|
||||
|
||||
if (prepared)
|
||||
juceFilter->releaseResources();
|
||||
|
||||
juceFilter = nullptr;
|
||||
asyncUpdater = nullptr;
|
||||
|
||||
if (--numInstances == 0)
|
||||
{
|
||||
#if JUCE_MAC
|
||||
// Hack to allow any NSWindows to clear themselves up before returning to PT..
|
||||
for (int i = 20; --i >= 0;)
|
||||
MessageManager::getInstance()->runDispatchLoopUntil (1);
|
||||
#endif
|
||||
if (mLoggedIn)
|
||||
MIDILogOut();
|
||||
|
||||
shutdownJuce_GUI();
|
||||
midiBufferNode = nullptr;
|
||||
midiTransport = nullptr;
|
||||
|
||||
if (prepared)
|
||||
juceFilter->releaseResources();
|
||||
|
||||
juceFilter = nullptr;
|
||||
asyncUpdater = nullptr;
|
||||
|
||||
if (--numInstances == 0)
|
||||
{
|
||||
#if JUCE_MAC
|
||||
// Hack to allow any NSWindows to clear themselves up before returning to PT..
|
||||
for (int i = 20; --i >= 0;)
|
||||
MessageManager::getInstance()->runDispatchLoopUntil (1);
|
||||
#endif
|
||||
|
||||
shutdownJuce_GUI();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -248,17 +249,19 @@ public:
|
|||
if (port != 0)
|
||||
{
|
||||
JUCE_AUTORELEASEPOOL
|
||||
updateSize();
|
||||
{
|
||||
updateSize();
|
||||
|
||||
#if JUCE_WINDOWS
|
||||
void* const hostWindow = (void*) ASI_GethWnd ((WindowPtr) port);
|
||||
#else
|
||||
void* const hostWindow = (void*) GetWindowFromPort (port);
|
||||
#endif
|
||||
wrapper = nullptr;
|
||||
wrapper = new EditorCompWrapper (hostWindow, editorComp, this);
|
||||
#if JUCE_WINDOWS
|
||||
void* const hostWindow = (void*) ASI_GethWnd ((WindowPtr) port);
|
||||
#else
|
||||
void* const hostWindow = (void*) GetWindowFromPort (port);
|
||||
#endif
|
||||
wrapper = nullptr;
|
||||
wrapper = new EditorCompWrapper (hostWindow, editorComp, this);
|
||||
|
||||
process->touchAllParameters();
|
||||
process->touchAllParameters();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -291,15 +294,17 @@ public:
|
|||
if (editorComp != nullptr || wrapper != nullptr)
|
||||
{
|
||||
JUCE_AUTORELEASEPOOL
|
||||
PopupMenu::dismissAllActiveMenus();
|
||||
{
|
||||
PopupMenu::dismissAllActiveMenus();
|
||||
|
||||
if (juce::Component* const modalComponent = juce::Component::getCurrentlyModalComponent())
|
||||
modalComponent->exitModalState (0);
|
||||
if (juce::Component* const modalComponent = juce::Component::getCurrentlyModalComponent())
|
||||
modalComponent->exitModalState (0);
|
||||
|
||||
filter->editorBeingDeleted (editorComp);
|
||||
filter->editorBeingDeleted (editorComp);
|
||||
|
||||
editorComp = nullptr;
|
||||
wrapper = nullptr;
|
||||
editorComp = nullptr;
|
||||
wrapper = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -302,38 +302,39 @@ public:
|
|||
~JuceVSTWrapper()
|
||||
{
|
||||
JUCE_AUTORELEASEPOOL
|
||||
|
||||
{
|
||||
#if JUCE_LINUX
|
||||
MessageManagerLock mmLock;
|
||||
#endif
|
||||
stopTimer();
|
||||
deleteEditor (false);
|
||||
{
|
||||
#if JUCE_LINUX
|
||||
MessageManagerLock mmLock;
|
||||
#endif
|
||||
stopTimer();
|
||||
deleteEditor (false);
|
||||
|
||||
hasShutdown = true;
|
||||
hasShutdown = true;
|
||||
|
||||
delete filter;
|
||||
filter = nullptr;
|
||||
delete filter;
|
||||
filter = nullptr;
|
||||
|
||||
jassert (editorComp == 0);
|
||||
jassert (editorComp == 0);
|
||||
|
||||
channels.free();
|
||||
deleteTempChannels();
|
||||
channels.free();
|
||||
deleteTempChannels();
|
||||
|
||||
jassert (activePlugins.contains (this));
|
||||
activePlugins.removeFirstMatchingValue (this);
|
||||
}
|
||||
jassert (activePlugins.contains (this));
|
||||
activePlugins.removeFirstMatchingValue (this);
|
||||
}
|
||||
|
||||
if (activePlugins.size() == 0)
|
||||
{
|
||||
#if JUCE_LINUX
|
||||
SharedMessageThread::deleteInstance();
|
||||
#endif
|
||||
shutdownJuce_GUI();
|
||||
if (activePlugins.size() == 0)
|
||||
{
|
||||
#if JUCE_LINUX
|
||||
SharedMessageThread::deleteInstance();
|
||||
#endif
|
||||
shutdownJuce_GUI();
|
||||
|
||||
#if JUCE_WINDOWS
|
||||
messageThreadIsDefinitelyCorrect = false;
|
||||
#endif
|
||||
#if JUCE_WINDOWS
|
||||
messageThreadIsDefinitelyCorrect = false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1035,12 +1036,14 @@ public:
|
|||
recursionCheck = true;
|
||||
|
||||
JUCE_AUTORELEASEPOOL
|
||||
Timer::callPendingTimersSynchronously();
|
||||
{
|
||||
Timer::callPendingTimersSynchronously();
|
||||
|
||||
for (int i = ComponentPeer::getNumPeers(); --i >= 0;)
|
||||
ComponentPeer::getPeer (i)->performAnyPendingRepaintsNow();
|
||||
for (int i = ComponentPeer::getNumPeers(); --i >= 0;)
|
||||
ComponentPeer::getPeer (i)->performAnyPendingRepaintsNow();
|
||||
|
||||
recursionCheck = false;
|
||||
recursionCheck = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1071,47 +1074,49 @@ public:
|
|||
void deleteEditor (bool canDeleteLaterIfModal)
|
||||
{
|
||||
JUCE_AUTORELEASEPOOL
|
||||
PopupMenu::dismissAllActiveMenus();
|
||||
|
||||
jassert (! recursionCheck);
|
||||
recursionCheck = true;
|
||||
|
||||
if (editorComp != nullptr)
|
||||
{
|
||||
if (Component* const modalComponent = Component::getCurrentlyModalComponent())
|
||||
{
|
||||
modalComponent->exitModalState (0);
|
||||
PopupMenu::dismissAllActiveMenus();
|
||||
|
||||
if (canDeleteLaterIfModal)
|
||||
jassert (! recursionCheck);
|
||||
recursionCheck = true;
|
||||
|
||||
if (editorComp != nullptr)
|
||||
{
|
||||
if (Component* const modalComponent = Component::getCurrentlyModalComponent())
|
||||
{
|
||||
shouldDeleteEditor = true;
|
||||
recursionCheck = false;
|
||||
return;
|
||||
modalComponent->exitModalState (0);
|
||||
|
||||
if (canDeleteLaterIfModal)
|
||||
{
|
||||
shouldDeleteEditor = true;
|
||||
recursionCheck = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#if JUCE_MAC
|
||||
if (hostWindow != 0)
|
||||
{
|
||||
detachComponentFromWindowRef (editorComp, hostWindow);
|
||||
hostWindow = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
filter->editorBeingDeleted (editorComp->getEditorComp());
|
||||
|
||||
editorComp = nullptr;
|
||||
|
||||
// there's some kind of component currently modal, but the host
|
||||
// is trying to delete our plugin. You should try to avoid this happening..
|
||||
jassert (Component::getCurrentlyModalComponent() == nullptr);
|
||||
}
|
||||
|
||||
#if JUCE_MAC
|
||||
if (hostWindow != 0)
|
||||
{
|
||||
detachComponentFromWindowRef (editorComp, hostWindow);
|
||||
hostWindow = 0;
|
||||
}
|
||||
#if JUCE_LINUX
|
||||
hostWindow = 0;
|
||||
#endif
|
||||
|
||||
filter->editorBeingDeleted (editorComp->getEditorComp());
|
||||
|
||||
editorComp = nullptr;
|
||||
|
||||
// there's some kind of component currently modal, but the host
|
||||
// is trying to delete our plugin. You should try to avoid this happening..
|
||||
jassert (Component::getCurrentlyModalComponent() == nullptr);
|
||||
recursionCheck = false;
|
||||
}
|
||||
|
||||
#if JUCE_LINUX
|
||||
hostWindow = 0;
|
||||
#endif
|
||||
|
||||
recursionCheck = false;
|
||||
}
|
||||
|
||||
VstIntPtr dispatcher (VstInt32 opCode, VstInt32 index, VstIntPtr value, void* ptr, float opt)
|
||||
|
|
@ -1466,23 +1471,25 @@ namespace
|
|||
AEffect* pluginEntryPoint (audioMasterCallback audioMaster)
|
||||
{
|
||||
JUCE_AUTORELEASEPOOL
|
||||
initialiseJuce_GUI();
|
||||
|
||||
try
|
||||
{
|
||||
if (audioMaster (0, audioMasterVersion, 0, 0, 0, 0) != 0)
|
||||
{
|
||||
#if JUCE_LINUX
|
||||
MessageManagerLock mmLock;
|
||||
#endif
|
||||
initialiseJuce_GUI();
|
||||
|
||||
AudioProcessor* const filter = createPluginFilterOfType (AudioProcessor::wrapperType_VST);
|
||||
JuceVSTWrapper* const wrapper = new JuceVSTWrapper (audioMaster, filter);
|
||||
return wrapper->getAeffect();
|
||||
try
|
||||
{
|
||||
if (audioMaster (0, audioMasterVersion, 0, 0, 0, 0) != 0)
|
||||
{
|
||||
#if JUCE_LINUX
|
||||
MessageManagerLock mmLock;
|
||||
#endif
|
||||
|
||||
AudioProcessor* const filter = createPluginFilterOfType (AudioProcessor::wrapperType_VST);
|
||||
JuceVSTWrapper* const wrapper = new JuceVSTWrapper (audioMaster, filter);
|
||||
return wrapper->getAeffect();
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{}
|
||||
}
|
||||
catch (...)
|
||||
{}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,90 +82,91 @@ void* attachComponentToWindowRef (Component* comp, void* windowRef);
|
|||
void* attachComponentToWindowRef (Component* comp, void* windowRef)
|
||||
{
|
||||
JUCE_AUTORELEASEPOOL
|
||||
|
||||
#if JUCE_64BIT
|
||||
NSView* parentView = (NSView*) windowRef;
|
||||
|
||||
#if JucePlugin_EditorRequiresKeyboardFocus
|
||||
comp->addToDesktop (0, parentView);
|
||||
#else
|
||||
comp->addToDesktop (ComponentPeer::windowIgnoresKeyPresses, parentView);
|
||||
#endif
|
||||
|
||||
// (this workaround is because Wavelab provides a zero-size parent view..)
|
||||
if ([parentView frame].size.height == 0)
|
||||
[((NSView*) comp->getWindowHandle()) setFrameOrigin: NSZeroPoint];
|
||||
|
||||
comp->setVisible (true);
|
||||
comp->toFront (false);
|
||||
|
||||
[[parentView window] setAcceptsMouseMovedEvents: YES];
|
||||
return parentView;
|
||||
#else
|
||||
NSWindow* hostWindow = [[NSWindow alloc] initWithWindowRef: windowRef];
|
||||
[hostWindow retain];
|
||||
[hostWindow setCanHide: YES];
|
||||
[hostWindow setReleasedWhenClosed: YES];
|
||||
|
||||
HIViewRef parentView = 0;
|
||||
|
||||
WindowAttributes attributes;
|
||||
GetWindowAttributes ((WindowRef) windowRef, &attributes);
|
||||
if ((attributes & kWindowCompositingAttribute) != 0)
|
||||
{
|
||||
HIViewRef root = HIViewGetRoot ((WindowRef) windowRef);
|
||||
HIViewFindByID (root, kHIViewWindowContentID, &parentView);
|
||||
#if JUCE_64BIT
|
||||
NSView* parentView = (NSView*) windowRef;
|
||||
|
||||
if (parentView == 0)
|
||||
parentView = root;
|
||||
#if JucePlugin_EditorRequiresKeyboardFocus
|
||||
comp->addToDesktop (0, parentView);
|
||||
#else
|
||||
comp->addToDesktop (ComponentPeer::windowIgnoresKeyPresses, parentView);
|
||||
#endif
|
||||
|
||||
// (this workaround is because Wavelab provides a zero-size parent view..)
|
||||
if ([parentView frame].size.height == 0)
|
||||
[((NSView*) comp->getWindowHandle()) setFrameOrigin: NSZeroPoint];
|
||||
|
||||
comp->setVisible (true);
|
||||
comp->toFront (false);
|
||||
|
||||
[[parentView window] setAcceptsMouseMovedEvents: YES];
|
||||
return parentView;
|
||||
#else
|
||||
NSWindow* hostWindow = [[NSWindow alloc] initWithWindowRef: windowRef];
|
||||
[hostWindow retain];
|
||||
[hostWindow setCanHide: YES];
|
||||
[hostWindow setReleasedWhenClosed: YES];
|
||||
|
||||
HIViewRef parentView = 0;
|
||||
|
||||
WindowAttributes attributes;
|
||||
GetWindowAttributes ((WindowRef) windowRef, &attributes);
|
||||
if ((attributes & kWindowCompositingAttribute) != 0)
|
||||
{
|
||||
HIViewRef root = HIViewGetRoot ((WindowRef) windowRef);
|
||||
HIViewFindByID (root, kHIViewWindowContentID, &parentView);
|
||||
|
||||
if (parentView == 0)
|
||||
parentView = root;
|
||||
}
|
||||
else
|
||||
{
|
||||
GetRootControl ((WindowRef) windowRef, (ControlRef*) &parentView);
|
||||
|
||||
if (parentView == 0)
|
||||
CreateRootControl ((WindowRef) windowRef, (ControlRef*) &parentView);
|
||||
}
|
||||
|
||||
// It seems that the only way to successfully position our overlaid window is by putting a dummy
|
||||
// HIView into the host's carbon window, and then catching events to see when it gets repositioned
|
||||
HIViewRef dummyView = 0;
|
||||
HIImageViewCreate (0, &dummyView);
|
||||
HIRect r = { {0, 0}, { (float) comp->getWidth(), (float) comp->getHeight()} };
|
||||
HIViewSetFrame (dummyView, &r);
|
||||
HIViewAddSubview (parentView, dummyView);
|
||||
comp->getProperties().set ("dummyViewRef", String::toHexString ((pointer_sized_int) (void*) dummyView));
|
||||
|
||||
EventHandlerRef ref;
|
||||
const EventTypeSpec kControlBoundsChangedEvent = { kEventClassControl, kEventControlBoundsChanged };
|
||||
InstallEventHandler (GetControlEventTarget (dummyView), NewEventHandlerUPP (viewBoundsChangedEvent), 1, &kControlBoundsChangedEvent, (void*) comp, &ref);
|
||||
comp->getProperties().set ("boundsEventRef", String::toHexString ((pointer_sized_int) (void*) ref));
|
||||
|
||||
updateComponentPos (comp);
|
||||
|
||||
#if ! JucePlugin_EditorRequiresKeyboardFocus
|
||||
comp->addToDesktop (ComponentPeer::windowIsTemporary | ComponentPeer::windowIgnoresKeyPresses);
|
||||
#else
|
||||
comp->addToDesktop (ComponentPeer::windowIsTemporary);
|
||||
#endif
|
||||
|
||||
comp->setVisible (true);
|
||||
comp->toFront (false);
|
||||
|
||||
NSView* pluginView = (NSView*) comp->getWindowHandle();
|
||||
NSWindow* pluginWindow = [pluginView window];
|
||||
[pluginWindow setExcludedFromWindowsMenu: YES];
|
||||
[pluginWindow setCanHide: YES];
|
||||
|
||||
[hostWindow addChildWindow: pluginWindow
|
||||
ordered: NSWindowAbove];
|
||||
[hostWindow orderFront: nil];
|
||||
[pluginWindow orderFront: nil];
|
||||
|
||||
attachWindowHidingHooks (comp, (WindowRef) windowRef, hostWindow);
|
||||
|
||||
return hostWindow;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
GetRootControl ((WindowRef) windowRef, (ControlRef*) &parentView);
|
||||
|
||||
if (parentView == 0)
|
||||
CreateRootControl ((WindowRef) windowRef, (ControlRef*) &parentView);
|
||||
}
|
||||
|
||||
// It seems that the only way to successfully position our overlaid window is by putting a dummy
|
||||
// HIView into the host's carbon window, and then catching events to see when it gets repositioned
|
||||
HIViewRef dummyView = 0;
|
||||
HIImageViewCreate (0, &dummyView);
|
||||
HIRect r = { {0, 0}, { (float) comp->getWidth(), (float) comp->getHeight()} };
|
||||
HIViewSetFrame (dummyView, &r);
|
||||
HIViewAddSubview (parentView, dummyView);
|
||||
comp->getProperties().set ("dummyViewRef", String::toHexString ((pointer_sized_int) (void*) dummyView));
|
||||
|
||||
EventHandlerRef ref;
|
||||
const EventTypeSpec kControlBoundsChangedEvent = { kEventClassControl, kEventControlBoundsChanged };
|
||||
InstallEventHandler (GetControlEventTarget (dummyView), NewEventHandlerUPP (viewBoundsChangedEvent), 1, &kControlBoundsChangedEvent, (void*) comp, &ref);
|
||||
comp->getProperties().set ("boundsEventRef", String::toHexString ((pointer_sized_int) (void*) ref));
|
||||
|
||||
updateComponentPos (comp);
|
||||
|
||||
#if ! JucePlugin_EditorRequiresKeyboardFocus
|
||||
comp->addToDesktop (ComponentPeer::windowIsTemporary | ComponentPeer::windowIgnoresKeyPresses);
|
||||
#else
|
||||
comp->addToDesktop (ComponentPeer::windowIsTemporary);
|
||||
#endif
|
||||
|
||||
comp->setVisible (true);
|
||||
comp->toFront (false);
|
||||
|
||||
NSView* pluginView = (NSView*) comp->getWindowHandle();
|
||||
NSWindow* pluginWindow = [pluginView window];
|
||||
[pluginWindow setExcludedFromWindowsMenu: YES];
|
||||
[pluginWindow setCanHide: YES];
|
||||
|
||||
[hostWindow addChildWindow: pluginWindow
|
||||
ordered: NSWindowAbove];
|
||||
[hostWindow orderFront: nil];
|
||||
[pluginWindow orderFront: nil];
|
||||
|
||||
attachWindowHidingHooks (comp, (WindowRef) windowRef, hostWindow);
|
||||
|
||||
return hostWindow;
|
||||
#endif
|
||||
}
|
||||
|
||||
void detachComponentFromWindowRef (Component* comp, void* nsWindow);
|
||||
|
|
|
|||
|
|
@ -463,124 +463,121 @@ public:
|
|||
|
||||
void setWindow (NPWindow* window)
|
||||
{
|
||||
JUCE_AUTORELEASEPOOL;
|
||||
|
||||
log ("setWindow");
|
||||
|
||||
NSView* parentView = nil;
|
||||
NP_CGContext* const cgContext = (window != nullptr) ? (NP_CGContext*) window->window : nullptr;
|
||||
log ("NP_CGContext: " + String::toHexString ((pointer_sized_int) cgContext));
|
||||
|
||||
#if JUCE_USE_NPAPI_CARBON_UI
|
||||
WindowRef windowRef = cgContext != nullptr ? (WindowRef) cgContext->window : 0;
|
||||
|
||||
if (windowRef != 0)
|
||||
JUCE_AUTORELEASEPOOL
|
||||
{
|
||||
NSWindow* win = [[[NSWindow alloc] initWithWindowRef: windowRef] autorelease];
|
||||
#else
|
||||
NSWindow* win = cgContext != nullptr ? (NSWindow*) cgContext->window : nil;
|
||||
log ("setWindow");
|
||||
|
||||
if (win != nil)
|
||||
{
|
||||
#endif
|
||||
log ("window: " + nsStringToJuce ([win description]));
|
||||
NSView* parentView = nil;
|
||||
NP_CGContext* const cgContext = (window != nullptr) ? (NP_CGContext*) window->window : nullptr;
|
||||
log ("NP_CGContext: " + String::toHexString ((pointer_sized_int) cgContext));
|
||||
|
||||
const Rectangle<int> clip (window->clipRect.left, window->clipRect.top,
|
||||
window->clipRect.right - window->clipRect.left,
|
||||
window->clipRect.bottom - window->clipRect.top);
|
||||
const Rectangle<int> target ((int) window->x, (int) window->y, (int) window->width, (int) window->height);
|
||||
const Rectangle<int> intersection (clip.getIntersection (target));
|
||||
|
||||
// in firefox the clip rect is usually out of step with the target rect, but in safari it matches
|
||||
log ("plugin window clip: " + clip.toString());
|
||||
log ("plugin window target: " + target.toString());
|
||||
log ("plugin window intersection: " + intersection.toString());
|
||||
|
||||
NSView* content = [win contentView];
|
||||
|
||||
if (! intersection.isEmpty())
|
||||
#if JUCE_USE_NPAPI_CARBON_UI
|
||||
if (WindowRef windowRef = cgContext != nullptr ? (WindowRef) cgContext->window : 0)
|
||||
{
|
||||
log ("content: " + nsStringToJuce ([content description]));
|
||||
|
||||
float wx = (float) intersection.getCentreX();
|
||||
float wy = (float) intersection.getCentreY();
|
||||
|
||||
NSRect v = [content convertRect: [content frame] toView: nil];
|
||||
NSRect w = [win frame];
|
||||
|
||||
log ("content: " + Rectangle<int> (v.origin.x, v.origin.y, v.size.width, v.size.height).toString()
|
||||
+ " frame: " + Rectangle<int> (w.origin.x, w.origin.y, w.size.width, w.size.height).toString());
|
||||
|
||||
// adjust the requested window pos to deal with the content view's origin within the window
|
||||
wy -= w.size.height - (v.origin.y + v.size.height);
|
||||
|
||||
parentView = findViewAt (content, wx, wy);
|
||||
|
||||
if (! isBrowserContentView (parentView))
|
||||
parentView = currentParentView;
|
||||
}
|
||||
else if (currentParentView != nil && ! target.isEmpty())
|
||||
NSWindow* win = [[[NSWindow alloc] initWithWindowRef: windowRef] autorelease];
|
||||
#else
|
||||
if (NSWindow* win = cgContext != nullptr ? (NSWindow*) cgContext->window : nil)
|
||||
{
|
||||
// Firefox can send lots of spurious resize messages when updating its pages, so this is a
|
||||
// bodge to avoid flickering caused by repeatedly removing and re-adding the view..
|
||||
#endif
|
||||
log ("window: " + nsStringToJuce ([win description]));
|
||||
|
||||
if (content != nil && contains (content, currentParentView))
|
||||
parentView = currentParentView;
|
||||
}
|
||||
log ("parent: " + nsStringToJuce ([parentView description]));
|
||||
}
|
||||
|
||||
if (parentView != currentParentView)
|
||||
{
|
||||
log ("new view: " + nsStringToJuce ([parentView description]));
|
||||
|
||||
removeFromDesktop();
|
||||
setVisible (false);
|
||||
|
||||
currentParentView = parentView;
|
||||
|
||||
if (parentView != nil)
|
||||
{
|
||||
setSize (window->width, window->height);
|
||||
addToDesktop (0, parentView);
|
||||
setVisible (true);
|
||||
}
|
||||
}
|
||||
|
||||
if (window != nullptr)
|
||||
{
|
||||
if (isFirefox4)
|
||||
{
|
||||
// This voodoo is required to keep the plugin clipped to the correct region and
|
||||
// to stop it overwriting the toolbars in FF4.
|
||||
const Rectangle<int> clip (window->clipRect.left, window->clipRect.top,
|
||||
window->clipRect.right - window->clipRect.left,
|
||||
window->clipRect.bottom - window->clipRect.top);
|
||||
const Rectangle<int> target ((int) window->x, (int) window->y, (int) window->width, (int) window->height);
|
||||
const Rectangle<int> intersection (clip.getIntersection (target));
|
||||
|
||||
Point<int> clipToTargetOffset;
|
||||
// in firefox the clip rect is usually out of step with the target rect, but in safari it matches
|
||||
log ("plugin window clip: " + clip.toString());
|
||||
log ("plugin window target: " + target.toString());
|
||||
log ("plugin window intersection: " + intersection.toString());
|
||||
|
||||
NSView* content = [win contentView];
|
||||
|
||||
if (! intersection.isEmpty())
|
||||
{
|
||||
NSView* contentView = [[parentView window] contentView];
|
||||
NSRect v = [contentView convertRect: [contentView frame] toView: nil];
|
||||
NSRect w = [[parentView window] frame];
|
||||
log ("content: " + nsStringToJuce ([content description]));
|
||||
|
||||
clipToTargetOffset.setX ((int) v.origin.x);
|
||||
clipToTargetOffset.setY ((int) (w.size.height - (v.origin.y + v.size.height)));
|
||||
float wx = (float) intersection.getCentreX();
|
||||
float wy = (float) intersection.getCentreY();
|
||||
|
||||
NSRect v = [content convertRect: [content frame] toView: nil];
|
||||
NSRect w = [win frame];
|
||||
|
||||
log ("content: " + Rectangle<int> (v.origin.x, v.origin.y, v.size.width, v.size.height).toString()
|
||||
+ " frame: " + Rectangle<int> (w.origin.x, w.origin.y, w.size.width, w.size.height).toString());
|
||||
|
||||
// adjust the requested window pos to deal with the content view's origin within the window
|
||||
wy -= w.size.height - (v.origin.y + v.size.height);
|
||||
|
||||
parentView = findViewAt (content, wx, wy);
|
||||
|
||||
if (! isBrowserContentView (parentView))
|
||||
parentView = currentParentView;
|
||||
}
|
||||
else if (currentParentView != nil && ! target.isEmpty())
|
||||
{
|
||||
// Firefox can send lots of spurious resize messages when updating its pages, so this is a
|
||||
// bodge to avoid flickering caused by repeatedly removing and re-adding the view..
|
||||
|
||||
if (child != nullptr)
|
||||
child->setBounds (target - clip.getPosition() - clipToTargetOffset);
|
||||
|
||||
NSRect parentFrame = [parentView frame];
|
||||
|
||||
[(NSView*) getWindowHandle() setFrame: NSMakeRect (clip.getX() - parentFrame.origin.x,
|
||||
clip.getY() - parentFrame.origin.y,
|
||||
clip.getWidth(), clip.getHeight())];
|
||||
if (content != nil && contains (content, currentParentView))
|
||||
parentView = currentParentView;
|
||||
}
|
||||
log ("parent: " + nsStringToJuce ([parentView description]));
|
||||
}
|
||||
else
|
||||
|
||||
if (parentView != currentParentView)
|
||||
{
|
||||
setSize (window->width, window->height);
|
||||
log ("new view: " + nsStringToJuce ([parentView description]));
|
||||
|
||||
removeFromDesktop();
|
||||
setVisible (false);
|
||||
|
||||
currentParentView = parentView;
|
||||
|
||||
if (parentView != nil)
|
||||
{
|
||||
setSize (window->width, window->height);
|
||||
addToDesktop (0, parentView);
|
||||
setVisible (true);
|
||||
}
|
||||
}
|
||||
|
||||
if (window != nullptr)
|
||||
{
|
||||
if (isFirefox4)
|
||||
{
|
||||
// This voodoo is required to keep the plugin clipped to the correct region and
|
||||
// to stop it overwriting the toolbars in FF4.
|
||||
const Rectangle<int> clip (window->clipRect.left, window->clipRect.top,
|
||||
window->clipRect.right - window->clipRect.left,
|
||||
window->clipRect.bottom - window->clipRect.top);
|
||||
const Rectangle<int> target ((int) window->x, (int) window->y, (int) window->width, (int) window->height);
|
||||
|
||||
Point<int> clipToTargetOffset;
|
||||
|
||||
{
|
||||
NSView* contentView = [[parentView window] contentView];
|
||||
NSRect v = [contentView convertRect: [contentView frame] toView: nil];
|
||||
NSRect w = [[parentView window] frame];
|
||||
|
||||
clipToTargetOffset.setX ((int) v.origin.x);
|
||||
clipToTargetOffset.setY ((int) (w.size.height - (v.origin.y + v.size.height)));
|
||||
}
|
||||
|
||||
if (child != nullptr)
|
||||
child->setBounds (target - clip.getPosition() - clipToTargetOffset);
|
||||
|
||||
NSRect parentFrame = [parentView frame];
|
||||
|
||||
[(NSView*) getWindowHandle() setFrame: NSMakeRect (clip.getX() - parentFrame.origin.x,
|
||||
clip.getY() - parentFrame.origin.y,
|
||||
clip.getWidth(), clip.getHeight())];
|
||||
}
|
||||
else
|
||||
{
|
||||
setSize (window->width, window->height);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,44 +44,45 @@ public:
|
|||
averageTimeOffset (0)
|
||||
{
|
||||
JUCE_AUTORELEASEPOOL
|
||||
|
||||
session = [[QTCaptureSession alloc] init];
|
||||
|
||||
NSArray* devs = [QTCaptureDevice inputDevicesWithMediaType: QTMediaTypeVideo];
|
||||
device = (QTCaptureDevice*) [devs objectAtIndex: index];
|
||||
|
||||
static DelegateClass cls;
|
||||
callbackDelegate = [cls.createInstance() init];
|
||||
DelegateClass::setOwner (callbackDelegate, this);
|
||||
|
||||
NSError* err = nil;
|
||||
[device retain];
|
||||
[device open: &err];
|
||||
|
||||
if (err == nil)
|
||||
{
|
||||
input = [[QTCaptureDeviceInput alloc] initWithDevice: device];
|
||||
audioInput = [[QTCaptureDeviceInput alloc] initWithDevice: device];
|
||||
session = [[QTCaptureSession alloc] init];
|
||||
|
||||
[session addInput: input error: &err];
|
||||
NSArray* devs = [QTCaptureDevice inputDevicesWithMediaType: QTMediaTypeVideo];
|
||||
device = (QTCaptureDevice*) [devs objectAtIndex: index];
|
||||
|
||||
static DelegateClass cls;
|
||||
callbackDelegate = [cls.createInstance() init];
|
||||
DelegateClass::setOwner (callbackDelegate, this);
|
||||
|
||||
NSError* err = nil;
|
||||
[device retain];
|
||||
[device open: &err];
|
||||
|
||||
if (err == nil)
|
||||
{
|
||||
resetFile();
|
||||
input = [[QTCaptureDeviceInput alloc] initWithDevice: device];
|
||||
audioInput = [[QTCaptureDeviceInput alloc] initWithDevice: device];
|
||||
|
||||
imageOutput = [[QTCaptureDecompressedVideoOutput alloc] init];
|
||||
[imageOutput setDelegate: callbackDelegate];
|
||||
[session addInput: input error: &err];
|
||||
|
||||
if (err == nil)
|
||||
{
|
||||
[session startRunning];
|
||||
return;
|
||||
resetFile();
|
||||
|
||||
imageOutput = [[QTCaptureDecompressedVideoOutput alloc] init];
|
||||
[imageOutput setDelegate: callbackDelegate];
|
||||
|
||||
if (err == nil)
|
||||
{
|
||||
[session startRunning];
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
openingError = nsStringToJuce ([err description]);
|
||||
DBG (openingError);
|
||||
openingError = nsStringToJuce ([err description]);
|
||||
DBG (openingError);
|
||||
}
|
||||
}
|
||||
|
||||
~QTCameraDeviceInternal()
|
||||
|
|
@ -237,10 +238,11 @@ private:
|
|||
if (internal->listeners.size() > 0)
|
||||
{
|
||||
JUCE_AUTORELEASEPOOL
|
||||
|
||||
internal->callListeners ([CIImage imageWithCVImageBuffer: videoFrame],
|
||||
CVPixelBufferGetWidth (videoFrame),
|
||||
CVPixelBufferGetHeight (videoFrame));
|
||||
{
|
||||
internal->callListeners ([CIImage imageWithCVImageBuffer: videoFrame],
|
||||
CVPixelBufferGetWidth (videoFrame),
|
||||
CVPixelBufferGetHeight (videoFrame));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -258,11 +260,13 @@ public:
|
|||
QTCaptureViewerComp (CameraDevice* const cameraDevice, QTCameraDeviceInternal* const internal)
|
||||
{
|
||||
JUCE_AUTORELEASEPOOL
|
||||
captureView = [[QTCaptureView alloc] init];
|
||||
[captureView setCaptureSession: internal->session];
|
||||
{
|
||||
captureView = [[QTCaptureView alloc] init];
|
||||
[captureView setCaptureSession: internal->session];
|
||||
|
||||
setSize (640, 480); // xxx need to somehow get the movie size - how?
|
||||
setView (captureView);
|
||||
setSize (640, 480); // xxx need to somehow get the movie size - how?
|
||||
setView (captureView);
|
||||
}
|
||||
}
|
||||
|
||||
~QTCaptureViewerComp()
|
||||
|
|
@ -373,17 +377,18 @@ void CameraDevice::removeListener (Listener* listenerToRemove)
|
|||
StringArray CameraDevice::getAvailableDevices()
|
||||
{
|
||||
JUCE_AUTORELEASEPOOL
|
||||
|
||||
StringArray results;
|
||||
NSArray* devs = [QTCaptureDevice inputDevicesWithMediaType: QTMediaTypeVideo];
|
||||
|
||||
for (int i = 0; i < (int) [devs count]; ++i)
|
||||
{
|
||||
QTCaptureDevice* dev = (QTCaptureDevice*) [devs objectAtIndex: i];
|
||||
results.add (nsStringToJuce ([dev localizedDisplayName]));
|
||||
}
|
||||
StringArray results;
|
||||
NSArray* devs = [QTCaptureDevice inputDevicesWithMediaType: QTMediaTypeVideo];
|
||||
|
||||
return results;
|
||||
for (int i = 0; i < (int) [devs count]; ++i)
|
||||
{
|
||||
QTCaptureDevice* dev = (QTCaptureDevice*) [devs objectAtIndex: i];
|
||||
results.add (nsStringToJuce ([dev localizedDisplayName]));
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
||||
CameraDevice* CameraDevice::openDevice (int index,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue