mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 08:36:32 +01:00
pull from trunk
git-svn-id: svn://localhost/ardour2/branches/undo@764 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
5756373841
commit
f07cb624c0
12 changed files with 134 additions and 54 deletions
|
|
@ -971,13 +971,13 @@ ENABLE_PREPROCESSING = YES
|
||||||
# compilation will be performed. Macro expansion can be done in a controlled
|
# compilation will be performed. Macro expansion can be done in a controlled
|
||||||
# way by setting EXPAND_ONLY_PREDEF to YES.
|
# way by setting EXPAND_ONLY_PREDEF to YES.
|
||||||
|
|
||||||
MACRO_EXPANSION = NO
|
MACRO_EXPANSION = YES
|
||||||
|
|
||||||
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
|
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
|
||||||
# then the macro expansion is limited to the macros specified with the
|
# then the macro expansion is limited to the macros specified with the
|
||||||
# PREDEFINED and EXPAND_AS_DEFINED tags.
|
# PREDEFINED and EXPAND_AS_DEFINED tags.
|
||||||
|
|
||||||
EXPAND_ONLY_PREDEF = NO
|
EXPAND_ONLY_PREDEF = YES
|
||||||
|
|
||||||
# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
|
# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
|
||||||
# in the INCLUDE_PATH (see below) will be search if a #include is found.
|
# in the INCLUDE_PATH (see below) will be search if a #include is found.
|
||||||
|
|
@ -1005,7 +1005,7 @@ INCLUDE_FILE_PATTERNS =
|
||||||
# undefined via #undef or recursively expanded use the := operator
|
# undefined via #undef or recursively expanded use the := operator
|
||||||
# instead of the = operator.
|
# instead of the = operator.
|
||||||
|
|
||||||
PREDEFINED =
|
PREDEFINED = HAVE_COREAUDIO VST_SUPPORT HAVE_LIBLO FFT_ANALYSIS
|
||||||
|
|
||||||
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
|
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
|
||||||
# this tag can be used to specify a list of macro names that should be expanded.
|
# this tag can be used to specify a list of macro names that should be expanded.
|
||||||
|
|
|
||||||
45
au_pluginui.cc
Normal file
45
au_pluginui.cc
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2006 Paul Davis
|
||||||
|
Written by Taybin Rutkin
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ardour/insert.h>
|
||||||
|
#include <ardour/audio_unit.h>
|
||||||
|
|
||||||
|
#include "plugin_ui.h"
|
||||||
|
|
||||||
|
using namespace ARDOUR;
|
||||||
|
using namespace PBD;
|
||||||
|
|
||||||
|
AUPluginUI::AUPluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_ptr<AUPlugin> ap)
|
||||||
|
: PlugUIBase (pi),
|
||||||
|
au (ap)
|
||||||
|
{
|
||||||
|
info << "AUPluginUI created" << endmsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
AUPluginUI::~AUPluginUI ()
|
||||||
|
{
|
||||||
|
// nothing to do here - plugin destructor destroys the GUI
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
AUPluginUI::get_preferred_height ()
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
@ -50,6 +50,7 @@ namespace ARDOUR {
|
||||||
class Plugin;
|
class Plugin;
|
||||||
class VSTPlugin;
|
class VSTPlugin;
|
||||||
class Redirect;
|
class Redirect;
|
||||||
|
class AUPlugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace PBD {
|
namespace PBD {
|
||||||
|
|
@ -231,6 +232,22 @@ class VSTPluginUI : public PlugUIBase, public Gtk::VBox
|
||||||
bool configure_handler (GdkEventConfigure*, Gtk::Socket*);
|
bool configure_handler (GdkEventConfigure*, Gtk::Socket*);
|
||||||
void save_plugin_setting ();
|
void save_plugin_setting ();
|
||||||
};
|
};
|
||||||
#endif
|
#endif // VST_SUPPORT
|
||||||
|
|
||||||
|
#ifdef HAVE_COREAUDIO
|
||||||
|
class AUPluginUI : public PlugUIBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AUPluginUI (boost::shared_ptr<ARDOUR::PluginInsert>, boost::shared_ptr<ARDOUR::AUPlugin>);
|
||||||
|
~AUPluginUI ();
|
||||||
|
|
||||||
|
gint get_preferred_height ();
|
||||||
|
bool start_updating(GdkEventAny*) {return false;}
|
||||||
|
bool stop_updating(GdkEventAny*) {return false;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
boost::shared_ptr<ARDOUR::AUPlugin> au;
|
||||||
|
};
|
||||||
|
#endif // HAVE_COREAUDIO
|
||||||
|
|
||||||
#endif /* __ardour_plugin_ui_h__ */
|
#endif /* __ardour_plugin_ui_h__ */
|
||||||
|
|
|
||||||
|
|
@ -31,17 +31,17 @@ using namespace Gtk;
|
||||||
using namespace ARDOUR;
|
using namespace ARDOUR;
|
||||||
using namespace PBD;
|
using namespace PBD;
|
||||||
|
|
||||||
VSTPluginUI::VSTPluginUI (PluginInsert& pi, VSTPlugin& vp)
|
VSTPluginUI::VSTPluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_ptr<VSTPlugin> vp)
|
||||||
: PlugUIBase (pi),
|
: PlugUIBase (pi),
|
||||||
vst (vp)
|
vst (vp)
|
||||||
{
|
{
|
||||||
fst_run_editor (vst.fst());
|
fst_run_editor (vst->fst());
|
||||||
|
|
||||||
preset_box.pack_end (bypass_button, false, false, 10);
|
preset_box.pack_end (bypass_button, false, false, 10);
|
||||||
preset_box.pack_end (save_button, false, false);
|
preset_box.pack_end (save_button, false, false);
|
||||||
preset_box.pack_end (combo, false, false);
|
preset_box.pack_end (combo, false, false);
|
||||||
|
|
||||||
bypass_button.set_active (!insert.active());
|
bypass_button.set_active (!insert->active());
|
||||||
|
|
||||||
pack_start (preset_box, false, false);
|
pack_start (preset_box, false, false);
|
||||||
pack_start (socket, true, true);
|
pack_start (socket, true, true);
|
||||||
|
|
@ -55,7 +55,7 @@ VSTPluginUI::~VSTPluginUI ()
|
||||||
int
|
int
|
||||||
VSTPluginUI::get_preferred_height ()
|
VSTPluginUI::get_preferred_height ()
|
||||||
{
|
{
|
||||||
return vst.fst()->height;
|
return vst->fst()->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
@ -69,7 +69,7 @@ VSTPluginUI::package (Gtk::Window& win)
|
||||||
this assumes that the window's owner understands the XEmbed protocol.
|
this assumes that the window's owner understands the XEmbed protocol.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
socket.add_id (fst_get_XID (vst.fst()));
|
socket.add_id (fst_get_XID (vst->fst()));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,8 @@ class AUPlugin : public ARDOUR::Plugin
|
||||||
private:
|
private:
|
||||||
CAComponent* comp;
|
CAComponent* comp;
|
||||||
CAAudioUnit* unit;
|
CAAudioUnit* unit;
|
||||||
|
|
||||||
|
std::vector<std::pair<uint32_t, uint32_t> > parameter_map;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AUPluginInfo : public PluginInfo {
|
class AUPluginInfo : public PluginInfo {
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,8 @@ class StateManager : public sigc::trackable
|
||||||
|
|
||||||
state_id_t _current_state_id;
|
state_id_t _current_state_id;
|
||||||
|
|
||||||
|
virtual bool should_save_state () const { return true; }
|
||||||
|
|
||||||
static void prohibit_save ();
|
static void prohibit_save ();
|
||||||
static void allow_save (const char* why, bool dosave);
|
static void allow_save (const char* why, bool dosave);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,7 @@ class VSTPlugin : public ARDOUR::Plugin
|
||||||
|
|
||||||
class VSTPluginInfo : public PluginInfo
|
class VSTPluginInfo : public PluginInfo
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
VSTPluginInfo () {}
|
VSTPluginInfo () {}
|
||||||
~VSTPluginInfo () {}
|
~VSTPluginInfo () {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,13 +82,13 @@ AUPlugin::unique_id () const
|
||||||
const char *
|
const char *
|
||||||
AUPlugin::label () const
|
AUPlugin::label () const
|
||||||
{
|
{
|
||||||
return "";
|
return "AUPlugin label";
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
AUPlugin::maker () const
|
AUPlugin::maker () const
|
||||||
{
|
{
|
||||||
return "";
|
return "AUplugin maker";
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
|
|
@ -100,25 +100,30 @@ AUPlugin::parameter_count () const
|
||||||
float
|
float
|
||||||
AUPlugin::default_value (uint32_t port)
|
AUPlugin::default_value (uint32_t port)
|
||||||
{
|
{
|
||||||
return 0.0;
|
// AudioUnits don't have default values. Maybe presets though?
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
jack_nframes_t
|
jack_nframes_t
|
||||||
AUPlugin::latency () const
|
AUPlugin::latency () const
|
||||||
{
|
{
|
||||||
return 0;
|
return unit->Latency ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AUPlugin::set_parameter (uint32_t which, float val)
|
AUPlugin::set_parameter (uint32_t which, float val)
|
||||||
{
|
{
|
||||||
|
unit->SetParameter (parameter_map[which].first, parameter_map[which].second, 0, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
AUPlugin::get_parameter (uint32_t which) const
|
AUPlugin::get_parameter (uint32_t which) const
|
||||||
{
|
{
|
||||||
return 0.0;
|
float outValue = 0.0;
|
||||||
|
|
||||||
|
unit->GetParameter(parameter_map[which].first, parameter_map[which].second, 0, outValue);
|
||||||
|
|
||||||
|
return outValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
@ -136,13 +141,13 @@ AUPlugin::nth_parameter (uint32_t which, bool& ok) const
|
||||||
void
|
void
|
||||||
AUPlugin::activate ()
|
AUPlugin::activate ()
|
||||||
{
|
{
|
||||||
|
unit->GlobalReset ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AUPlugin::deactivate ()
|
AUPlugin::deactivate ()
|
||||||
{
|
{
|
||||||
|
// not needed. GlobalReset () takes care of it.
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -154,7 +159,19 @@ AUPlugin::set_block_size (jack_nframes_t nframes)
|
||||||
int
|
int
|
||||||
AUPlugin::connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, jack_nframes_t nframes, jack_nframes_t offset)
|
AUPlugin::connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, jack_nframes_t nframes, jack_nframes_t offset)
|
||||||
{
|
{
|
||||||
return -1;
|
AudioUnitRenderActionFlags flags = 0;
|
||||||
|
AudioTimeStamp ts;
|
||||||
|
|
||||||
|
AudioBufferList abl;
|
||||||
|
abl.mNumberBuffers = 1;
|
||||||
|
abl.mBuffers[0].mNumberChannels = 1;
|
||||||
|
abl.mBuffers[0].mDataByteSize = nframes * sizeof(Sample);
|
||||||
|
abl.mBuffers[0].mData = &bufs[0];
|
||||||
|
|
||||||
|
|
||||||
|
unit->Render (&flags, &ts, 0, 0, &abl);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
set<uint32_t>
|
set<uint32_t>
|
||||||
|
|
@ -281,40 +298,31 @@ AUPluginInfo::discover ()
|
||||||
{
|
{
|
||||||
PluginInfoList plugs;
|
PluginInfoList plugs;
|
||||||
|
|
||||||
int numTypes = 2; // this magic number was retrieved from the apple AUHost example.
|
|
||||||
|
|
||||||
CAComponentDescription desc;
|
CAComponentDescription desc;
|
||||||
desc.componentFlags = 0;
|
desc.componentFlags = 0;
|
||||||
desc.componentFlagsMask = 0;
|
desc.componentFlagsMask = 0;
|
||||||
desc.componentSubType = 0;
|
desc.componentSubType = 0;
|
||||||
desc.componentManufacturer = 0;
|
desc.componentManufacturer = 0;
|
||||||
|
desc.componentType = kAudioUnitType_Effect;
|
||||||
|
|
||||||
for (int i = 0; i < numTypes; ++i) {
|
Component comp = 0;
|
||||||
if (i == 1) {
|
|
||||||
desc.componentType = kAudioUnitType_MusicEffect;
|
|
||||||
} else {
|
|
||||||
desc.componentType = kAudioUnitType_Effect;
|
|
||||||
}
|
|
||||||
|
|
||||||
Component comp = 0;
|
comp = FindNextComponent (NULL, &desc);
|
||||||
|
while (comp != NULL) {
|
||||||
|
CAComponentDescription temp;
|
||||||
|
GetComponentInfo (comp, &temp, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
AUPluginInfoPtr plug(new AUPluginInfo);
|
||||||
|
plug->name = AUPluginInfo::get_name (temp);
|
||||||
|
plug->type = PluginInfo::AudioUnit;
|
||||||
|
plug->n_inputs = 0;
|
||||||
|
plug->n_outputs = 0;
|
||||||
|
plug->category = "AudioUnit";
|
||||||
|
plug->desc = new CAComponentDescription(temp);
|
||||||
|
|
||||||
comp = FindNextComponent (NULL, &desc);
|
plugs.push_back(plug);
|
||||||
while (comp != NULL) {
|
|
||||||
CAComponentDescription temp;
|
comp = FindNextComponent (comp, &desc);
|
||||||
GetComponentInfo (comp, &temp, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
AUPluginInfoPtr plug(new AUPluginInfo);
|
|
||||||
plug->name = AUPluginInfo::get_name (temp);
|
|
||||||
plug->type = PluginInfo::AudioUnit;
|
|
||||||
plug->n_inputs = 0;
|
|
||||||
plug->n_outputs = 0;
|
|
||||||
plug->category = "AudioUnit";
|
|
||||||
plug->desc = new CAComponentDescription(temp);
|
|
||||||
|
|
||||||
plugs.push_back(plug);
|
|
||||||
|
|
||||||
comp = FindNextComponent (comp, &desc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return plugs;
|
return plugs;
|
||||||
|
|
|
||||||
|
|
@ -382,7 +382,7 @@ PluginManager::vst_discover (string path)
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginInfoPtr info(new PluginInfo);
|
PluginInfoPtr info(new VSTPluginInfo);
|
||||||
|
|
||||||
/* what a goddam joke freeware VST is */
|
/* what a goddam joke freeware VST is */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,9 @@ StateManager::use_state (state_id_t id)
|
||||||
void
|
void
|
||||||
StateManager::save_state (std::string why)
|
StateManager::save_state (std::string why)
|
||||||
{
|
{
|
||||||
|
if (!should_save_state())
|
||||||
|
return;
|
||||||
|
|
||||||
if (!_allow_save) {
|
if (!_allow_save) {
|
||||||
SaveAllowed.connect (mem_fun (*this, &StateManager::save_state));
|
SaveAllowed.connect (mem_fun (*this, &StateManager::save_state));
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -488,9 +488,11 @@ VSTPluginInfo::load (Session& session)
|
||||||
|
|
||||||
if (Config->get_use_vst()) {
|
if (Config->get_use_vst()) {
|
||||||
FSTHandle* handle;
|
FSTHandle* handle;
|
||||||
|
|
||||||
if ((handle = fst_load (info->path.c_str())) == 0) {
|
handle = fst_load(path.c_str());
|
||||||
error << string_compose(_("VST: cannot load module from \"%1\""), info->path) << endmsg;
|
|
||||||
|
if ( (int)handle == -1) {
|
||||||
|
error << string_compose(_("VST: cannot load module from \"%1\""), path) << endmsg;
|
||||||
} else {
|
} else {
|
||||||
plugin.reset (new VSTPlugin (session.engine(), session, handle));
|
plugin.reset (new VSTPlugin (session.engine(), session, handle));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,38 +128,38 @@ static const int legal_sample_rates [] =
|
||||||
{ 8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000
|
{ 8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static inline void
|
static void
|
||||||
s2flac8_array (const short *src, FLAC__int32 *dest, int count)
|
s2flac8_array (const short *src, FLAC__int32 *dest, int count)
|
||||||
{ while (--count >= 0)
|
{ while (--count >= 0)
|
||||||
dest [count] = src [count] >> 8 ;
|
dest [count] = src [count] >> 8 ;
|
||||||
} /* s2flac8_array */
|
} /* s2flac8_array */
|
||||||
|
|
||||||
static inline void
|
static void
|
||||||
s2flac16_array (const short *src, FLAC__int32 *dest, int count)
|
s2flac16_array (const short *src, FLAC__int32 *dest, int count)
|
||||||
{ while (--count >= 0)
|
{ while (--count >= 0)
|
||||||
dest [count] = src [count] ;
|
dest [count] = src [count] ;
|
||||||
} /* s2flac16_array */
|
} /* s2flac16_array */
|
||||||
|
|
||||||
static inline void
|
static void
|
||||||
s2flac24_array (const short *src, FLAC__int32 *dest, int count)
|
s2flac24_array (const short *src, FLAC__int32 *dest, int count)
|
||||||
{ while (--count >= 0)
|
{ while (--count >= 0)
|
||||||
dest [count] = src [count] << 8 ;
|
dest [count] = src [count] << 8 ;
|
||||||
} /* s2flac24_array */
|
} /* s2flac24_array */
|
||||||
|
|
||||||
static inline void
|
static void
|
||||||
i2flac8_array (const int *src, FLAC__int32 *dest, int count)
|
i2flac8_array (const int *src, FLAC__int32 *dest, int count)
|
||||||
{ while (--count >= 0)
|
{ while (--count >= 0)
|
||||||
dest [count] = src [count] >> 24 ;
|
dest [count] = src [count] >> 24 ;
|
||||||
} /* i2flac8_array */
|
} /* i2flac8_array */
|
||||||
|
|
||||||
static inline void
|
static void
|
||||||
i2flac16_array (const int *src, FLAC__int32 *dest, int count)
|
i2flac16_array (const int *src, FLAC__int32 *dest, int count)
|
||||||
{
|
{
|
||||||
while (--count >= 0)
|
while (--count >= 0)
|
||||||
dest [count] = src [count] >> 16 ;
|
dest [count] = src [count] >> 16 ;
|
||||||
} /* i2flac16_array */
|
} /* i2flac16_array */
|
||||||
|
|
||||||
static inline void
|
static void
|
||||||
i2flac24_array (const int *src, FLAC__int32 *dest, int count)
|
i2flac24_array (const int *src, FLAC__int32 *dest, int count)
|
||||||
{ while (--count >= 0)
|
{ while (--count >= 0)
|
||||||
dest [count] = src [count] >> 8 ;
|
dest [count] = src [count] >> 8 ;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue