13
0

Merge branch 'master' into cairocanvas

This commit is contained in:
Paul Davis 2013-08-14 13:11:34 -04:00
commit e6521bb043
10 changed files with 151 additions and 45 deletions

View File

@ -293,21 +293,10 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
/* lets get this party started */
try {
if (ARDOUR::init (ARDOUR_COMMAND_LINE::use_vst, ARDOUR_COMMAND_LINE::try_hw_optimization, localedir)) {
throw failed_constructor ();
}
setup_gtk_ardour_enums ();
setup_profile ();
setup_gtk_ardour_enums ();
setup_profile ();
SessionEvent::create_per_thread_pool ("GUI", 512);
} catch (failed_constructor& err) {
error << string_compose (_("could not initialize %1."), PROGRAM_NAME) << endmsg;
// pass it on up
throw;
}
SessionEvent::create_per_thread_pool ("GUI", 512);
/* we like keyboards */

View File

@ -32,11 +32,6 @@ using namespace PBD;
int
curvetest (string filename)
{
// needed to initialize ID objects/counter used
// by Curve et al.
PBD::ID::init ();
ifstream in (filename.c_str());
stringstream line;
//Evoral::Parameter param(GainAutomation, -1.0, +1.0, 0.0);

View File

@ -482,10 +482,6 @@ int main (int argc, char *argv[])
exit (1);
}
if (curvetest_file) {
return curvetest (curvetest_file);
}
cout << PROGRAM_NAME
<< VERSIONSTRING
<< _(" (built using ")
@ -513,7 +509,14 @@ int main (int argc, char *argv[])
/* some GUI objects need this */
PBD::ID::init ();
if (!ARDOUR::init (ARDOUR_COMMAND_LINE::use_vst, ARDOUR_COMMAND_LINE::try_hw_optimization, localedir)) {
error << string_compose (_("could not initialize %1."), PROGRAM_NAME) << endmsg;
exit (1);
}
if (curvetest_file) {
return curvetest (curvetest_file);
}
if (::signal (SIGPIPE, sigpipe_handler)) {
cerr << _("Cannot xinstall SIGPIPE error handler") << endl;

View File

@ -50,7 +50,15 @@ namespace ARDOUR {
extern PBD::Signal1<void,std::string> BootMessage;
extern PBD::Signal0<void> GUIIdle;
int init (bool with_vst, bool try_optimization, const char* localedir);
/**
* @param with_vst true to enable VST Support
* @param try_optimization true to enable hardware optimized routines
* for mixing, finding peak values etc.
* @param localedir Directory to look for localisation files
*
* @return true if Ardour library was successfully initialized
*/
bool init (bool with_vst, bool try_optimization, const char* localedir);
void init_post_engine ();
int cleanup ();
bool no_auto_connect ();

View File

@ -50,8 +50,6 @@
#undef check /* stupid Apple and their un-namespaced, generic Carbon macros */
#endif
#include <giomm.h>
#include <glibmm/fileutils.h>
#include <glibmm/miscutils.h>
@ -60,6 +58,7 @@
#include "pbd/cpus.h"
#include "pbd/error.h"
#include "pbd/id.h"
#include "pbd/pbd.h"
#include "pbd/strsplit.h"
#include "pbd/fpu.h"
#include "pbd/file_utils.h"
@ -107,6 +106,8 @@ using namespace ARDOUR;
using namespace std;
using namespace PBD;
bool libardour_initialized = false;
compute_peak_t ARDOUR::compute_peak = 0;
find_peaks_t ARDOUR::find_peaks = 0;
apply_gain_to_buffer_t ARDOUR::apply_gain_to_buffer = 0;
@ -215,21 +216,19 @@ lotsa_files_please ()
}
}
int
bool
ARDOUR::init (bool use_windows_vst, bool try_optimization, const char* localedir)
{
if (!Glib::thread_supported()) {
Glib::thread_init();
if (libardour_initialized) {
return true;
}
// this really should be in PBD::init..if there was one
Gio::init ();
if (!PBD::init()) return false;
#ifdef ENABLE_NLS
(void) bindtextdomain(PACKAGE, localedir);
#endif
PBD::ID::init ();
SessionEvent::init_event_pool ();
SessionObject::make_property_quarks ();
@ -269,7 +268,7 @@ ARDOUR::init (bool use_windows_vst, bool try_optimization, const char* localedir
Config = new RCConfiguration;
if (Config->load_state ()) {
return -1;
return false;
}
Config->set_use_windows_vst (use_windows_vst);
@ -282,13 +281,13 @@ ARDOUR::init (bool use_windows_vst, bool try_optimization, const char* localedir
#ifdef WINDOWS_VST_SUPPORT
if (Config->get_use_windows_vst() && fst_init (0)) {
return -1;
return false;
}
#endif
#ifdef LXVST_SUPPORT
if (Config->get_use_lxvst() && vstfx_init (0)) {
return -1;
return false;
}
#endif
@ -331,7 +330,9 @@ ARDOUR::init (bool use_windows_vst, bool try_optimization, const char* localedir
EventTypeMap::instance().new_parameter(EnvelopeAutomation);
EventTypeMap::instance().new_parameter(MidiCCAutomation);
return 0;
libardour_initialized = true;
return true;
}
void
@ -365,7 +366,7 @@ ARDOUR::cleanup ()
#ifdef LXVST_SUPPORT
vstfx_exit();
#endif
EnumWriter::destroy ();
PBD::cleanup ();
return 0;
}

View File

@ -1137,8 +1137,20 @@ LV2Plugin::write_from_ui(uint32_t index,
const uint8_t* body)
{
if (!_from_ui) {
_from_ui = new RingBuffer<uint8_t>(
_session.engine().raw_buffer_size(DataType::MIDI) * NBUFS);
size_t rbs = _session.engine().raw_buffer_size(DataType::MIDI) * NBUFS;
/* buffer data communication from plugin UI to plugin instance.
* this buffer needs to potentially hold
* (port's minimumSize) * (audio-periods) / (UI-periods)
* bytes.
*
* e.g 48kSPS / 128fpp -> audio-periods = 375 Hz
* ui-periods = 25 Hz (SuperRapidScreenUpdate)
* default minimumSize = 32K (see LV2Plugin::allocate_atom_event_buffers()
* -> 15 * 32K
* it is safe to overflow (but the plugin state may be inconsistent).
*/
rbs = max((size_t) 32768 * 6, rbs);
_from_ui = new RingBuffer<uint8_t>(rbs);
}
if (!write_to(_from_ui, index, protocol, size, body)) {
@ -1165,8 +1177,10 @@ void
LV2Plugin::enable_ui_emmission()
{
if (!_to_ui) {
_to_ui = new RingBuffer<uint8_t>(
_session.engine().raw_buffer_size(DataType::MIDI) * NBUFS);
/* see note in LV2Plugin::write_from_ui() */
size_t rbs = _session.engine().raw_buffer_size(DataType::MIDI) * NBUFS;
rbs = max((size_t) 32768 * 8, rbs);
_to_ui = new RingBuffer<uint8_t>(rbs);
}
}
@ -1901,7 +1915,7 @@ LV2Plugin::Impl::designated_input (const char* uri, void** bufptrs[], void** buf
return port;
}
static bool lv2_filter (const string& str, void *arg)
static bool lv2_filter (const string& str, void * /* arg*/)
{
/* Not a dotfile, has a prefix before a period, suffix is "lv2" */

View File

@ -20,8 +20,6 @@
#include "pbd/controllable.h"
#include "pbd/enumwriter.h"
void setup_libpbd_enums () __attribute__ ((constructor));
using namespace PBD;
using namespace std;

67
libs/pbd/pbd.cc Normal file
View File

@ -0,0 +1,67 @@
/*
Copyright (C) 2011 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.
*/
#include <iostream>
#include <cstdlib>
#include <giomm.h>
#include <glibmm/thread.h>
#include "pbd/pbd.h"
#include "pbd/debug.h"
#include "pbd/id.h"
#include "pbd/enumwriter.h"
#include "i18n.h"
extern void setup_libpbd_enums ();
namespace {
static bool libpbd_initialized = false;
}
bool
PBD::init ()
{
if (libpbd_initialized) {
return true;
}
if (!Glib::thread_supported()) {
Glib::thread_init();
}
Gio::init ();
PBD::ID::init ();
setup_libpbd_enums ();
libpbd_initialized = true;
return true;
}
void
PBD::cleanup ()
{
EnumWriter::destroy ();
}

30
libs/pbd/pbd/pbd.h Normal file
View File

@ -0,0 +1,30 @@
/*
Copyright (C) 2011 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 __libpbd_pbd_h__
#define __libpbd_pbd_h__
namespace PBD {
bool init ();
void cleanup ();
} // namespace PBD
#endif

View File

@ -56,6 +56,7 @@ libpbd_sources = [
'openuri.cc',
'pathexpand.cc',
'pathscanner.cc',
'pbd.cc',
'pool.cc',
'property_list.cc',
'pthread_utils.cc',