mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 19:56:31 +01:00
Remove unnecessary header usage.
AUPluginUI displays an empty window. git-svn-id: svn://localhost/ardour2/trunk@792 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
7d2b7e72fd
commit
b099d2aa87
11 changed files with 191 additions and 33 deletions
|
|
@ -215,6 +215,7 @@ if env['VST']:
|
||||||
if gtkardour['COREAUDIO']:
|
if gtkardour['COREAUDIO']:
|
||||||
extra_sources += coreaudio_files
|
extra_sources += coreaudio_files
|
||||||
gtkardour.Append(CCFLAGS='-DHAVE_COREAUDIO')
|
gtkardour.Append(CCFLAGS='-DHAVE_COREAUDIO')
|
||||||
|
gtkardour.Append(LINKFLAGS='-framework Carbon')
|
||||||
gtkardour.Merge([libraries['appleutility']])
|
gtkardour.Merge([libraries['appleutility']])
|
||||||
|
|
||||||
if env['FFT_ANALYSIS']:
|
if env['FFT_ANALYSIS']:
|
||||||
|
|
|
||||||
|
|
@ -18,37 +18,102 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ardour/insert.h>
|
|
||||||
#include <ardour/audio_unit.h>
|
#include <ardour/audio_unit.h>
|
||||||
|
#include <ardour/insert.h>
|
||||||
|
|
||||||
#include "plugin_ui.h"
|
#include <gtkmm2ext/doi.h>
|
||||||
|
|
||||||
|
#include "au_pluginui.h"
|
||||||
|
#include "gui_thread.h"
|
||||||
|
|
||||||
|
#include <appleutility/CAAudioUnit.h>
|
||||||
|
#include <appleutility/CAComponent.h>
|
||||||
|
|
||||||
|
#include <AudioUnit/AudioUnit.h>
|
||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
using namespace ARDOUR;
|
using namespace ARDOUR;
|
||||||
using namespace PBD;
|
using namespace PBD;
|
||||||
|
|
||||||
AUPluginUI::AUPluginUI (boost::shared_ptr<PluginInsert> ap)
|
AUPluginUI::AUPluginUI (boost::shared_ptr<PluginInsert> insert)
|
||||||
{
|
{
|
||||||
if ((au = boost::dynamic_pointer_cast<AUPlugin> (ap->plugin())) == 0) {
|
if ((au = boost::dynamic_pointer_cast<AUPlugin> (insert->plugin())) == 0) {
|
||||||
error << _("unknown type of editor-supplying plugin (note: no AudioUnit support in this version of ardour)") << endmsg;
|
error << _("unknown type of editor-supplying plugin (note: no AudioUnit support in this version of ardour)") << endmsg;
|
||||||
throw failed_constructor ();
|
throw failed_constructor ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OSStatus err = noErr;
|
||||||
|
|
||||||
|
CAComponentDescription desc;
|
||||||
|
Component carbonViewComponent = NULL;
|
||||||
|
AudioUnitCarbonView carbonView = NULL;
|
||||||
|
|
||||||
|
GetComponentInfo(au->get_comp()->Comp(), &desc, 0, 0, 0);
|
||||||
|
carbonViewComponent = get_carbon_view_component(desc.componentSubType);
|
||||||
|
err = OpenAComponent(carbonViewComponent, &carbonView);
|
||||||
|
|
||||||
|
Rect rec;
|
||||||
|
rec.top = 0;
|
||||||
|
rec.left = 0;
|
||||||
|
rec.bottom = 400;
|
||||||
|
rec.right = 500;
|
||||||
|
|
||||||
|
ProcessSerialNumber ourPSN;
|
||||||
|
|
||||||
|
/* Here we will set the MacOSX native section of the process to the foreground for putting up this
|
||||||
|
* dialog box. First step is to get our process serial number. We do this by calling
|
||||||
|
* GetCurrentProcess.
|
||||||
|
* First Argument: On success this PSN will be our PSN on return.
|
||||||
|
* Return Value: A Macintosh error indicating success or failure.
|
||||||
|
*/
|
||||||
|
err = GetCurrentProcess(&ourPSN);
|
||||||
|
|
||||||
|
//If no error then set this process to be frontmost.
|
||||||
|
if (err == noErr) {
|
||||||
|
/* Calling SetFrontProcess to make us frontmost.
|
||||||
|
* First Argument: The Process Serial Number of the process we want to make frontmost. Here
|
||||||
|
* of course we pass our process serial number
|
||||||
|
* Return Value: An error value indicating success or failure. We just ignore the return
|
||||||
|
* value here.
|
||||||
|
*/
|
||||||
|
(void)SetFrontProcess(&ourPSN);
|
||||||
|
} else {
|
||||||
|
error << "couldn't get current process" << endmsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = CreateNewWindow (kDocumentWindowClass, kWindowStandardFloatingAttributes, &rec, &wr);
|
||||||
|
|
||||||
|
ComponentResult auResult;
|
||||||
|
ControlRef rootControl = NULL;
|
||||||
|
GetRootControl(wr, &rootControl);
|
||||||
|
|
||||||
|
int width = 500;
|
||||||
|
int height = 400;
|
||||||
|
Float32Point location = {30, 30};
|
||||||
|
Float32Point size = {width, height};
|
||||||
|
ControlRef audioUnitControl = NULL;
|
||||||
|
|
||||||
|
auResult = AudioUnitCarbonViewCreate(carbonView,
|
||||||
|
au->get_au()->AU(),
|
||||||
|
wr,
|
||||||
|
rootControl,
|
||||||
|
&location,
|
||||||
|
&size,
|
||||||
|
&audioUnitControl);
|
||||||
|
|
||||||
|
ShowWindow (wr);
|
||||||
|
BringToFront (wr);
|
||||||
|
// AudioUnitCarbonViewSetEventListener(carbonView, EventListener, this);
|
||||||
#if 0
|
#if 0
|
||||||
set_position (Gtk::WIN_POS_MOUSE);
|
|
||||||
set_name ("PluginEditor");
|
set_name ("PluginEditor");
|
||||||
add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
|
add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
|
||||||
|
|
||||||
signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), reinterpret_cast<Window*> (this)));
|
signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), reinterpret_cast<Window*> (this)));
|
||||||
insert->GoingAway.connect (mem_fun(*this, &PluginUIWindow::plugin_going_away));
|
#endif
|
||||||
|
|
||||||
if (scrollable) {
|
insert->GoingAway.connect (mem_fun(*this, &AUPluginUI::plugin_going_away));
|
||||||
gint h = _pluginui->get_preferred_height ();
|
|
||||||
if (h > 600) h = 600;
|
|
||||||
set_default_size (450, h);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
info << "AUPluginUI created" << endmsg;
|
info << "AUPluginUI created" << endmsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -56,3 +121,39 @@ AUPluginUI::~AUPluginUI ()
|
||||||
{
|
{
|
||||||
// nothing to do here - plugin destructor destroys the GUI
|
// nothing to do here - plugin destructor destroys the GUI
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AUPluginUI::plugin_going_away (ARDOUR::Redirect* ignored)
|
||||||
|
{
|
||||||
|
ENSURE_GUI_THREAD(bind (mem_fun(*this, &AUPluginUI::plugin_going_away), ignored));
|
||||||
|
|
||||||
|
delete_when_idle (this);
|
||||||
|
}
|
||||||
|
|
||||||
|
Component
|
||||||
|
AUPluginUI::get_carbon_view_component(OSType subtype)
|
||||||
|
{
|
||||||
|
ComponentDescription desc;
|
||||||
|
Component component;
|
||||||
|
|
||||||
|
desc.componentType = kAudioUnitCarbonViewComponentType; // 'auvw'
|
||||||
|
desc.componentSubType = subtype;
|
||||||
|
desc.componentManufacturer = 0;
|
||||||
|
desc.componentFlags = 0;
|
||||||
|
desc.componentFlagsMask = 0;
|
||||||
|
|
||||||
|
// First see if we can find a carbon view designed specifically for this
|
||||||
|
// plug-in:
|
||||||
|
|
||||||
|
component = FindNextComponent(NULL, &desc);
|
||||||
|
if (component)
|
||||||
|
return component;
|
||||||
|
|
||||||
|
// If not, grab the generic carbon view, which will create a GUI for
|
||||||
|
// any Audio Unit.
|
||||||
|
|
||||||
|
desc.componentSubType = kAUCarbonViewSubType_Generic;
|
||||||
|
component = FindNextComponent(NULL, &desc);
|
||||||
|
|
||||||
|
return component;
|
||||||
|
}
|
||||||
|
|
|
||||||
48
gtk2_ardour/au_pluginui.h
Normal file
48
gtk2_ardour/au_pluginui.h
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2006 Paul Davis
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __au_plugin_ui_h__
|
||||||
|
#define __au_plugin_ui_h__
|
||||||
|
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
|
#include <Carbon/Carbon.h>
|
||||||
|
#include <AudioUnit/AudioUnit.h>
|
||||||
|
|
||||||
|
namespace ARDOUR {
|
||||||
|
class AUPlugin;
|
||||||
|
class PluginInsert;
|
||||||
|
class Redirect;
|
||||||
|
}
|
||||||
|
|
||||||
|
class AUPluginUI
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AUPluginUI (boost::shared_ptr<ARDOUR::PluginInsert>);
|
||||||
|
~AUPluginUI ();
|
||||||
|
|
||||||
|
private:
|
||||||
|
WindowRef wr;
|
||||||
|
boost::shared_ptr<ARDOUR::AUPlugin> au;
|
||||||
|
|
||||||
|
void plugin_going_away (ARDOUR::Redirect*);
|
||||||
|
Component get_carbon_view_component(OSType subtype);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __au_plugin_ui_h__
|
||||||
|
|
@ -60,8 +60,6 @@
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "pan_automation_time_axis.h"
|
#include "pan_automation_time_axis.h"
|
||||||
#include "playlist_selector.h"
|
#include "playlist_selector.h"
|
||||||
#include "plugin_selector.h"
|
|
||||||
#include "plugin_ui.h"
|
|
||||||
#include "prompter.h"
|
#include "prompter.h"
|
||||||
#include "public_editor.h"
|
#include "public_editor.h"
|
||||||
#include "audio_region_view.h"
|
#include "audio_region_view.h"
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,7 @@
|
||||||
#include "mixer_strip.h"
|
#include "mixer_strip.h"
|
||||||
#include "mixer_ui.h"
|
#include "mixer_ui.h"
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "plugin_selector.h"
|
|
||||||
#include "public_editor.h"
|
#include "public_editor.h"
|
||||||
#include "plugin_ui.h"
|
|
||||||
#include "send_ui.h"
|
#include "send_ui.h"
|
||||||
#include "io_selector.h"
|
#include "io_selector.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
|
||||||
|
|
@ -205,3 +205,4 @@ PlugUIBase::bypass_toggled ()
|
||||||
insert->set_active (!x, this);
|
insert->set_active (!x, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2000 Paul Davis
|
Copyright (C) 2000-2006 Paul Davis
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -234,16 +234,4 @@ class VSTPluginUI : public PlugUIBase, public Gtk::VBox
|
||||||
};
|
};
|
||||||
#endif // VST_SUPPORT
|
#endif // VST_SUPPORT
|
||||||
|
|
||||||
#ifdef HAVE_COREAUDIO
|
|
||||||
class AUPluginUI
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
AUPluginUI (boost::shared_ptr<ARDOUR::PluginInsert>);
|
|
||||||
~AUPluginUI ();
|
|
||||||
|
|
||||||
private:
|
|
||||||
boost::shared_ptr<ARDOUR::AUPlugin> au;
|
|
||||||
};
|
|
||||||
#endif // HAVE_COREAUDIO
|
|
||||||
|
|
||||||
#endif /* __ardour_plugin_ui_h__ */
|
#endif /* __ardour_plugin_ui_h__ */
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@
|
||||||
#include "route_redirect_selection.h"
|
#include "route_redirect_selection.h"
|
||||||
#include "mixer_ui.h"
|
#include "mixer_ui.h"
|
||||||
#include "actions.h"
|
#include "actions.h"
|
||||||
|
|
||||||
#include "plugin_ui.h"
|
#include "plugin_ui.h"
|
||||||
#include "send_ui.h"
|
#include "send_ui.h"
|
||||||
#include "io_selector.h"
|
#include "io_selector.h"
|
||||||
|
|
@ -63,6 +62,10 @@
|
||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_COREAUDIO
|
||||||
|
#include "au_pluginui.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace sigc;
|
using namespace sigc;
|
||||||
using namespace ARDOUR;
|
using namespace ARDOUR;
|
||||||
using namespace PBD;
|
using namespace PBD;
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,6 @@
|
||||||
#include "gui_thread.h"
|
#include "gui_thread.h"
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "playlist_selector.h"
|
#include "playlist_selector.h"
|
||||||
#include "plugin_selector.h"
|
|
||||||
#include "plugin_ui.h"
|
|
||||||
#include "point_selection.h"
|
#include "point_selection.h"
|
||||||
#include "prompter.h"
|
#include "prompter.h"
|
||||||
#include "public_editor.h"
|
#include "public_editor.h"
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,9 @@ class AUPlugin : public ARDOUR::Plugin
|
||||||
|
|
||||||
bool has_editor () const;
|
bool has_editor () const;
|
||||||
|
|
||||||
|
CAAudioUnit* get_au () { return unit; }
|
||||||
|
CAComponent* get_comp () { return comp; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CAComponent* comp;
|
CAComponent* comp;
|
||||||
CAAudioUnit* unit;
|
CAAudioUnit* unit;
|
||||||
|
|
@ -110,6 +113,7 @@ class AUPluginInfo : public PluginInfo {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::string get_name (CAComponentDescription&);
|
static std::string get_name (CAComponentDescription&);
|
||||||
|
void setup_nchannels (CAComponentDescription&);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef boost::shared_ptr<AUPluginInfo> AUPluginInfoPtr;
|
typedef boost::shared_ptr<AUPluginInfo> AUPluginInfoPtr;
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ AUPlugin::get_parameter (uint32_t which) const
|
||||||
int
|
int
|
||||||
AUPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const
|
AUPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const
|
||||||
{
|
{
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
|
|
@ -325,6 +325,7 @@ AUPluginInfo::discover ()
|
||||||
plug->type = ARDOUR::AudioUnit;
|
plug->type = ARDOUR::AudioUnit;
|
||||||
plug->n_inputs = 0;
|
plug->n_inputs = 0;
|
||||||
plug->n_outputs = 0;
|
plug->n_outputs = 0;
|
||||||
|
// plug->setup_nchannels (temp);
|
||||||
plug->category = "AudioUnit";
|
plug->category = "AudioUnit";
|
||||||
plug->desc = new CAComponentDescription(temp);
|
plug->desc = new CAComponentDescription(temp);
|
||||||
|
|
||||||
|
|
@ -376,3 +377,20 @@ AUPluginInfo::get_name (CAComponentDescription& comp_desc)
|
||||||
|
|
||||||
return CFStringRefToStdString(itemName);
|
return CFStringRefToStdString(itemName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AUPluginInfo::setup_nchannels (CAComponentDescription& comp_desc)
|
||||||
|
{
|
||||||
|
CAAudioUnit unit;
|
||||||
|
|
||||||
|
CAAudioUnit::Open (comp_desc, unit);
|
||||||
|
|
||||||
|
if (unit.SupportsNumChannels()) {
|
||||||
|
n_inputs = n_outputs = 0;
|
||||||
|
} else {
|
||||||
|
AUChannelInfo cinfo;
|
||||||
|
size_t info_size = sizeof(cinfo);
|
||||||
|
OSStatus err = AudioUnitGetProperty (unit.AU(), kAudioUnitProperty_SupportedNumChannels, kAudioUnitScope_Global,
|
||||||
|
0, &cinfo, &info_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue