summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct27
-rw-r--r--gtk2_ardour/analysis_window.cc2
-rw-r--r--gtk2_ardour/analysis_window.h4
-rw-r--r--gtk2_ardour/ardour_ui.cc7
-rw-r--r--gtk2_ardour/audio_clock.cc1
-rw-r--r--gtk2_ardour/connection_editor.cc4
-rw-r--r--gtk2_ardour/connection_editor.h4
-rw-r--r--gtk2_ardour/editor.cc5
-rw-r--r--gtk2_ardour/editor_audio_import.cc2
-rw-r--r--gtk2_ardour/export_dialog.cc3
-rw-r--r--gtk2_ardour/export_range_markers_dialog.cc4
-rw-r--r--gtk2_ardour/fft_graph.cc4
-rw-r--r--gtk2_ardour/io_selector.cc8
-rw-r--r--gtk2_ardour/io_selector.h6
-rw-r--r--gtk2_ardour/main.cc3
-rw-r--r--gtk2_ardour/mixer_ui.cc2
-rw-r--r--gtk2_ardour/new_session_dialog.cc4
-rw-r--r--gtk2_ardour/route_params_ui.cc2
-rw-r--r--gtk2_ardour/sfdb_ui.cc3
-rw-r--r--libs/ardour/SConscript10
-rw-r--r--libs/ardour/ardour/ardour.h3
-rw-r--r--libs/ardour/ardour/audioengine.h24
-rw-r--r--libs/ardour/ardour/auditioner.h12
-rw-r--r--libs/ardour/ardour/automation_event.h10
-rw-r--r--libs/ardour/ardour/connection.h4
-rw-r--r--libs/ardour/ardour/control_protocol_manager.h4
-rw-r--r--libs/ardour/ardour/coreaudio_source.h2
-rw-r--r--libs/ardour/ardour/curve.h3
-rw-r--r--libs/ardour/ardour/diskstream.h10
-rw-r--r--libs/ardour/ardour/io.h23
-rw-r--r--libs/ardour/ardour/location.h10
-rw-r--r--libs/ardour/ardour/logcurve.h4
-rw-r--r--libs/ardour/ardour/playlist.h13
-rw-r--r--libs/ardour/ardour/redirect.h5
-rw-r--r--libs/ardour/ardour/region.h2
-rw-r--r--libs/ardour/ardour/route.h13
-rw-r--r--libs/ardour/ardour/session.h60
-rw-r--r--libs/ardour/ardour/session_connection.h2
-rw-r--r--libs/ardour/ardour/session_diskstream.h2
-rw-r--r--libs/ardour/ardour/session_playlist.h2
-rw-r--r--libs/ardour/ardour/session_region.h2
-rw-r--r--libs/ardour/ardour/session_route.h9
-rw-r--r--libs/ardour/ardour/session_selection.h2
-rw-r--r--libs/ardour/ardour/slave.h1
-rw-r--r--libs/ardour/ardour/sndfilesource.h2
-rw-r--r--libs/ardour/ardour/source.h8
-rw-r--r--libs/ardour/ardour/tempo.h7
-rw-r--r--libs/ardour/audio_playlist.cc4
-rw-r--r--libs/ardour/audio_track.cc10
-rw-r--r--libs/ardour/audioengine.cc85
-rw-r--r--libs/ardour/audioregion.cc3
-rw-r--r--libs/ardour/auditioner.cc18
-rw-r--r--libs/ardour/automation_event.cc38
-rw-r--r--libs/ardour/connection.cc13
-rw-r--r--libs/ardour/control_protocol_manager.cc11
-rw-r--r--libs/ardour/coreaudio_source.cc2
-rw-r--r--libs/ardour/curve.cc7
-rw-r--r--libs/ardour/destructive_filesource.cc2
-rw-r--r--libs/ardour/diskstream.cc35
-rw-r--r--libs/ardour/filesource.cc27
-rw-r--r--libs/ardour/gdither.cc2
-rw-r--r--libs/ardour/globals.cc12
-rw-r--r--libs/ardour/import.cc9
-rw-r--r--libs/ardour/insert.cc6
-rw-r--r--libs/ardour/io.cc114
-rw-r--r--libs/ardour/location.cc28
-rw-r--r--libs/ardour/panner.cc5
-rw-r--r--libs/ardour/playlist.cc12
-rw-r--r--libs/ardour/redirect.cc8
-rw-r--r--libs/ardour/region.cc8
-rw-r--r--libs/ardour/route.cc46
-rw-r--r--libs/ardour/session.cc148
-rw-r--r--libs/ardour/session_butler.cc37
-rw-r--r--libs/ardour/session_click.cc4
-rw-r--r--libs/ardour/session_events.cc2
-rw-r--r--libs/ardour/session_export.cc8
-rw-r--r--libs/ardour/session_feedback.cc4
-rw-r--r--libs/ardour/session_midi.cc14
-rw-r--r--libs/ardour/session_process.cc41
-rw-r--r--libs/ardour/session_state.cc51
-rw-r--r--libs/ardour/session_transport.cc32
-rw-r--r--libs/ardour/sndfilesource.cc2
-rw-r--r--libs/ardour/source.cc35
-rw-r--r--libs/ardour/tempo.cc32
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/gtk_ui.h3
-rw-r--r--libs/midi++2/SConscript2
-rw-r--r--libs/midi++2/midi++/port.h3
-rw-r--r--libs/midi++2/midimanager.cc11
-rw-r--r--libs/midi++2/midiport.cc4
-rw-r--r--libs/pbd3/SConscript4
-rw-r--r--libs/pbd3/basename.cc31
-rw-r--r--libs/pbd3/dirname.cc51
-rw-r--r--libs/pbd3/pbd/abstract_ui.cc2
-rw-r--r--libs/pbd3/pbd/abstract_ui.h5
-rw-r--r--libs/pbd3/pbd/atomic.h1232
-rw-r--r--libs/pbd3/pbd/basename.h4
-rw-r--r--libs/pbd3/pbd/datum.h57
-rw-r--r--libs/pbd3/pbd/dirname.h11
-rw-r--r--libs/pbd3/pbd/ellipsoid.h74
-rw-r--r--libs/pbd3/pbd/foreach.h42
-rw-r--r--libs/pbd3/pbd/lock_free_fifo.h86
-rw-r--r--libs/pbd3/pbd/lockmonitor.h325
-rw-r--r--libs/pbd3/pbd/pool.h9
-rw-r--r--libs/pbd3/pbd/position.h38
-rw-r--r--libs/pbd3/pbd/precision_timer.h61
-rw-r--r--libs/pbd3/pbd/pthread_spinlock.h29
-rw-r--r--libs/pbd3/pbd/rcpointer.h61
-rw-r--r--libs/pbd3/pbd/relation.h35
-rw-r--r--libs/pbd3/pbd/ringbuffer.h51
-rw-r--r--libs/pbd3/pbd/ringbufferNPT.h51
-rw-r--r--libs/pbd3/pbd/rt.h25
-rw-r--r--libs/pbd3/pbd/rtthread.h30
-rw-r--r--libs/pbd3/pbd/scale.h53
-rw-r--r--libs/pbd3/pbd/thread.h127
-rw-r--r--libs/pbd3/pbd/types.h32
-rw-r--r--libs/pbd3/pbd/unescape.h6
-rw-r--r--libs/pbd3/pool.cc30
-rw-r--r--libs/pbd3/unescape.cc137
-rw-r--r--libs/surfaces/control_protocol/SConscript4
-rw-r--r--libs/surfaces/generic_midi/SConscript4
-rw-r--r--libs/surfaces/tranzport/SConscript3
121 files changed, 755 insertions, 3237 deletions
diff --git a/SConstruct b/SConstruct
index 1403b69c8a..64f0234869 100644
--- a/SConstruct
+++ b/SConstruct
@@ -36,8 +36,9 @@ opts.AddOptions(
BoolOption('FPU_OPTIMIZATION', 'Build runtime checked assembler code', 1),
BoolOption('FFT_ANALYSIS', 'Include FFT analysis window', 0),
BoolOption('SURFACES', 'Build support for control surfaces', 0),
- BoolOption('DMALLOC', 'Compile and link using the dmalloc library', 0)
- )
+ BoolOption('DMALLOC', 'Compile and link using the dmalloc library', 0),
+ BoolOption('LIBLO', 'Compile with support for liblo library', 1)
+)
#----------------------------------------------------------------------
# a handy helper that provides a way to merge compile/link information
@@ -380,6 +381,7 @@ libraries['glib2'] = LibraryInfo()
libraries['glib2'].ParseConfig ('pkg-config --cflags --libs glib-2.0')
libraries['glib2'].ParseConfig ('pkg-config --cflags --libs gobject-2.0')
libraries['glib2'].ParseConfig ('pkg-config --cflags --libs gmodule-2.0')
+libraries['glib2'].ParseConfig ('pkg-config --cflags --libs gthread-2.0')
libraries['gtk2'] = LibraryInfo()
libraries['gtk2'].ParseConfig ('pkg-config --cflags --libs gtk+-2.0')
@@ -425,14 +427,15 @@ libraries['usb'] = conf.Finish ()
#
# Check for liblo
-libraries['lo'] = LibraryInfo ()
+if env['LIBLO']:
+ libraries['lo'] = LibraryInfo ()
-conf = Configure (libraries['lo'])
-if conf.CheckLib ('lo', 'lo_server_new') == False:
- print "liblo does not appear to be installed."
- exit (0)
+ conf = Configure (libraries['lo'])
+ if conf.CheckLib ('lo', 'lo_server_new') == False:
+ print "liblo does not appear to be installed."
+ sys.exit (1)
-libraries['lo'] = conf.Finish ()
+ libraries['lo'] = conf.Finish ()
#
# Check for dmalloc
@@ -470,7 +473,10 @@ elif conf.CheckCHeader('/System/Library/Frameworks/CoreMIDI.framework/Headers/Co
env['SYSMIDI'] = 'CoreMIDI'
subst_dict['%MIDITAG%'] = "ardour"
subst_dict['%MIDITYPE%'] = "coremidi"
-
+else:
+ print "It appears you don't have the required MIDI libraries installed."
+ sys.exit (1)
+
env = conf.Finish()
if env['SYSLIBS']:
@@ -757,6 +763,9 @@ env.Append(CCFLAGS="-Wall")
if env['VST']:
env.Append(CCFLAGS="-DVST_SUPPORT")
+if env['LIBLO']:
+ env.Append(CCFLAGS="-DHAVE_LIBLO")
+
#
# everybody needs this
#
diff --git a/gtk2_ardour/analysis_window.cc b/gtk2_ardour/analysis_window.cc
index 014aeaaabc..f044ca7388 100644
--- a/gtk2_ardour/analysis_window.cc
+++ b/gtk2_ardour/analysis_window.cc
@@ -211,7 +211,7 @@ AnalysisWindow::analyze_data (Gtk::Button *button)
{
track_list_ready = false;
{
- LockMonitor lm (track_list_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (track_list_lock);
// Empty track list & free old graphs
clear_tracklist();
diff --git a/gtk2_ardour/analysis_window.h b/gtk2_ardour/analysis_window.h
index a5ca5b3c26..cd1243bb6a 100644
--- a/gtk2_ardour/analysis_window.h
+++ b/gtk2_ardour/analysis_window.h
@@ -34,7 +34,7 @@
#include <gtkmm2ext/dndtreeview.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
#include "ardour_dialog.h"
@@ -106,7 +106,7 @@ class AnalysisWindow : public ArdourDialog
FFTGraph fft_graph;
bool track_list_ready;
- PBD::Lock track_list_lock;
+ Glib::Mutex track_list_lock;
friend class FFTGraph;
};
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index 146d4d2ffe..a802aaebba 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -33,7 +33,6 @@
#include <pbd/error.h>
#include <pbd/compose.h>
-#include <pbd/basename.h>
#include <pbd/pathscanner.h>
#include <pbd/failed_constructor.h>
#include <gtkmm2ext/gtk_ui.h>
@@ -717,7 +716,7 @@ ARDOUR_UI::redisplay_recent_sessions ()
TreeModel::Row row = *(recent_session_model->append());
- row[recent_session_columns.visible_name] = PBD::basename (fullpath);
+ row[recent_session_columns.visible_name] = Glib::path_get_basename (fullpath);
row[recent_session_columns.fullpath] = fullpath;
if (states->size() > 1) {
@@ -824,9 +823,11 @@ ARDOUR_UI::filter_ardour_session_dirs (const FileFilter::Info& info)
return false;
}
+ // XXX Portability
+
string session_file = info.filename;
session_file += '/';
- session_file += PBD::basename (info.filename);
+ session_file += Glib::path_get_basename (info.filename);
session_file += ".ardour";
if (stat (session_file.c_str(), &statbuf) != 0) {
diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc
index 506b082b53..a5e7aa7193 100644
--- a/gtk2_ardour/audio_clock.cc
+++ b/gtk2_ardour/audio_clock.cc
@@ -41,6 +41,7 @@ using namespace sigc;
using namespace Gtk;
using PBD::atoi;
+using PBD::atof;
const uint32_t AudioClock::field_length[(int) AudioClock::AudioFrames+1] = {
2, /* SMPTE_Hours */
diff --git a/gtk2_ardour/connection_editor.cc b/gtk2_ardour/connection_editor.cc
index 596029eeb3..f411f945c8 100644
--- a/gtk2_ardour/connection_editor.cc
+++ b/gtk2_ardour/connection_editor.cc
@@ -490,7 +490,7 @@ ConnectionEditor::display_ports ()
void
ConnectionEditor::display_connection_state (bool for_input)
{
- LockMonitor lm (port_display_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (port_display_lock);
uint32_t limit;
if (session == 0 || current_connection == 0) {
@@ -601,7 +601,7 @@ ConnectionEditor::add_port ()
void
ConnectionEditor::connection_port_button_press_event (GdkEventButton* ev, TreeView* tview)
{
- LockMonitor lm (port_display_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (port_display_lock);
int which_port = reinterpret_cast<intptr_t> (treeview->get_data ("port"));
diff --git a/gtk2_ardour/connection_editor.h b/gtk2_ardour/connection_editor.h
index 1d6dd7d7fc..71d201cd8d 100644
--- a/gtk2_ardour/connection_editor.h
+++ b/gtk2_ardour/connection_editor.h
@@ -39,7 +39,7 @@ using __gnu_cxx::slist;
#include "ardour_dialog.h"
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
namespace ARDOUR {
class Session;
@@ -116,7 +116,7 @@ class ConnectionEditor : public ArdourDialog {
Gtk::Button clear_button;
Gtk::Button add_port_button;
- PBD::Lock port_display_lock;
+ Glib::Mutex port_display_lock;
slist<Gtk::ScrolledWindow *> port_displays;
Gtk::Button ok_button;
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 6dc3b955f1..c7956386ce 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -90,6 +90,7 @@ using namespace Gtkmm2ext;
using namespace Editing;
using PBD::internationalize;
+using PBD::atoi;
const double Editor::timebar_height = 15.0;
@@ -2191,7 +2192,7 @@ Editor::set_state (const XMLNode& node)
}
if ((prop = node.property ("zoom"))) {
- set_frames_per_unit (atof (prop->value()));
+ set_frames_per_unit (PBD::atof (prop->value()));
}
if ((prop = node.property ("snap-to"))) {
@@ -2899,7 +2900,7 @@ Editor::convert_drop_to_paths (vector<ustring>& paths,
for (vector<ustring>::iterator i = uris.begin(); i != uris.end(); ++i) {
if ((*i).substr (0,7) == "file://") {
string p = *i;
- url_decode (p);
+ PBD::url_decode (p);
paths.push_back (p.substr (7));
}
}
diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc
index 184c1757f2..ee73c46b24 100644
--- a/gtk2_ardour/editor_audio_import.cc
+++ b/gtk2_ardour/editor_audio_import.cc
@@ -203,7 +203,7 @@ Editor::embed_sndfile (Glib::ustring path, bool split, bool multiple_files, bool
/* lets see if we can link it into the session */
linked_path = session->sound_dir();
- linked_path += PBD::basename (path);
+ linked_path += Glib::path_get_basename (path);
if (link (path.c_str(), linked_path.c_str()) == 0) {
diff --git a/gtk2_ardour/export_dialog.cc b/gtk2_ardour/export_dialog.cc
index 1293fca34b..834127e042 100644
--- a/gtk2_ardour/export_dialog.cc
+++ b/gtk2_ardour/export_dialog.cc
@@ -27,7 +27,6 @@
#include <samplerate.h>
#include <pbd/convert.h>
-#include <pbd/dirname.h>
#include <pbd/xml++.h>
#include <gtkmm2ext/utils.h>
@@ -1154,7 +1153,7 @@ ExportDialog::is_filepath_valid(string &filepath)
// directory needs to exist and be writable
- string dirpath = PBD::dirname (filepath);
+ string dirpath = Glib::path_get_dirname (filepath);
if (::access (dirpath.c_str(), W_OK) != 0) {
string txt = _("Cannot write file in: ") + dirpath;
MessageDialog msg (*this, txt, false, MESSAGE_ERROR, BUTTONS_OK, true);
diff --git a/gtk2_ardour/export_range_markers_dialog.cc b/gtk2_ardour/export_range_markers_dialog.cc
index 07ce651e62..3ff6ae783d 100644
--- a/gtk2_ardour/export_range_markers_dialog.cc
+++ b/gtk2_ardour/export_range_markers_dialog.cc
@@ -25,8 +25,6 @@
#include <ardour/audioengine.h>
#include <ardour/sndfile_helpers.h>
-#include <pbd/dirname.h>
-
#include "ardour_ui.h"
#include "export_range_markers_dialog.h"
@@ -149,7 +147,7 @@ ExportRangeMarkersDialog::is_filepath_valid(string &filepath)
}
// directory needs to exist and be writable
- string dirpath = PBD::dirname (filepath);
+ string dirpath = Glib::path_get_dirname (filepath);
if (::access (dirpath.c_str(), W_OK) != 0) {
string txt = _("Cannot write file in: ") + dirpath;
MessageDialog msg (*this, txt, false, MESSAGE_ERROR, BUTTONS_OK, true);
diff --git a/gtk2_ardour/fft_graph.cc b/gtk2_ardour/fft_graph.cc
index df13614ecf..c2d81abf3c 100644
--- a/gtk2_ardour/fft_graph.cc
+++ b/gtk2_ardour/fft_graph.cc
@@ -58,7 +58,7 @@ void
FFTGraph::setWindowSize(int windowSize)
{
if (_a_window) {
- LockMonitor lm (_a_window->track_list_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_a_window->track_list_lock);
setWindowSize_internal(windowSize);
} else {
setWindowSize_internal(windowSize);
@@ -261,7 +261,7 @@ FFTGraph::draw_scales(Glib::RefPtr<Gdk::Window> window)
void
FFTGraph::redraw()
{
- LockMonitor lm (_a_window->track_list_lock, __LINE__, __FILE__ );
+ Glib::Mutex::Lock lm (_a_window->track_list_lock);
draw_scales(get_window());
diff --git a/gtk2_ardour/io_selector.cc b/gtk2_ardour/io_selector.cc
index 247ad602bd..b45966c5e3 100644
--- a/gtk2_ardour/io_selector.cc
+++ b/gtk2_ardour/io_selector.cc
@@ -23,7 +23,7 @@
#include <gtkmm/messagedialog.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
#include <ardour/io.h>
#include <ardour/route.h>
@@ -368,7 +368,7 @@ IOSelector::display_ports ()
TreeView *selected_port_tview = 0;
{
- LockMonitor lm (port_display_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (port_display_lock);
Port *port;
uint32_t limit;
@@ -670,7 +670,7 @@ IOSelector::port_column_button_release (GdkEventButton* event, TreeView* treevie
if (Keyboard::is_delete_event (event)) {
Port* port;
{
- LockMonitor lm (port_display_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (port_display_lock);
port = static_cast<Port *> (treeview->get_data (_("port")));
@@ -724,7 +724,7 @@ IOSelector::select_treeview (TreeView* tview)
switch.
*/
- LockMonitor lm (port_display_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (port_display_lock);
Port* port = reinterpret_cast<Port *> (tview->get_data (_("port")));
if (port != selected_port) {
diff --git a/gtk2_ardour/io_selector.h b/gtk2_ardour/io_selector.h
index 1dd77dd5a1..44518e6759 100644
--- a/gtk2_ardour/io_selector.h
+++ b/gtk2_ardour/io_selector.h
@@ -29,6 +29,9 @@ using __gnu_cxx::slist;
#endif
#include <string>
+
+#include <glibmm/thread.h>
+
#include <gtkmm/box.h>
#include <gtkmm/frame.h>
#include <gtkmm/button.h>
@@ -39,6 +42,7 @@ using __gnu_cxx::slist;
#include <ardour_dialog.h>
+
namespace ARDOUR {
class IO;
class Session;
@@ -105,7 +109,7 @@ class IOSelector : public Gtk::VBox {
Gtk::Button clear_connections_button;
Gtk::ScrolledWindow port_display_scroller;
- PBD::Lock port_display_lock;
+ Glib::Mutex port_display_lock;
slist<Gtk::TreeView *> port_displays;
void display_ports ();
diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc
index 20630e4f1c..e9ac25a8f8 100644
--- a/gtk2_ardour/main.cc
+++ b/gtk2_ardour/main.cc
@@ -367,6 +367,9 @@ main (int argc, char *argv[])
ARDOUR::AudioEngine *engine;
vector<Glib::ustring> null_file_list;
+ // needs a better home.
+ Glib::thread_init();
+
gtk_set_locale ();
(void) bindtextdomain (PACKAGE, LOCALEDIR);
diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc
index 2d0a37cd47..1ded8625c6 100644
--- a/gtk2_ardour/mixer_ui.cc
+++ b/gtk2_ardour/mixer_ui.cc
@@ -24,7 +24,7 @@
#include <gtkmm/accelmap.h>
#include <pbd/convert.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
#include <gtkmm2ext/gtk_ui.h>
#include <gtkmm2ext/utils.h>
diff --git a/gtk2_ardour/new_session_dialog.cc b/gtk2_ardour/new_session_dialog.cc
index b7b448b677..88944aacb7 100644
--- a/gtk2_ardour/new_session_dialog.cc
+++ b/gtk2_ardour/new_session_dialog.cc
@@ -24,8 +24,6 @@
#include <ardour/recent_sessions.h>
#include <ardour/session.h>
-#include <pbd/basename.h>
-
#include <gtkmm/entry.h>
#include <gtkmm/filechooserbutton.h>
#include <gtkmm/spinbutton.h>
@@ -659,7 +657,7 @@ NewSessionDialog::reset_recent()
Gtk::TreeModel::Row row = *(recent_model->append());
- row[recent_columns.visible_name] = PBD::basename (fullpath);
+ row[recent_columns.visible_name] = Glib::path_get_basename (fullpath);
row[recent_columns.fullpath] = fullpath;
if (states->size() > 1) {
diff --git a/gtk2_ardour/route_params_ui.cc b/gtk2_ardour/route_params_ui.cc
index a52cf79f3f..aee247df02 100644
--- a/gtk2_ardour/route_params_ui.cc
+++ b/gtk2_ardour/route_params_ui.cc
@@ -20,7 +20,7 @@
#include <algorithm>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/stop_signal.h>
diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc
index a8b2510cf5..947f470ac8 100644
--- a/gtk2_ardour/sfdb_ui.cc
+++ b/gtk2_ardour/sfdb_ui.cc
@@ -25,7 +25,6 @@
#include <gtkmm/box.h>
#include <gtkmm/stock.h>
-#include <pbd/basename.h>
#include <pbd/convert.h>
#include <gtkmm2ext/utils.h>
@@ -206,7 +205,7 @@ SoundFileBox::play_btn_clicked ()
}
string result;
- _session->region_name (result, PBD::basename(srclist[0]->name()), false);
+ _session->region_name (result, Glib::path_get_basename(srclist[0]->name()), false);
AudioRegion* a_region = new AudioRegion(srclist, 0, srclist[0]->length(), result, 0, Region::DefaultFlags, false);
region_cache[path] = a_region;
}
diff --git a/libs/ardour/SConscript b/libs/ardour/SConscript
index 93593bad18..73137def57 100644
--- a/libs/ardour/SConscript
+++ b/libs/ardour/SConscript
@@ -58,7 +58,6 @@ ladspa_plugin.cc
location.cc
mtc_slave.cc
named_selection.cc
-osc.cc
panner.cc
pcm_utils.cc
playlist.cc
@@ -97,6 +96,7 @@ mix.cc
arch_specific_objects = [ ]
+osc_files = [ 'osc.cc' ]
vst_files = [ 'vst_plugin.cc', 'session_vst.cc' ]
coreaudio_files = [ 'coreaudio_source.cc' ]
extra_sources = [ ]
@@ -104,6 +104,9 @@ extra_sources = [ ]
if ardour['VST']:
extra_sources += vst_files
+if ardour['LIBLO']:
+ extra_sources += osc_files
+
ardour.Append(CCFLAGS="-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE")
ardour.Append(CXXFLAGS="-DDATA_DIR=\\\""+final_prefix+"/share\\\"")
ardour.Append(CXXFLAGS="-DMODULE_DIR=\\\""+final_prefix+"/lib\\\"")
@@ -194,9 +197,12 @@ ardour.Merge ([
libraries['pbd3'],
libraries['soundtouch'],
libraries['midi++2'],
- libraries['lo'],
+ libraries['glib2'],
+ libraries['glibmm2']
])
+if ardour['LIBLO']:
+ ardour.Merge ([ libraries['lo'] ])
ardour.VersionBuild(['version.cc', 'ardour/version.h'], 'SConscript')
diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h
index 3308266f2f..fee6c601a2 100644
--- a/libs/ardour/ardour/ardour.h
+++ b/libs/ardour/ardour/ardour.h
@@ -26,14 +26,11 @@
#include <signal.h>
#include <pbd/error.h>
-#include <pbd/lockmonitor.h>
#include <pbd/failed_constructor.h>
#include <ardour/configuration.h>
#include <ardour/types.h>
-using namespace PBD;
-
namespace MIDI {
class MachineControl;
class Port;
diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h
index 36dbbd1dbe..bbd7001100 100644
--- a/libs/ardour/ardour/audioengine.h
+++ b/libs/ardour/ardour/audioengine.h
@@ -28,7 +28,9 @@
#include <string>
#include <sigc++/signal.h>
-#include <pthread.h>
+
+#include <glibmm/thread.h>
+
#include <ardour/ardour.h>
#include <jack/jack.h>
#include <jack/transport.h>
@@ -59,7 +61,7 @@ class AudioEngine : public sigc::trackable
int start ();
bool running() const { return _running; }
- PBD::NonBlockingLock& process_lock() { return _process_lock; }
+ Glib::Mutex& process_lock() { return _process_lock; }
jack_nframes_t frame_rate();
jack_nframes_t frames_per_cycle();
@@ -185,10 +187,10 @@ class AudioEngine : public sigc::trackable
ARDOUR::Session *session;
jack_client_t *_jack;
std::string jack_client_name;
- PBD::NonBlockingLock port_lock;
- PBD::NonBlockingLock _process_lock;
- PBD::Lock session_remove_lock;
- pthread_cond_t session_removed;
+ Glib::Mutex port_lock;
+ Glib::Mutex _process_lock;
+ Glib::Mutex session_remove_lock;
+ Glib::Cond session_removed;
bool session_remove_pending;
bool _running;
bool _has_run;
@@ -202,8 +204,6 @@ class AudioEngine : public sigc::trackable
sigc::slot<int,jack_nframes_t> freewheel_action;
bool reconnect_on_halt;
int _usecs_per_cycle;
- jack_nframes_t last_meter_point;
- jack_nframes_t meter_interval;
typedef std::set<Port*> Ports;
Ports ports;
@@ -237,10 +237,10 @@ class AudioEngine : public sigc::trackable
int connect_to_jack (std::string client_name);
- static void* _meter_thread (void* arg);
- void* meter_thread ();
- pthread_t meter_thread_id;
- void maybe_start_metering_thread ();
+ void meter_thread ();
+ void start_metering_thread ();
+ Glib::Thread* m_meter_thread;
+ gint m_meter_exit;
};
}; /* namespace ARDOUR */
diff --git a/libs/ardour/ardour/auditioner.h b/libs/ardour/ardour/auditioner.h
index b79620eaa2..d5d4063dda 100644
--- a/libs/ardour/ardour/auditioner.h
+++ b/libs/ardour/ardour/auditioner.h
@@ -22,10 +22,8 @@
#define __ardour_auditioner_h__
#include <string>
-#include <pthread.h>
-#include <pbd/lockmonitor.h>
-#include <pbd/atomic.h>
+#include <glibmm/thread.h>
#include <ardour/ardour.h>
#include <ardour/audio_track.h>
@@ -50,16 +48,16 @@ class Auditioner : public AudioTrack
int play_audition (jack_nframes_t nframes);
void cancel_audition () {
- atomic_set (&_active, 0);
+ g_atomic_int_set (&_active, 0);
}
- bool active() const { return atomic_read (&_active); }
+ bool active() const { return g_atomic_int_get (&_active); }
private:
AudioRegion *the_region;
jack_nframes_t current_frame;
- atomic_t _active;
- PBD::Lock lock;
+ gint _active;
+ Glib::Mutex lock;
jack_nframes_t length;
void drop_ports ();
diff --git a/libs/ardour/ardour/automation_event.h b/libs/ardour/ardour/automation_event.h
index f26828a114..78daa531dd 100644
--- a/libs/ardour/ardour/automation_event.h
+++ b/libs/ardour/ardour/automation_event.h
@@ -26,7 +26,7 @@
#include <cmath>
#include <sigc++/signal.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
#include <pbd/undo.h>
#include <pbd/xml++.h>
#include <ardour/ardour.h>
@@ -144,7 +144,7 @@ class AutomationList : public StateManager
std::pair<AutomationList::iterator,AutomationList::iterator> control_points_adjacent (double when);
template<class T> void apply_to_points (T& obj, void (T::*method)(const AutomationList&)) {
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
(obj.*method)(*this);
}
@@ -157,13 +157,13 @@ class AutomationList : public StateManager
double get_max_xval() const { return max_xval; }
double eval (double where) {
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
return unlocked_eval (where);
}
double rt_safe_eval (double where, bool& ok) {
- TentativeLockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock, Glib::TRY_LOCK);
if ((ok = lm.locked())) {
return unlocked_eval (where);
@@ -186,7 +186,7 @@ class AutomationList : public StateManager
};
AutomationEventList events;
- mutable PBD::NonBlockingLock lock;
+ mutable Glib::Mutex lock;
bool _frozen;
bool changed_when_thawed;
bool _dirty;
diff --git a/libs/ardour/ardour/connection.h b/libs/ardour/ardour/connection.h
index b33af9cb21..899bffc06a 100644
--- a/libs/ardour/ardour/connection.h
+++ b/libs/ardour/ardour/connection.h
@@ -24,7 +24,7 @@
#include <vector>
#include <string>
#include <sigc++/signal.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
#include <ardour/stateful.h>
using std::vector;
@@ -67,7 +67,7 @@ class Connection : public Stateful, public sigc::trackable {
Connection (const XMLNode&);
private:
- mutable PBD::Lock port_lock;
+ mutable Glib::Mutex port_lock;
vector<PortList> _ports;
string _name;
bool _sysdep;
diff --git a/libs/ardour/ardour/control_protocol_manager.h b/libs/ardour/ardour/control_protocol_manager.h
index 42b5a69a48..03b21a299c 100644
--- a/libs/ardour/ardour/control_protocol_manager.h
+++ b/libs/ardour/ardour/control_protocol_manager.h
@@ -6,7 +6,7 @@
#include <sigc++/sigc++.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
#include <ardour/stateful.h>
@@ -52,7 +52,7 @@ struct ControlProtocolInfo {
static ControlProtocolManager* _instance;
Session* _session;
- PBD::Lock protocols_lock;
+ Glib::Mutex protocols_lock;
std::list<ControlProtocol*> control_protocols;
void drop_session ();
diff --git a/libs/ardour/ardour/coreaudio_source.h b/libs/ardour/ardour/coreaudio_source.h
index 4193623006..736ea32df7 100644
--- a/libs/ardour/ardour/coreaudio_source.h
+++ b/libs/ardour/ardour/coreaudio_source.h
@@ -40,7 +40,7 @@ class CoreAudioSource : public ExternalSource {
mutable float *tmpbuf;
mutable jack_nframes_t tmpbufsize;
- mutable PBD::Lock _tmpbuf_lock;
+ mutable Glib::Mutex _tmpbuf_lock;
void init (const string &str, bool build_peak);
};
diff --git a/libs/ardour/ardour/curve.h b/libs/ardour/ardour/curve.h
index 1c6a4c5bc4..ede060e1cb 100644
--- a/libs/ardour/ardour/curve.h
+++ b/libs/ardour/ardour/curve.h
@@ -23,11 +23,10 @@
#include <sys/types.h>
#include <sigc++/signal.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
#include <pbd/undo.h>
#include <list>
#include <algorithm>
-#include <pthread.h>
#include <ardour/automation_event.h>
namespace ARDOUR {
diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h
index 8838177f14..a017b7af9b 100644
--- a/libs/ardour/ardour/diskstream.h
+++ b/libs/ardour/ardour/diskstream.h
@@ -33,7 +33,7 @@
#include <pbd/fastlog.h>
#include <pbd/ringbufferNPT.h>
-#include <pbd/atomic.h>
+
#include <ardour/ardour.h>
#include <ardour/configuration.h>
@@ -115,7 +115,7 @@ class DiskStream : public Stateful, public sigc::trackable
}
void set_record_enabled (bool yn, void *src);
- bool record_enabled() const { return atomic_read (&_record_enabled); }
+ bool record_enabled() const { return g_atomic_int_get (&_record_enabled); }
void punch_in ();
void punch_out ();
@@ -320,7 +320,7 @@ class DiskStream : public Stateful, public sigc::trackable
uint32_t _n_channels;
id_t _id;
- atomic_t _record_enabled;
+ gint _record_enabled;
AudioPlaylist* _playlist;
double _visible_speed;
double _actual_speed;
@@ -365,7 +365,7 @@ class DiskStream : public Stateful, public sigc::trackable
AlignStyle _persistent_alignment_style;
bool first_input_change;
- PBD::NonBlockingLock state_lock;
+ Glib::Mutex state_lock;
jack_nframes_t scrub_start;
jack_nframes_t scrub_buffer_size;
@@ -404,7 +404,7 @@ class DiskStream : public Stateful, public sigc::trackable
};
vector<CaptureInfo*> capture_info;
- PBD::Lock capture_info_lock;
+ Glib::Mutex capture_info_lock;
void init (Flag);
diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h
index 8321e9afda..c80a7abfaa 100644
--- a/libs/ardour/ardour/io.h
+++ b/libs/ardour/ardour/io.h
@@ -27,10 +27,11 @@
#include <sigc++/signal.h>
#include <jack/jack.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
+
#include <pbd/fastlog.h>
#include <pbd/undo.h>
-#include <pbd/atomic.h>
+
#include <midi++/controllable.h>
#include <ardour/ardour.h>
@@ -205,7 +206,15 @@ class IO : public Stateful, public ARDOUR::StateManager
}
}
- static sigc::signal<void> Meter;
+ static void update_meters();
+
+private:
+
+ static sigc::signal<void> Meter;
+ static Glib::StaticMutex m_meter_signal_lock;
+ sigc::connection m_meter_connection;
+
+public:
/* automation */
@@ -261,7 +270,7 @@ class IO : public Stateful, public ARDOUR::StateManager
int ports_became_legal ();
private:
- mutable PBD::Lock io_lock;
+ mutable Glib::Mutex io_lock;
protected:
Session& _session;
@@ -269,7 +278,7 @@ class IO : public Stateful, public ARDOUR::StateManager
gain_t _gain;
gain_t _effective_gain;
gain_t _desired_gain;
- PBD::NonBlockingLock declick_lock;
+ Glib::Mutex declick_lock;
vector<Port*> _outputs;
vector<Port*> _inputs;
vector<float> _peak_power;
@@ -322,7 +331,7 @@ class IO : public Stateful, public ARDOUR::StateManager
jack_nframes_t last_automation_snapshot;
static jack_nframes_t _automation_interval;
- AutoState _gain_automation_state;
+ AutoState _gain_automation_state;
AutoStyle _gain_automation_style;
bool apply_gain_automation;
@@ -331,7 +340,7 @@ class IO : public Stateful, public ARDOUR::StateManager
int save_automation (const string&);
int load_automation (const string&);
- PBD::NonBlockingLock automation_lock;
+ Glib::Mutex automation_lock;
/* AudioTrack::deprecated_use_diskstream_connections() needs these */
diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h
index bb744c95be..75f4c5d12a 100644
--- a/libs/ardour/ardour/location.h
+++ b/libs/ardour/ardour/location.h
@@ -27,10 +27,10 @@
#include <map>
#include <sys/types.h>
-#include <pthread.h>
#include <sigc++/signal.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
+
#include <pbd/undo.h>
#include "ardour.h"
@@ -168,12 +168,12 @@ class Locations : public Stateful, public StateManager
sigc::signal<void,Location*> removed;
template<class T> void apply (T& obj, void (T::*method)(LocationList&)) {
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
(obj.*method)(locations);
}
template<class T1, class T2> void apply (T1& obj, void (T1::*method)(LocationList&, T2& arg), T2& arg) {
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
(obj.*method)(locations, arg);
}
@@ -190,7 +190,7 @@ class Locations : public Stateful, public StateManager
LocationList locations;
Location *current_location;
- mutable PBD::Lock lock;
+ mutable Glib::Mutex lock;
int set_current_unlocked (Location *);
void location_changed (Location*);
diff --git a/libs/ardour/ardour/logcurve.h b/libs/ardour/ardour/logcurve.h
index 84911b0369..e65be55772 100644
--- a/libs/ardour/ardour/logcurve.h
+++ b/libs/ardour/ardour/logcurve.h
@@ -22,7 +22,7 @@
#define __ardour_logcurve_h__
#include <pbd/fastlog.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
namespace ARDOUR {
@@ -94,7 +94,7 @@ class LogCurve {
}
void set_length (uint32_t len) { l = len; }
- mutable PBD::NonBlockingLock lock;
+ mutable Glib::Mutex lock;
protected:
float a;
diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h
index c6cb65efc5..02aaa5c5c9 100644
--- a/libs/ardour/ardour/playlist.h
+++ b/libs/ardour/ardour/playlist.h
@@ -28,8 +28,9 @@
#include <sys/stat.h>
+#include <glib.h>
+
#include <sigc++/signal.h>
-#include <pbd/atomic.h>
#include <pbd/undo.h>
#include <ardour/ardour.h>
@@ -169,9 +170,9 @@ class Playlist : public Stateful, public StateManager {
RegionList regions;
string _name;
Session& _session;
- atomic_t block_notifications;
- atomic_t ignore_state_changes;
- mutable PBD::NonBlockingLock region_lock;
+ gint block_notifications;
+ gint ignore_state_changes;
+ mutable Glib::Mutex region_lock;
RegionList pending_removals;
RegionList pending_adds;
RegionList pending_bounds;
@@ -197,8 +198,8 @@ class Playlist : public Stateful, public StateManager {
void init (bool hide);
bool holding_state () const {
- return atomic_read (&block_notifications) != 0 ||
- atomic_read (&ignore_state_changes) != 0;
+ return g_atomic_int_get (&block_notifications) != 0 ||
+ g_atomic_int_get (&ignore_state_changes) != 0;
}
/* prevent the compiler from ever generating these */
diff --git a/libs/ardour/ardour/redirect.h b/libs/ardour/ardour/redirect.h
index b370589079..ede55a1d80 100644
--- a/libs/ardour/ardour/redirect.h
+++ b/libs/ardour/ardour/redirect.h
@@ -27,7 +27,8 @@
#include <map>
#include <sigc++/signal.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
+
#include <pbd/undo.h>
#include <ardour/ardour.h>
@@ -131,7 +132,7 @@ class Redirect : public IO
map<uint32_t,AutomationList*> parameter_automation;
set<uint32_t> visible_parameter_automation;
- mutable PBD::NonBlockingLock _automation_lock;
+ mutable Glib::Mutex _automation_lock;
void can_automate (uint32_t);
set<uint32_t> can_automate_list;
diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h
index 5af5a660c1..3c94dad6fd 100644
--- a/libs/ardour/ardour/region.h
+++ b/libs/ardour/ardour/region.h
@@ -221,7 +221,7 @@ class Region : public Stateful, public StateManager
string _name;
mutable RegionEditState _first_edit;
int _frozen;
- PBD::Lock lock;
+ Glib::Mutex lock;
ARDOUR::id_t _id;
ARDOUR::Playlist* _playlist;
mutable uint32_t _read_data_count; // modified in read()
diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h
index 8a707eb902..5699d9ef14 100644
--- a/libs/ardour/ardour/route.h
+++ b/libs/ardour/ardour/route.h
@@ -27,11 +27,8 @@
#include <map>
#include <string>
-#include <pthread.h>
-
-#include <pbd/atomic.h>
#include <pbd/fastlog.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
#include <pbd/xml++.h>
#include <pbd/undo.h>
#include <midi++/controllable.h>
@@ -142,14 +139,14 @@ class Route : public IO
void flush_redirects ();
template<class T> void foreach_redirect (T *obj, void (T::*func)(Redirect *)) {
- RWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (redirect_lock);
for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
(obj->*func) (*i);
}
}
Redirect *nth_redirect (uint32_t n) {
- RWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (redirect_lock);
RedirectList::iterator i;
for (i = _redirects.begin(); i != _redirects.end() && n; ++i, --n);
if (i == _redirects.end()) {
@@ -294,9 +291,9 @@ class Route : public IO
jack_nframes_t _roll_delay;
jack_nframes_t _own_latency;
RedirectList _redirects;
- PBD::NonBlockingRWLock redirect_lock;
+ Glib::RWLock redirect_lock;
IO *_control_outs;
- PBD::NonBlockingLock control_outs_lock;
+ Glib::Mutex control_outs_lock;
RouteGroup *_edit_group;
RouteGroup *_mix_group;
std::string _comment;
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 0d968fcff1..c78a53135a 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -31,9 +31,9 @@
#include <sndfile.h>
+#include <glibmm/thread.h>
+
#include <pbd/error.h>
-#include <pbd/atomic.h>
-#include <pbd/lockmonitor.h>
#include <pbd/undo.h>
#include <pbd/pool.h>
@@ -274,7 +274,7 @@ class Session : public sigc::trackable, public Stateful
typedef list<DiskStream *> DiskStreamList;
Session::DiskStreamList disk_streams() const {
- RWLockMonitor lm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (diskstream_lock);
return diskstreams; /* XXX yes, force a copy */
}
@@ -284,7 +284,7 @@ class Session : public sigc::trackable, public Stateful
typedef list<Route *> RouteList;
RouteList get_routes() const {
- RWLockMonitor rlock (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock rlock (route_lock);
return routes; /* XXX yes, force a copy */
}
@@ -310,7 +310,7 @@ class Session : public sigc::trackable, public Stateful
}
RecordState record_status() const {
- return (RecordState) atomic_read (&_record_status);
+ return (RecordState) g_atomic_int_get (&_record_status);
}
bool actively_recording () {
@@ -1004,12 +1004,12 @@ class Session : public sigc::trackable, public Stateful
typedef void (Session::*process_function_type)(jack_nframes_t);
AudioEngine &_engine;
- atomic_t processing_prohibited;
+ gint processing_prohibited;
process_function_type process_function;
process_function_type last_process_function;
jack_nframes_t _current_frame_rate;
int transport_sub_state;
- atomic_t _record_status;
+ gint _record_status;
jack_nframes_t _transport_frame;
Location* end_location;
Location* start_location;
@@ -1166,14 +1166,14 @@ class Session : public sigc::trackable, public Stateful
bool pending_abort;
bool pending_auto_loop;
- Sample* butler_mixdown_buffer;
- float* butler_gain_buffer;
- pthread_t butler_thread;
- PBD::NonBlockingLock butler_request_lock;
- pthread_cond_t butler_paused;
- bool butler_should_run;
- atomic_t butler_should_do_transport_work;
- int butler_request_pipe[2];
+ Sample* butler_mixdown_buffer;
+ float* butler_gain_buffer;
+ pthread_t butler_thread;
+ Glib::Mutex butler_request_lock;
+ Glib::Cond butler_paused;
+ bool butler_should_run;
+ gint butler_should_do_transport_work;
+ int butler_request_pipe[2];
struct ButlerRequest {
enum Type {
@@ -1417,10 +1417,10 @@ class Session : public sigc::trackable, public Stateful
static MultiAllocSingleReleasePool pool;
};
- PBD::Lock midi_lock;
+ Glib::Mutex midi_lock;
pthread_t midi_thread;
int midi_request_pipe[2];
- atomic_t butler_active;
+ gint butler_active;
RingBuffer<MIDIRequest*> midi_requests;
int start_midi_thread ();
@@ -1471,7 +1471,7 @@ class Session : public sigc::trackable, public Stateful
/* disk-streams */
DiskStreamList diskstreams;
- mutable PBD::NonBlockingRWLock diskstream_lock;
+ mutable Glib::RWLock diskstream_lock;
uint32_t dstream_buffer_size;
void add_diskstream (DiskStream*);
int load_diskstreams (const XMLNode&);
@@ -1479,7 +1479,7 @@ class Session : public sigc::trackable, public Stateful
/* routes stuff */
RouteList routes;
- mutable PBD::NonBlockingRWLock route_lock;
+ mutable Glib::RWLock route_lock;
void add_route (Route*);
uint32_t destructive_index;
@@ -1502,7 +1502,7 @@ class Session : public sigc::trackable, public Stateful
/* REGION MANAGEMENT */
- mutable PBD::Lock region_lock;
+ mutable Glib::Mutex region_lock;
typedef map<ARDOUR::id_t,AudioRegion *> AudioRegionList;
AudioRegionList audio_regions;
@@ -1515,7 +1515,7 @@ class Session : public sigc::trackable, public Stateful
/* SOURCES */
- mutable PBD::Lock source_lock;
+ mutable Glib::Mutex source_lock;
typedef std::map<id_t, Source *> SourceList;
SourceList sources;
@@ -1529,7 +1529,7 @@ class Session : public sigc::trackable, public Stateful
/* PLAYLISTS */
- mutable PBD::Lock playlist_lock;
+ mutable Glib::Mutex playlist_lock;
typedef set<Playlist *> PlaylistList;
PlaylistList playlists;
PlaylistList unused_playlists;
@@ -1547,7 +1547,7 @@ class Session : public sigc::trackable, public Stateful
/* NAMED SELECTIONS */
- mutable PBD::Lock named_selection_lock;
+ mutable Glib::Mutex named_selection_lock;
typedef set<NamedSelection *> NamedSelectionList;
NamedSelectionList named_selections;
@@ -1607,7 +1607,7 @@ class Session : public sigc::trackable, public Stateful
vector<space_and_path> session_dirs;
vector<space_and_path>::iterator last_rr_session_dir;
uint32_t _total_free_4k_blocks;
- PBD::Lock space_lock;
+ Glib::Mutex space_lock;
static const char* sound_dir_name;
static const char* tape_dir_name;
@@ -1618,15 +1618,15 @@ class Session : public sigc::trackable, public Stateful
int ensure_sound_dir (string, string&);
void refresh_disk_space ();
- atomic_t _playback_load;
- atomic_t _capture_load;
- atomic_t _playback_load_min;
- atomic_t _capture_load_min;
+ gint _playback_load;
+ gint _capture_load;
+ gint _playback_load_min;
+ gint _capture_load_min;
/* I/O Connections */
typedef list<Connection *> ConnectionList;
- mutable PBD::Lock connection_lock;
+ mutable Glib::Mutex connection_lock;
ConnectionList _connections;
int load_connections (const XMLNode&);
@@ -1685,7 +1685,7 @@ class Session : public sigc::trackable, public Stateful
Sample* click_emphasis_data;
jack_nframes_t click_length;
jack_nframes_t click_emphasis_length;
- mutable PBD::NonBlockingRWLock click_lock;
+ mutable Glib::RWLock click_lock;
static const Sample default_click[];
static const jack_nframes_t default_click_length;
diff --git a/libs/ardour/ardour/session_connection.h b/libs/ardour/ardour/session_connection.h
index caa20ed387..addc896b0b 100644
--- a/libs/ardour/ardour/session_connection.h
+++ b/libs/ardour/ardour/session_connection.h
@@ -29,7 +29,7 @@ namespace ARDOUR {
template<class T> void
Session::foreach_connection (T *obj, void (T::*func)(Connection *))
{
- LockMonitor lm (connection_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (connection_lock);
for (ConnectionList::iterator i = _connections.begin(); i != _connections.end(); i++) {
(obj->*func) (*i);
}
diff --git a/libs/ardour/ardour/session_diskstream.h b/libs/ardour/ardour/session_diskstream.h
index 24693c5793..3c888c92c3 100644
--- a/libs/ardour/ardour/session_diskstream.h
+++ b/libs/ardour/ardour/session_diskstream.h
@@ -29,7 +29,7 @@ namespace ARDOUR {
template<class T> void
Session::foreach_diskstream (T *obj, void (T::*func)(DiskStream&))
{
- RWLockMonitor lm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (diskstream_lock);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); i++) {
if (!(*i)->hidden()) {
(obj->*func) (**i);
diff --git a/libs/ardour/ardour/session_playlist.h b/libs/ardour/ardour/session_playlist.h
index 925a60182a..6f1b8dbd12 100644
--- a/libs/ardour/ardour/session_playlist.h
+++ b/libs/ardour/ardour/session_playlist.h
@@ -29,7 +29,7 @@ namespace ARDOUR {
template<class T> void
Session::foreach_playlist (T *obj, void (T::*func)(Playlist *))
{
- LockMonitor lm (playlist_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (playlist_lock);
for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); i++) {
if (!(*i)->hidden()) {
(obj->*func) (*i);
diff --git a/libs/ardour/ardour/session_region.h b/libs/ardour/ardour/session_region.h
index 16580d8e73..13d88a9aa4 100644
--- a/libs/ardour/ardour/session_region.h
+++ b/libs/ardour/ardour/session_region.h
@@ -8,7 +8,7 @@ namespace ARDOUR {
template<class T> void Session::foreach_audio_region (T *obj, void (T::*func)(AudioRegion *))
{
- LockMonitor lm (region_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (region_lock);
for (AudioRegionList::iterator i = audio_regions.begin(); i != audio_regions.end(); i++) {
(obj->*func) ((*i).second);
}
diff --git a/libs/ardour/ardour/session_route.h b/libs/ardour/ardour/session_route.h
index f3c8e3f5fb..afe78b394e 100644
--- a/libs/ardour/ardour/session_route.h
+++ b/libs/ardour/ardour/session_route.h
@@ -23,7 +23,8 @@
#include <iostream>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
+
#include <ardour/session.h>
#include <ardour/route.h>
@@ -35,7 +36,7 @@ Session::foreach_route (T *obj, void (T::*func)(Route&))
RouteList public_order;
{
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (route_lock);
public_order = routes;
}
@@ -53,7 +54,7 @@ Session::foreach_route (T *obj, void (T::*func)(Route*))
RouteList public_order;
{
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (route_lock);
public_order = routes;
}
@@ -72,7 +73,7 @@ Session::foreach_route (T *obj, void (T::*func)(Route&, A), A arg1)
RouteList public_order;
{
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (route_lock);
public_order = routes;
}
diff --git a/libs/ardour/ardour/session_selection.h b/libs/ardour/ardour/session_selection.h
index a1dd31d7ff..a110c2c3da 100644
--- a/libs/ardour/ardour/session_selection.h
+++ b/libs/ardour/ardour/session_selection.h
@@ -29,7 +29,7 @@ namespace ARDOUR {
template<class T> void
Session::foreach_named_selection (T& obj, void (T::*func)(NamedSelection&))
{
- LockMonitor lm (named_selection_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (named_selection_lock);
for (NamedSelectionList::iterator i = named_selections.begin(); i != named_selections.end(); i++) {
(obj.*func) (**i);
}
diff --git a/libs/ardour/ardour/slave.h b/libs/ardour/ardour/slave.h
index 90e63aed83..0079c10e0a 100644
--- a/libs/ardour/ardour/slave.h
+++ b/libs/ardour/ardour/slave.h
@@ -25,7 +25,6 @@
#include <jack/jack.h>
-#include <pthread.h>
#include <sigc++/signal.h>
#include <ardour/ardour.h>
#include <midi++/parser.h>
diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h
index 2bd6042ec2..5d11c9ef09 100644
--- a/libs/ardour/ardour/sndfilesource.h
+++ b/libs/ardour/ardour/sndfilesource.h
@@ -43,7 +43,7 @@ class SndFileSource : public ExternalSource {
mutable float *tmpbuf;
mutable jack_nframes_t tmpbufsize;
- mutable PBD::Lock _tmpbuf_lock;
+ mutable Glib::Mutex _tmpbuf_lock;
void init (const string &str, bool build_peak);
};
diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h
index 2eee7a7634..3781950fbf 100644
--- a/libs/ardour/ardour/source.h
+++ b/libs/ardour/ardour/source.h
@@ -25,10 +25,12 @@
#include <vector>
#include <string>
-#include <time.h>
+#include <ctime>
#include <sigc++/signal.h>
+#include <glibmm/thread.h>
+
#include <ardour/ardour.h>
#include <ardour/stateful.h>
#include <pbd/xml++.h>
@@ -125,7 +127,7 @@ class Source : public Stateful, public sigc::trackable
string _name;
uint32_t _use_cnt;
bool _peaks_built;
- mutable PBD::Lock _lock;
+ mutable Glib::Mutex _lock;
jack_nframes_t _length;
bool next_peak_clear_should_notify;
string peakpath;
@@ -156,7 +158,7 @@ class Source : public Stateful, public sigc::trackable
};
static vector<Source*> pending_peak_sources;
- static PBD::Lock pending_peak_sources_lock;
+ static Glib::StaticMutex pending_peak_sources_lock;
static void queue_for_peaks (Source&);
static void clear_queue_for_peaks ();
diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h
index 2f04f603e7..13e8eb6348 100644
--- a/libs/ardour/ardour/tempo.h
+++ b/libs/ardour/ardour/tempo.h
@@ -25,8 +25,7 @@
#include <string>
#include <vector>
#include <cmath>
-#include <pthread.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
#include <pbd/undo.h>
#include <sigc++/signal.h>
@@ -198,7 +197,7 @@ class TempoMap : public Stateful, public StateManager {
typedef vector<BBTPoint> BBTPointList;
template<class T> void apply_with_metrics (T& obj, void (T::*method)(const Metrics&)) {
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
(obj.*method)(*metrics);
}
@@ -285,7 +284,7 @@ class TempoMap : public Stateful, public StateManager {
jack_nframes_t last_bbt_when;
bool last_bbt_valid;
BBT_Time last_bbt;
- mutable PBD::Lock lock;
+ mutable Glib::Mutex lock;
void timestamp_metrics ();
diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc
index a0d43d5575..9f3c02ce43 100644
--- a/libs/ardour/audio_playlist.cc
+++ b/libs/ardour/audio_playlist.cc
@@ -203,7 +203,7 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, ch
its OK to block (for short intervals).
*/
- LockMonitor rm (region_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock rm (region_lock);
end = start + cnt - 1;
@@ -504,7 +504,7 @@ AudioPlaylist::add_crossfade (Crossfade& xfade)
void AudioPlaylist::notify_crossfade_added (Crossfade *x)
{
- if (atomic_read(&block_notifications)) {
+ if (g_atomic_int_get(&block_notifications)) {
_pending_xfade_adds.insert (_pending_xfade_adds.end(), x);
} else {
NewCrossfade (x); /* EMIT SIGNAL */
diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc
index 702d167a4f..30adc54d1a 100644
--- a/libs/ardour/audio_track.cc
+++ b/libs/ardour/audio_track.cc
@@ -625,7 +625,7 @@ AudioTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nfram
jack_nframes_t transport_frame;
{
- TentativeRWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (redirect_lock, Glib::TRY_LOCK);
if (lm.locked()) {
// automation snapshot can also be called from the non-rt context
// and it uses the redirect list, so we take the lock out here
@@ -709,7 +709,7 @@ AudioTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nfram
/* don't waste time with automation if we're recording or we've just stopped (yes it can happen) */
if (!diskstream->record_enabled() && _session.transport_rolling()) {
- TentativeLockMonitor am (automation_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock am (automation_lock, Glib::TRY_LOCK);
if (am.locked() && gain_automation_playback()) {
apply_gain_automation = _gain_automation_curve.rt_safe_get_vector (start_frame, end_frame, _session.gain_automation_buffer(), nframes);
@@ -789,7 +789,7 @@ AudioTrack::export_stuff (vector<Sample*>& buffers, char * workbuf, uint32_t nbu
vector<Sample*>::iterator bi;
Sample * b;
- RWLockMonitor rlock (redirect_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock rlock (redirect_lock);
if (diskstream->playlist()->read (buffers[0], mix_buffer, gain_buffer, workbuf, start, nframes) != nframes) {
return -1;
@@ -958,7 +958,7 @@ AudioTrack::freeze (InterThreadInfo& itt)
_freeze_record.have_mementos = true;
{
- RWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (redirect_lock);
for (RedirectList::iterator r = _redirects.begin(); r != _redirects.end(); ++r) {
@@ -1015,7 +1015,7 @@ AudioTrack::unfreeze ()
} else {
- RWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__); // should this be a write lock? jlc
+ Glib::RWLock::ReaderLock lm (redirect_lock); // should this be a write lock? jlc
for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
for (vector<FreezeRecordInsertInfo*>::iterator ii = _freeze_record.insert_info.begin(); ii != _freeze_record.insert_info.end(); ++ii) {
if ((*ii)->id == (*i)->id()) {
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index 9d736f765e..87866e7b31 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -22,6 +22,7 @@
#include <cerrno>
#include <vector>
+#include <glibmm/timer.h>
#include <pbd/pthread_utils.h>
#include <ardour/audioengine.h>
@@ -45,7 +46,6 @@ jack_nframes_t Port::long_over_length = 10;
AudioEngine::AudioEngine (string client_name)
{
- pthread_cond_init (&session_removed, 0);
session = 0;
session_remove_pending = false;
_running = false;
@@ -60,10 +60,12 @@ AudioEngine::AudioEngine (string client_name)
_buffer_size = 0;
_freewheeling = false;
_freewheel_thread_registered = false;
- last_meter_point = 0;
- meter_interval = 0;
- meter_thread_id = (pthread_t) 0;
+
+ m_meter_thread = 0;
+ m_meter_exit = false;
+ start_metering_thread();
+
if (connect_to_jack (client_name)) {
throw NoBackendAvailable ();
}
@@ -76,9 +78,9 @@ AudioEngine::~AudioEngine ()
jack_client_close (_jack);
}
- if (meter_thread_id != (pthread_t) 0) {
- pthread_cancel (meter_thread_id);
- }
+ if(m_meter_thread) {
+ g_atomic_int_inc(&m_meter_exit);
+ }
}
void
@@ -227,7 +229,7 @@ AudioEngine::_freewheel_callback (int onoff, void *arg)
int
AudioEngine::process_callback (jack_nframes_t nframes)
{
- TentativeLockMonitor tm (_process_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock tm (_process_lock, Glib::TRY_LOCK);
jack_nframes_t next_processed_frames;
/* handle wrap around of total frames counter */
@@ -246,7 +248,7 @@ AudioEngine::process_callback (jack_nframes_t nframes)
if (session_remove_pending) {
session = 0;
session_remove_pending = false;
- pthread_cond_signal (&session_removed);
+ session_removed.signal();
_processed_frames = next_processed_frames;
return 0;
}
@@ -269,14 +271,7 @@ AudioEngine::process_callback (jack_nframes_t nframes)
_processed_frames = next_processed_frames;
return 0;
}
-
- /* manage meters */
- if ((meter_interval > _buffer_size) && (last_meter_point + meter_interval < next_processed_frames)) {
- IO::Meter ();
- last_meter_point = next_processed_frames;
- }
-
if (last_monitor_check + monitor_check_interval < next_processed_frames) {
for (Ports::iterator i = ports.begin(); i != ports.end(); ++i) {
@@ -315,11 +310,6 @@ AudioEngine::jack_sample_rate_callback (jack_nframes_t nframes)
monitor_check_interval = nframes / 10;
last_monitor_check = 0;
- meter_interval = nframes / 100;
- last_meter_point = 0;
-
- maybe_start_metering_thread ();
-
if (session) {
session->set_frame_rate (nframes);
}
@@ -350,48 +340,25 @@ AudioEngine::jack_bufsize_callback (jack_nframes_t nframes)
session->set_block_size (_buffer_size);
}
- maybe_start_metering_thread ();
-
return 0;
}
void
-AudioEngine::maybe_start_metering_thread ()
-{
- if (meter_interval == 0) {
- return;
- }
-
- if (_buffer_size == 0) {
- return;
- }
-
- if (meter_interval < _buffer_size) {
- if (meter_thread_id != (pthread_t) 0) {
- pthread_cancel (meter_thread_id);
- }
- pthread_create (&meter_thread_id, 0, _meter_thread, this);
- }
-}
-
-void*
-AudioEngine::_meter_thread (void *arg)
+AudioEngine::start_metering_thread ()
{
- return static_cast<AudioEngine*>(arg)->meter_thread ();
+ if(m_meter_thread == 0) {
+ m_meter_thread = Glib::Thread::create (sigc::mem_fun(this, &AudioEngine::meter_thread), false);
+ }
}
-void*
+void
AudioEngine::meter_thread ()
{
- PBD::ThreadCreated (pthread_self(), "Metering");
-
- while (true) {
- usleep (10000); /* 1/100th sec interval */
- pthread_testcancel();
- IO::Meter ();
+ while (g_atomic_int_get(&m_meter_exit) != true) {
+ Glib::usleep (10000); /* 1/100th sec interval */
+ IO::update_meters ();
}
-
- return 0;
+ return;
}
void
@@ -405,13 +372,13 @@ AudioEngine::set_session (Session *s)
void
AudioEngine::remove_session ()
{
- LockMonitor lm (_process_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_process_lock);
if (_running) {
if (session) {
session_remove_pending = true;
- pthread_cond_wait (&session_removed, _process_lock.mutex());
+ session_removed.wait(_process_lock);
}
} else {
@@ -448,7 +415,7 @@ AudioEngine::register_audio_input_port (const string& portname)
} else {
- pthread_mutex_unlock (_process_lock.mutex());
+ _process_lock.unlock();
throw PortRegistrationFailure();
}
@@ -476,7 +443,7 @@ AudioEngine::register_audio_output_port (const string& portname)
} else {
- pthread_mutex_unlock (_process_lock.mutex());
+ _process_lock.unlock();
throw PortRegistrationFailure ();
}
@@ -633,7 +600,7 @@ AudioEngine::frames_per_cycle ()
Port *
AudioEngine::get_port_by_name (const string& portname, bool keep)
{
- LockMonitor lm (_process_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_process_lock);
if (!_running) {
if (!_has_run) {
@@ -966,7 +933,7 @@ AudioEngine::reconnect_to_jack ()
if (_jack) {
disconnect_from_jack ();
/* XXX give jackd a chance */
- usleep (250000);
+ Glib::usleep (250000);
}
if (connect_to_jack (jack_client_name)) {
diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc
index eb8dfbc123..21773d9222 100644
--- a/libs/ardour/audioregion.cc
+++ b/libs/ardour/audioregion.cc
@@ -27,8 +27,9 @@
#include <sigc++/bind.h>
#include <sigc++/class_slot.h>
+#include <glibmm/thread.h>
+
#include <pbd/basename.h>
-#include <pbd/lockmonitor.h>
#include <pbd/xml++.h>
#include <ardour/audioregion.h>
diff --git a/libs/ardour/auditioner.cc b/libs/ardour/auditioner.cc
index ed97cf7b39..ce7b9a3e6f 100644
--- a/libs/ardour/auditioner.cc
+++ b/libs/ardour/auditioner.cc
@@ -18,7 +18,7 @@
$Id$
*/
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
#include <ardour/diskstream.h>
#include <ardour/audioregion.h>
@@ -57,7 +57,7 @@ Auditioner::Auditioner (Session& s)
IO::output_changed.connect (mem_fun (*this, &Auditioner::output_changed));
the_region = 0;
- atomic_set (&_active, 0);
+ g_atomic_int_set (&_active, 0);
}
Auditioner::~Auditioner ()
@@ -74,14 +74,14 @@ Auditioner::prepare_playlist ()
void
Auditioner::audition_current_playlist ()
{
- if (atomic_read (&_active)) {
+ if (g_atomic_int_get (&_active)) {
/* don't go via session for this, because we are going
to remain active.
*/
cancel_audition ();
}
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
diskstream->seek (0);
length = diskstream->playlist()->get_maximum_extent();
current_frame = 0;
@@ -90,20 +90,20 @@ Auditioner::audition_current_playlist ()
_panner->reset (n_outputs(), diskstream->n_channels());
- atomic_set (&_active, 1);
+ g_atomic_int_set (&_active, 1);
}
void
Auditioner::audition_region (AudioRegion& region)
{
- if (atomic_read (&_active)) {
+ if (g_atomic_int_get (&_active)) {
/* don't go via session for this, because we are going
to remain active.
*/
cancel_audition ();
}
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
the_region = new AudioRegion (region);
the_region->set_position (0, this);
@@ -126,7 +126,7 @@ Auditioner::audition_region (AudioRegion& region)
length = the_region->length();
diskstream->seek (0);
current_frame = 0;
- atomic_set (&_active, 1);
+ g_atomic_int_set (&_active, 1);
}
int
@@ -136,7 +136,7 @@ Auditioner::play_audition (jack_nframes_t nframes)
jack_nframes_t this_nframes;
int ret;
- if (atomic_read (&_active) == 0) {
+ if (g_atomic_int_get (&_active) == 0) {
silence (nframes, 0);
return 0;
}
diff --git a/libs/ardour/automation_event.cc b/libs/ardour/automation_event.cc
index 88932009bf..17888c4a7c 100644
--- a/libs/ardour/automation_event.cc
+++ b/libs/ardour/automation_event.cc
@@ -225,7 +225,7 @@ void
AutomationList::clear ()
{
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
events.clear ();
if (!no_state) {
save_state (_("cleared"));
@@ -239,14 +239,14 @@ AutomationList::clear ()
void
AutomationList::x_scale (double factor)
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
_x_scale (factor);
}
bool
AutomationList::extend_to (double when)
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
if (events.empty() || events.back()->when == when) {
return false;
}
@@ -285,7 +285,7 @@ AutomationList::rt_add (double when, double value)
// cerr << "RT: alist @ " << this << " add " << value << " @ " << when << endl;
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
iterator where;
TimeComparator cmp;
@@ -369,7 +369,7 @@ AutomationList::add (double when, double value, bool for_loading)
/* this is for graphical editing and loading data from storage */
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
TimeComparator cmp;
ControlEvent cp (when, 0.0f);
bool insert = true;
@@ -413,7 +413,7 @@ void
AutomationList::erase (AutomationList::iterator i)
{
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
events.erase (i);
reposition_for_rt_add (0);
if (!no_state) {
@@ -428,7 +428,7 @@ void
AutomationList::erase (AutomationList::iterator start, AutomationList::iterator end)
{
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
events.erase (start, end);
reposition_for_rt_add (0);
if (!no_state) {
@@ -445,7 +445,7 @@ AutomationList::reset_range (double start, double endt)
bool reset = false;
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
TimeComparator cmp;
ControlEvent cp (start, 0.0f);
iterator s;
@@ -481,7 +481,7 @@ AutomationList::erase_range (double start, double endt)
bool erased = false;
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
TimeComparator cmp;
ControlEvent cp (start, 0.0f);
iterator s;
@@ -515,7 +515,7 @@ AutomationList::move_range (iterator start, iterator end, double xdelta, double
*/
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
while (start != end) {
(*start)->when += xdelta;
@@ -542,7 +542,7 @@ AutomationList::modify (iterator iter, double when, double val)
*/
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
(*iter)->when = when;
(*iter)->value = val;
if (!no_state) {
@@ -558,7 +558,7 @@ AutomationList::modify (iterator iter, double when, double val)
std::pair<AutomationList::iterator,AutomationList::iterator>
AutomationList::control_points_adjacent (double xval)
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
iterator i;
TimeComparator cmp;
ControlEvent cp (xval, 0.0f);
@@ -620,7 +620,7 @@ Change
AutomationList::restore_state (StateManager::State& state)
{
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
State* lstate = dynamic_cast<State*> (&state);
events.clear ();
@@ -655,7 +655,7 @@ void
AutomationList::truncate_end (double last_coordinate)
{
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
ControlEvent cp (last_coordinate, 0);
list<ControlEvent*>::reverse_iterator i;
double last_val;
@@ -760,7 +760,7 @@ void
AutomationList::truncate_start (double overall_length)
{
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
AutomationList::iterator i;
double first_legal_value;
double first_legal_coordinate;
@@ -998,7 +998,7 @@ AutomationList::cut (iterator start, iterator end)
AutomationList* nal = new AutomationList (default_value);
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
for (iterator x = start; x != end; ) {
iterator tmp;
@@ -1032,7 +1032,7 @@ AutomationList::cut_copy_clear (double start, double end, int op)
bool changed = false;
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
if ((s = lower_bound (events.begin(), events.end(), &cp, cmp)) == events.end()) {
return nal;
@@ -1094,7 +1094,7 @@ AutomationList::copy (iterator start, iterator end)
AutomationList* nal = new AutomationList (default_value);
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
for (iterator x = start; x != end; ) {
iterator tmp;
@@ -1141,7 +1141,7 @@ AutomationList::paste (AutomationList& alist, double pos, float times)
}
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
iterator where;
iterator prev;
double end = 0;
diff --git a/libs/ardour/connection.cc b/libs/ardour/connection.cc
index 83e0a87dc1..719751f7ba 100644
--- a/libs/ardour/connection.cc
+++ b/libs/ardour/connection.cc
@@ -28,7 +28,6 @@
#include "i18n.h"
using namespace ARDOUR;
-using namespace PBD;
Connection::Connection (const XMLNode& node)
{
@@ -58,7 +57,7 @@ void
Connection::add_connection (int port, string portname)
{
{
- LockMonitor lm (port_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (port_lock);
_ports[port].push_back (portname);
}
ConnectionsChanged (port); /* EMIT SIGNAL */
@@ -70,7 +69,7 @@ Connection::remove_connection (int port, string portname)
bool changed = false;
{
- LockMonitor lm (port_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (port_lock);
PortList& pl = _ports[port];
PortList::iterator i = find (pl.begin(), pl.end(), portname);
@@ -88,7 +87,7 @@ Connection::remove_connection (int port, string portname)
const Connection::PortList&
Connection::port_connections (int port) const
{
- LockMonitor lm (port_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (port_lock);
return _ports[port];
}
@@ -102,7 +101,7 @@ void
Connection::add_port ()
{
{
- LockMonitor lm (port_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (port_lock);
_ports.push_back (PortList());
}
ConfigurationChanged(); /* EMIT SIGNAL */
@@ -114,7 +113,7 @@ Connection::remove_port (int which_port)
bool changed = false;
{
- LockMonitor lm (port_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (port_lock);
vector<PortList>::iterator i;
int n;
@@ -135,7 +134,7 @@ void
Connection::clear ()
{
{
- LockMonitor lm (port_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (port_lock);
_ports.clear ();
}
diff --git a/libs/ardour/control_protocol_manager.cc b/libs/ardour/control_protocol_manager.cc
index ca1eefc3fe..57a89cc2d9 100644
--- a/libs/ardour/control_protocol_manager.cc
+++ b/libs/ardour/control_protocol_manager.cc
@@ -13,7 +13,6 @@
using namespace ARDOUR;
-using namespace PBD;
using namespace std;
#include "i18n.h"
@@ -32,7 +31,7 @@ ControlProtocolManager::ControlProtocolManager ()
ControlProtocolManager::~ControlProtocolManager()
{
- LockMonitor lm (protocols_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (protocols_lock);
for (list<ControlProtocol*>::iterator i = control_protocols.begin(); i != control_protocols.end(); ++i) {
delete (*i);
@@ -62,7 +61,7 @@ ControlProtocolManager::drop_session ()
_session = 0;
{
- LockMonitor lm (protocols_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (protocols_lock);
for (list<ControlProtocol*>::iterator p = control_protocols.begin(); p != control_protocols.end(); ++p) {
delete *p;
}
@@ -89,7 +88,7 @@ ControlProtocolManager::instantiate (ControlProtocolInfo& cpi)
return 0;
}
- LockMonitor lm (protocols_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (protocols_lock);
control_protocols.push_back (cpi.protocol);
return cpi.protocol;
@@ -113,7 +112,7 @@ ControlProtocolManager::teardown (ControlProtocolInfo& cpi)
cpi.descriptor->destroy (cpi.descriptor, cpi.protocol);
{
- LockMonitor lm (protocols_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (protocols_lock);
list<ControlProtocol*>::iterator p = find (control_protocols.begin(), control_protocols.end(), cpi.protocol);
if (p != control_protocols.end()) {
control_protocols.erase (p);
@@ -281,7 +280,7 @@ XMLNode&
ControlProtocolManager::get_state (void)
{
XMLNode* root = new XMLNode (state_node_name);
- LockMonitor lm (protocols_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (protocols_lock);
for (list<ControlProtocolInfo*>::iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) {
XMLNode* child = new XMLNode (X_("Protocol"));
diff --git a/libs/ardour/coreaudio_source.cc b/libs/ardour/coreaudio_source.cc
index d81630d6b7..3bab57587e 100644
--- a/libs/ardour/coreaudio_source.cc
+++ b/libs/ardour/coreaudio_source.cc
@@ -173,7 +173,7 @@ CoreAudioSource::read (Sample *dst, jack_nframes_t start, jack_nframes_t cnt, ch
uint32_t real_cnt = cnt * n_channels;
{
- LockMonitor lm (_tmpbuf_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_tmpbuf_lock);
if (tmpbufsize < real_cnt) {
diff --git a/libs/ardour/curve.cc b/libs/ardour/curve.cc
index 613222020c..a515c3a39a 100644
--- a/libs/ardour/curve.cc
+++ b/libs/ardour/curve.cc
@@ -28,7 +28,7 @@
#include <cfloat>
#include <cmath>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
#include <sigc++/bind.h>
#include "ardour/curve.h"
@@ -37,7 +37,6 @@
using namespace std;
using namespace ARDOUR;
-using namespace PBD;
using namespace sigc;
Curve::Curve (double minv, double maxv, double canv, bool nostate)
@@ -204,7 +203,7 @@ Curve::solve ()
bool
Curve::rt_safe_get_vector (double x0, double x1, float *vec, int32_t veclen)
{
- TentativeLockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock, Glib::TRY_LOCK);
if (!lm.locked()) {
return false;
@@ -217,7 +216,7 @@ Curve::rt_safe_get_vector (double x0, double x1, float *vec, int32_t veclen)
void
Curve::get_vector (double x0, double x1, float *vec, int32_t veclen)
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
_get_vector (x0, x1, vec, veclen);
}
diff --git a/libs/ardour/destructive_filesource.cc b/libs/ardour/destructive_filesource.cc
index eaa1242f8c..9a4c2425e9 100644
--- a/libs/ardour/destructive_filesource.cc
+++ b/libs/ardour/destructive_filesource.cc
@@ -268,7 +268,7 @@ jack_nframes_t
DestructiveFileSource::write (Sample* data, jack_nframes_t cnt, char * workbuf)
{
{
- LockMonitor lm (_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_lock);
jack_nframes_t old_file_pos;
diff --git a/libs/ardour/diskstream.cc b/libs/ardour/diskstream.cc
index 4fb13210fa..90e8387f3f 100644
--- a/libs/ardour/diskstream.cc
+++ b/libs/ardour/diskstream.cc
@@ -33,7 +33,7 @@
#include <pbd/error.h>
#include <pbd/basename.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
#include <pbd/xml++.h>
#include <ardour/ardour.h>
@@ -139,7 +139,7 @@ DiskStream::init (Flag f)
first_input_change = true;
_playlist = 0;
i_am_the_modifier = 0;
- atomic_set (&_record_enabled, 0);
+ g_atomic_int_set (&_record_enabled, 0);
was_recording = false;
capture_start_frame = 0;
capture_captured = 0;
@@ -213,7 +213,7 @@ DiskStream::destroy_channel (ChannelInfo &chan)
DiskStream::~DiskStream ()
{
- LockMonitor lm (state_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (state_lock);
if (_playlist) {
_playlist->unref ();
@@ -229,7 +229,7 @@ DiskStream::~DiskStream ()
void
DiskStream::handle_input_change (IOChange change, void *src)
{
- LockMonitor lm (state_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (state_lock);
if (!(input_change_pending & change)) {
input_change_pending = IOChange (input_change_pending|change);
@@ -241,7 +241,7 @@ void
DiskStream::non_realtime_input_change ()
{
{
- LockMonitor lm (state_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (state_lock);
if (input_change_pending == NoChange) {
return;
@@ -349,7 +349,7 @@ int
DiskStream::use_playlist (AudioPlaylist* playlist)
{
{
- LockMonitor lm (state_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (state_lock);
if (playlist == _playlist) {
return 0;
@@ -565,7 +565,7 @@ DiskStream::non_realtime_set_speed ()
{
if (_buffer_reallocation_required)
{
- LockMonitor lm (state_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (state_lock);
allocate_temporary_buffers ();
_buffer_reallocation_required = false;
@@ -753,7 +753,8 @@ DiskStream::process (jack_nframes_t transport_frame, jack_nframes_t nframes, jac
returns a non-zero value, in which case, ::commit should not be called.
*/
- if (pthread_mutex_trylock (state_lock.mutex())) {
+ // If we can't take the state lock return.
+ if (!state_lock.trylock()) {
return 1;
}
@@ -1002,7 +1003,7 @@ DiskStream::process (jack_nframes_t transport_frame, jack_nframes_t nframes, jac
be called. unlock the state lock.
*/
- pthread_mutex_unlock (state_lock.mutex());
+ state_lock.unlock();
}
return ret;
@@ -1011,7 +1012,7 @@ DiskStream::process (jack_nframes_t transport_frame, jack_nframes_t nframes, jac
void
DiskStream::recover ()
{
- pthread_mutex_unlock (state_lock.mutex());
+ state_lock.unlock();
_processed = false;
}
@@ -1047,7 +1048,7 @@ DiskStream::commit (jack_nframes_t nframes)
|| channels[0].capture_buf->read_space() >= disk_io_chunk_frames;
}
- pthread_mutex_unlock (state_lock.mutex());
+ state_lock.unlock();
_processed = false;
@@ -1140,7 +1141,7 @@ DiskStream::overwrite_existing_buffers ()
int
DiskStream::seek (jack_nframes_t frame, bool complete_refill)
{
- LockMonitor lm (state_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (state_lock);
uint32_t n;
int ret;
ChannelList::iterator chan;
@@ -1702,7 +1703,7 @@ DiskStream::transport_stopped (struct tm& when, time_t twhen, bool abort_capture
}
/* XXX is there anything we can do if err != 0 ? */
- LockMonitor lm (capture_info_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (capture_info_lock);
if (capture_info.empty()) {
return;
@@ -1925,7 +1926,7 @@ DiskStream::set_record_enabled (bool yn, void* src)
if (record_enabled() != yn) {
if (yn) {
- atomic_set (&_record_enabled, 1);
+ g_atomic_int_set (&_record_enabled, 1);
capturing_sources.clear ();
if (Config->get_use_hardware_monitoring()) {
for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) {
@@ -1941,7 +1942,7 @@ DiskStream::set_record_enabled (bool yn, void* src)
}
} else {
- atomic_set (&_record_enabled, 0);
+ g_atomic_int_set (&_record_enabled, 0);
if (Config->get_use_hardware_monitoring()) {
for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) {
if ((*chan).source) {
@@ -2415,7 +2416,7 @@ DiskStream::set_loop (Location *location)
jack_nframes_t
DiskStream::get_capture_start_frame (uint32_t n)
{
- LockMonitor lm (capture_info_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (capture_info_lock);
if (capture_info.size() > n) {
return capture_info[n]->start;
@@ -2428,7 +2429,7 @@ DiskStream::get_capture_start_frame (uint32_t n)
jack_nframes_t
DiskStream::get_captured_frames (uint32_t n)
{
- LockMonitor lm (capture_info_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (capture_info_lock);
if (capture_info.size() > n) {
return capture_info[n]->frames;
diff --git a/libs/ardour/filesource.cc b/libs/ardour/filesource.cc
index 568ce46bd1..63a9a3d014 100644
--- a/libs/ardour/filesource.cc
+++ b/libs/ardour/filesource.cc
@@ -53,10 +53,11 @@
#include <vector>
#include <cstdio> /* for rename(2) */
+#include <glibmm.h>
+
#include <pbd/stl_delete.h>
-#include <pbd/basename.h>
-#include <pbd/dirname.h>
-#include <pbd/lockmonitor.h>
+
+#include <glibmm/thread.h>
#include <pbd/pathscanner.h>
#include <ardour/ardour.h>
@@ -351,7 +352,7 @@ FileSource::set_allow_remove_if_empty (bool yn)
int
FileSource::set_name (string newname, bool destructive)
{
- LockMonitor lm (_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_lock);
string oldpath = _path;
string newpath = Session::change_audio_path_by_name (oldpath, _name, newname, destructive);
@@ -365,7 +366,7 @@ FileSource::set_name (string newname, bool destructive)
return -1;
}
- _name = basename (newpath);
+ _name = Glib::path_get_basename (newpath);
_path = newpath;
return rename_peakfile (peak_path (_path));
@@ -680,7 +681,7 @@ FileSource::compute_header_size ()
int
FileSource::update_header (jack_nframes_t when, struct tm& now, time_t tnow)
{
- LockMonitor lm (_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_lock);
if (is_bwf) {
/* random code is 9 digits */
@@ -1009,7 +1010,7 @@ FileSource::mark_for_remove ()
jack_nframes_t
FileSource::read (Sample *dst, jack_nframes_t start, jack_nframes_t cnt, char * workbuf) const
{
- LockMonitor lm (_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_lock);
return read_unlocked (dst, start, cnt, workbuf);
}
@@ -1055,7 +1056,7 @@ jack_nframes_t
FileSource::write (Sample *data, jack_nframes_t cnt, char * workbuf)
{
{
- LockMonitor lm (_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_lock);
jack_nframes_t oldlen;
int32_t frame_pos = _length;
@@ -1287,7 +1288,7 @@ FileSource::is_empty (string path)
void
FileSource::mark_streaming_write_completed ()
{
- LockMonitor lm (_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_lock);
next_peak_clear_should_notify = true;
@@ -1313,13 +1314,15 @@ FileSource::move_to_trash (const string trash_dir_name)
on whichever filesystem it was already on.
*/
- newpath = PBD::dirname (_path);
- newpath = PBD::dirname (newpath);
+ // XXX Portability
+
+ newpath = Glib::path_get_dirname (_path);
+ newpath = Glib::path_get_dirname (newpath);
newpath += '/';
newpath += trash_dir_name;
newpath += '/';
- newpath += PBD::basename (_path);
+ newpath += Glib::path_get_basename (_path);
if (access (newpath.c_str(), F_OK) == 0) {
diff --git a/libs/ardour/gdither.cc b/libs/ardour/gdither.cc
index 3cdd7ee89e..ec6bfaa2ea 100644
--- a/libs/ardour/gdither.cc
+++ b/libs/ardour/gdither.cc
@@ -175,7 +175,7 @@ inline static void gdither_innner_loop(const GDitherType dt,
const int clamp_l)
{
uint32_t pos, i;
- u_int8_t *o8 = (u_int8_t*) y;
+ uint8_t *o8 = (uint8_t*) y;
int16_t *o16 = (int16_t*) y;
int32_t *o32 = (int32_t*) y;
float tmp, r, ideal;
diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc
index 23e93ee2a9..762ee101f8 100644
--- a/libs/ardour/globals.cc
+++ b/libs/ardour/globals.cc
@@ -47,7 +47,10 @@
#include <ardour/utils.h>
#include <ardour/session.h>
#include <ardour/control_protocol_manager.h>
+
+#ifdef HAVE_LIBLO
#include <ardour/osc.h>
+#endif
#include <ardour/mix.h>
@@ -59,7 +62,10 @@
ARDOUR::Configuration* ARDOUR::Config = 0;
ARDOUR::AudioLibrary* ARDOUR::Library = 0;
+
+#ifdef HAVE_LIBLO
ARDOUR::OSC* ARDOUR::osc = 0;
+#endif
using namespace ARDOUR;
using namespace std;
@@ -74,6 +80,7 @@ Change ARDOUR::PositionChanged = ARDOUR::new_change ();
Change ARDOUR::NameChanged = ARDOUR::new_change ();
Change ARDOUR::BoundsChanged = Change (0); // see init(), below
+#ifdef HAVE_LIBLO
static int
setup_osc ()
{
@@ -89,6 +96,7 @@ setup_osc ()
return 0;
}
}
+#endif
static int
setup_midi ()
@@ -197,10 +205,12 @@ ARDOUR::init (AudioEngine& engine, bool use_vst, bool try_optimization, void (*s
if (setup_midi ()) {
return -1;
}
-
+
+#ifdef HAVE_LIBLO
if (setup_osc ()) {
return -1;
}
+#endif
#ifdef VST_SUPPORT
if (Config->get_use_vst() && fst_init (sighandler)) {
diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc
index 69d5ee7b11..c13816e648 100644
--- a/libs/ardour/import.cc
+++ b/libs/ardour/import.cc
@@ -30,7 +30,10 @@
#include <sndfile.h>
#include <samplerate.h>
+#include <glibmm.h>
+
#include <pbd/basename.h>
+
#include <ardour/ardour.h>
#include <ardour/session.h>
#include <ardour/diskstream.h>
@@ -212,7 +215,7 @@ Session::import_audiofile (import_status& status)
sources.push_back(newfiles[n]);
}
- AudioRegion *r = new AudioRegion (sources, 0, newfiles[0]->length(), region_name_from_path (PBD::basename(basepath)),
+ AudioRegion *r = new AudioRegion (sources, 0, newfiles[0]->length(), region_name_from_path (Glib::path_get_basename (basepath)),
0, AudioRegion::Flag (AudioRegion::DefaultFlags | AudioRegion::WholeFile));
status.new_regions.push_back (r);
@@ -228,7 +231,7 @@ Session::import_audiofile (import_status& status)
did not bother to create whole-file AudioRegions for them. Do it now.
*/
- AudioRegion *r = new AudioRegion (*newfiles[n], 0, newfiles[n]->length(), region_name_from_path (PBD::basename (newfiles[n]->name())),
+ AudioRegion *r = new AudioRegion (*newfiles[n], 0, newfiles[n]->length(), region_name_from_path (Glib::path_get_basename (newfiles[n]->name())),
0, AudioRegion::Flag (AudioRegion::DefaultFlags | AudioRegion::WholeFile | AudioRegion::Import));
status.new_regions.push_back (r);
@@ -285,7 +288,7 @@ Session::import_audiofile (import_status& status)
string
Session::build_tmp_convert_name(string infile)
{
- string tmp_name(_path + "/." + PBD::basename (infile.c_str()) + "XXXXXX");
+ string tmp_name(_path + "/." + Glib::path_get_basename (infile.c_str()) + "XXXXXX");
char* tmp = new char[tmp_name.length() + 1];
tmp_name.copy(tmp, string::npos);
tmp[tmp_name.length()] = 0;
diff --git a/libs/ardour/insert.cc b/libs/ardour/insert.cc
index 2c74bdc1c0..c3c3462016 100644
--- a/libs/ardour/insert.cc
+++ b/libs/ardour/insert.cc
@@ -76,7 +76,7 @@ PluginInsert::PluginInsert (Session& s, Plugin& plug, Placement placement)
save_state (_("initial state"));
{
- LockMonitor em (_session.engine().process_lock(), __LINE__, __FILE__);
+ Glib::Mutex::Lock em (_session.engine().process_lock());
IO::MoreOutputs (output_streams ());
}
@@ -97,7 +97,7 @@ PluginInsert::PluginInsert (Session& s, const XMLNode& node)
_plugins[0]->ParameterChanged.connect (mem_fun (*this, &PluginInsert::parameter_changed));
{
- LockMonitor em (_session.engine().process_lock(), __LINE__, __FILE__);
+ Glib::Mutex::Lock em (_session.engine().process_lock());
IO::MoreOutputs (output_streams());
}
}
@@ -410,7 +410,7 @@ PluginInsert::automation_run (vector<Sample *>& bufs, uint32_t nbufs, jack_nfram
jack_nframes_t now = _session.transport_frame ();
jack_nframes_t end = now + nframes;
- TentativeLockMonitor lm (_automation_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_automation_lock, Glib::TRY_LOCK);
if (!lm.locked()) {
connect_and_run (bufs, nbufs, nframes, offset, false);
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index b6ea1eee6e..fa30463bd4 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -25,7 +25,8 @@
#include <sigc++/bind.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
+
#include <pbd/xml++.h>
#include <ardour/audioengine.h>
@@ -70,6 +71,8 @@ sigc::signal<int> IO::PannersLegal;
sigc::signal<void,uint32_t> IO::MoreOutputs;
sigc::signal<int> IO::PortsCreated;
+Glib::StaticMutex IO::m_meter_signal_lock = GLIBMM_STATIC_MUTEX_INIT;
+
/* this is a default mapper of MIDI control values to a gain coefficient.
others can be imagined. see IO::set_midi_to_gain_function().
*/
@@ -126,13 +129,20 @@ IO::IO (Session& s, string name,
_gain_automation_state = Off;
_gain_automation_style = Absolute;
-
- Meter.connect (mem_fun (*this, &IO::meter));
+
+ {
+ // IO::Meter is emitted from another thread so the
+ // Meter signal must be protected.
+ Glib::Mutex::Lock guard (m_meter_signal_lock);
+ m_meter_connection = Meter.connect (mem_fun (*this, &IO::meter));
+ }
}
IO::~IO ()
{
- LockMonitor lm (io_lock, __LINE__, __FILE__);
+
+ Glib::Mutex::Lock guard (m_meter_signal_lock);
+ Glib::Mutex::Lock lm (io_lock);
vector<Port *>::iterator i;
for (i = _inputs.begin(); i != _inputs.end(); ++i) {
@@ -142,6 +152,8 @@ IO::~IO ()
for (i = _outputs.begin(); i != _outputs.end(); ++i) {
_session.engine().unregister_port (*i);
}
+
+ m_meter_connection.disconnect();
}
void
@@ -380,7 +392,7 @@ IO::deliver_output (vector<Sample *>& bufs, uint32_t nbufs, jack_nframes_t nfram
gain_t pangain = _gain;
{
- TentativeLockMonitor dm (declick_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock dm (declick_lock, Glib::TRY_LOCK);
if (dm.locked()) {
dg = _desired_gain;
@@ -427,7 +439,7 @@ IO::deliver_output_no_pan (vector<Sample *>& bufs, uint32_t nbufs, jack_nframes_
} else {
- TentativeLockMonitor dm (declick_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock dm (declick_lock, Glib::TRY_LOCK);
if (dm.locked()) {
dg = _desired_gain;
@@ -568,10 +580,10 @@ IO::disconnect_input (Port* our_port, string other_port, void* src)
}
{
- LockMonitor em (_session.engine().process_lock(), __LINE__, __FILE__);
+ Glib::Mutex::Lock em (_session.engine().process_lock());
{
- LockMonitor lm (io_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (io_lock);
/* check that our_port is really one of ours */
@@ -604,10 +616,10 @@ IO::connect_input (Port* our_port, string other_port, void* src)
}
{
- LockMonitor em(_session.engine().process_lock(), __LINE__, __FILE__);
+ Glib::Mutex::Lock em(_session.engine().process_lock());
{
- LockMonitor lm (io_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (io_lock);
/* check that our_port is really one of ours */
@@ -638,10 +650,10 @@ IO::disconnect_output (Port* our_port, string other_port, void* src)
}
{
- LockMonitor em(_session.engine().process_lock(), __LINE__, __FILE__);
+ Glib::Mutex::Lock em(_session.engine().process_lock());
{
- LockMonitor lm (io_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (io_lock);
if (find (_outputs.begin(), _outputs.end(), our_port) == _outputs.end()) {
return -1;
@@ -671,10 +683,10 @@ IO::connect_output (Port* our_port, string other_port, void* src)
}
{
- LockMonitor em(_session.engine().process_lock(), __LINE__, __FILE__);
+ Glib::Mutex::Lock em(_session.engine().process_lock());
{
- LockMonitor lm (io_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (io_lock);
/* check that our_port is really one of ours */
@@ -730,10 +742,10 @@ IO::remove_output_port (Port* port, void* src)
IOChange change (NoChange);
{
- LockMonitor em(_session.engine().process_lock(), __LINE__, __FILE__);
+ Glib::Mutex::Lock em(_session.engine().process_lock());
{
- LockMonitor lm (io_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (io_lock);
if (_noutputs - 1 == (uint32_t) _output_minimum) {
/* sorry, you can't do this */
@@ -779,10 +791,10 @@ IO::add_output_port (string destination, void* src)
char buf[64];
{
- LockMonitor em(_session.engine().process_lock(), __LINE__, __FILE__);
+ Glib::Mutex::Lock em(_session.engine().process_lock());
{
- LockMonitor lm (io_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (io_lock);
if (_output_maximum >= 0 && (int) _noutputs == _output_maximum) {
return -1;
@@ -830,10 +842,10 @@ IO::remove_input_port (Port* port, void* src)
IOChange change (NoChange);
{
- LockMonitor em(_session.engine().process_lock(), __LINE__, __FILE__);
+ Glib::Mutex::Lock em(_session.engine().process_lock());
{
- LockMonitor lm (io_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (io_lock);
if (((int)_ninputs - 1) < _input_minimum) {
/* sorry, you can't do this */
@@ -880,10 +892,10 @@ IO::add_input_port (string source, void* src)
char buf[64];
{
- LockMonitor em (_session.engine().process_lock(), __LINE__, __FILE__);
+ Glib::Mutex::Lock em (_session.engine().process_lock());
{
- LockMonitor lm (io_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (io_lock);
if (_input_maximum >= 0 && (int) _ninputs == _input_maximum) {
return -1;
@@ -931,10 +943,10 @@ int
IO::disconnect_inputs (void* src)
{
{
- LockMonitor em (_session.engine().process_lock(), __LINE__, __FILE__);
+ Glib::Mutex::Lock em (_session.engine().process_lock());
{
- LockMonitor lm (io_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (io_lock);
for (vector<Port *>::iterator i = _inputs.begin(); i != _inputs.end(); ++i) {
_session.engine().disconnect (*i);
@@ -951,10 +963,10 @@ int
IO::disconnect_outputs (void* src)
{
{
- LockMonitor em (_session.engine().process_lock(), __LINE__, __FILE__);
+ Glib::Mutex::Lock em (_session.engine().process_lock());
{
- LockMonitor lm (io_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (io_lock);
for (vector<Port *>::iterator i = _outputs.begin(); i != _outputs.end(); ++i) {
_session.engine().disconnect (*i);
@@ -1063,8 +1075,8 @@ IO::ensure_io (uint32_t nin, uint32_t nout, bool clear, void* src)
}
{
- LockMonitor em (_session.engine().process_lock(), __LINE__, __FILE__);
- LockMonitor lm (io_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock em (_session.engine().process_lock());
+ Glib::Mutex::Lock lm (io_lock);
Port* port;
@@ -1212,8 +1224,8 @@ IO::ensure_inputs (uint32_t n, bool clear, bool lockit, void* src)
}
if (lockit) {
- LockMonitor em (_session.engine().process_lock(), __LINE__, __FILE__);
- LockMonitor im (io_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock em (_session.engine().process_lock());
+ Glib::Mutex::Lock im (io_lock);
changed = ensure_inputs_locked (n, clear, src);
} else {
changed = ensure_inputs_locked (n, clear, src);
@@ -1314,8 +1326,8 @@ IO::ensure_outputs (uint32_t n, bool clear, bool lockit, void* src)
/* XXX caller should hold io_lock, but generally doesn't */
if (lockit) {
- LockMonitor em (_session.engine().process_lock(), __LINE__, __FILE__);
- LockMonitor im (io_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock em (_session.engine().process_lock());
+ Glib::Mutex::Lock im (io_lock);
changed = ensure_outputs_locked (n, clear, src);
} else {
changed = ensure_outputs_locked (n, clear, src);
@@ -1389,7 +1401,7 @@ IO::state (bool full_state)
bool need_ins = true;
bool need_outs = true;
LocaleGuard lg (X_("POSIX"));
- LockMonitor lm (io_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (io_lock);
node->add_property("name", _name);
snprintf (buf, sizeof(buf), "%" PRIu64, id());
@@ -2058,7 +2070,7 @@ IO::set_output_maximum (int n)
void
IO::set_port_latency (jack_nframes_t nframes)
{
- LockMonitor lm (io_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (io_lock);
for (vector<Port *>::iterator i = _outputs.begin(); i != _outputs.end(); ++i) {
(*i)->set_latency (nframes);
@@ -2109,8 +2121,8 @@ IO::use_input_connection (Connection& c, void* src)
uint32_t limit;
{
- LockMonitor lm (_session.engine().process_lock(), __LINE__, __FILE__);
- LockMonitor lm2 (io_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_session.engine().process_lock());
+ Glib::Mutex::Lock lm2 (io_lock);
limit = c.nports();
@@ -2187,8 +2199,8 @@ IO::use_output_connection (Connection& c, void* src)
uint32_t limit;
{
- LockMonitor lm (_session.engine().process_lock(), __LINE__, __FILE__);
- LockMonitor lm2 (io_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_session.engine().process_lock());
+ Glib::Mutex::Lock lm2 (io_lock);
limit = c.nports();
@@ -2437,10 +2449,26 @@ IO::send_state_changed ()
return;
}
+/**
+ Update the peak meters.
+
+ The meter signal lock is taken to prevent modification of the
+ Meter signal while updating the meters, taking the meter signal
+ lock prior to taking the io_lock ensures that all IO will remain
+ valid while metering.
+*/
+void
+IO::update_meters()
+{
+ Glib::Mutex::Lock guard (m_meter_signal_lock);
+
+ Meter();
+}
+
void
IO::meter ()
{
- LockMonitor lm (io_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (io_lock); // READER: meter thread.
uint32_t limit = max (_ninputs, _noutputs);
for (uint32_t n = 0; n < limit; ++n) {
@@ -2602,7 +2630,7 @@ IO::load_automation (const string& path)
void
IO::clear_automation ()
{
- LockMonitor lm (automation_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (automation_lock);
_gain_automation_curve.clear ();
_panner->clear_automation ();
}
@@ -2613,7 +2641,7 @@ IO::set_gain_automation_state (AutoState state)
bool changed = false;
{
- LockMonitor lm (automation_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (automation_lock);
if (state != _gain_automation_curve.automation_state()) {
changed = true;
@@ -2638,7 +2666,7 @@ IO::set_gain_automation_style (AutoStyle style)
bool changed = false;
{
- LockMonitor lm (automation_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (automation_lock);
if (style != _gain_automation_curve.automation_style()) {
changed = true;
@@ -2666,7 +2694,7 @@ IO::set_gain (gain_t val, void *src)
if (val>1.99526231f) val=1.99526231f;
{
- LockMonitor dm (declick_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock dm (declick_lock);
_desired_gain = val;
}
diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc
index 7d479637e3..28ec42a394 100644
--- a/libs/ardour/location.cc
+++ b/libs/ardour/location.cc
@@ -371,7 +371,7 @@ Locations::set_current (Location *loc, bool want_lock)
int ret;
if (want_lock) {
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
ret = set_current_unlocked (loc);
} else {
ret = set_current_unlocked (loc);
@@ -399,7 +399,7 @@ void
Locations::clear ()
{
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
LocationList::iterator tmp;
for (LocationList::iterator i = locations.begin(); i != locations.end(); ) {
tmp = i;
@@ -424,7 +424,7 @@ void
Locations::clear_markers ()
{
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
LocationList::iterator tmp;
for (LocationList::iterator i = locations.begin(); i != locations.end(); ) {
@@ -448,7 +448,7 @@ void
Locations::clear_ranges ()
{
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
LocationList::iterator tmp;
for (LocationList::iterator i = locations.begin(); i != locations.end(); ) {
@@ -477,7 +477,7 @@ void
Locations::add (Location *loc, bool make_current)
{
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
locations.push_back (loc);
if (make_current) {
@@ -507,7 +507,7 @@ Locations::remove (Location *loc)
}
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
for (i = locations.begin(); i != locations.end(); ++i) {
if ((*i) == loc) {
@@ -547,7 +547,7 @@ Locations::get_state ()
{
XMLNode *node = new XMLNode ("Locations");
LocationList::iterator iter;
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
for (iter = locations.begin(); iter != locations.end(); ++iter) {
node->add_child_nocopy ((*iter)->get_state ());
@@ -570,7 +570,7 @@ Locations::set_state (const XMLNode& node)
nlist = node.children();
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
Location *loc = new Location;
@@ -614,7 +614,7 @@ Locations::first_location_before (jack_nframes_t frame)
LocationList locs;
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
locs = locations;
}
@@ -638,7 +638,7 @@ Locations::first_location_after (jack_nframes_t frame)
LocationList locs;
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
locs = locations;
}
@@ -662,7 +662,7 @@ Locations::first_mark_before (jack_nframes_t frame)
LocationList locs;
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
locs = locations;
}
@@ -699,7 +699,7 @@ Locations::first_mark_after (jack_nframes_t frame)
LocationList locs;
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
locs = locations;
}
@@ -792,7 +792,7 @@ Change
Locations::restore_state (StateManager::State& state)
{
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
State* lstate = dynamic_cast<State*> (&state);
locations = lstate->locations;
@@ -817,7 +817,7 @@ uint32_t
Locations::num_range_markers () const
{
uint32_t cnt = 0;
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
for (LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) {
if ((*i)->is_range_marker()) {
++cnt;
diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc
index 6b0013cada..bc7b472732 100644
--- a/libs/ardour/panner.cc
+++ b/libs/ardour/panner.cc
@@ -28,9 +28,10 @@
#include <unistd.h>
#include <float.h>
+#include <glibmm.h>
+
#include <pbd/error.h>
#include <pbd/failed_constructor.h>
-#include <pbd/basename.h>
#include <pbd/xml++.h>
#include <ardour/session.h>
@@ -1369,7 +1370,7 @@ Panner::state (bool full)
if (full) {
if (save () == 0) {
- root->add_property (X_("automation"), PBD::basename (automation_path));
+ root->add_property (X_("automation"), Glib::path_get_basename (automation_path));
}
}
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index 73be1da86d..1bc6ccac6d 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -225,8 +225,8 @@ Playlist::copy_regions (RegionList& newlist) const
void
Playlist::init (bool hide)
{
- atomic_set (&block_notifications, 0);
- atomic_set (&ignore_state_changes, 0);
+ g_atomic_int_set (&block_notifications, 0);
+ g_atomic_int_set (&ignore_state_changes, 0);
pending_modified = false;
pending_length = false;
_refcnt = 0;
@@ -292,13 +292,13 @@ void
Playlist::freeze ()
{
delay_notifications ();
- atomic_inc (&ignore_state_changes);
+ g_atomic_int_inc (&ignore_state_changes);
}
void
Playlist::thaw ()
{
- atomic_dec (&ignore_state_changes);
+ g_atomic_int_dec_and_test (&ignore_state_changes);
release_notifications ();
}
@@ -306,14 +306,14 @@ Playlist::thaw ()
void
Playlist::delay_notifications ()
{
- atomic_inc (&block_notifications);
+ g_atomic_int_inc (&block_notifications);
freeze_length = _get_maximum_extent();
}
void
Playlist::release_notifications ()
{
- if (atomic_dec_and_test(&block_notifications)) {
+ if (g_atomic_int_dec_and_test (&block_notifications)) {
flush_notifications ();
}
}
diff --git a/libs/ardour/redirect.cc b/libs/ardour/redirect.cc
index 403e6edddd..746d2790e2 100644
--- a/libs/ardour/redirect.cc
+++ b/libs/ardour/redirect.cc
@@ -126,7 +126,7 @@ Redirect::load_automation (string path)
return 1;
}
- LockMonitor lm (_automation_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_automation_lock);
set<uint32_t> tosave;
parameter_automation.clear ();
@@ -159,7 +159,7 @@ Redirect::load_automation (string path)
int
Redirect::save_automation (string path)
{
- LockMonitor lm (_automation_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_automation_lock);
string fullpath;
if (parameter_automation.empty()) {
@@ -268,7 +268,7 @@ Redirect::state (bool full_state)
void
Redirect::what_has_automation (set<uint32_t>& s) const
{
- LockMonitor lm (_automation_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_automation_lock);
map<uint32_t,AutomationList*>::const_iterator li;
for (li = parameter_automation.begin(); li != parameter_automation.end(); ++li) {
@@ -279,7 +279,7 @@ Redirect::what_has_automation (set<uint32_t>& s) const
void
Redirect::what_has_visible_automation (set<uint32_t>& s) const
{
- LockMonitor lm (_automation_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_automation_lock);
set<uint32_t>::const_iterator li;
for (li = visible_parameter_automation.begin(); li != visible_parameter_automation.end(); ++li) {
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index 91d5704db2..08df23146b 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -26,7 +26,7 @@
#include <sigc++/bind.h>
#include <sigc++/class_slot.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
#include <pbd/xml++.h>
#include <ardour/region.h>
@@ -178,7 +178,7 @@ Region::restore_and_return_flags (RegionState& state)
Change what_changed = Change (0);
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
if (_start != state._start) {
what_changed = Change (what_changed|StartChanged);
@@ -947,7 +947,7 @@ Region::thaw (const string& why)
Change what_changed = Change (0);
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
if (_frozen && --_frozen > 0) {
return;
@@ -978,7 +978,7 @@ void
Region::send_change (Change what_changed)
{
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
if (_frozen) {
pending_changed = Change (pending_changed|what_changed);
return;
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 71beb945bf..93fbb85e49 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -235,7 +235,7 @@ Route::process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs,
declick = _pending_declick;
{
- TentativeLockMonitor cm (control_outs_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock cm (control_outs_lock, Glib::TRY_LOCK);
if (cm.locked()) {
co = _control_outs;
@@ -245,7 +245,7 @@ Route::process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs,
}
{
- TentativeLockMonitor dm (declick_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock dm (declick_lock, Glib::TRY_LOCK);
if (dm.locked()) {
dmg = desired_mute_gain;
@@ -330,7 +330,7 @@ Route::process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs,
-------------------------------------------------------------------------------------------------- */
if (with_redirects) {
- TentativeRWLockMonitor rm (redirect_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock rm (redirect_lock, Glib::TRY_LOCK);
if (rm.locked()) {
if (mute_gain > 0 || !_mute_affects_pre_fader) {
for (i = _redirects.begin(); i != _redirects.end(); ++i) {
@@ -499,7 +499,7 @@ Route::process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs,
if (post_fader_work) {
- TentativeRWLockMonitor rm (redirect_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock rm (redirect_lock, Glib::TRY_LOCK);
if (rm.locked()) {
if (mute_gain > 0 || !_mute_affects_post_fader) {
for (i = _redirects.begin(); i != _redirects.end(); ++i) {
@@ -723,7 +723,7 @@ Route::set_solo (bool yn, void *src)
void
Route::set_solo_mute (bool yn)
{
- LockMonitor lm (declick_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (declick_lock);
/* Called by Session in response to another Route being soloed.
*/
@@ -757,7 +757,7 @@ Route::set_mute (bool yn, void *src)
_midi_mute_control.send_feedback (_muted);
}
- LockMonitor lm (declick_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (declick_lock);
desired_mute_gain = (yn?0.0f:1.0f);
}
}
@@ -772,7 +772,7 @@ Route::add_redirect (Redirect *redirect, void *src, uint32_t* err_streams)
}
{
- RWLockMonitor lm (redirect_lock, true, __LINE__, __FILE__);
+ Glib::RWLock::WriterLock lm (redirect_lock);
PluginInsert* pi;
PortInsert* porti;
@@ -845,7 +845,7 @@ Route::add_redirects (const RedirectList& others, void *src, uint32_t* err_strea
}
{
- RWLockMonitor lm (redirect_lock, true, __LINE__, __FILE__);
+ Glib::RWLock::WriterLock lm (redirect_lock);
RedirectList::iterator existing_end = _redirects.end();
--existing_end;
@@ -904,7 +904,7 @@ Route::clear_redirects (void *src)
}
{
- RWLockMonitor lm (redirect_lock, true, __LINE__, __FILE__);
+ Glib::RWLock::WriterLock lm (redirect_lock);
for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
delete *i;
@@ -934,7 +934,7 @@ Route::remove_redirect (Redirect *redirect, void *src, uint32_t* err_streams)
redirect_max_outs = 0;
{
- RWLockMonitor lm (redirect_lock, true, __LINE__, __FILE__);
+ Glib::RWLock::WriterLock lm (redirect_lock);
RedirectList::iterator i;
bool removed = false;
@@ -1013,7 +1013,7 @@ Route::remove_redirect (Redirect *redirect, void *src, uint32_t* err_streams)
int
Route::reset_plugin_counts (uint32_t* lpc)
{
- RWLockMonitor lm (redirect_lock, true, __LINE__, __FILE__);
+ Glib::RWLock::WriterLock lm (redirect_lock);
return _reset_plugin_counts (lpc);
}
@@ -1183,7 +1183,7 @@ Route::copy_redirects (const Route& other, Placement placement, uint32_t* err_st
RedirectList to_be_deleted;
{
- RWLockMonitor lm (redirect_lock, true, __LINE__, __FILE__);
+ Glib::RWLock::WriterLock lm (redirect_lock);
RedirectList::iterator tmp;
RedirectList the_copy;
@@ -1262,7 +1262,7 @@ Route::copy_redirects (const Route& other, Placement placement, uint32_t* err_st
void
Route::all_redirects_flip ()
{
- RWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (redirect_lock);
if (_redirects.empty()) {
return;
@@ -1278,7 +1278,7 @@ Route::all_redirects_flip ()
void
Route::all_redirects_active (bool state)
{
- RWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (redirect_lock);
if (_redirects.empty()) {
return;
@@ -1300,7 +1300,7 @@ Route::sort_redirects (uint32_t* err_streams)
{
{
RedirectSorter comparator;
- RWLockMonitor lm (redirect_lock, true, __LINE__, __FILE__);
+ Glib::RWLock::WriterLock lm (redirect_lock);
uint32_t old_rmo = redirect_max_outs;
/* the sweet power of C++ ... */
@@ -1779,7 +1779,7 @@ Route::silence (jack_nframes_t nframes, jack_nframes_t offset)
}
{
- TentativeRWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (redirect_lock, Glib::TRY_LOCK);
if (lm.locked()) {
for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
@@ -1804,7 +1804,7 @@ Route::silence (jack_nframes_t nframes, jack_nframes_t offset)
int
Route::set_control_outs (const vector<string>& ports)
{
- LockMonitor lm (control_outs_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (control_outs_lock);
vector<string>::const_iterator i;
if (_control_outs) {
@@ -2007,7 +2007,7 @@ Route::transport_stopped (bool abort_ignored, bool did_locate, bool can_flush_re
jack_nframes_t now = _session.transport_frame();
{
- RWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (redirect_lock);
if (!did_locate) {
automation_snapshot (now);
@@ -2126,7 +2126,7 @@ Route::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t
bool can_record, bool rec_monitors_input)
{
{
- TentativeRWLockMonitor lm(redirect_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (redirect_lock, Glib::TRY_LOCK);
if (lm.locked()) {
// automation snapshot can also be called from the non-rt context
// and it uses the redirect list, so we take the lock out here
@@ -2150,7 +2150,7 @@ Route::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t
apply_gain_automation = false;
{
- TentativeLockMonitor am (automation_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock am (automation_lock, Glib::TRY_LOCK);
if (am.locked() && _session.transport_rolling()) {
@@ -2242,7 +2242,7 @@ Route::send_all_midi_feedback ()
if (_session.get_midi_feedback()) {
{
- RWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (redirect_lock);
for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
(*i)->send_all_midi_feedback ();
}
@@ -2262,7 +2262,7 @@ Route::write_midi_feedback (MIDI::byte* buf, int32_t& bufsize)
buf = _midi_mute_control.write_feedback (buf, bufsize, _muted);
{
- RWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (redirect_lock);
for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
buf = (*i)->write_midi_feedback (buf, bufsize);
}
@@ -2278,7 +2278,7 @@ Route::flush_redirects ()
this is called from the RT audio thread.
*/
- RWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (redirect_lock);
for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
(*i)->deactivate ();
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index a8ab2204dc..d729b5d7f7 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -32,12 +32,13 @@
#include <sigc++/bind.h>
#include <sigc++/retype.h>
+#include <glibmm.h>
+
#include <pbd/error.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
#include <pbd/pathscanner.h>
#include <pbd/stl_delete.h>
#include <pbd/basename.h>
-#include <pbd/dirname.h>
#include <ardour/audioengine.h>
#include <ardour/configuration.h>
@@ -64,7 +65,10 @@
#include <ardour/crossfade.h>
#include <ardour/playlist.h>
#include <ardour/click.h>
+
+#ifdef HAVE_LIBLO
#include <ardour/osc.h>
+#endif
#include "i18n.h"
@@ -550,7 +554,7 @@ Session::set_worst_io_latencies (bool take_lock)
}
if (take_lock) {
- route_lock.read_lock ();
+ route_lock.reader_lock ();
}
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
@@ -559,7 +563,7 @@ Session::set_worst_io_latencies (bool take_lock)
}
if (take_lock) {
- route_lock.unlock ();
+ route_lock.reader_unlock ();
}
}
@@ -794,10 +798,12 @@ Session::when_engine_running ()
_engine.set_session (this);
+#ifdef HAVE_LIBLO
/* and to OSC */
osc->set_session (*this);
-
+#endif
+
_state_of_the_state = Clean;
DirtyChanged (); /* EMIT SIGNAL */
@@ -954,7 +960,7 @@ Session::set_auto_input (bool yn)
a non-tentative rwlock here, because the action must occur.
The rarity and short potential lock duration makes this "OK"
*/
- RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock dsm (diskstream_lock);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
if ((*i)->record_enabled ()) {
//cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl;
@@ -972,7 +978,7 @@ void
Session::reset_input_monitor_state ()
{
if (transport_rolling()) {
- RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock dsm (diskstream_lock);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
if ((*i)->record_enabled ()) {
//cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl;
@@ -980,7 +986,7 @@ Session::reset_input_monitor_state ()
}
}
} else {
- RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock dsm (diskstream_lock);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
if ((*i)->record_enabled ()) {
//cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl;
@@ -1247,8 +1253,8 @@ void
Session::enable_record ()
{
/* XXX really atomic compare+swap here */
- if (atomic_read (&_record_status) != Recording) {
- atomic_set (&_record_status, Recording);
+ if (g_atomic_int_get (&_record_status) != Recording) {
+ g_atomic_int_set (&_record_status, Recording);
_last_record_location = _transport_frame;
send_mmc_in_another_thread (MIDI::MachineControl::cmdRecordStrobe);
@@ -1257,7 +1263,7 @@ Session::enable_record ()
a non-tentative rwlock here, because the action must occur.
The rarity and short potential lock duration makes this "OK"
*/
- RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock dsm (diskstream_lock);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
if ((*i)->record_enabled ()) {
@@ -1275,13 +1281,13 @@ Session::disable_record (bool rt_context, bool force)
{
RecordState rs;
- if ((rs = (RecordState) atomic_read (&_record_status)) != Disabled) {
+ if ((rs = (RecordState) g_atomic_int_get (&_record_status)) != Disabled) {
if (!Config->get_latched_record_enable () || force) {
- atomic_set (&_record_status, Disabled);
+ g_atomic_int_set (&_record_status, Disabled);
} else {
if (rs == Recording) {
- atomic_set (&_record_status, Enabled);
+ g_atomic_int_set (&_record_status, Enabled);
}
}
@@ -1292,7 +1298,7 @@ Session::disable_record (bool rt_context, bool force)
a non-tentative rwlock here, because the action must occur.
The rarity and short potential lock duration makes this "OK"
*/
- RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock dsm (diskstream_lock);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
if ((*i)->record_enabled ()) {
@@ -1312,14 +1318,14 @@ Session::disable_record (bool rt_context, bool force)
void
Session::step_back_from_record ()
{
- atomic_set (&_record_status, Enabled);
+ g_atomic_int_set (&_record_status, Enabled);
if (Config->get_use_hardware_monitoring()) {
/* Even though this can be called from RT context we are using
a non-tentative rwlock here, because the action must occur.
The rarity and short potential lock duration makes this "OK"
*/
- RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock dsm (diskstream_lock);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
if (auto_input && (*i)->record_enabled ()) {
@@ -1333,7 +1339,7 @@ Session::step_back_from_record ()
void
Session::maybe_enable_record ()
{
- atomic_set (&_record_status, Enabled);
+ g_atomic_int_set (&_record_status, Enabled);
/* XXX this save should really happen in another thread. its needed so that
pending capture state can be recovered if we crash.
@@ -1441,8 +1447,8 @@ Session::set_block_size (jack_nframes_t nframes)
*/
{
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
- RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (route_lock);
+ Glib::RWLock::ReaderLock dsm (diskstream_lock);
vector<Sample*>::iterator i;
uint32_t np;
@@ -1519,7 +1525,7 @@ Session::set_default_fade (float steepness, float fade_msecs)
{
// jlc, WTF is this!
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (route_lock);
AudioRegion::set_default_fade (steepness, fade_frames);
}
@@ -1670,7 +1676,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod
/* count existing audio tracks */
{
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (route_lock);
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
if (dynamic_cast<AudioTrack*>(*i) != 0) {
if (!(*i)->hidden()) {
@@ -1786,7 +1792,7 @@ Session::new_audio_route (int input_channels, int output_channels)
/* count existing audio busses */
{
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (route_lock);
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
if (dynamic_cast<AudioTrack*>(*i) == 0) {
if (!(*i)->hidden()) {
@@ -1869,7 +1875,7 @@ void
Session::add_route (Route* route)
{
{
- RWLockMonitor lm (route_lock, true, __LINE__, __FILE__);
+ Glib::RWLock::WriterLock lm (route_lock);
routes.push_front (route);
resort_routes(0);
}
@@ -1900,7 +1906,7 @@ Session::add_diskstream (DiskStream* dstream)
dstream->do_refill(0, 0, 0);
{
- RWLockMonitor lm (diskstream_lock, true, __LINE__, __FILE__);
+ Glib::RWLock::WriterLock lm (diskstream_lock);
diskstreams.push_back (dstream);
}
@@ -1928,7 +1934,7 @@ void
Session::remove_route (Route& route)
{
{
- RWLockMonitor lm (route_lock, true, __LINE__, __FILE__);
+ Glib::RWLock::WriterLock lm (route_lock);
routes.remove (&route);
/* deleting the master out seems like a dumb
@@ -1956,7 +1962,7 @@ Session::remove_route (Route& route)
}
{
- RWLockMonitor lm (diskstream_lock, true, __LINE__, __FILE__);
+ Glib::RWLock::WriterLock lm (diskstream_lock);
AudioTrack* at;
@@ -1992,7 +1998,7 @@ Session::route_solo_changed (void* src, Route* route)
return;
}
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (route_lock);
bool is_track;
is_track = (dynamic_cast<AudioTrack*>(route) != 0);
@@ -2191,14 +2197,14 @@ Session::catch_up_on_solo ()
basis, but needs the global overview that only the session
has.
*/
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (route_lock);
update_route_solo_state();
}
Route *
Session::route_by_name (string name)
{
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (route_lock);
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
if ((*i)->name() == name) {
@@ -2212,7 +2218,7 @@ Session::route_by_name (string name)
Route *
Session::route_by_remote_id (uint32_t id)
{
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (route_lock);
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
if ((*i)->remote_control_id() == id) {
@@ -2262,7 +2268,7 @@ Session::get_maximum_extent () const
DiskStream *
Session::diskstream_by_name (string name)
{
- RWLockMonitor lm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (diskstream_lock);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
if ((*i)->name() == name) {
@@ -2276,7 +2282,7 @@ Session::diskstream_by_name (string name)
DiskStream *
Session::diskstream_by_id (id_t id)
{
- RWLockMonitor lm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (diskstream_lock);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
if ((*i)->id() == id) {
@@ -2348,7 +2354,7 @@ Session::region_name (string& result, string base, bool newlevel) const
if (base == "") {
- LockMonitor lm (region_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (region_lock);
snprintf (buf, sizeof (buf), "%d", (int)audio_regions.size() + 1);
@@ -2376,7 +2382,7 @@ Session::region_name (string& result, string base, bool newlevel) const
bool name_taken = true;
{
- LockMonitor lm (region_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (region_lock);
for (int n = 1; n < 5000; ++n) {
@@ -2415,7 +2421,7 @@ Session::add_region (Region* region)
bool added = false;
{
- LockMonitor lm (region_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (region_lock);
if ((ar = dynamic_cast<AudioRegion*> (region)) != 0) {
@@ -2492,7 +2498,7 @@ Session::remove_region (Region* region)
bool removed = false;
{
- LockMonitor lm (region_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (region_lock);
if ((ar = dynamic_cast<AudioRegion*> (region)) != 0) {
if ((i = audio_regions.find (region->id())) != audio_regions.end()) {
@@ -2523,7 +2529,7 @@ Session::find_whole_file_parent (AudioRegion& child)
{
AudioRegionList::iterator i;
AudioRegion* region;
- LockMonitor lm (region_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (region_lock);
for (i = audio_regions.begin(); i != audio_regions.end(); ++i) {
@@ -2599,7 +2605,7 @@ Session::remove_last_capture ()
{
list<Region*> r;
- RWLockMonitor lm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (diskstream_lock);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
list<Region*>& l = (*i)->last_capture_regions();
@@ -2629,7 +2635,7 @@ Session::add_source (Source* source)
pair<SourceList::key_type, SourceList::mapped_type> entry;
{
- LockMonitor lm (source_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (source_lock);
entry.first = source->id();
entry.second = source;
sources.insert (entry);
@@ -2647,7 +2653,7 @@ Session::remove_source (Source* source)
SourceList::iterator i;
{
- LockMonitor lm (source_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (source_lock);
if ((i = sources.find (source->id())) != sources.end()) {
sources.erase (i);
@@ -2669,7 +2675,7 @@ Session::remove_source (Source* source)
Source *
Session::get_source (ARDOUR::id_t id)
{
- LockMonitor lm (source_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (source_lock);
SourceList::iterator i;
Source* source = 0;
@@ -2687,8 +2693,8 @@ Session::peak_path_from_audio_path (string audio_path)
string res;
- res = PBD::dirname (audio_path);
- res = PBD::dirname (res);
+ res = Glib::path_get_dirname (audio_path);
+ res = Glib::path_get_dirname (res);
res += '/';
res += peak_dir_name;
res += '/';
@@ -2702,7 +2708,7 @@ string
Session::change_audio_path_by_name (string path, string oldname, string newname, bool destructive)
{
string look_for;
- string old_basename = basename_nosuffix (oldname);
+ string old_basename = PBD::basename_nosuffix (oldname);
string new_legalized = legalize_for_path (newname);
/* note: we know (or assume) the old path is already valid */
@@ -2915,7 +2921,7 @@ Session::get_playlist (string name)
Playlist *
Session::playlist_by_name (string name)
{
- LockMonitor lm (playlist_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (playlist_lock);
for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i) {
if ((*i)->name() == name) {
return* i;
@@ -2937,7 +2943,7 @@ Session::add_playlist (Playlist* playlist)
}
{
- LockMonitor lm (playlist_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (playlist_lock);
if (find (playlists.begin(), playlists.end(), playlist) == playlists.end()) {
playlists.insert (playlists.begin(), playlist);
// playlist->ref();
@@ -2957,7 +2963,7 @@ Session::track_playlist (Playlist* pl, bool inuse)
PlaylistList::iterator x;
{
- LockMonitor lm (playlist_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (playlist_lock);
if (!inuse) {
//cerr << "shifting playlist to unused: " << pl->name() << endl;
@@ -2989,7 +2995,7 @@ Session::remove_playlist (Playlist* playlist)
}
{
- LockMonitor lm (playlist_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (playlist_lock);
// cerr << "removing playlist: " << playlist->name() << endl;
PlaylistList::iterator i;
@@ -3105,7 +3111,7 @@ void
Session::set_all_solo (bool yn)
{
{
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (route_lock);
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
if (!(*i)->hidden()) {
@@ -3121,7 +3127,7 @@ void
Session::set_all_mute (bool yn)
{
{
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (route_lock);
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
if (!(*i)->hidden()) {
@@ -3136,7 +3142,7 @@ Session::set_all_mute (bool yn)
uint32_t
Session::n_diskstreams () const
{
- RWLockMonitor lm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (diskstream_lock);
uint32_t n = 0;
for (DiskStreamList::const_iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
@@ -3150,7 +3156,7 @@ Session::n_diskstreams () const
void
Session::foreach_diskstream (void (DiskStream::*func)(void))
{
- RWLockMonitor lm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (diskstream_lock);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
if (!(*i)->hidden()) {
((*i)->*func)();
@@ -3169,8 +3175,8 @@ Session::graph_reordered ()
return;
}
- RWLockMonitor lm1 (route_lock, true, __LINE__, __FILE__);
- RWLockMonitor lm2 (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::WriterLock lm1 (route_lock);
+ Glib::RWLock::ReaderLock lm2 (diskstream_lock);
resort_routes (0);
@@ -3198,7 +3204,7 @@ Session::record_enable_all ()
void
Session::record_enable_change_all (bool yn)
{
- RWLockMonitor lm1 (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm1 (route_lock);
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
AudioTrack* at;
@@ -3283,7 +3289,7 @@ void
Session::add_connection (ARDOUR::Connection* connection)
{
{
- LockMonitor (connection_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock guard (connection_lock);
_connections.push_back (connection);
}
@@ -3298,7 +3304,7 @@ Session::remove_connection (ARDOUR::Connection* connection)
bool removed = false;
{
- LockMonitor (connection_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock guard (connection_lock);
ConnectionList::iterator i = find (_connections.begin(), _connections.end(), connection);
if (i != _connections.end()) {
@@ -3317,7 +3323,7 @@ Session::remove_connection (ARDOUR::Connection* connection)
ARDOUR::Connection *
Session::connection_by_name (string name) const
{
- LockMonitor lm (connection_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (connection_lock);
for (ConnectionList::const_iterator i = _connections.begin(); i != _connections.end(); ++i) {
if ((*i)->name() == name) {
@@ -3334,7 +3340,7 @@ Session::set_edit_mode (EditMode mode)
_edit_mode = mode;
{
- LockMonitor lm (playlist_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (playlist_lock);
for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i) {
(*i)->set_edit_mode (mode);
@@ -3409,7 +3415,7 @@ Session::next_insert_name ()
NamedSelection *
Session::named_selection_by_name (string name)
{
- LockMonitor lm (named_selection_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (named_selection_lock);
for (NamedSelectionList::iterator i = named_selections.begin(); i != named_selections.end(); ++i) {
if ((*i)->name == name) {
return* i;
@@ -3422,7 +3428,7 @@ void
Session::add_named_selection (NamedSelection* named_selection)
{
{
- LockMonitor lm (named_selection_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (named_selection_lock);
named_selections.insert (named_selections.begin(), named_selection);
}
@@ -3437,7 +3443,7 @@ Session::remove_named_selection (NamedSelection* named_selection)
bool removed = false;
{
- LockMonitor lm (named_selection_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (named_selection_lock);
NamedSelectionList::iterator i = find (named_selections.begin(), named_selections.end(), named_selection);
@@ -3459,7 +3465,7 @@ Session::reset_native_file_format ()
{
// jlc - WHY take routelock?
//RWLockMonitor lm1 (route_lock, true, __LINE__, __FILE__);
- RWLockMonitor lm2 (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm2 (diskstream_lock);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
(*i)->reset_write_sources (false);
@@ -3469,7 +3475,7 @@ Session::reset_native_file_format ()
bool
Session::route_name_unique (string n) const
{
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (route_lock);
for (RouteList::const_iterator i = routes.begin(); i != routes.end(); ++i) {
if ((*i)->name() == n) {
@@ -3489,7 +3495,7 @@ Session::remove_file_source (FileSource& fs)
uint32_t
Session::n_playlists () const
{
- LockMonitor lm (playlist_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (playlist_lock);
return playlists.size();
}
@@ -3538,7 +3544,7 @@ Session::add_instant_xml (XMLNode& node, const std::string& dir)
int
Session::freeze (InterThreadInfo& itt)
{
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (route_lock);
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
@@ -3573,7 +3579,7 @@ Session::write_one_track (AudioTrack& track, jack_nframes_t start, jack_nframes_
char * workbuf = 0;
const jack_nframes_t chunk_size = (256 * 1024)/4;
- atomic_set (&processing_prohibited, 1);
+ g_atomic_int_set (&processing_prohibited, 1);
/* call tree *MUST* hold route_lock */
@@ -3694,7 +3700,7 @@ Session::write_one_track (AudioTrack& track, jack_nframes_t start, jack_nframes_
delete [] workbuf;
}
- atomic_set (&processing_prohibited, 0);
+ g_atomic_int_set (&processing_prohibited, 0);
itt.done = true;
@@ -3714,7 +3720,7 @@ uint32_t
Session::ntracks () const
{
uint32_t n = 0;
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (route_lock);
for (RouteList::const_iterator i = routes.begin(); i != routes.end(); ++i) {
if (dynamic_cast<AudioTrack*> (*i)) {
@@ -3729,7 +3735,7 @@ uint32_t
Session::nbusses () const
{
uint32_t n = 0;
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (route_lock);
for (RouteList::const_iterator i = routes.begin(); i != routes.end(); ++i) {
if (dynamic_cast<AudioTrack*> (*i) == 0) {
diff --git a/libs/ardour/session_butler.cc b/libs/ardour/session_butler.cc
index dafc28385b..ebe0d64548 100644
--- a/libs/ardour/session_butler.cc
+++ b/libs/ardour/session_butler.cc
@@ -26,8 +26,9 @@
#include <fcntl.h>
#include <poll.h>
+#include <glibmm/thread.h>
+
#include <pbd/error.h>
-#include <pbd/lockmonitor.h>
#include <pbd/pthread_utils.h>
#include <ardour/configuration.h>
@@ -73,8 +74,6 @@ Session::start_butler_thread ()
Crossfade::set_buffer_size (dstream_buffer_size);
- pthread_cond_init (&butler_paused, 0);
-
butler_should_run = false;
if (pipe (butler_request_pipe)) {
@@ -114,7 +113,7 @@ Session::terminate_butler_thread ()
void
Session::schedule_butler_transport_work ()
{
- atomic_inc (&butler_should_do_transport_work);
+ g_atomic_int_inc (&butler_should_do_transport_work);
summon_butler ();
}
@@ -135,19 +134,19 @@ Session::summon_butler ()
void
Session::stop_butler ()
{
- LockMonitor lm (butler_request_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (butler_request_lock);
char c = ButlerRequest::Pause;
::write (butler_request_pipe[1], &c, 1);
- pthread_cond_wait (&butler_paused, butler_request_lock.mutex());
+ butler_paused.wait(butler_request_lock);
}
void
Session::wait_till_butler_finished ()
{
- LockMonitor lm (butler_request_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (butler_request_lock);
char c = ButlerRequest::Wake;
::write (butler_request_pipe[1], &c, 1);
- pthread_cond_wait (&butler_paused, butler_request_lock.mutex());
+ butler_paused.wait(butler_request_lock);
}
void *
@@ -158,7 +157,7 @@ Session::_butler_thread_work (void* arg)
return 0;
}
-#define transport_work_requested() atomic_read(&butler_should_do_transport_work)
+#define transport_work_requested() g_atomic_int_get(&butler_should_do_transport_work)
void *
Session::butler_thread_work ()
@@ -256,7 +255,7 @@ Session::butler_thread_work ()
gettimeofday (&begin, 0);
- RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock dsm (diskstream_lock);
for (i = diskstreams.begin(); !transport_work_requested() && butler_should_run && i != diskstreams.end(); ++i) {
@@ -355,7 +354,7 @@ Session::butler_thread_work ()
{
- LockMonitor lm (butler_request_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (butler_request_lock);
if (butler_should_run && (disk_work_outstanding || transport_work_requested())) {
// for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
@@ -365,7 +364,7 @@ Session::butler_thread_work ()
continue;
}
- pthread_cond_signal (&butler_paused);
+ butler_paused.signal();
}
}
@@ -398,7 +397,7 @@ Session::overwrite_some_buffers (DiskStream* ds)
} else {
- RWLockMonitor dm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock dm (diskstream_lock);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
(*i)->set_pending_overwrite (true);
}
@@ -429,36 +428,36 @@ Session::write_data_rate () const
uint32_t
Session::playback_load ()
{
- return (uint32_t) atomic_read (&_playback_load);
+ return (uint32_t) g_atomic_int_get (&_playback_load);
}
uint32_t
Session::capture_load ()
{
- return (uint32_t) atomic_read (&_capture_load);
+ return (uint32_t) g_atomic_int_get (&_capture_load);
}
uint32_t
Session::playback_load_min ()
{
- return (uint32_t) atomic_read (&_playback_load_min);
+ return (uint32_t) g_atomic_int_get (&_playback_load_min);
}
uint32_t
Session::capture_load_min ()
{
- return (uint32_t) atomic_read (&_capture_load_min);
+ return (uint32_t) g_atomic_int_get (&_capture_load_min);
}
void
Session::reset_capture_load_min ()
{
- atomic_set (&_capture_load_min, 100);
+ g_atomic_int_set (&_capture_load_min, 100);
}
void
Session::reset_playback_load_min ()
{
- atomic_set (&_playback_load_min, 100);
+ g_atomic_int_set (&_playback_load_min, 100);
}
diff --git a/libs/ardour/session_click.cc b/libs/ardour/session_click.cc
index c9777500a2..4503287da1 100644
--- a/libs/ardour/session_click.cc
+++ b/libs/ardour/session_click.cc
@@ -47,7 +47,7 @@ Session::click (jack_nframes_t start, jack_nframes_t nframes, jack_nframes_t off
return;
}
- TentativeRWLockMonitor clickm (click_lock, true, __LINE__, __FILE__);
+ Glib::RWLock::WriterLock clickm (click_lock, Glib::TRY_LOCK);
if (!clickm.locked() || _transport_speed != 1.0 || !_clicking || click_data == 0) {
_click_io->silence (nframes, offset);
@@ -209,7 +209,7 @@ Session::setup_click_sounds (int which)
void
Session::clear_clicks ()
{
- RWLockMonitor lm (click_lock, true, __LINE__, __FILE__);
+ Glib::RWLock::WriterLock lm (click_lock);
for (Clicks::iterator i = clicks.begin(); i != clicks.end(); ++i) {
delete *i;
diff --git a/libs/ardour/session_events.cc b/libs/ardour/session_events.cc
index 2aeace81f4..d48bbe3053 100644
--- a/libs/ardour/session_events.cc
+++ b/libs/ardour/session_events.cc
@@ -24,7 +24,7 @@
#include <ardour/timestamps.h>
#include <pbd/error.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
#include <ardour/ardour.h>
#include <ardour/session.h>
diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc
index 677b2c1258..183b6df237 100644
--- a/libs/ardour/session_export.cc
+++ b/libs/ardour/session_export.cc
@@ -37,7 +37,7 @@
#include <sigc++/bind.h>
#include <pbd/error.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
#include <ardour/gdither.h>
#include <ardour/timestamps.h>
@@ -485,7 +485,7 @@ Session::prepare_to_export (AudioExportSpecification& spec)
/* take everyone out of awrite to avoid disasters */
{
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (route_lock);
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
(*i)->protect_automation ();
}
@@ -494,7 +494,7 @@ Session::prepare_to_export (AudioExportSpecification& spec)
/* get everyone to the right position */
{
- RWLockMonitor lm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (diskstream_lock);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
if ((*i)-> seek (spec.start_frame, true)) {
error << string_compose (_("%1: cannot seek to %2 for export"),
@@ -524,7 +524,7 @@ Session::prepare_to_export (AudioExportSpecification& spec)
set_transport_speed (1.0, false);
butler_transport_work ();
- atomic_set (&butler_should_do_transport_work, 0);
+ g_atomic_int_set (&butler_should_do_transport_work, 0);
post_transport ();
/* we are ready to go ... */
diff --git a/libs/ardour/session_feedback.cc b/libs/ardour/session_feedback.cc
index 600567892e..ea8580b3c2 100644
--- a/libs/ardour/session_feedback.cc
+++ b/libs/ardour/session_feedback.cc
@@ -28,8 +28,10 @@
#include <midi++/types.h>
#include <midi++/port.h>
#include <midi++/manager.h>
+
+#include <glibmm/thread.h>
+
#include <pbd/error.h>
-#include <pbd/lockmonitor.h>
#include <pbd/pthread_utils.h>
#include <ardour/configuration.h>
diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc
index aa079f8827..d8382c69a4 100644
--- a/libs/ardour/session_midi.cc
+++ b/libs/ardour/session_midi.cc
@@ -30,7 +30,7 @@
#include <midi++/port.h>
#include <midi++/manager.h>
#include <pbd/error.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
#include <pbd/pthread_utils.h>
#include <ardour/configuration.h>
@@ -110,7 +110,7 @@ Session::set_midi_control (bool yn)
poke_midi_thread ();
if (_midi_port) {
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock guard (route_lock);
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
(*i)->reset_midi_control (_midi_port, midi_control);
}
@@ -601,7 +601,7 @@ Session::mmc_record_strobe (MIDI::MachineControl &mmc)
*/
save_state ("", true);
- atomic_set (&_record_status, Enabled);
+ g_atomic_int_set (&_record_status, Enabled);
RecordStateChanged (); /* EMIT SIGNAL */
request_transport_speed (1.0);
@@ -783,7 +783,7 @@ Session::mmc_record_enable (MIDI::MachineControl &mmc, size_t trk, bool enabled)
if (mmc_control) {
RouteList::iterator i;
- RWLockMonitor (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock guard (route_lock);
for (i = routes.begin(); i != routes.end(); ++i) {
AudioTrack *at;
@@ -908,7 +908,7 @@ Session::send_full_time_code ()
msg[8] = smpte.frames;
{
- LockMonitor lm (midi_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (midi_lock);
if (_mtc_port->midimsg (msg, sizeof (msg))) {
error << _("Session: could not send full MIDI time code") << endmsg;
@@ -940,7 +940,7 @@ Session::send_midi_time_code ()
// Send quarter frames up to current time
{
- LockMonitor lm (midi_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (midi_lock);
switch(next_quarter_frame_to_send) {
case 0:
@@ -1075,7 +1075,7 @@ Session::deliver_mmc (MIDI::MachineControl::Command cmd, jack_nframes_t where)
mmc_buffer[nbytes++] = 0xf7; // terminate SysEx/MMC message
- LockMonitor lm (midi_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (midi_lock);
if (_mmc_port->write (mmc_buffer, nbytes) != nbytes) {
error << string_compose(_("MMC: cannot send command %1%2%3"), &hex, cmd, &dec) << endmsg;
diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc
index 3280a5f4bb..2f098a384f 100644
--- a/libs/ardour/session_process.cc
+++ b/libs/ardour/session_process.cc
@@ -23,14 +23,13 @@
#include <algorithm>
#include <unistd.h>
-#include <ardour/timestamps.h>
-
#include <pbd/error.h>
-#include <pbd/atomic.h>
-#include <pbd/lockmonitor.h>
+
+#include <glibmm/thread.h>
#include <ardour/ardour.h>
#include <ardour/session.h>
+#include <ardour/timestamps.h>
#include <ardour/diskstream.h>
#include <ardour/audioengine.h>
#include <ardour/slave.h>
@@ -54,7 +53,7 @@ Session::process (jack_nframes_t nframes)
}
if (non_realtime_work_pending()) {
- if (atomic_read (&butler_should_do_transport_work) == 0) {
+ if (g_atomic_int_get (&butler_should_do_transport_work) == 0) {
post_transport ();
}
}
@@ -85,7 +84,7 @@ Session::no_roll (jack_nframes_t nframes, jack_nframes_t offset)
this is really bad ...
*/
- if (atomic_read (&processing_prohibited)) {
+ if (g_atomic_int_get (&processing_prohibited)) {
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
(*i)->silence (nframes, offset);
}
@@ -222,15 +221,15 @@ Session::commit_diskstreams (jack_nframes_t nframes, bool &needs_butler)
cworst = min (cworst, (*i)->capture_buffer_load());
}
- uint32_t pmin = atomic_read (&_playback_load);
- uint32_t pminold = atomic_read (&_playback_load_min);
- uint32_t cmin = atomic_read (&_capture_load);
- uint32_t cminold = atomic_read (&_capture_load_min);
+ uint32_t pmin = g_atomic_int_get (&_playback_load);
+ uint32_t pminold = g_atomic_int_get (&_playback_load_min);
+ uint32_t cmin = g_atomic_int_get (&_capture_load);
+ uint32_t cminold = g_atomic_int_get (&_capture_load_min);
- atomic_set (&_playback_load, (uint32_t) floor (pworst * 100.0f));
- atomic_set (&_capture_load, (uint32_t) floor (cworst * 100.0f));
- atomic_set (&_playback_load_min, min (pmin, pminold));
- atomic_set (&_capture_load_min, min (cmin, cminold));
+ g_atomic_int_set (&_playback_load, (uint32_t) floor (pworst * 100.0f));
+ g_atomic_int_set (&_capture_load, (uint32_t) floor (cworst * 100.0f));
+ g_atomic_int_set (&_playback_load_min, min (pmin, pminold));
+ g_atomic_int_set (&_capture_load_min, min (cmin, cminold));
if (actively_recording()) {
set_dirty();
@@ -280,8 +279,8 @@ Session::process_with_events (jack_nframes_t nframes)
end_frame = _transport_frame + nframes;
{
- TentativeRWLockMonitor rm (route_lock, false, __LINE__, __FILE__);
- TentativeRWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock rm (route_lock, Glib::TRY_LOCK);
+ Glib::RWLock::ReaderLock dsm (diskstream_lock, Glib::TRY_LOCK);
Event* this_event;
Events::iterator the_next_one;
@@ -557,7 +556,7 @@ Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset)
if (slave_state == Waiting) {
// cerr << "waiting at " << slave_transport_frame << endl;
- TentativeRWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock dsm (diskstream_lock, Glib::TRY_LOCK);
if (dsm.locked() && slave_transport_frame >= slave_wait_end) {
// cerr << "\tstart at " << _transport_frame << endl;
@@ -679,7 +678,7 @@ Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset)
bool need_butler;
- TentativeRWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock dsm (diskstream_lock, Glib::TRY_LOCK);
if (!dsm.locked()) {
goto noroll;
}
@@ -730,8 +729,8 @@ Session::process_without_events (jack_nframes_t nframes)
long frames_moved;
{
- TentativeRWLockMonitor rm (route_lock, false, __LINE__, __FILE__);
- TentativeRWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock rm (route_lock, Glib::TRY_LOCK);
+ Glib::RWLock::ReaderLock dsm (diskstream_lock, Glib::TRY_LOCK);
if (!rm.locked() || !dsm.locked() || (post_transport_work & (PostTransportLocate|PostTransportStop))) {
no_roll (nframes, 0);
@@ -802,7 +801,7 @@ Session::process_without_events (jack_nframes_t nframes)
void
Session::process_audition (jack_nframes_t nframes)
{
- TentativeRWLockMonitor rm (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock rm (route_lock, Glib::TRY_LOCK);
Event* ev;
if (rm.locked()) {
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index eaadec0fd3..cf510e9881 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -44,14 +44,15 @@
#include <sys/param.h>
#endif
+#include <glibmm.h>
+
#include <midi++/mmc.h>
#include <midi++/port.h>
#include <pbd/error.h>
-#include <pbd/dirname.h>
-#include <pbd/lockmonitor.h>
+
+#include <glibmm/thread.h>
#include <pbd/pathscanner.h>
#include <pbd/pthread_utils.h>
-#include <pbd/basename.h>
#include <pbd/strsplit.h>
#include <ardour/audioengine.h>
@@ -118,7 +119,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
_tempo_map = new TempoMap (_current_frame_rate);
_tempo_map->StateChanged.connect (mem_fun (*this, &Session::tempo_map_changed));
- atomic_set (&processing_prohibited, 0);
+ g_atomic_int_set (&processing_prohibited, 0);
send_cnt = 0;
insert_cnt = 0;
_transport_speed = 0;
@@ -129,7 +130,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
end_location = new Location (0, 0, _("end"), Location::Flags ((Location::IsMark|Location::IsEnd)));
start_location = new Location (0, 0, _("start"), Location::Flags ((Location::IsMark|Location::IsStart)));
_end_location_is_free = true;
- atomic_set (&_record_status, Disabled);
+ g_atomic_int_set (&_record_status, Disabled);
auto_play = false;
punch_in = false;
punch_out = false;
@@ -170,12 +171,12 @@ Session::first_stage_init (string fullpath, string snapshot_name)
midi_control = true;
mmc = 0;
post_transport_work = PostTransportWork (0);
- atomic_set (&butler_should_do_transport_work, 0);
- atomic_set (&butler_active, 0);
- atomic_set (&_playback_load, 100);
- atomic_set (&_capture_load, 100);
- atomic_set (&_playback_load_min, 100);
- atomic_set (&_capture_load_min, 100);
+ g_atomic_int_set (&butler_should_do_transport_work, 0);
+ g_atomic_int_set (&butler_active, 0);
+ g_atomic_int_set (&_playback_load, 100);
+ g_atomic_int_set (&_capture_load, 100);
+ g_atomic_int_set (&_playback_load_min, 100);
+ g_atomic_int_set (&_capture_load_min, 100);
pending_audition_region = 0;
_edit_mode = Slide;
pending_edit_mode = _edit_mode;
@@ -1334,7 +1335,7 @@ Session::state(bool full_state)
child = node->add_child ("Sources");
if (full_state) {
- LockMonitor sl (source_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock sl (source_lock);
for (SourceList::iterator siter = sources.begin(); siter != sources.end(); ++siter) {
@@ -1363,7 +1364,7 @@ Session::state(bool full_state)
child = node->add_child ("Regions");
if (full_state) {
- LockMonitor rl (region_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock rl (region_lock);
for (AudioRegionList::const_iterator i = audio_regions.begin(); i != audio_regions.end(); ++i) {
@@ -1378,7 +1379,7 @@ Session::state(bool full_state)
child = node->add_child ("DiskStreams");
{
- RWLockMonitor dl (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock dl (diskstream_lock);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
if (!(*i)->hidden()) {
child->add_child_nocopy ((*i)->get_state());
@@ -1390,7 +1391,7 @@ Session::state(bool full_state)
child = node->add_child ("Connections");
{
- LockMonitor lm (connection_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (connection_lock);
for (ConnectionList::iterator i = _connections.begin(); i != _connections.end(); ++i) {
if (!(*i)->system_dependent()) {
child->add_child_nocopy ((*i)->get_state());
@@ -1400,7 +1401,7 @@ Session::state(bool full_state)
child = node->add_child ("Routes");
{
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (route_lock);
RoutePublicOrderSorter cmp;
RouteList public_order(routes);
@@ -1803,7 +1804,7 @@ Session::get_sources_as_xml ()
{
XMLNode* node = new XMLNode (X_("Sources"));
- LockMonitor lm (source_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (source_lock);
for (SourceList::iterator i = sources.begin(); i != sources.end(); ++i) {
node->add_child_nocopy ((*i).second->get_state());
@@ -1958,7 +1959,7 @@ Session::refresh_disk_space ()
#if HAVE_SYS_VFS_H
struct statfs statfsbuf;
vector<space_and_path>::iterator i;
- LockMonitor lm (space_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (space_lock);
double scale;
/* get freespace on every FS that is part of the session path */
@@ -2399,7 +2400,7 @@ Session::load_route_groups (const XMLNode& node, bool edit)
void
Session::swap_configuration(Configuration** new_config)
{
- RWLockMonitor lm (route_lock, true, __LINE__, __FILE__); // jlc - WHY?
+ Glib::RWLock::WriterLock lm (route_lock); // jlc - WHY?
Configuration* tmp = *new_config;
*new_config = Config;
Config = tmp;
@@ -2409,7 +2410,7 @@ Session::swap_configuration(Configuration** new_config)
void
Session::copy_configuration(Configuration* new_config)
{
- RWLockMonitor lm (route_lock, true, __LINE__, __FILE__);
+ Glib::RWLock::WriterLock lm (route_lock);
new_config = new Configuration(*Config);
}
@@ -2588,7 +2589,7 @@ Session::GlobalRouteBooleanState
Session::get_global_route_boolean (bool (Route::*method)(void) const)
{
GlobalRouteBooleanState s;
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (route_lock);
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
if (!(*i)->hidden()) {
@@ -2608,7 +2609,7 @@ Session::GlobalRouteMeterState
Session::get_global_route_metering ()
{
GlobalRouteMeterState s;
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (route_lock);
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
if (!(*i)->hidden()) {
@@ -3065,13 +3066,13 @@ Session::cleanup_sources (Session::cleanup_report& rep)
on whichever filesystem it was already on.
*/
- newpath = PBD::dirname (*x);
- newpath = PBD::dirname (newpath);
+ newpath = Glib::path_get_dirname (*x);
+ newpath = Glib::path_get_dirname (newpath);
newpath += '/';
newpath += dead_sound_dir_name;
newpath += '/';
- newpath += PBD::basename ((*x));
+ newpath += Glib::path_get_basename ((*x));
if (access (newpath.c_str(), F_OK) == 0) {
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc
index 6e756b28b7..db15b64c32 100644
--- a/libs/ardour/session_transport.cc
+++ b/libs/ardour/session_transport.cc
@@ -27,7 +27,7 @@
#include <pbd/undo.h>
#include <pbd/error.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
#include <pbd/pthread_utils.h>
#include <midi++/mmc.h>
@@ -190,8 +190,8 @@ Session::realtime_stop (bool abort)
void
Session::butler_transport_work ()
{
- RWLockMonitor rm (route_lock, false, __LINE__, __FILE__);
- RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock rm (route_lock);
+ Glib::RWLock::ReaderLock dsm (diskstream_lock);
if (post_transport_work & PostTransportCurveRealloc) {
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
@@ -240,13 +240,13 @@ Session::butler_transport_work ()
non_realtime_set_audition ();
}
- atomic_dec (&butler_should_do_transport_work);
+ g_atomic_int_dec_and_test (&butler_should_do_transport_work);
}
void
Session::non_realtime_set_speed ()
{
- RWLockMonitor lm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (diskstream_lock);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
(*i)->non_realtime_set_speed ();
@@ -256,7 +256,7 @@ Session::non_realtime_set_speed ()
void
Session::non_realtime_overwrite ()
{
- RWLockMonitor lm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (diskstream_lock);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
if ((*i)->pending_overwrite) {
@@ -395,9 +395,9 @@ Session::non_realtime_stop (bool abort)
*/
if (!Config->get_latched_record_enable()) {
- atomic_set (&_record_status, Disabled);
+ g_atomic_int_set (&_record_status, Disabled);
} else {
- atomic_set (&_record_status, Enabled);
+ g_atomic_int_set (&_record_status, Enabled);
}
RecordStateChanged (); /* emit signal */
}
@@ -625,7 +625,7 @@ Session::locate (jack_nframes_t target_frame, bool with_roll, bool with_flush, b
/* this is functionally what clear_clicks() does but with a tentative lock */
- TentativeRWLockMonitor clickm (click_lock, true, __LINE__, __FILE__);
+ Glib::RWLock::WriterLock clickm (click_lock, Glib::TRY_LOCK);
if (clickm.locked()) {
@@ -644,7 +644,7 @@ Session::locate (jack_nframes_t target_frame, bool with_roll, bool with_flush, b
a non-tentative rwlock here, because the action must occur.
The rarity and short potential lock duration makes this "OK"
*/
- RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock dsm (diskstream_lock);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
if ((*i)->record_enabled ()) {
//cerr << "switching from input" << __FILE__ << __LINE__ << endl << endl;
@@ -659,7 +659,7 @@ Session::locate (jack_nframes_t target_frame, bool with_roll, bool with_flush, b
a non-tentative rwlock here, because the action must occur.
The rarity and short potential lock duration makes this "OK"
*/
- RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock dsm (diskstream_lock);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
if ((*i)->record_enabled ()) {
//cerr << "switching to input" << __FILE__ << __LINE__ << endl << endl;
@@ -703,7 +703,7 @@ Session::set_transport_speed (float speed, bool abort)
a non-tentative rwlock here, because the action must occur.
The rarity and short potential lock duration makes this "OK"
*/
- RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock dsm (diskstream_lock);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
if ((*i)->record_enabled ()) {
//cerr << "switching to input" << __FILE__ << __LINE__ << endl << endl;
@@ -729,7 +729,7 @@ Session::set_transport_speed (float speed, bool abort)
a non-tentative rwlock here, because the action must occur.
The rarity and short potential lock duration makes this "OK"
*/
- RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock dsm (diskstream_lock);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
if (auto_input && (*i)->record_enabled ()) {
//cerr << "switching from input" << __FILE__ << __LINE__ << endl << endl;
@@ -1156,7 +1156,7 @@ Session::engine_halted ()
the picture.
*/
- atomic_set (&butler_should_do_transport_work, 0);
+ g_atomic_int_set (&butler_should_do_transport_work, 0);
post_transport_work = PostTransportWork (0);
stop_butler ();
@@ -1192,8 +1192,8 @@ Session::update_latency_compensation (bool with_stop, bool abort)
return;
}
- RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
- RWLockMonitor lm2 (diskstream_lock, false, __LINE__, __FILE__);
+ Glib::RWLock::ReaderLock lm (route_lock);
+ Glib::RWLock::ReaderLock lm2 (diskstream_lock);
_worst_track_latency = 0;
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc
index e547b212a0..87f7faf423 100644
--- a/libs/ardour/sndfilesource.cc
+++ b/libs/ardour/sndfilesource.cc
@@ -138,7 +138,7 @@ SndFileSource::read (Sample *dst, jack_nframes_t start, jack_nframes_t cnt, char
real_cnt = cnt * _info.channels;
{
- LockMonitor lm (_tmpbuf_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_tmpbuf_lock);
if (tmpbufsize < real_cnt) {
diff --git a/libs/ardour/source.cc b/libs/ardour/source.cc
index ffb067733d..7d790a036d 100644
--- a/libs/ardour/source.cc
+++ b/libs/ardour/source.cc
@@ -29,7 +29,7 @@
#include <iomanip>
#include <algorithm>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
#include <pbd/xml++.h>
#include <pbd/pthread_utils.h>
@@ -41,13 +41,12 @@ using std::min;
using std::max;
using namespace ARDOUR;
-using namespace PBD;
-sigc::signal<void,Source *> Source::SourceCreated;
+sigc::signal<void,Source *> Source::SourceCreated;
pthread_t Source::peak_thread;
bool Source::have_peak_thread = false;
vector<Source*> Source::pending_peak_sources;
-PBD::Lock Source::pending_peak_sources_lock;
+Glib::StaticMutex Source::pending_peak_sources_lock = GLIBMM_STATIC_MUTEX_INIT;
int Source::peak_request_pipe[2];
bool Source::_build_missing_peakfiles = false;
@@ -142,19 +141,19 @@ Source::peak_thread_work (void* arg)
PBD::ThreadCreated (pthread_self(), X_("Peak"));
struct pollfd pfd[1];
- LockMonitor lm (pending_peak_sources_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (pending_peak_sources_lock);
while (true) {
pfd[0].fd = peak_request_pipe[0];
pfd[0].events = POLLIN|POLLERR|POLLHUP;
- pthread_mutex_unlock (pending_peak_sources_lock.mutex());
+ pending_peak_sources_lock.unlock();
if (poll (pfd, 1, -1) < 0) {
if (errno == EINTR) {
- pthread_mutex_lock (pending_peak_sources_lock.mutex());
+ pending_peak_sources_lock.lock();
continue;
}
@@ -204,16 +203,16 @@ Source::peak_thread_work (void* arg)
}
}
- pthread_mutex_lock (pending_peak_sources_lock.mutex());
+ pending_peak_sources_lock.lock();
while (!pending_peak_sources.empty()) {
Source* s = pending_peak_sources.front();
pending_peak_sources.erase (pending_peak_sources.begin());
- pthread_mutex_unlock (pending_peak_sources_lock.mutex());
+ pending_peak_sources_lock.unlock();
s->build_peaks();
- pthread_mutex_lock (pending_peak_sources_lock.mutex());
+ pending_peak_sources_lock.lock();
}
}
@@ -272,7 +271,7 @@ Source::queue_for_peaks (Source& source)
{
if (have_peak_thread) {
- LockMonitor lm (pending_peak_sources_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (pending_peak_sources_lock);
source.next_peak_clear_should_notify = true;
@@ -291,7 +290,7 @@ void Source::clear_queue_for_peaks ()
{
/* this is done to cancel a group of running peak builds */
if (have_peak_thread) {
- LockMonitor lm (pending_peak_sources_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (pending_peak_sources_lock);
pending_peak_sources.clear ();
}
}
@@ -301,7 +300,7 @@ bool
Source::peaks_ready (sigc::slot<void> the_slot, sigc::connection& conn) const
{
bool ret;
- LockMonitor lm (_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_lock);
/* check to see if the peak data is ready. if not
connect the slot while still holding the lock.
@@ -388,7 +387,7 @@ Source::initialize_peakfile (bool newfile, string audio_path)
int
Source::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t start, jack_nframes_t cnt, double samples_per_visual_peak) const
{
- LockMonitor lm (_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_lock);
double scale;
double expected_peaks;
PeakData::PeakDatum xmax;
@@ -699,7 +698,7 @@ Source::build_peaks ()
list<PeakBuildRecord*> copy;
{
- LockMonitor lm (_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_lock);
copy = pending_peak_builds;
pending_peak_builds.clear ();
}
@@ -719,7 +718,7 @@ Source::build_peaks ()
}
{
- LockMonitor lm (_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_lock);
if (status == 0) {
_peaks_built = true;
@@ -830,7 +829,7 @@ Source::do_build_peak (jack_nframes_t first_frame, jack_nframes_t cnt)
void
Source::build_peaks_from_scratch ()
{
- LockMonitor lp (_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lp (_lock);
next_peak_clear_should_notify = true;
pending_peak_builds.push_back (new PeakBuildRecord (0, _length));
@@ -883,7 +882,7 @@ Source::available_peaks (double zoom_factor) const
}
{
- LockMonitor lm (_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (_lock);
end = lseek (peakfile, 0, SEEK_END);
}
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc
index 5d6365cff3..64964b29dd 100644
--- a/libs/ardour/tempo.cc
+++ b/libs/ardour/tempo.cc
@@ -25,7 +25,7 @@
#include <sigc++/bind.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
#include <pbd/xml++.h>
#include <ardour/tempo.h>
#include <ardour/utils.h>
@@ -240,7 +240,7 @@ TempoMap::move_metric_section (MetricSection& section, const BBT_Time& when)
return 1;
}
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
MetricSectionSorter cmp;
BBT_Time corrected (when);
@@ -283,7 +283,7 @@ TempoMap::remove_tempo (const TempoSection& tempo)
bool removed = false;
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
Metrics::iterator i;
for (i = metrics->begin(); i != metrics->end(); ++i) {
@@ -310,7 +310,7 @@ TempoMap::remove_meter (const MeterSection& tempo)
bool removed = false;
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
Metrics::iterator i;
for (i = metrics->begin(); i != metrics->end(); ++i) {
@@ -361,7 +361,7 @@ void
TempoMap::add_tempo (const Tempo& tempo, BBT_Time where)
{
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
/* new tempos always start on a beat */
@@ -381,7 +381,7 @@ TempoMap::replace_tempo (TempoSection& existing, const Tempo& replacement)
bool replaced = false;
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
Metrics::iterator i;
for (i = metrics->begin(); i != metrics->end(); ++i) {
@@ -411,7 +411,7 @@ void
TempoMap::add_meter (const Meter& meter, BBT_Time where)
{
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
/* a new meter always starts a new bar on the first beat. so
round the start time appropriately. remember that
@@ -443,7 +443,7 @@ TempoMap::replace_meter (MeterSection& existing, const Meter& replacement)
bool replaced = false;
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
Metrics::iterator i;
for (i = metrics->begin(); i != metrics->end(); ++i) {
@@ -611,7 +611,7 @@ TempoMap::metric_at (BBT_Time bbt) const
void
TempoMap::bbt_time (jack_nframes_t frame, BBT_Time& bbt) const
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
bbt_time_unlocked (frame, bbt);
}
@@ -759,7 +759,7 @@ TempoMap::bbt_duration_at (jack_nframes_t pos, const BBT_Time& bbt, int dir) con
bbt_time(pos,when);
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
frames = bbt_duration_at_unlocked (when, bbt,dir);
}
@@ -896,7 +896,7 @@ TempoMap::bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, i
jack_nframes_t
TempoMap::round_to_bar (jack_nframes_t fr, int dir)
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
return round_to_type (fr, dir, Bar);
}
@@ -904,7 +904,7 @@ TempoMap::round_to_bar (jack_nframes_t fr, int dir)
jack_nframes_t
TempoMap::round_to_beat (jack_nframes_t fr, int dir)
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
return round_to_type (fr, dir, Beat);
}
@@ -912,7 +912,7 @@ jack_nframes_t
TempoMap::round_to_beat_subdivision (jack_nframes_t fr, int sub_num)
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
TempoMap::BBTPointList::iterator i;
TempoMap::BBTPointList *more_zoomed_bbt_points;
jack_nframes_t frame_one_beats_worth;
@@ -1185,7 +1185,7 @@ TempoMap::meter_at (jack_nframes_t frame)
XMLNode&
TempoMap::get_state ()
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
Metrics::const_iterator i;
XMLNode *root = new XMLNode ("TempoMap");
@@ -1200,7 +1200,7 @@ int
TempoMap::set_state (const XMLNode& node)
{
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
XMLNodeList nlist;
XMLNodeConstIterator niter;
@@ -1292,7 +1292,7 @@ TempoMap::get_memento () const
Change
TempoMap::restore_state (StateManager::State& state)
{
- LockMonitor lm (lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (lock);
TempoMapState* tmstate = dynamic_cast<TempoMapState*> (&state);
diff --git a/libs/gtkmm2ext/gtkmm2ext/gtk_ui.h b/libs/gtkmm2ext/gtkmm2ext/gtk_ui.h
index 5446374d7b..14af137680 100644
--- a/libs/gtkmm2ext/gtkmm2ext/gtk_ui.h
+++ b/libs/gtkmm2ext/gtkmm2ext/gtk_ui.h
@@ -36,11 +36,10 @@
#include <gdkmm/color.h>
#include <pbd/abstract_ui.h>
#include <pbd/ringbufferNPT.h>
-#include <pbd/atomic.h>
+
#include <pbd/pool.h>
#include <pbd/error.h>
#include <pbd/receiver.h>
-#include <pbd/lockmonitor.h>
using std::string;
using std::queue;
diff --git a/libs/midi++2/SConscript b/libs/midi++2/SConscript
index 7c3267a6c7..928372909c 100644
--- a/libs/midi++2/SConscript
+++ b/libs/midi++2/SConscript
@@ -7,7 +7,7 @@ import glob
Import('env libraries install_prefix')
midi2 = env.Copy()
-midi2.Merge([ libraries['sigc2'], libraries['xml'], libraries['pbd3'] ])
+midi2.Merge([ libraries['sigc2'], libraries['xml'], libraries['glib2'], libraries['pbd3'] ])
domain = 'midipp'
diff --git a/libs/midi++2/midi++/port.h b/libs/midi++2/midi++/port.h
index 81e28615d0..a186f1fd5f 100644
--- a/libs/midi++2/midi++/port.h
+++ b/libs/midi++2/midi++/port.h
@@ -24,7 +24,6 @@
#include <sigc++/sigc++.h>
-#include <pbd/selectable.h>
#include <midi++/types.h>
#include <midi++/parser.h>
@@ -67,7 +66,7 @@ class Port : public sigc::trackable {
virtual int selectable() const = 0;
- void selector_read_callback (Select::Selectable *, Select::Condition);
+ //void selector_read_callback (Select::Selectable *, Select::Condition);
static void xforms_read_callback (int cond, int fd, void *ptr);
static void gtk_read_callback (void *ptr, int fd, int cond);
diff --git a/libs/midi++2/midimanager.cc b/libs/midi++2/midimanager.cc
index 7b3ed7d336..692c06fe92 100644
--- a/libs/midi++2/midimanager.cc
+++ b/libs/midi++2/midimanager.cc
@@ -18,8 +18,10 @@
*/
#include <fcntl.h>
+
+#include <glib.h>
+
#include <pbd/error.h>
-#include <pbd/basename.h>
#include <midi++/types.h>
#include <midi++/manager.h>
@@ -30,6 +32,8 @@
using namespace std;
using namespace MIDI;
+/* XXX check for strdup leaks */
+
Manager *Manager::theManager = 0;
Manager::Manager ()
@@ -312,7 +316,7 @@ Manager::parse_port_request (string str, Port::Type type)
"devicename" is the full path to the requested file
"tagname" (optional) is the name used to refer to the
- port. If not given, PBD::basename (devicename)
+ port. If not given, g_path_get_basename (devicename)
will be used.
"mode" (optional) is either "r" or "w" or something else.
@@ -360,7 +364,8 @@ Manager::parse_port_request (string str, Port::Type type)
}
} else {
- req->tagname = strdup (PBD::basename (req->devname));
+ // check when tagname is freed
+ req->tagname = g_path_get_basename (req->devname);
req->mode = O_RDWR;
}
diff --git a/libs/midi++2/midiport.cc b/libs/midi++2/midiport.cc
index 6d374ed8c0..a42aac2984 100644
--- a/libs/midi++2/midiport.cc
+++ b/libs/midi++2/midiport.cc
@@ -26,7 +26,7 @@
#include <midi++/channel.h>
#include <midi++/port_request.h>
-using namespace Select;
+//using namespace Select;
using namespace MIDI;
size_t Port::nports = 0;
@@ -96,6 +96,7 @@ Port::clock ()
return 0;
}
+/*
void
Port::selector_read_callback (Selectable *s, Select::Condition cond)
@@ -103,6 +104,7 @@ Port::selector_read_callback (Selectable *s, Select::Condition cond)
byte buf[64];
read (buf, sizeof (buf));
}
+*/
void
Port::xforms_read_callback (int cond, int fd, void *ptr)
diff --git a/libs/pbd3/SConscript b/libs/pbd3/SConscript
index 65264adcee..ca216759c4 100644
--- a/libs/pbd3/SConscript
+++ b/libs/pbd3/SConscript
@@ -21,7 +21,6 @@ pbd3_files = Split("""
basename.cc
base_ui.cc
convert.cc
-dirname.cc
dmalloc.cc
mountpoint.cc
pathscanner.cc
@@ -33,7 +32,6 @@ strsplit.cc
textreceiver.cc
transmitter.cc
undo.cc
-unescape.cc
version.cc
whitespace.cc
xml++.cc
@@ -46,7 +44,7 @@ if conf.CheckCHeader('execinfo.h'):
conf.env.Append(CXXFLAGS="-DHAVE_EXECINFO")
pbd3 = conf.Finish()
-pbd3.Merge ([ libraries['sigc2'], libraries['xml'] ])
+pbd3.Merge ([ libraries['sigc2'], libraries['xml'], libraries['glibmm2'], libraries['glib2'] ])
pbd3.VersionBuild(['version.cc','pbd/version.h'], 'SConscript')
diff --git a/libs/pbd3/basename.cc b/libs/pbd3/basename.cc
index b8c5c64d91..a51e393b78 100644
--- a/libs/pbd3/basename.cc
+++ b/libs/pbd3/basename.cc
@@ -2,37 +2,10 @@
#include <string.h>
#include <pbd/basename.h>
-char *
-PBD::basename (const char *path)
-
-{
- char *slash;
-
- if ((slash = strrchr (path, '/')) == 0) {
- return strdup (path);
- }
-
- if (*(slash+1) == '\0') {
- return strdup ("");
- }
-
- return strdup (slash+1);
-}
-
-std::string
-PBD::basename (const std::string str)
-{
- std::string::size_type slash = str.find_last_of ('/');
-
- if (slash == std::string::npos) {
- return str;
- }
-
- return str.substr (slash+1);
-}
+// implement this using Glib::path_get_basename
std::string
-PBD::basename_nosuffix (const std::string str)
+PBD::basename_nosuffix (const std::string& str)
{
std::string::size_type slash = str.find_last_of ('/');
std::string noslash;
diff --git a/libs/pbd3/dirname.cc b/libs/pbd3/dirname.cc
deleted file mode 100644
index 6b97ac7e3a..0000000000
--- a/libs/pbd3/dirname.cc
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <cstdio>
-#include <cstdlib>
-#include <string>
-#include <pbd/dirname.h>
-
-
-char *
-PBD::dirname (const char *path)
-
-{
- char *slash;
- size_t len;
- char *ret;
-
- if ((slash = strrchr (path, '/')) == 0) {
- return strdup (path);
- }
-
- if (*(slash+1) == '\0') {
- return strdup ("");
- }
-
- len = (size_t) (slash - path);
- ret = (char *) malloc (sizeof (char) * (len + 1));
-
- snprintf (ret, len, "%*s", (int)len, path);
- return ret;
-}
-
-std::string
-PBD::dirname (const std::string str)
-{
- std::string::size_type slash = str.find_last_of ('/');
- std::string dir;
-
- if (slash == std::string::npos) {
- return str;
- }
-
- /* remove trailing multiple slashes (legal under POSIX) */
-
- dir = str.substr (0, slash);
- slash = dir.length();
-
- while (slash > 1 && dir[slash-1] == '/') {
- slash--;
- dir = dir.substr (0, slash);
- }
-
- return dir;
-}
diff --git a/libs/pbd3/pbd/abstract_ui.cc b/libs/pbd3/pbd/abstract_ui.cc
index 06cf1665a3..0e34787a2d 100644
--- a/libs/pbd3/pbd/abstract_ui.cc
+++ b/libs/pbd3/pbd/abstract_ui.cc
@@ -29,7 +29,7 @@ AbstractUI<RequestObject>::register_thread_with_request_count (pthread_t thread_
RequestBuffer* b = new RequestBuffer (num_requests);
{
- PBD::LockMonitor lm (request_buffer_map_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock lm (request_buffer_map_lock);
request_buffers[thread_id] = b;
}
diff --git a/libs/pbd3/pbd/abstract_ui.h b/libs/pbd3/pbd/abstract_ui.h
index 98f077cb48..f80db7bf1a 100644
--- a/libs/pbd3/pbd/abstract_ui.h
+++ b/libs/pbd3/pbd/abstract_ui.h
@@ -27,8 +27,9 @@
#include <sigc++/sigc++.h>
+#include <glibmm/thread.h>
+
#include <pbd/receiver.h>
-#include <pbd/lockmonitor.h>
#include <pbd/ringbufferNPT.h>
#include <pbd/base_ui.h>
@@ -62,7 +63,7 @@ class AbstractUI : public BaseUI
typedef typename RequestBuffer::rw_vector RequestBufferVector;
typedef typename std::map<pthread_t,RequestBuffer*>::iterator RequestBufferMapIterator;
- PBD::Lock request_buffer_map_lock;
+ Glib::Mutex request_buffer_map_lock;
typedef std::map<pthread_t,RequestBuffer*> RequestBufferMap;
RequestBufferMap request_buffers;
pthread_key_t thread_request_buffer_key;
diff --git a/libs/pbd3/pbd/atomic.h b/libs/pbd3/pbd/atomic.h
deleted file mode 100644
index 81e76f41fa..0000000000
--- a/libs/pbd3/pbd/atomic.h
+++ /dev/null
@@ -1,1232 +0,0 @@
-/*
- Copyright (C) 2001 Paul Davis and others (see below)
- Code derived from various headers from the Linux kernel.
- Copyright attributions maintained where present.
-
- 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.
-
- $Id$
-*/
-
-#ifndef __libpbd_atomic_h__
-#define __libpbd_atomic_h__
-
-#ifdef HAVE_SMP /* a macro we control, to manage ... */
-#define CONFIG_SMP /* ... the macro the kernel headers use */
-#endif
-
-#if defined(__powerpc__) || defined(__ppc__)
-
-/*
- * BK Id: SCCS/s.atomic.h 1.15 10/28/01 10:37:22 trini
- */
-/*
- * PowerPC atomic operations
- */
-
-#ifndef _ASM_PPC_ATOMIC_H_
-#define _ASM_PPC_ATOMIC_H_
-
-typedef struct { volatile int counter; } atomic_t;
-
-
-#define ATOMIC_INIT(i) { (i) }
-
-#define atomic_read(v) ((v)->counter)
-#define atomic_set(v,i) (((v)->counter) = (i))
-
-extern void atomic_clear_mask(unsigned long mask, unsigned long *addr);
-extern void atomic_set_mask(unsigned long mask, unsigned long *addr);
-
-#ifdef CONFIG_SMP
-#define SMP_ISYNC "\n\tisync"
-#else
-#define SMP_ISYNC
-#endif
-
-static __inline__ void atomic_add(int a, atomic_t *v)
-{
- int t;
-
- __asm__ __volatile__(
-"1: lwarx %0,0,%3\n\
- add %0,%2,%0\n\
- stwcx. %0,0,%3\n\
- bne- 1b"
- : "=&r" (t), "=m" (v->counter)
- : "r" (a), "r" (&v->counter), "m" (v->counter)
- : "cc");
-}
-
-static __inline__ int atomic_add_return(int a, atomic_t *v)
-{
- int t;
-
- __asm__ __volatile__(
-"1: lwarx %0,0,%2\n\
- add %0,%1,%0\n\
- stwcx. %0,0,%2\n\
- bne- 1b"
- SMP_ISYNC
- : "=&r" (t)
- : "r" (a), "r" (&v->counter)
- : "cc", "memory");
-
- return t;
-}
-
-static __inline__ void atomic_sub(int a, atomic_t *v)
-{
- int t;
-
- __asm__ __volatile__(
-"1: lwarx %0,0,%3\n\
- subf %0,%2,%0\n\
- stwcx. %0,0,%3\n\
- bne- 1b"
- : "=&r" (t), "=m" (v->counter)
- : "r" (a), "r" (&v->counter), "m" (v->counter)
- : "cc");
-}
-
-static __inline__ int atomic_sub_return(int a, atomic_t *v)
-{
- int t;
-
- __asm__ __volatile__(
-"1: lwarx %0,0,%2\n\
- subf %0,%1,%0\n\
- stwcx. %0,0,%2\n\
- bne- 1b"
- SMP_ISYNC
- : "=&r" (t)
- : "r" (a), "r" (&v->counter)
- : "cc", "memory");
-
- return t;
-}
-
-static __inline__ void atomic_inc(atomic_t *v)
-{
- int t;
-
- __asm__ __volatile__(
-"1: lwarx %0,0,%2\n\
- addic %0,%0,1\n\
- stwcx. %0,0,%2\n\
- bne- 1b"
- : "=&r" (t), "=m" (v->counter)
- : "r" (&v->counter), "m" (v->counter)
- : "cc");
-}
-
-static __inline__ int atomic_inc_return(atomic_t *v)
-{
- int t;
-
- __asm__ __volatile__(
-"1: lwarx %0,0,%1\n\
- addic %0,%0,1\n\
- stwcx. %0,0,%1\n\
- bne- 1b"
- SMP_ISYNC
- : "=&r" (t)
- : "r" (&v->counter)
- : "cc", "memory");
-
- return t;
-}
-
-static __inline__ void atomic_dec(atomic_t *v)
-{
- int t;
-
- __asm__ __volatile__(
-"1: lwarx %0,0,%2\n\
- addic %0,%0,-1\n\
- stwcx. %0,0,%2\n\
- bne- 1b"
- : "=&r" (t), "=m" (v->counter)
- : "r" (&v->counter), "m" (v->counter)
- : "cc");
-}
-
-static __inline__ int atomic_dec_return(atomic_t *v)
-{
- int t;
-
- __asm__ __volatile__(
-"1: lwarx %0,0,%1\n\
- addic %0,%0,-1\n\
- stwcx. %0,0,%1\n\
- bne- 1b"
- SMP_ISYNC
- : "=&r" (t)
- : "r" (&v->counter)
- : "cc", "memory");
-
- return t;
-}
-
-#define atomic_sub_and_test(a, v) (atomic_sub_return((a), (v)) == 0)
-#define atomic_dec_and_test(v) (atomic_dec_return((v)) == 0)
-
-/*
- * Atomically test *v and decrement if it is greater than 0.
- * The function returns the old value of *v minus 1.
- */
-static __inline__ int atomic_dec_if_positive(atomic_t *v)
-{
- int t;
-
- __asm__ __volatile__(
-"1: lwarx %0,0,%1\n\
- addic. %0,%0,-1\n\
- blt- 2f\n\
- stwcx. %0,0,%1\n\
- bne- 1b"
- SMP_ISYNC
- "\n\
-2:" : "=&r" (t)
- : "r" (&v->counter)
- : "cc", "memory");
-
- return t;
-}
-
-#define smp_mb__before_atomic_dec() smp_mb()
-#define smp_mb__after_atomic_dec() smp_mb()
-#define smp_mb__before_atomic_inc() smp_mb()
-#define smp_mb__after_atomic_inc() smp_mb()
-
-#endif /* _ASM_PPC_ATOMIC_H_ */
-
-/***********************************************************************/
-
-# else /* !PPC */
-
-#if defined(__i386__) || defined(__x86_64__)
-
-#ifndef __ARCH_I386_ATOMIC__
-#define __ARCH_I386_ATOMIC__
-
-/*
- * Atomic operations that C can't guarantee us. Useful for
- * resource counting etc..
- */
-
-#ifdef CONFIG_SMP
-#define SMP_LOCK "lock ; "
-#else
-#define SMP_LOCK ""
-#endif
-
-/*
- * Make sure gcc doesn't try to be clever and move things around
- * on us. We need to use _exactly_ the address the user gave us,
- * not some alias that contains the same information.
- */
-typedef struct { volatile int counter; } atomic_t;
-
-#define ATOMIC_INIT(i) { (i) }
-
-/**
- * atomic_read - read atomic variable
- * @v: pointer of type atomic_t
- *
- * Atomically reads the value of @v. Note that the guaranteed
- * useful range of an atomic_t is only 24 bits.
- */
-#define atomic_read(v) ((v)->counter)
-
-/**
- * atomic_set - set atomic variable
- * @v: pointer of type atomic_t
- * @i: required value
- *
- * Atomically sets the value of @v to @i. Note that the guaranteed
- * useful range of an atomic_t is only 24 bits.
- */
-#define atomic_set(v,i) (((v)->counter) = (i))
-
-/**
- * atomic_add - add integer to atomic variable
- * @i: integer value to add
- * @v: pointer of type atomic_t
- *
- * Atomically adds @i to @v. Note that the guaranteed useful range
- * of an atomic_t is only 24 bits.
- */
-static __inline__ void atomic_add(int i, atomic_t *v)
-{
- __asm__ __volatile__(
- SMP_LOCK "addl %1,%0"
- :"=m" (v->counter)
- :"ir" (i), "m" (v->counter));
-}
-
-/**
- * atomic_sub - subtract the atomic variable
- * @i: integer value to subtract
- * @v: pointer of type atomic_t
- *
- * Atomically subtracts @i from @v. Note that the guaranteed
- * useful range of an atomic_t is only 24 bits.
- */
-static __inline__ void atomic_sub(int i, atomic_t *v)
-{
- __asm__ __volatile__(
- SMP_LOCK "subl %1,%0"
- :"=m" (v->counter)
- :"ir" (i), "m" (v->counter));
-}
-
-/**
- * atomic_sub_and_test - subtract value from variable and test result
- * @i: integer value to subtract
- * @v: pointer of type atomic_t
- *
- * Atomically subtracts @i from @v and returns
- * true if the result is zero, or false for all
- * other cases. Note that the guaranteed
- * useful range of an atomic_t is only 24 bits.
- */
-static __inline__ int atomic_sub_and_test(int i, atomic_t *v)
-{
- unsigned char c;
-
- __asm__ __volatile__(
- SMP_LOCK "subl %2,%0; sete %1"
- :"=m" (v->counter), "=qm" (c)
- :"ir" (i), "m" (v->counter) : "memory");
- return c;
-}
-
-/**
- * atomic_inc - increment atomic variable
- * @v: pointer of type atomic_t
- *
- * Atomically increments @v by 1. Note that the guaranteed
- * useful range of an atomic_t is only 24 bits.
- */
-static __inline__ void atomic_inc(atomic_t *v)
-{
- __asm__ __volatile__(
- SMP_LOCK "incl %0"
- :"=m" (v->counter)
- :"m" (v->counter));
-}
-
-/**
- * atomic_dec - decrement atomic variable
- * @v: pointer of type atomic_t
- *
- * Atomically decrements @v by 1. Note that the guaranteed
- * useful range of an atomic_t is only 24 bits.
- */
-static __inline__ void atomic_dec(atomic_t *v)
-{
- __asm__ __volatile__(
- SMP_LOCK "decl %0"
- :"=m" (v->counter)
- :"m" (v->counter));
-}
-
-/**
- * atomic_dec_and_test - decrement and test
- * @v: pointer of type atomic_t
- *
- * Atomically decrements @v by 1 and
- * returns true if the result is 0, or false for all other
- * cases. Note that the guaranteed
- * useful range of an atomic_t is only 24 bits.
- */
-static __inline__ int atomic_dec_and_test(atomic_t *v)
-{
- unsigned char c;
-
- __asm__ __volatile__(
- SMP_LOCK "decl %0; sete %1"
- :"=m" (v->counter), "=qm" (c)
- :"m" (v->counter) : "memory");
- return c != 0;
-}
-
-/**
- * atomic_inc_and_test - increment and test
- * @v: pointer of type atomic_t
- *
- * Atomically increments @v by 1
- * and returns true if the result is zero, or false for all
- * other cases. Note that the guaranteed
- * useful range of an atomic_t is only 24 bits.
- */
-static __inline__ int atomic_inc_and_test(atomic_t *v)
-{
- unsigned char c;
-
- __asm__ __volatile__(
- SMP_LOCK "incl %0; sete %1"
- :"=m" (v->counter), "=qm" (c)
- :"m" (v->counter) : "memory");
- return c != 0;
-}
-
-/**
- * atomic_add_negative - add and test if negative
- * @v: pointer of type atomic_t
- * @i: integer value to add
- *
- * Atomically adds @i to @v and returns true
- * if the result is negative, or false when
- * result is greater than or equal to zero. Note that the guaranteed
- * useful range of an atomic_t is only 24 bits.
- */
-static __inline__ int atomic_add_negative(int i, atomic_t *v)
-{
- unsigned char c;
-
- __asm__ __volatile__(
- SMP_LOCK "addl %2,%0; sets %1"
- :"=m" (v->counter), "=qm" (c)
- :"ir" (i), "m" (v->counter) : "memory");
- return c;
-}
-
-/* These are x86-specific, used by some header files */
-#define atomic_clear_mask(mask, addr) \
-__asm__ __volatile__(SMP_LOCK "andl %0,%1" \
-: : "r" (~(mask)),"m" (*addr) : "memory")
-
-#define atomic_set_mask(mask, addr) \
-__asm__ __volatile__(SMP_LOCK "orl %0,%1" \
-: : "r" (mask),"m" (*addr) : "memory")
-
-/* Atomic operations are already serializing on x86 */
-#define smp_mb__before_atomic_dec() barrier()
-#define smp_mb__after_atomic_dec() barrier()
-#define smp_mb__before_atomic_inc() barrier()
-#define smp_mb__after_atomic_inc() barrier()
-
-#endif /* __ARCH_I386_ATOMIC__ */
-
-/***********************************************************************/
-
-#else /* !PPC && !i386 */
-
-#ifdef __sparc__
-
-/* atomic.h: These still suck, but the I-cache hit rate is higher.
- *
- * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
- * Copyright (C) 2000 Anton Blanchard (anton@linuxcare.com.au)
- */
-
-#ifndef __ARCH_SPARC_ATOMIC__
-#define __ARCH_SPARC_ATOMIC__
-
-typedef struct { volatile int counter; } atomic_t;
-
-#ifndef CONFIG_SMP
-
-#define ATOMIC_INIT(i) { (i) }
-#define atomic_read(v) ((v)->counter)
-#define atomic_set(v, i) (((v)->counter) = i)
-
-#else
-/* We do the bulk of the actual work out of line in two common
- * routines in assembler, see arch/sparc/lib/atomic.S for the
- * "fun" details.
- *
- * For SMP the trick is you embed the spin lock byte within
- * the word, use the low byte so signedness is easily retained
- * via a quick arithmetic shift. It looks like this:
- *
- * ----------------------------------------
- * | signed 24-bit counter value | lock | atomic_t
- * ----------------------------------------
- * 31 8 7 0
- */
-
-#define ATOMIC_INIT(i) { (i << 8) }
-
-static __inline__ int atomic_read(atomic_t *v)
-{
- int ret = v->counter;
-
- while(ret & 0xff)
- ret = v->counter;
-
- return ret >> 8;
-}
-
-#define atomic_set(v, i) (((v)->counter) = ((i) << 8))
-#endif
-
-static __inline__ int __atomic_add(int i, atomic_t *v)
-{
- register volatile int *ptr asm("g1");
- register int increment asm("g2");
-
- ptr = &v->counter;
- increment = i;
-
- __asm__ __volatile__(
- "mov %%o7, %%g4\n\t"
- "call ___atomic_add\n\t"
- " add %%o7, 8, %%o7\n"
- : "=&r" (increment)
- : "0" (increment), "r" (ptr)
- : "g3", "g4", "g7", "memory", "cc");
-
- return increment;
-}
-
-static __inline__ int __atomic_sub(int i, atomic_t *v)
-{
- register volatile int *ptr asm("g1");
- register int increment asm("g2");
-
- ptr = &v->counter;
- increment = i;
-
- __asm__ __volatile__(
- "mov %%o7, %%g4\n\t"
- "call ___atomic_sub\n\t"
- " add %%o7, 8, %%o7\n"
- : "=&r" (increment)
- : "0" (increment), "r" (ptr)
- : "g3", "g4", "g7", "memory", "cc");
-
- return increment;
-}
-
-#define atomic_add(i, v) ((void)__atomic_add((i), (v)))
-#define atomic_sub(i, v) ((void)__atomic_sub((i), (v)))
-
-#define atomic_dec_return(v) __atomic_sub(1, (v))
-#define atomic_inc_return(v) __atomic_add(1, (v))
-
-#define atomic_sub_and_test(i, v) (__atomic_sub((i), (v)) == 0)
-#define atomic_dec_and_test(v) (__atomic_sub(1, (v)) == 0)
-
-#define atomic_inc(v) ((void)__atomic_add(1, (v)))
-#define atomic_dec(v) ((void)__atomic_sub(1, (v)))
-
-#define atomic_add_negative(i, v) (__atomic_add((i), (v)) < 0)
-
-/* Atomic operations are already serializing */
-#define smp_mb__before_atomic_dec() barrier()
-#define smp_mb__after_atomic_dec() barrier()
-#define smp_mb__before_atomic_inc() barrier()
-#define smp_mb__after_atomic_inc() barrier()
-
-
-#endif /* !(__ARCH_SPARC_ATOMIC__) */
-
-/***********************************************************************/
-
-#else
-
-#ifdef __ia64__
-
-#ifndef __ARCH_IA64_ATOMIC__
-#define __ARCH_IA64_ATOMIC__
-
-typedef volatile int atomic_t;
-
-inline
-int
-atomic_read (const atomic_t * a)
-{
- return *a;
-}
-
-inline
-void
-atomic_set(atomic_t *a, int v)
-{
- *a = v;
-}
-
-inline
-void
-atomic_inc (atomic_t *v)
-{
- int old, r;
-
- do {
- old = atomic_read(v);
- __asm__ __volatile__ ("mov ar.ccv=%0;;" :: "rO" (old));
- __asm__ __volatile__ ("cmpxchg4.acq %0=[%1],%2,ar.ccv"
- : "=r"(r) : "r"(v), "r"(old + 1)
- : "memory");
- } while (r != old);
-}
-
-inline
-void
-atomic_dec (atomic_t *v)
-{
- int old, r;
-
- do {
- old = atomic_read(v);
- __asm__ __volatile__ ("mov ar.ccv=%0;;" :: "rO" (old));
- __asm__ __volatile__ ("cmpxchg4.acq %0=[%1],%2,ar.ccv"
- : "=r"(r) : "r"(v), "r"(old - 1)
- : "memory");
- } while (r != old);
-}
-
-inline
-int
-atomic_dec_and_test (atomic_t *v)
-{
- int old, r;
-
- do {
- old = atomic_read(v);
- __asm__ __volatile__ ("mov ar.ccv=%0;;" :: "rO" (old));
- __asm__ __volatile__ ("cmpxchg4.acq %0=[%1],%2,ar.ccv"
- : "=r"(r) : "r"(v), "r"(old - 1)
- : "memory");
- } while (r != old);
- return old != 1;
-}
-
-#endif /* !(__ARCH_IA64_ATOMIC__) */
-
-#else
-
-#ifdef __alpha__
-
-#ifndef _ALPHA_ATOMIC_H
-#define _ALPHA_ATOMIC_H
-
-/*
- * Atomic operations that C can't guarantee us. Useful for
- * resource counting etc...
- *
- * But use these as seldom as possible since they are much slower
- * than regular operations.
- */
-
-
-/*
- * Counter is volatile to make sure gcc doesn't try to be clever
- * and move things around on us. We need to use _exactly_ the address
- * the user gave us, not some alias that contains the same information.
- */
-typedef struct { volatile int counter; } atomic_t;
-
-#define ATOMIC_INIT(i) ( (atomic_t) { (i) } )
-
-#define atomic_read(v) ((v)->counter)
-#define atomic_set(v,i) ((v)->counter = (i))
-
-/*
- * To get proper branch prediction for the main line, we must branch
- * forward to code at the end of this object's .text section, then
- * branch back to restart the operation.
- */
-
-static __inline__ void atomic_add(int i, atomic_t * v)
-{
- unsigned long temp;
- __asm__ __volatile__(
- "1: ldl_l %0,%1\n"
- " addl %0,%2,%0\n"
- " stl_c %0,%1\n"
- " beq %0,2f\n"
- ".subsection 2\n"
- "2: br 1b\n"
- ".previous"
- :"=&r" (temp), "=m" (v->counter)
- :"Ir" (i), "m" (v->counter));
-}
-
-static __inline__ void atomic_sub(int i, atomic_t * v)
-{
- unsigned long temp;
- __asm__ __volatile__(
- "1: ldl_l %0,%1\n"
- " subl %0,%2,%0\n"
- " stl_c %0,%1\n"
- " beq %0,2f\n"
- ".subsection 2\n"
- "2: br 1b\n"
- ".previous"
- :"=&r" (temp), "=m" (v->counter)
- :"Ir" (i), "m" (v->counter));
-}
-
-/*
- * Same as above, but return the result value
- */
-static __inline__ long atomic_add_return(int i, atomic_t * v)
-{
- long temp, result;
- __asm__ __volatile__(
- "1: ldl_l %0,%1\n"
- " addl %0,%3,%2\n"
- " addl %0,%3,%0\n"
- " stl_c %0,%1\n"
- " beq %0,2f\n"
- " mb\n"
- ".subsection 2\n"
- "2: br 1b\n"
- ".previous"
- :"=&r" (temp), "=m" (v->counter), "=&r" (result)
- :"Ir" (i), "m" (v->counter) : "memory");
- return result;
-}
-
-static __inline__ long atomic_sub_return(int i, atomic_t * v)
-{
- long temp, result;
- __asm__ __volatile__(
- "1: ldl_l %0,%1\n"
- " subl %0,%3,%2\n"
- " subl %0,%3,%0\n"
- " stl_c %0,%1\n"
- " beq %0,2f\n"
- " mb\n"
- ".subsection 2\n"
- "2: br 1b\n"
- ".previous"
- :"=&r" (temp), "=m" (v->counter), "=&r" (result)
- :"Ir" (i), "m" (v->counter) : "memory");
- return result;
-}
-
-#define atomic_dec_return(v) atomic_sub_return(1,(v))
-#define atomic_inc_return(v) atomic_add_return(1,(v))
-
-#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
-#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
-
-#define atomic_inc(v) atomic_add(1,(v))
-#define atomic_dec(v) atomic_sub(1,(v))
-
-#define smp_mb__before_atomic_dec() smp_mb()
-#define smp_mb__after_atomic_dec() smp_mb()
-#define smp_mb__before_atomic_inc() smp_mb()
-#define smp_mb__after_atomic_inc() smp_mb()
-
-#endif /* _ALPHA_ATOMIC_H */
-
-#else
-
-#ifdef __s390__
-
-#ifndef __ARCH_S390_ATOMIC__
-#define __ARCH_S390_ATOMIC__
-
-/*
- * include/asm-s390/atomic.h
- *
- * S390 version
- * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- * Denis Joseph Barrow
- *
- * Derived from "include/asm-i386/bitops.h"
- * Copyright (C) 1992, Linus Torvalds
- *
- */
-
-/*
- * Atomic operations that C can't guarantee us. Useful for
- * resource counting etc..
- * S390 uses 'Compare And Swap' for atomicity in SMP enviroment
- */
-
-typedef struct { volatile int counter; } __attribute__ ((aligned (4))) atomic_t;
-#define ATOMIC_INIT(i) { (i) }
-
-#define atomic_eieio() __asm__ __volatile__ ("BCR 15,0")
-
-#define __CS_LOOP(old_val, new_val, ptr, op_val, op_string) \
- __asm__ __volatile__(" l %0,0(%2)\n" \
- "0: lr %1,%0\n" \
- op_string " %1,%3\n" \
- " cs %0,%1,0(%2)\n" \
- " jl 0b" \
- : "=&d" (old_val), "=&d" (new_val) \
- : "a" (ptr), "d" (op_val) : "cc" );
-
-#define atomic_read(v) ((v)->counter)
-#define atomic_set(v,i) (((v)->counter) = (i))
-
-static __inline__ void atomic_add(int i, atomic_t *v)
-{
- int old_val, new_val;
- __CS_LOOP(old_val, new_val, v, i, "ar");
-}
-
-static __inline__ int atomic_add_return (int i, atomic_t *v)
-{
- int old_val, new_val;
- __CS_LOOP(old_val, new_val, v, i, "ar");
- return new_val;
-}
-
-static __inline__ int atomic_add_negative(int i, atomic_t *v)
-{
- int old_val, new_val;
- __CS_LOOP(old_val, new_val, v, i, "ar");
- return new_val < 0;
-}
-
-static __inline__ void atomic_sub(int i, atomic_t *v)
-{
- int old_val, new_val;
- __CS_LOOP(old_val, new_val, v, i, "sr");
-}
-
-static __inline__ void atomic_inc(volatile atomic_t *v)
-{
- int old_val, new_val;
- __CS_LOOP(old_val, new_val, v, 1, "ar");
-}
-
-static __inline__ int atomic_inc_return(volatile atomic_t *v)
-{
- int old_val, new_val;
- __CS_LOOP(old_val, new_val, v, 1, "ar");
- return new_val;
-}
-
-static __inline__ int atomic_inc_and_test(volatile atomic_t *v)
-{
- int old_val, new_val;
- __CS_LOOP(old_val, new_val, v, 1, "ar");
- return new_val != 0;
-}
-
-static __inline__ void atomic_dec(volatile atomic_t *v)
-{
- int old_val, new_val;
- __CS_LOOP(old_val, new_val, v, 1, "sr");
-}
-
-static __inline__ int atomic_dec_return(volatile atomic_t *v)
-{
- int old_val, new_val;
- __CS_LOOP(old_val, new_val, v, 1, "sr");
- return new_val;
-}
-
-static __inline__ int atomic_dec_and_test(volatile atomic_t *v)
-{
- int old_val, new_val;
- __CS_LOOP(old_val, new_val, v, 1, "sr");
- return new_val == 0;
-}
-
-static __inline__ void atomic_clear_mask(unsigned long mask, atomic_t *v)
-{
- int old_val, new_val;
- __CS_LOOP(old_val, new_val, v, ~mask, "nr");
-}
-
-static __inline__ void atomic_set_mask(unsigned long mask, atomic_t *v)
-{
- int old_val, new_val;
- __CS_LOOP(old_val, new_val, v, mask, "or");
-}
-
-/*
- returns 0 if expected_oldval==value in *v ( swap was successful )
- returns 1 if unsuccessful.
-*/
-static __inline__ int
-atomic_compare_and_swap(int expected_oldval,int new_val,atomic_t *v)
-{
- int retval;
-
- __asm__ __volatile__(
- " lr 0,%2\n"
- " cs 0,%3,0(%1)\n"
- " ipm %0\n"
- " srl %0,28\n"
- "0:"
- : "=&d" (retval)
- : "a" (v), "d" (expected_oldval) , "d" (new_val)
- : "0", "cc");
- return retval;
-}
-
-/*
- Spin till *v = expected_oldval then swap with newval.
- */
-static __inline__ void
-atomic_compare_and_swap_spin(int expected_oldval,int new_val,atomic_t *v)
-{
- __asm__ __volatile__(
- "0: lr 0,%1\n"
- " cs 0,%2,0(%0)\n"
- " jl 0b\n"
- : : "a" (v), "d" (expected_oldval) , "d" (new_val)
- : "cc", "0" );
-}
-
-#define smp_mb__before_atomic_dec() smp_mb()
-#define smp_mb__after_atomic_dec() smp_mb()
-#define smp_mb__before_atomic_inc() smp_mb()
-#define smp_mb__after_atomic_inc() smp_mb()
-
-#endif /* __ARCH_S390_ATOMIC __ */
-
-#else
-
-#ifdef __mips__
-
-/*
- * Atomic operations that C can't guarantee us. Useful for
- * resource counting etc..
- *
- * But use these as seldom as possible since they are much more slower
- * than regular operations.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1996, 1997, 2000 by Ralf Baechle
- */
-#ifndef __ASM_ATOMIC_H
-#define __ASM_ATOMIC_H
-
-typedef struct { volatile int counter; } atomic_t;
-
-#define ATOMIC_INIT(i) { (i) }
-
-/*
- * atomic_read - read atomic variable
- * @v: pointer of type atomic_t
- *
- * Atomically reads the value of @v. Note that the guaranteed
- * useful range of an atomic_t is only 24 bits.
- */
-#define atomic_read(v) ((v)->counter)
-
-/*
- * atomic_set - set atomic variable
- * @v: pointer of type atomic_t
- * @i: required value
- *
- * Atomically sets the value of @v to @i. Note that the guaranteed
- * useful range of an atomic_t is only 24 bits.
- */
-#define atomic_set(v,i) ((v)->counter = (i))
-
-/*
- * ... while for MIPS II and better we can use ll/sc instruction. This
- * implementation is SMP safe ...
- */
-
-/*
- * atomic_add - add integer to atomic variable
- * @i: integer value to add
- * @v: pointer of type atomic_t
- *
- * Atomically adds @i to @v. Note that the guaranteed useful range
- * of an atomic_t is only 24 bits.
- */
-extern __inline__ void atomic_add(int i, atomic_t * v)
-{
- unsigned long temp;
-
- __asm__ __volatile__(
- ".set push # atomic_add\n"
- ".set mips2 \n"
- "1: ll %0, %1 \n"
- " addu %0, %2 \n"
- " sc %0, %1 \n"
- " beqz %0, 1b \n"
- ".set pop \n"
- : "=&r" (temp), "=m" (v->counter)
- : "Ir" (i), "m" (v->counter));
-}
-
-/*
- * atomic_sub - subtract the atomic variable
- * @i: integer value to subtract
- * @v: pointer of type atomic_t
- *
- * Atomically subtracts @i from @v. Note that the guaranteed
- * useful range of an atomic_t is only 24 bits.
- */
-extern __inline__ void atomic_sub(int i, atomic_t * v)
-{
- unsigned long temp;
-
- __asm__ __volatile__(
- ".set push # atomic_sub\n"
- ".set mips2 \n"
- "1: ll %0, %1 \n"
- " subu %0, %2 \n"
- " sc %0, %1 \n"
- " beqz %0, 1b \n"
- ".set pop \n"
- : "=&r" (temp), "=m" (v->counter)
- : "Ir" (i), "m" (v->counter));
-}
-
-/*
- * Same as above, but return the result value
- */
-extern __inline__ int atomic_add_return(int i, atomic_t * v)
-{
- unsigned long temp, result;
-
- __asm__ __volatile__(
- ".set push # atomic_add_return\n"
- ".set mips2 \n"
- ".set noreorder \n"
- "1: ll %1, %2 \n"
- " addu %0, %1, %3 \n"
- " sc %0, %2 \n"
- " beqz %0, 1b \n"
- " addu %0, %1, %3 \n"
- " sync \n"
- ".set pop \n"
- : "=&r" (result), "=&r" (temp), "=m" (v->counter)
- : "Ir" (i), "m" (v->counter)
- : "memory");
-
- return result;
-}
-
-extern __inline__ int atomic_sub_return(int i, atomic_t * v)
-{
- unsigned long temp, result;
-
- __asm__ __volatile__(
- ".set push # atomic_sub_return\n"
- ".set mips2 \n"
- ".set noreorder \n"
- "1: ll %1, %2 \n"
- " subu %0, %1, %3 \n"
- " sc %0, %2 \n"
- " beqz %0, 1b \n"
- " subu %0, %1, %3 \n"
- " sync \n"
- ".set pop \n"
- : "=&r" (result), "=&r" (temp), "=m" (v->counter)
- : "Ir" (i), "m" (v->counter)
- : "memory");
-
- return result;
-}
-
-#define atomic_dec_return(v) atomic_sub_return(1,(v))
-#define atomic_inc_return(v) atomic_add_return(1,(v))
-
-/*
- * atomic_sub_and_test - subtract value from variable and test result
- * @i: integer value to subtract
- * @v: pointer of type atomic_t
- *
- * Atomically subtracts @i from @v and returns
- * true if the result is zero, or false for all
- * other cases. Note that the guaranteed
- * useful range of an atomic_t is only 24 bits.
- */
-#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
-
-/*
- * atomic_inc_and_test - increment and test
- * @v: pointer of type atomic_t
- *
- * Atomically increments @v by 1
- * and returns true if the result is zero, or false for all
- * other cases. Note that the guaranteed
- * useful range of an atomic_t is only 24 bits.
- */
-#define atomic_inc_and_test(v) (atomic_inc_return(1, (v)) == 0)
-
-/*
- * atomic_dec_and_test - decrement by 1 and test
- * @v: pointer of type atomic_t
- *
- * Atomically decrements @v by 1 and
- * returns true if the result is 0, or false for all other
- * cases. Note that the guaranteed
- * useful range of an atomic_t is only 24 bits.
- */
-#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
-
-/*
- * atomic_inc - increment atomic variable
- * @v: pointer of type atomic_t
- *
- * Atomically increments @v by 1. Note that the guaranteed
- * useful range of an atomic_t is only 24 bits.
- */
-#define atomic_inc(v) atomic_add(1,(v))
-
-/*
- * atomic_dec - decrement and test
- * @v: pointer of type atomic_t
- *
- * Atomically decrements @v by 1. Note that the guaranteed
- * useful range of an atomic_t is only 24 bits.
- */
-#define atomic_dec(v) atomic_sub(1,(v))
-
-/*
- * atomic_add_negative - add and test if negative
- * @v: pointer of type atomic_t
- * @i: integer value to add
- *
- * Atomically adds @i to @v and returns true
- * if the result is negative, or false when
- * result is greater than or equal to zero. Note that the guaranteed
- * useful range of an atomic_t is only 24 bits.
- *
- * Currently not implemented for MIPS.
- */
-
-/* Atomic operations are already serializing */
-#define smp_mb__before_atomic_dec() smp_mb()
-#define smp_mb__after_atomic_dec() smp_mb()
-#define smp_mb__before_atomic_inc() smp_mb()
-#define smp_mb__after_atomic_inc() smp_mb()
-
-#endif /* __ASM_ATOMIC_H */
-
-#else
-
-#if defined(__m68k__)
-
-#ifndef __ARCH_M68K_ATOMIC__
-#define __ARCH_M68K_ATOMIC__
-
-/*
- * Atomic operations that C can't guarantee us. Useful for
- * resource counting etc..
- */
-
-/*
- * We do not have SMP m68k systems, so we don't have to deal with that.
- */
-
-typedef struct { int counter; } atomic_t;
-#define ATOMIC_INIT(i) { (i) }
-
-#define atomic_read(v) ((v)->counter)
-#define atomic_set(v, i) (((v)->counter) = i)
-
-static __inline__ void atomic_add(int i, atomic_t *v)
-{
- __asm__ __volatile__("addl %1,%0" : "=m" (*v) : "id" (i), "0" (*v));
-}
-
-static __inline__ void atomic_sub(int i, atomic_t *v)
-{
- __asm__ __volatile__("subl %1,%0" : "=m" (*v) : "id" (i), "0" (*v));
-}
-
-static __inline__ void atomic_inc(volatile atomic_t *v)
-{
- __asm__ __volatile__("addql #1,%0" : "=m" (*v): "0" (*v));
-}
-
-static __inline__ void atomic_dec(volatile atomic_t *v)
-{
- __asm__ __volatile__("subql #1,%0" : "=m" (*v): "0" (*v));
-}
-
-static __inline__ int atomic_dec_and_test(volatile atomic_t *v)
-{
- char c;
- __asm__ __volatile__("subql #1,%1; seq %0" : "=d" (c), "=m" (*v): "1" (*v));
- return c != 0;
-}
-
-#define atomic_clear_mask(mask, v) \
- __asm__ __volatile__("andl %1,%0" : "=m" (*v) : "id" (~(mask)),"0"(*v))
-
-#define atomic_set_mask(mask, v) \
- __asm__ __volatile__("orl %1,%0" : "=m" (*v) : "id" (mask),"0"(*v))
-
-/* Atomic operations are already serializing */
-#define smp_mb__before_atomic_dec() barrier()
-#define smp_mb__after_atomic_dec() barrier()
-#define smp_mb__before_atomic_inc() barrier()
-#define smp_mb__after_atomic_inc() barrier()
-
-#endif /* __ARCH_M68K_ATOMIC __ */
-
-#else
-
-#warning libs/pbd has no implementation of strictly atomic operations for your hardware.
-
-#define __NO_STRICT_ATOMIC
-#ifdef __NO_STRICT_ATOMIC
-
-/*
- * Because the implementations from the kernel (where all these come
- * from) use cli and spinlocks for hppa and arm...
- */
-
-typedef struct { volatile int counter; } atomic_t;
-
-#define ATOMIC_INIT(i) ( (atomic_t) { (i) } )
-
-#define atomic_read(v) ((v)->counter)
-#define atomic_set(v,i) ((v)->counter = (i))
-
-static __inline__ void atomic_inc(atomic_t *v)
-{
- v->counter++;
-}
-
-static __inline__ void atomic_dec(atomic_t *v)
-{
- v->counter--;
-}
-
-static __inline__ int atomic_dec_and_test(atomic_t *v)
-{
- int res;
- v->counter--;
- res = v->counter;
- return res == 0;
-}
-
-static __inline__ int atomic_inc_and_test(atomic_t *v)
-{
- int res;
- v->counter++;
- res = v->counter;
- return res == 0;
-}
-
-# endif /* __NO_STRICT_ATOMIC */
-# endif /* m68k */
-# endif /* mips */
-# endif /* s390 */
-# endif /* alpha */
-# endif /* ia64 */
-# endif /* sparc */
-# endif /* i386 */
-# endif /* ppc */
-
-#endif /* __libpbd_atomic_h__ */
-
diff --git a/libs/pbd3/pbd/basename.h b/libs/pbd3/pbd/basename.h
index 01f40b6b6a..35aebe166c 100644
--- a/libs/pbd3/pbd/basename.h
+++ b/libs/pbd3/pbd/basename.h
@@ -6,9 +6,7 @@
namespace PBD
{
-extern char *basename (const char *);
-extern std::string basename (const std::string);
-extern std::string basename_nosuffix (const std::string);
+extern std::string basename_nosuffix (const std::string&);
};
diff --git a/libs/pbd3/pbd/datum.h b/libs/pbd3/pbd/datum.h
deleted file mode 100644
index 1f2704b429..0000000000
--- a/libs/pbd3/pbd/datum.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- Copyright (C) 1998-99 Paul Barton-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.
-
- $Id$
-*/
-
-#ifndef __qm_datum_h__
-#define __qm_datum_h__
-
-/* A basic data type used whenever we want to represent
- something that might be a string or a number.
-*/
-
-struct Datum {
- enum Type {
- String,
- Numeric,
- };
- Type type;
- union {
- const char *str;
- float n;
- };
-
- Datum &operator=(float val) {
- type = Numeric;
- n = val;
- return *this;
- }
-
- Datum &operator=(int val) {
- type = Numeric;
- n=(float) val;
- return *this;
- }
-
- Datum &operator=(const char *val) {
- type = String;
- str = val;
- return *this;
- }
-};
-
-#endif // __qm_datum_h__
diff --git a/libs/pbd3/pbd/dirname.h b/libs/pbd3/pbd/dirname.h
deleted file mode 100644
index 5e63ddb55d..0000000000
--- a/libs/pbd3/pbd/dirname.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __stupid_dirname_h__
-#define __stupid_dirname_h__
-
-
-#include <string>
-
-namespace PBD {
- extern char *dirname (const char *);
- extern std::string dirname (const std::string);
-}
-#endif // __stupid_dirname_h__
diff --git a/libs/pbd3/pbd/ellipsoid.h b/libs/pbd3/pbd/ellipsoid.h
deleted file mode 100644
index 3758e415c2..0000000000
--- a/libs/pbd3/pbd/ellipsoid.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- Copyright (C) 1998-99 Paul Barton-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.
-
- $Id$
-*/
-
-#ifndef __qm_ellipsoid_h__
-#define __qm_ellipsoid_h__
-
-struct Arc
-{
- int rect_x;
- int rect_y;
- int rect_h;
- int rect_w;
- int start_angle;
- int arc_angle;
- bool counter_clockwise;
-};
-
-class Ellipsoid
-{
- int start_x;
- int end_x;
- int start_y;
- int end_y;
- static const unsigned int narcs;
-
- public:
- Arc arc[2];
-
- Ellipsoid () {
- start_x = -1;
- end_x = -1;
- }
-
- bool ready() { return start_x != -1 && end_x != -1; }
- void set_start (int x, int y);
- void set_end (int x, int y);
- void compute ();
-
- void set_start_angle (int n, int which_arc = -1) {
- if (which_arc < 0) {
- arc[0].start_angle = n * 64;
- arc[1].start_angle = n * 64;
- } else if (which_arc < (int) narcs) {
- arc[which_arc].start_angle = n * 64;
- }
- }
- void set_arc_angle (int n, int which_arc = -1) {
- if (which_arc < 0) {
- arc[0].arc_angle = n * 64;
- arc[1].arc_angle = n * 64;
- } else if (which_arc < (int) narcs) {
- arc[which_arc].arc_angle = n * 64;
- }
- }
-};
-
-#endif // __qm_ellipsoid_h__
diff --git a/libs/pbd3/pbd/foreach.h b/libs/pbd3/pbd/foreach.h
deleted file mode 100644
index 5102d81bb0..0000000000
--- a/libs/pbd3/pbd/foreach.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- Copyright (C) 2002 Paul Barton-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.
-
- $Id$
-*/
-
-#ifndef __lib_pbd_foreach_h__
-#define __lib_pbd_foreach_h__
-
-template<class Iter, class T> void foreach (Iter first, Iter last, void (T::*method)()) {
- for (; first != last; ++first) {
- ((*first).*method)();
- }
-}
-
-template<class Iter, class T, class A> void foreach (Iter first, Iter last, void (T::*method)(A a), A arg) {
- for (; first != last; ++first) {
- ((*first).*method)(arg);
- }
-}
-
-template<class Iter, class T, class A1, class A2> void foreach (Iter first, Iter last, void (T::*method)(A1, A2), A1 arg1, A2 arg2) {
- for (; first != last; ++first) {
- ((*first).*method)(arg1, arg2);
- }
-}
-
-#endif /* __lib_pbd_foreach_h__ */
diff --git a/libs/pbd3/pbd/lock_free_fifo.h b/libs/pbd3/pbd/lock_free_fifo.h
deleted file mode 100644
index cbe653fcb5..0000000000
--- a/libs/pbd3/pbd/lock_free_fifo.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- Copyright (C) 2000 Paul Barton-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.
-
- $Id$
-*/
-
-#ifndef __pbd_lockfree_fifo_h__
-#define __pbd_lockfree_fifo_h__
-
-#include <sys/types.h>
-#include <cstdlib>
-
-template<class T>
-class LockFreeFIFO
-{
-public:
- LockFreeFIFO (int sz) {
- size = sz;
- push_ptr = 0;
- pop_ptr = 0;
- buf = new T[size];
- };
-
- virtual ~LockFreeFIFO() {
- delete [] buf;
- }
-
-
- int pop (T& r) {
- if (pop_ptr == push_ptr) {
- return -1;
- } else {
- r = buf[pop_ptr];
- pop_ptr++;
- if (pop_ptr >= size) {
- pop_ptr = 0;
- }
- return 0;
- }
- }
-
- int top (T& r) {
- if (pop_ptr == push_ptr) {
- return -1;
- } else {
- r = buf[pop_ptr];
- return 0;
- }
- }
-
- int push (T& t) {
- if ((size_t) abs (static_cast<int>(push_ptr - pop_ptr)) < size) {
- buf[push_ptr] = t;
- push_ptr++;
- if (push_ptr >= size) {
- push_ptr = 0;
- }
- return 0;
- } else {
- return -1;
- }
- }
-
- protected:
- T *buf;
- volatile size_t push_ptr;
- volatile size_t pop_ptr;
- size_t size;
-};
-
-
-#endif /* __pbd_lockfree_fifo_h__ */
diff --git a/libs/pbd3/pbd/lockmonitor.h b/libs/pbd3/pbd/lockmonitor.h
deleted file mode 100644
index c91a041e9b..0000000000
--- a/libs/pbd3/pbd/lockmonitor.h
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- Copyright (C) 2000 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.
-
- $Id$
-*/
-
-#ifndef __pbd_lockmonitor_h__
-#define __pbd_lockmonitor_h__
-
-#include <pthread.h>
-#include <pbd/pthread_spinlock.h>
-
-#undef DEBUG_LOCK_MONITOR
-
-#ifdef DEBUG_LOCK_MONITOR
-#include <iostream>
-#include <ardour/cycles.h>
-#endif
-
-namespace PBD
-{
-class Lock {
- public:
- Lock() { pthread_mutex_init (&_mutex, 0); }
- virtual ~Lock() {}
-
- virtual int lock () { return pthread_mutex_lock (&_mutex); }
- virtual int unlock() { return pthread_mutex_unlock (&_mutex); }
-
- pthread_mutex_t *mutex() { return &_mutex; }
-
- protected:
- pthread_mutex_t _mutex;
-};
-
-class NonBlockingLock : public Lock {
- public:
- NonBlockingLock() {}
- ~NonBlockingLock(){}
-
- int lock () { return pthread_mutex_lock (&_mutex); }
- int trylock () { return pthread_mutex_trylock (&_mutex); }
- int unlock() { return pthread_mutex_unlock (&_mutex); }
-};
-
-class RWLock {
- public:
- RWLock() { pthread_rwlock_init (&_mutex, 0); }
- virtual ~RWLock() { pthread_rwlock_destroy(&_mutex); }
-
- virtual int write_lock () { return pthread_rwlock_wrlock (&_mutex); }
- virtual int read_lock () { return pthread_rwlock_rdlock (&_mutex); }
- virtual int unlock() { return pthread_rwlock_unlock (&_mutex); }
-
- pthread_rwlock_t *mutex() { return &_mutex; }
-
- protected:
- pthread_rwlock_t _mutex;
-};
-
-class NonBlockingRWLock : public RWLock {
- public:
- NonBlockingRWLock() {}
- ~NonBlockingRWLock(){}
-
- int write_trylock () { return pthread_rwlock_trywrlock (&_mutex); }
- int read_trylock () { return pthread_rwlock_tryrdlock (&_mutex); }
-};
-
-
-class LockMonitor
-{
- public:
- LockMonitor (Lock& lck, unsigned long l, const char *f)
- : lock (lck)
-#ifdef DEBUG_LOCK_MONITOR
- , line (l), file (f)
-#endif
- {
-
-#ifdef DEBUG_LOCK_MONITOR
- unsigned long long when;
- when = get_cycles();
- cerr << when << " lock " << &lock << " at " << line << " in " << file << endl;
-#endif
- lock.lock ();
-#ifdef DEBUG_LOCK_MONITOR
- when = get_cycles();
- cerr << '\t' << when
- << " locked: "
- << &lock << " at "
- << line << " in " << file << endl;
-#endif
- }
-
- ~LockMonitor () {
- lock.unlock ();
-#ifdef DEBUG_LOCK_MONITOR
- unsigned long long when;
- when = get_cycles();
- cerr << '\t' << when << ' '
- << " UNLOCKED "
- << &lock << " at "
- << line << " in " << file << endl;
-#endif
- }
- private:
- Lock& lock;
-#ifdef DEBUG_LOCK_MONITOR
- unsigned long line;
- const char * file;
-#endif
-};
-
-class TentativeLockMonitor
-{
- public:
- TentativeLockMonitor (NonBlockingLock& lck, unsigned long l, const char *f)
- : lock (lck)
-#ifdef DEBUG_LOCK_MONITOR
- , line (l), file (f)
-#endif
- {
-
-#ifdef DEBUG_LOCK_MONITOR
- unsigned long long when;
- when = get_cycles();
- cerr << when << " tentative lock " << &lock << " at " << line << " in " << file << endl;
-#endif
- _locked = (lock.trylock() == 0);
-
-#ifdef DEBUG_LOCK_MONITOR
- when = get_cycles();
- cerr << '\t' << when << ' '
- << _locked
- << " lock: "
- << &lock << " at "
- << line << " in " << file << endl;
-#endif
- }
-
- ~TentativeLockMonitor () {
- if (_locked) {
- lock.unlock ();
-#ifdef DEBUG_LOCK_MONITOR
- unsigned long long when;
- when = get_cycles();
- cerr << '\t' << when << ' '
- << " UNLOCKED "
- << &lock << " at "
- << line << " in " << file << endl;
-#endif
- }
- }
-
- bool locked() { return _locked; }
-
- private:
- NonBlockingLock& lock;
- bool _locked;
-#ifdef DEBUG_LOCK_MONITOR
- unsigned long line;
- const char * file;
-#endif
-};
-
-class SpinLockMonitor
-{
- public:
- SpinLockMonitor (pthread_mutex_t *lck, unsigned long l, const char *f)
- : lock (lck)
-#ifdef DEBUG_LOCK_MONITOR
- , line (l), file (f)
-#endif
- {
-
-#ifdef DEBUG_LOCK_MONITOR
- unsigned long long when;
- when = get_cycles();
- cerr << when << " spinlock " << lck << " at " << line << " in " << file << endl;
-#endif
- pthread_mutex_spinlock (lck);
-#ifdef DEBUG_LOCK_MONITOR
- when = get_cycles();
- cerr << '\t' << when
- << " locked at "
- << &lock << " at "
- << line << " in " << file << endl;
-#endif
- }
-
- ~SpinLockMonitor () {
- pthread_mutex_unlock (lock);
- }
- private:
- pthread_mutex_t *lock;
-#ifdef DEBUG_LOCK_MONITOR
- unsigned long line;
- const char * file;
-#endif
-};
-
-
-class RWLockMonitor
-{
- public:
- RWLockMonitor (RWLock& lck, bool write, unsigned long l, const char *f)
- : lock (lck)
-#ifdef DEBUG_LOCK_MONITOR
- , line (l), file (f)
-#endif
- {
-
-#ifdef DEBUG_LOCK_MONITOR
- unsigned long long when;
- when = get_cycles();
- cerr << when << " lock " << &lock << " at " << line << " in " << file << endl;
-#endif
- if (write) {
- lock.write_lock ();
- } else {
- lock.read_lock ();
- }
-#ifdef DEBUG_LOCK_MONITOR
- when = get_cycles();
- cerr << '\t' << when
- << " locked: "
- << &lock << " at "
- << line << " in " << file << endl;
-#endif
- }
-
- ~RWLockMonitor () {
- lock.unlock ();
-#ifdef DEBUG_LOCK_MONITOR
- unsigned long long when;
- when = get_cycles();
- cerr << '\t' << when << ' '
- << " UNLOCKED "
- << &lock << " at "
- << line << " in " << file << endl;
-#endif
- }
- private:
- RWLock& lock;
-#ifdef DEBUG_LOCK_MONITOR
- unsigned long line;
- const char * file;
-#endif
-};
-
-class TentativeRWLockMonitor
-{
- public:
- TentativeRWLockMonitor (NonBlockingRWLock& lck, bool write, unsigned long l, const char *f)
- : lock (lck)
-#ifdef DEBUG_LOCK_MONITOR
- , line (l), file (f)
-#endif
- {
-
-#ifdef DEBUG_LOCK_MONITOR
- unsigned long long when;
- when = get_cycles();
- cerr << when << " tentative lock " << &lock << " at " << line << " in " << file << endl;
-#endif
- if (write) {
- _locked = (lock.write_trylock() == 0);
- } else {
- _locked = (lock.read_trylock() == 0);
- }
-
-#ifdef DEBUG_LOCK_MONITOR
- when = get_cycles();
- cerr << '\t' << when << ' '
- << _locked
- << " lock: "
- << &lock << " at "
- << line << " in " << file << endl;
-#endif
- }
-
- ~TentativeRWLockMonitor () {
- if (_locked) {
- lock.unlock ();
-#ifdef DEBUG_LOCK_MONITOR
- unsigned long long when;
- when = get_cycles();
- cerr << '\t' << when << ' '
- << " UNLOCKED "
- << &lock << " at "
- << line << " in " << file << endl;
-#endif
- }
- }
-
- bool locked() { return _locked; }
-
- private:
- NonBlockingRWLock& lock;
- bool _locked;
-#ifdef DEBUG_LOCK_MONITOR
- unsigned long line;
- const char * file;
-#endif
-};
-
-
-} /* namespace */
-
-#endif /* __pbd_lockmonitor_h__*/
diff --git a/libs/pbd3/pbd/pool.h b/libs/pbd3/pbd/pool.h
index c8e9740acd..f8e19e72fb 100644
--- a/libs/pbd3/pbd/pool.h
+++ b/libs/pbd3/pbd/pool.h
@@ -23,7 +23,9 @@
#include <vector>
#include <string>
-#include <pthread.h>
+
+#include <glibmm/thread.h>
+
#include <pbd/ringbuffer.h>
class Pool
@@ -53,7 +55,7 @@ class SingleAllocMultiReleasePool : public Pool
virtual void release (void *);
private:
- pthread_mutex_t lock;
+ Glib::Mutex* m_lock;
};
@@ -67,8 +69,7 @@ class MultiAllocSingleReleasePool : public Pool
virtual void release (void *);
private:
- pthread_mutex_t lock;
+ Glib::Mutex* m_lock;
};
-
#endif // __qm_pool_h__
diff --git a/libs/pbd3/pbd/position.h b/libs/pbd3/pbd/position.h
deleted file mode 100644
index c8241af085..0000000000
--- a/libs/pbd3/pbd/position.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- Copyright (C) 1998-99 Paul Barton-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.
-
- $Id$
-*/
-
-#ifndef __qui_position_h__
-#define __qui_position_h__
-
-enum Position {
- Top,
- Left,
- Right,
- Bottom,
- UpperLeft,
- LowerLeft,
- UpperRight,
- LowerRight,
- Center,
- Nowhere,
-};
-
-
-#endif // __qui_position_h__
diff --git a/libs/pbd3/pbd/precision_timer.h b/libs/pbd3/pbd/precision_timer.h
deleted file mode 100644
index a103b4800d..0000000000
--- a/libs/pbd3/pbd/precision_timer.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- Copyright (C) 1998-99 Paul Barton-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.
-
- $Id$
-*/
-
-#ifndef __precision_timer_h__
-#define __precision_timer_h__
-
-#include <pbd/cycles.h>
-
-typedef cycles_t precision_time_t;
-
-class PrecisionTimer {
- public:
- PrecisionTimer ();
-
- /* returns current time in microseconds since
- the time base was created (which may be
- the same as when the PrecisionTimer was
- created or it may not).
- */
-
-#ifdef PBD_HAVE_CYCLE_COUNTER
-
- precision_time_t current () {
- return get_cycles() / cycles_per_usec;
- }
-
-#else /* !HAVE_CYCLE_COUNTER */
-
- precision_time_t current () {
- struct timeval now;
- gettimeofday (&now, 0);
- return (precision_time_t) ((now.tv_sec * 1000000) + now.tv_usec);
- }
-
-#endif /* HAVE_CYCLE_COUNTER */
-
- private:
- int get_mhz();
- static precision_time_t cycles_per_usec;
-};
-
-#endif // __precision_timer.h
-
-
diff --git a/libs/pbd3/pbd/pthread_spinlock.h b/libs/pbd3/pbd/pthread_spinlock.h
deleted file mode 100644
index 71835221fa..0000000000
--- a/libs/pbd3/pbd/pthread_spinlock.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- Copyright (C) 1998-99 Paul Barton-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.
-
- $Id$
-*/
-#ifndef __pthread_mutex_spinlock_h__
-#define __pthread_mutex_spinlock_h__
-
-#include <pthread.h>
-
-extern unsigned int pthread_calibrate_spinlimit ();
-extern void pthread_set_spinlimit (unsigned int spins);
-extern int pthread_mutex_spinlock (pthread_mutex_t *mp);
-
-#endif // __pthread_mutex_spinlock_h__
diff --git a/libs/pbd3/pbd/rcpointer.h b/libs/pbd3/pbd/rcpointer.h
deleted file mode 100644
index c634208437..0000000000
--- a/libs/pbd3/pbd/rcpointer.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- Copyright (C) 1998-99 Paul Barton-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.
-
- $Id$
-*/
-
-#ifndef __qm_rcpointer_h__
-#define __qm_rcpointer_h__
-
-template<class T> class RCPointer {
- public:
- T *operator->() { return _ptr; }
- bool operator==(T *p) { return _ptr == p; }
- bool operator!=(T *p) { return _ptr != p; }
-
- int refcount() { return _ptr->count; }
-
- RCPointer () { _ptr = 0; }
-
- RCPointer (T *p) : _ptr (p) {
- if (_ptr) _ptr->count++;
- }
-
- RCPointer (const RCPointer& r) : _ptr (r._ptr) {
- if (_ptr) _ptr->count++;
- }
-
- RCPointer &operator= (const RCPointer &r) {
- if (_ptr == r._ptr) return *this;
- if (_ptr && --_ptr->count == 0) {
- delete _ptr;
- }
- _ptr = r._ptr;
- if (_ptr) _ptr->count++;
- return *this;
- }
- ~RCPointer () {
- if (_ptr && --_ptr->count == 0) {
- delete _ptr;
- }
- }
-
- private:
- T *_ptr;
-};
-
-#endif // __qm_rcpointer_h__
diff --git a/libs/pbd3/pbd/relation.h b/libs/pbd3/pbd/relation.h
deleted file mode 100644
index f28aaecfa1..0000000000
--- a/libs/pbd3/pbd/relation.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- Copyright (C) 1999 Paul Barton-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.
-
- $Id$
-*/
-
-#ifndef __pbd_relation_h__
-#define __pbd_relation_h__
-
-enum RelationalCondition {
- Equal = 0,
- NotEqual,
- LessThan,
- LessThanOrEqual,
- GreaterThan,
- GreaterThanOrEqual,
- Changed,
-
- NumConditions
-};
-
-#endif // __pbd_relation_h__
diff --git a/libs/pbd3/pbd/ringbuffer.h b/libs/pbd3/pbd/ringbuffer.h
index cca9cbfc01..7906119ea9 100644
--- a/libs/pbd3/pbd/ringbuffer.h
+++ b/libs/pbd3/pbd/ringbuffer.h
@@ -21,8 +21,9 @@
#ifndef ringbuffer_h
#define ringbuffer_h
-#include <sys/mman.h>
-#include <pbd/atomic.h>
+//#include <sys/mman.h>
+
+#include <glib.h>
template<class T>
class RingBuffer
@@ -47,14 +48,14 @@ class RingBuffer
void reset () {
/* !!! NOT THREAD SAFE !!! */
- atomic_set (&write_ptr, 0);
- atomic_set (&read_ptr, 0);
+ g_atomic_int_set (&write_ptr, 0);
+ g_atomic_int_set (&read_ptr, 0);
}
void set (size_t r, size_t w) {
/* !!! NOT THREAD SAFE !!! */
- atomic_set (&write_ptr, w);
- atomic_set (&read_ptr, r);
+ g_atomic_int_set (&write_ptr, w);
+ g_atomic_int_set (&read_ptr, r);
}
size_t read (T *dest, size_t cnt);
@@ -69,22 +70,22 @@ class RingBuffer
void get_write_vector (rw_vector *);
void decrement_read_ptr (size_t cnt) {
- atomic_set (&read_ptr, (atomic_read(&read_ptr) - cnt) & size_mask);
+ g_atomic_int_set (&read_ptr, (g_atomic_int_get(&read_ptr) - cnt) & size_mask);
}
void increment_read_ptr (size_t cnt) {
- atomic_set (&read_ptr, (atomic_read(&read_ptr) + cnt) & size_mask);
+ g_atomic_int_set (&read_ptr, (g_atomic_int_get(&read_ptr) + cnt) & size_mask);
}
void increment_write_ptr (size_t cnt) {
- atomic_set (&write_ptr, (atomic_read(&write_ptr) + cnt) & size_mask);
+ g_atomic_int_set (&write_ptr, (g_atomic_int_get(&write_ptr) + cnt) & size_mask);
}
size_t write_space () {
size_t w, r;
- w = atomic_read (&write_ptr);
- r = atomic_read (&read_ptr);
+ w = g_atomic_int_get (&write_ptr);
+ r = g_atomic_int_get (&read_ptr);
if (w > r) {
return ((r - w + size) & size_mask) - 1;
@@ -98,8 +99,8 @@ class RingBuffer
size_t read_space () {
size_t w, r;
- w = atomic_read (&write_ptr);
- r = atomic_read (&read_ptr);
+ w = g_atomic_int_get (&write_ptr);
+ r = g_atomic_int_get (&read_ptr);
if (w > r) {
return w - r;
@@ -109,15 +110,15 @@ class RingBuffer
}
T *buffer () { return buf; }
- size_t get_write_ptr () const { return atomic_read (&write_ptr); }
- size_t get_read_ptr () const { return atomic_read (&read_ptr); }
+ size_t get_write_ptr () const { return g_atomic_int_get (&write_ptr); }
+ size_t get_read_ptr () const { return g_atomic_int_get (&read_ptr); }
size_t bufsize () const { return size; }
protected:
T *buf;
size_t size;
- atomic_t write_ptr;
- atomic_t read_ptr;
+ gint write_ptr;
+ gint read_ptr;
size_t size_mask;
};
@@ -130,7 +131,7 @@ RingBuffer<T>::read (T *dest, size_t cnt)
size_t n1, n2;
size_t priv_read_ptr;
- priv_read_ptr=atomic_read(&read_ptr);
+ priv_read_ptr=g_atomic_int_get(&read_ptr);
if ((free_cnt = read_space ()) == 0) {
return 0;
@@ -156,7 +157,7 @@ RingBuffer<T>::read (T *dest, size_t cnt)
priv_read_ptr = n2;
}
- atomic_set(&read_ptr, priv_read_ptr);
+ g_atomic_int_set(&read_ptr, priv_read_ptr);
return to_read;
}
@@ -170,7 +171,7 @@ RingBuffer<T>::write (T *src, size_t cnt)
size_t n1, n2;
size_t priv_write_ptr;
- priv_write_ptr=atomic_read(&write_ptr);
+ priv_write_ptr=g_atomic_int_get(&write_ptr);
if ((free_cnt = write_space ()) == 0) {
return 0;
@@ -196,7 +197,7 @@ RingBuffer<T>::write (T *src, size_t cnt)
priv_write_ptr = n2;
}
- atomic_set(&write_ptr, priv_write_ptr);
+ g_atomic_int_set(&write_ptr, priv_write_ptr);
return to_write;
}
@@ -208,8 +209,8 @@ RingBuffer<T>::get_read_vector (RingBuffer<T>::rw_vector *vec)
size_t cnt2;
size_t w, r;
- w = atomic_read (&write_ptr);
- r = atomic_read (&read_ptr);
+ w = g_atomic_int_get (&write_ptr);
+ r = g_atomic_int_get (&read_ptr);
if (w > r) {
free_cnt = w - r;
@@ -248,8 +249,8 @@ RingBuffer<T>::get_write_vector (RingBuffer<T>::rw_vector *vec)
size_t cnt2;
size_t w, r;
- w = atomic_read (&write_ptr);
- r = atomic_read (&read_ptr);
+ w = g_atomic_int_get (&write_ptr);
+ r = g_atomic_int_get (&read_ptr);
if (w > r) {
free_cnt = ((r - w + size) & size_mask) - 1;
diff --git a/libs/pbd3/pbd/ringbufferNPT.h b/libs/pbd3/pbd/ringbufferNPT.h
index d559a53d94..bb5df15b2e 100644
--- a/libs/pbd3/pbd/ringbufferNPT.h
+++ b/libs/pbd3/pbd/ringbufferNPT.h
@@ -21,8 +21,9 @@
#ifndef ringbuffer_npt_h
#define ringbuffer_npt_h
-#include <sys/mman.h>
-#include <pbd/atomic.h>
+//#include <sys/mman.h>
+
+#include <glib.h>
/* ringbuffer class where the element size is not required to be a power of two */
@@ -43,14 +44,14 @@ class RingBufferNPT
void reset () {
/* !!! NOT THREAD SAFE !!! */
- atomic_set (&write_ptr, 0);
- atomic_set (&read_ptr, 0);
+ g_atomic_int_set (&write_ptr, 0);
+ g_atomic_int_set (&read_ptr, 0);
}
void set (size_t r, size_t w) {
/* !!! NOT THREAD SAFE !!! */
- atomic_set (&write_ptr, w);
- atomic_set (&read_ptr, r);
+ g_atomic_int_set (&write_ptr, w);
+ g_atomic_int_set (&read_ptr, r);
}
size_t read (T *dest, size_t cnt);
@@ -65,22 +66,22 @@ class RingBufferNPT
void get_write_vector (rw_vector *);
void decrement_read_ptr (size_t cnt) {
- atomic_set (&read_ptr, (atomic_read(&read_ptr) - cnt) % size);
+ g_atomic_int_set (&read_ptr, (g_atomic_int_get(&read_ptr) - cnt) % size);
}
void increment_read_ptr (size_t cnt) {
- atomic_set (&read_ptr, (atomic_read(&read_ptr) + cnt) % size);
+ g_atomic_int_set (&read_ptr, (g_atomic_int_get(&read_ptr) + cnt) % size);
}
void increment_write_ptr (size_t cnt) {
- atomic_set (&write_ptr, (atomic_read(&write_ptr) + cnt) % size);
+ g_atomic_int_set (&write_ptr, (g_atomic_int_get(&write_ptr) + cnt) % size);
}
size_t write_space () {
size_t w, r;
- w = atomic_read (&write_ptr);
- r = atomic_read (&read_ptr);
+ w = g_atomic_int_get (&write_ptr);
+ r = g_atomic_int_get (&read_ptr);
if (w > r) {
return ((r - w + size) % size) - 1;
@@ -94,8 +95,8 @@ class RingBufferNPT
size_t read_space () {
size_t w, r;
- w = atomic_read (&write_ptr);
- r = atomic_read (&read_ptr);
+ w = g_atomic_int_get (&write_ptr);
+ r = g_atomic_int_get (&read_ptr);
if (w > r) {
return w - r;
@@ -105,15 +106,15 @@ class RingBufferNPT
}
T *buffer () { return buf; }
- size_t get_write_ptr () const { return atomic_read (&write_ptr); }
- size_t get_read_ptr () const { return atomic_read (&read_ptr); }
+ size_t get_write_ptr () const { return g_atomic_int_get (&write_ptr); }
+ size_t get_read_ptr () const { return g_atomic_int_get (&read_ptr); }
size_t bufsize () const { return size; }
protected:
T *buf;
size_t size;
- atomic_t write_ptr;
- atomic_t read_ptr;
+ gint write_ptr;
+ gint read_ptr;
};
template<class T> size_t
@@ -125,7 +126,7 @@ RingBufferNPT<T>::read (T *dest, size_t cnt)
size_t n1, n2;
size_t priv_read_ptr;
- priv_read_ptr=atomic_read(&read_ptr);
+ priv_read_ptr=g_atomic_int_get(&read_ptr);
if ((free_cnt = read_space ()) == 0) {
return 0;
@@ -151,7 +152,7 @@ RingBufferNPT<T>::read (T *dest, size_t cnt)
priv_read_ptr = n2;
}
- atomic_set(&read_ptr, priv_read_ptr);
+ g_atomic_int_set(&read_ptr, priv_read_ptr);
return to_read;
}
@@ -164,7 +165,7 @@ RingBufferNPT<T>::write (T *src, size_t cnt)
size_t n1, n2;
size_t priv_write_ptr;
- priv_write_ptr=atomic_read(&write_ptr);
+ priv_write_ptr=g_atomic_int_get(&write_ptr);
if ((free_cnt = write_space ()) == 0) {
return 0;
@@ -190,7 +191,7 @@ RingBufferNPT<T>::write (T *src, size_t cnt)
priv_write_ptr = n2;
}
- atomic_set(&write_ptr, priv_write_ptr);
+ g_atomic_int_set(&write_ptr, priv_write_ptr);
return to_write;
}
@@ -201,8 +202,8 @@ RingBufferNPT<T>::get_read_vector (RingBufferNPT<T>::rw_vector *vec)
size_t cnt2;
size_t w, r;
- w = atomic_read (&write_ptr);
- r = atomic_read (&read_ptr);
+ w = g_atomic_int_get (&write_ptr);
+ r = g_atomic_int_get (&read_ptr);
if (w > r) {
free_cnt = w - r;
@@ -240,8 +241,8 @@ RingBufferNPT<T>::get_write_vector (RingBufferNPT<T>::rw_vector *vec)
size_t cnt2;
size_t w, r;
- w = atomic_read (&write_ptr);
- r = atomic_read (&read_ptr);
+ w = g_atomic_int_get (&write_ptr);
+ r = g_atomic_int_get (&read_ptr);
if (w > r) {
free_cnt = ((r - w + size) % size) - 1;
diff --git a/libs/pbd3/pbd/rt.h b/libs/pbd3/pbd/rt.h
deleted file mode 100644
index aa954fcd42..0000000000
--- a/libs/pbd3/pbd/rt.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- Copyright (C) 1998-99 Paul Barton-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.
-
- $Id$
-*/
-#ifndef __libmisc_rt_h__
-#define __libmisc_rt_h__
-
-extern int become_real_time_thread (int rt_priorty = 10, bool fifo = true);
-
-#endif // __libmisc_rt_h__
diff --git a/libs/pbd3/pbd/rtthread.h b/libs/pbd3/pbd/rtthread.h
deleted file mode 100644
index b99c69ba79..0000000000
--- a/libs/pbd3/pbd/rtthread.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- Copyright (C) 1998-99 Paul Barton-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.
-
- $Id$
-*/
-#ifndef __rtthread_h__
-#define __rtthread_h__
-
-#include <pthread.h>
-
-extern int pthread_create_realtime (pthread_t *new_thread,
- void *(*start)(void *), void *arg,
- int priority = 10);
-
-
-#endif // __rtthread_h__
diff --git a/libs/pbd3/pbd/scale.h b/libs/pbd3/pbd/scale.h
deleted file mode 100644
index 0384ae52aa..0000000000
--- a/libs/pbd3/pbd/scale.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- Copyright (C) 2000 Paul Barton-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.
-
- $Id$
-*/
-
-#ifndef __pbd_scale_h__
-#define __pbd_scale_h__
-
-#include <cmath>
-
-inline float
-scale (float value, float lower, float upper)
-{
- return fabs (lower + value) / (upper-lower);
-}
-
-inline float
-scale_with_range (float value, float lower, float range)
-{
- return fabs (lower + value) / range;
-}
-
-
-inline float
-scale_to (float value, float lower, float upper, float to)
-{
- return (fabs (lower + value) / (upper-lower)) * to;
-}
-
-inline float
-scale_to_with_range (float value, float lower, float range, float to)
-{
- return (fabs (lower + value) / range) * to;
-}
-
-#endif /* __pbd_scale_h__ */
-
-
diff --git a/libs/pbd3/pbd/thread.h b/libs/pbd3/pbd/thread.h
deleted file mode 100644
index c1d5c3c78d..0000000000
--- a/libs/pbd3/pbd/thread.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- Copyright (C) 1998-99 Paul Barton-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.
-
- $Id$
-*/
-
-#ifndef __qm_thread_h__
-#define __qm_thread_h__
-
-#include <pthread.h>
-
-/* A generic base class for Quasimodo objects requiring their own
- thread to do work.
-*/
-
-class QMThread
-
-{
- public:
- QMThread (const char *name,
- void *(start)(void *), void *,
- bool realtime = false, int rt_priority = 10);
-
- virtual ~QMThread();
-
- int run ();
- void poke ();
- void pause ();
- void stop ();
- void *wait ();
-
- /* This doesn't guarantee anything about the state of
- the thread, but if you do things the right way, and
- make sure that the do_work() routine checks
- work_no_more() at the right times, and that the
- thread is awake, then calling this will cause
- the thread to exit fairly quickly.
- */
-
- void halt() { _must_exit = true ; }
-
- void exit (void *status);
- pthread_t thread_id() { return _thread; }
-
- bool thread_ok () { return _have_thread; }
- bool thread_active() { return _thread_active; }
-
- bool thread_running () {
- /* XXX not atomic */
- return _running && _thread_active;
- }
-
- bool thread_waiting () { return _thread_waiting; }
-
- static void try_to_kill_all_threads() {
- all_threads_must_die = true;
- }
-
- protected:
- void *main ();
-
- bool work_no_more () { return (!_running || _must_exit || all_threads_must_die); }
-
- bool myself () {
- return pthread_equal (_thread, pthread_self());
- }
-
- void suspend() {
- _running = false;
- }
-
- void lock (pthread_mutex_t *lock) {
- pthread_mutex_lock (lock);
- }
-
- void unlock (pthread_mutex_t *lock) {
- pthread_mutex_unlock (lock);
- }
-
- virtual void *do_work () = 0;
-
- private:
- const char *_name;
- bool _must_exit;
- bool _running;
- bool _thread_active;
- bool _thread_waiting;
- bool _have_thread;
-
- size_t work_cnt;
-
- pthread_mutex_t status_lock;
- pthread_cond_t wake_up; /* protected by status_lock */
- pthread_cond_t asleep; /* protected by status_lock */
- pthread_cond_t running; /* protected by status_lock */
- pthread_cond_t exited; /* protected by status_lock */
- pthread_t _thread;
-
- void lock () {
- pthread_mutex_lock (&status_lock);
- }
-
- void unlock () {
- pthread_mutex_unlock (&status_lock);
- }
-
- static bool all_threads_must_die;
-
- static void signal_catcher (int sig);
- void setup_signals ();
-};
-
-#endif // __qm_thread_h__
diff --git a/libs/pbd3/pbd/types.h b/libs/pbd3/pbd/types.h
deleted file mode 100644
index 52f067fd04..0000000000
--- a/libs/pbd3/pbd/types.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- Copyright (C) 1999 Paul Barton-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.
-
- $Id$
-*/
-
-#ifndef __pbd_types_h__
-#define __pbd_types_h__
-
-typedef unsigned char byte;
-typedef char int8;
-typedef unsigned short uint16;
-typedef short int16;
-typedef unsigned int uint32;
-typedef int int32;
-typedef unsigned long long int uint64;
-typedef long long int int64;
-
-#endif // __pbd_types_h__
diff --git a/libs/pbd3/pbd/unescape.h b/libs/pbd3/pbd/unescape.h
deleted file mode 100644
index 6596a86113..0000000000
--- a/libs/pbd3/pbd/unescape.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __unescape_h__
-#define __unescape_h__
-
-void unescape (char *);
-
-#endif // __unescape_h__
diff --git a/libs/pbd3/pool.cc b/libs/pbd3/pool.cc
index f05d88381c..7318bd4398 100644
--- a/libs/pbd3/pool.cc
+++ b/libs/pbd3/pool.cc
@@ -19,13 +19,10 @@
*/
#include <iostream>
-#include <sys/mman.h>
#include <vector>
#include <pbd/pool.h>
#include <pbd/error.h>
-#include <pbd/stl_delete.h>
-#include <pbd/pthread_utils.h>
using namespace std;
@@ -84,32 +81,39 @@ Pool::release (void *ptr)
/*---------------------------------------------*/
MultiAllocSingleReleasePool::MultiAllocSingleReleasePool (string n, unsigned long isize, unsigned long nitems)
- : Pool (n, isize, nitems)
+ : Pool (n, isize, nitems),
+ m_lock(0)
{
- pthread_mutex_init (&lock, 0);
}
MultiAllocSingleReleasePool::~MultiAllocSingleReleasePool ()
{
+ if(m_lock) delete m_lock;
}
SingleAllocMultiReleasePool::SingleAllocMultiReleasePool (string n, unsigned long isize, unsigned long nitems)
- : Pool (n, isize, nitems)
+ : Pool (n, isize, nitems),
+ m_lock(0)
{
- pthread_mutex_init (&lock, 0);
}
SingleAllocMultiReleasePool::~SingleAllocMultiReleasePool ()
{
+ if(m_lock) delete m_lock;
}
void*
MultiAllocSingleReleasePool::alloc ()
{
void *ptr;
- pthread_mutex_lock (&lock);
+ if(!m_lock) {
+ m_lock = new Glib::Mutex();
+ // umm, I'm not sure that this doesn't also allocate memory.
+ if(!m_lock) error << "cannot create Glib::Mutex in pool.cc" << endmsg;
+ }
+
+ Glib::Mutex::Lock guard(*m_lock);
ptr = Pool::alloc ();
- pthread_mutex_unlock (&lock);
return ptr;
}
@@ -128,8 +132,12 @@ SingleAllocMultiReleasePool::alloc ()
void
SingleAllocMultiReleasePool::release (void* ptr)
{
- pthread_mutex_lock (&lock);
+ if(!m_lock) {
+ m_lock = new Glib::Mutex();
+ // umm, I'm not sure that this doesn't also allocate memory.
+ if(!m_lock) error << "cannot create Glib::Mutex in pool.cc" << endmsg;
+ }
+ Glib::Mutex::Lock guard(*m_lock);
Pool::release (ptr);
- pthread_mutex_unlock (&lock);
}
diff --git a/libs/pbd3/unescape.cc b/libs/pbd3/unescape.cc
deleted file mode 100644
index 2c79740e4a..0000000000
--- a/libs/pbd3/unescape.cc
+++ /dev/null
@@ -1,137 +0,0 @@
-#include <cstdlib>
-
-#include <pbd/unescape.h>
-
-void
-unescape (char *str)
-
-{
- char *p;
- bool escaped;
- long offset;
- char octal[4];
- int noct;
- char hex[3];
- int nhex;
-
- escaped = false;
- offset = 0;
- octal[3] = '\0';
- hex[2] = '\0';
-
- p = str;
-
- while (*p) {
- if (!escaped) {
- if (*p == '\\') {
- escaped = true;
- } else {
- *(p-offset) = *p;
- }
- p++;
- continue;
- }
-
- switch (*p) {
- case 'f':
- offset++;
- *(p-offset) = '\f';
- break;
- case 'r':
- offset++;
- *(p-offset) = '\r';
- break;
-
- case 'v':
- offset++;
- *(p-offset) = '\v';
- break;
-
- case 'n':
- offset++;
- *(p-offset) = '\n';
- break;
-
- case 't':
- offset++;
- *(p-offset) = '\t';
- break;
-
- case 'b':
- offset++;
- *(p-offset) = '\b';
- break;
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- noct = 0;
- while (noct < 3 &&
- (*p >= '0' && *p <= '7')) {
- octal[noct++] = *p;
- offset++;
- p++;
- }
- p--;
- *(p-offset) = strtol (octal, 0, 8);
- break;
-
- case 'x':
- nhex = 0;
- p++;
- offset++;
-
- while (nhex < 2 &&
- ((*p >= '0' && *p <= '9') ||
- (*p >= 'a' && *p <= 'f') ||
- (*p >= 'A' && *p <= 'F'))) {
- hex[nhex++] = *p;
- offset++;
- p++;
- }
- p--;
- *(p-offset) = strtol (hex, 0, 16);
- break;
-
- case '\\':
- offset++;
- *(p-offset) = '\\';
- break;
-
- case '"':
- offset++;
- *(p-offset) = '"';
- break;
-
- case '\'':
- offset++;
- *(p-offset) = '\'';
- break;
-
- default:
- *(p-offset) = *p;
- }
-
- escaped = false;
- p++;
- }
-
- *(p-offset) = '\0';
-}
-
-#ifdef TEST
-#include <cstdio>
-
-main (int argc, char *argv[])
-
-{
- unescape (argv[1]);
- printf ("%s\n", argv[1]);
-}
-
-#endif
diff --git a/libs/surfaces/control_protocol/SConscript b/libs/surfaces/control_protocol/SConscript
index eeac7bed8b..38ff95d9f0 100644
--- a/libs/surfaces/control_protocol/SConscript
+++ b/libs/surfaces/control_protocol/SConscript
@@ -36,7 +36,9 @@ cp.Merge ([
libraries['pbd3'],
libraries['midi++2'],
libraries['xml'],
- libraries['usb']
+ libraries['usb'],
+ libraries['glib2'],
+ libraries['glibmm2']
])
libardour_cp = cp.SharedLibrary('ardour_cp', cp_files)
diff --git a/libs/surfaces/generic_midi/SConscript b/libs/surfaces/generic_midi/SConscript
index 97998f864f..1760eb24e9 100644
--- a/libs/surfaces/generic_midi/SConscript
+++ b/libs/surfaces/generic_midi/SConscript
@@ -37,7 +37,9 @@ genericmidi.Merge ([
libraries['pbd3'],
libraries['sigc2'],
libraries['usb'],
- libraries['xml']
+ libraries['xml'],
+ libraries['glib2'],
+ libraries['glibmm2']
])
libardour_genericmidi = genericmidi.SharedLibrary('ardour_genericmidi', genericmidi_files)
diff --git a/libs/surfaces/tranzport/SConscript b/libs/surfaces/tranzport/SConscript
index 55dae57cc1..bbd6719aef 100644
--- a/libs/surfaces/tranzport/SConscript
+++ b/libs/surfaces/tranzport/SConscript
@@ -37,7 +37,8 @@ tranzport.Merge ([
libraries['pbd3'],
libraries['midi++2'],
libraries['xml'],
- libraries['usb']
+ libraries['usb'],
+ libraries['glib2']
])
libardour_tranzport = tranzport.SharedLibrary('ardour_tranzport', tranzport_files)