Merged with trunk (painfully)

git-svn-id: svn://localhost/ardour2/branches/midi@581 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2006-06-13 07:27:52 +00:00
parent edc7a146f5
commit 868f557f26
127 changed files with 1758 additions and 1195 deletions

3
LAST_MERGE Normal file
View file

@ -0,0 +1,3 @@
Last merged with trunk revision:
579

View file

@ -11,12 +11,10 @@ import platform
from sets import Set from sets import Set
import SCons.Node.FS import SCons.Node.FS
#import pickle
SConsignFile() SConsignFile()
EnsureSConsVersion(0, 96) EnsureSConsVersion(0, 96)
version = '2.0alpha2' version = '2.0beta1'
subst_dict = { } subst_dict = { }
@ -38,7 +36,9 @@ opts.AddOptions(
BoolOption('FPU_OPTIMIZATION', 'Build runtime checked assembler code', 1), BoolOption('FPU_OPTIMIZATION', 'Build runtime checked assembler code', 1),
BoolOption('FFT_ANALYSIS', 'Include FFT analysis window', 0), BoolOption('FFT_ANALYSIS', 'Include FFT analysis window', 0),
BoolOption('SURFACES', 'Build support for control surfaces', 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),
BoolOption('COREAUDIO', 'Compile with Apple\'s CoreAudio library -- UNSTABLE', 0)
) )
#---------------------------------------------------------------------- #----------------------------------------------------------------------
@ -382,6 +382,7 @@ libraries['glib2'] = LibraryInfo()
libraries['glib2'].ParseConfig ('pkg-config --cflags --libs glib-2.0') 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 gobject-2.0')
libraries['glib2'].ParseConfig ('pkg-config --cflags --libs gmodule-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'] = LibraryInfo()
libraries['gtk2'].ParseConfig ('pkg-config --cflags --libs gtk+-2.0') libraries['gtk2'].ParseConfig ('pkg-config --cflags --libs gtk+-2.0')
@ -427,12 +428,13 @@ libraries['usb'] = conf.Finish ()
# #
# Check for liblo # Check for liblo
if env['LIBLO']:
libraries['lo'] = LibraryInfo () libraries['lo'] = LibraryInfo ()
conf = Configure (libraries['lo']) conf = Configure (libraries['lo'])
if conf.CheckLib ('lo', 'lo_server_new') == False: if conf.CheckLib ('lo', 'lo_server_new') == False:
print "liblo does not appear to be installed." print "liblo does not appear to be installed."
exit (0) sys.exit (1)
libraries['lo'] = conf.Finish () libraries['lo'] = conf.Finish ()
@ -461,12 +463,7 @@ libraries['dmalloc'] = conf.Finish ()
conf = Configure(env) conf = Configure(env)
if conf.CheckCHeader('jack/midiport.h'): if conf.CheckCHeader('alsa/asoundlib.h'):
libraries['sysmidi'] = LibraryInfo (LIBS='jack')
env['SYSMIDI'] = 'JACK MIDI'
subst_dict['%MIDITAG%'] = "control"
subst_dict['%MIDITYPE%'] = "jack"
elif conf.CheckCHeader('alsa/asoundlib.h'):
libraries['sysmidi'] = LibraryInfo (LIBS='asound') libraries['sysmidi'] = LibraryInfo (LIBS='asound')
env['SYSMIDI'] = 'ALSA Sequencer' env['SYSMIDI'] = 'ALSA Sequencer'
subst_dict['%MIDITAG%'] = "seq" subst_dict['%MIDITAG%'] = "seq"
@ -477,6 +474,9 @@ elif conf.CheckCHeader('/System/Library/Frameworks/CoreMIDI.framework/Headers/Co
env['SYSMIDI'] = 'CoreMIDI' env['SYSMIDI'] = 'CoreMIDI'
subst_dict['%MIDITAG%'] = "ardour" subst_dict['%MIDITAG%'] = "ardour"
subst_dict['%MIDITYPE%'] = "coremidi" subst_dict['%MIDITYPE%'] = "coremidi"
else:
print "It appears you don't have the required MIDI libraries installed."
sys.exit (1)
env = conf.Finish() env = conf.Finish()
@ -594,12 +594,6 @@ Help(opts.GenerateHelpText(env))
if os.environ.has_key('PATH'): if os.environ.has_key('PATH'):
env.Append(PATH = os.environ['PATH']) env.Append(PATH = os.environ['PATH'])
if os.environ.has_key('TERM'):
env.Append(PATH = os.environ['TERM'])
if os.environ.has_key('HOME'):
env.Append(HOME = os.environ['HOME'])
if os.environ.has_key('PKG_CONFIG_PATH'): if os.environ.has_key('PKG_CONFIG_PATH'):
env.Append(PKG_CONFIG_PATH = os.environ['PKG_CONFIG_PATH']) env.Append(PKG_CONFIG_PATH = os.environ['PKG_CONFIG_PATH'])
@ -742,6 +736,12 @@ if env['FPU_OPTIMIZATION']:
print "\nWarning: you are building Ardour with SSE support even though your system does not support these instructions. (This may not be an error, especially if you are a package maintainer)" print "\nWarning: you are building Ardour with SSE support even though your system does not support these instructions. (This may not be an error, especially if you are a package maintainer)"
# end optimization section # end optimization section
#
# save off guessed arch element in an env
#
env.Append(CONFIG_ARCH=config[config_arch])
# #
# ARCH="..." overrides all # ARCH="..." overrides all
# #
@ -770,6 +770,9 @@ env.Append(CCFLAGS="-Wall")
if env['VST']: if env['VST']:
env.Append(CCFLAGS="-DVST_SUPPORT") env.Append(CCFLAGS="-DVST_SUPPORT")
if env['LIBLO']:
env.Append(CCFLAGS="-DHAVE_LIBLO")
# #
# everybody needs this # everybody needs this
# #
@ -873,8 +876,6 @@ for sublistdir in [ subdirs, gtk_subdirs, surface_subdirs ]:
for subdir in sublistdir: for subdir in sublistdir:
SConscript (subdir + '/SConscript') SConscript (subdir + '/SConscript')
#pickle.dump(env, open('.scons_env', 'w'), pickle.HIGHEST_PROTOCOL)
# cleanup # cleanup
env.Clean ('scrub', [ 'scache.conf', '.sconf_temp', '.sconsign.dblite', 'config.log']) env.Clean ('scrub', [ 'scache.conf', '.sconf_temp', '.sconsign.dblite', 'config.log'])

View file

@ -262,6 +262,7 @@ env.Alias('install', env.Install(os.path.join(install_prefix, 'share/ardour2/pix
env.Alias ('tarball', env.Distribute (env['DISTTREE'], env.Alias ('tarball', env.Distribute (env['DISTTREE'],
[ 'SConscript', [ 'SConscript',
'i18n.h', 'gettext.h', 'i18n.h', 'gettext.h',
'ardour.sh.in',
'ardour2_ui.rc', 'splash.ppm', 'ardour2_ui.rc', 'splash.ppm',
'ardour.menus', 'ardour.bindings', 'ardour.colors', 'ardour.menus', 'ardour.bindings', 'ardour.colors',
'editor_xpms' 'editor_xpms'

View file

@ -211,7 +211,7 @@ AnalysisWindow::analyze_data (Gtk::Button *button)
{ {
track_list_ready = false; track_list_ready = false;
{ {
LockMonitor lm (track_list_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (track_list_lock);
// Empty track list & free old graphs // Empty track list & free old graphs
clear_tracklist(); clear_tracklist();

View file

@ -34,7 +34,7 @@
#include <gtkmm2ext/dndtreeview.h> #include <gtkmm2ext/dndtreeview.h>
#include <pbd/lockmonitor.h> #include <glibmm/thread.h>
#include "ardour_dialog.h" #include "ardour_dialog.h"
@ -106,7 +106,7 @@ class AnalysisWindow : public ArdourDialog
FFTGraph fft_graph; FFTGraph fft_graph;
bool track_list_ready; bool track_list_ready;
PBD::Lock track_list_lock; Glib::Mutex track_list_lock;
friend class FFTGraph; friend class FFTGraph;
}; };

View file

@ -33,7 +33,6 @@
#include <pbd/error.h> #include <pbd/error.h>
#include <pbd/compose.h> #include <pbd/compose.h>
#include <pbd/basename.h>
#include <pbd/pathscanner.h> #include <pbd/pathscanner.h>
#include <pbd/failed_constructor.h> #include <pbd/failed_constructor.h>
#include <gtkmm2ext/gtk_ui.h> #include <gtkmm2ext/gtk_ui.h>
@ -210,22 +209,6 @@ ARDOUR_UI::set_engine (AudioEngine& e)
keyboard = new Keyboard; keyboard = new Keyboard;
string meter_path;
meter_path = ARDOUR::find_data_file("v_meter_strip.xpm", "pixmaps");
if (meter_path.empty()) {
error << _("no vertical meter strip image found") << endmsg;
exit (1);
}
FastMeter::set_vertical_xpm (meter_path);
meter_path = ARDOUR::find_data_file("h_meter_strip.xpm", "pixmaps");
if (meter_path.empty()) {
error << _("no horizontal meter strip image found") << endmsg;
exit (1);
}
FastMeter::set_horizontal_xpm (meter_path);
if (setup_windows ()) { if (setup_windows ()) {
throw failed_constructor (); throw failed_constructor ();
} }
@ -717,7 +700,7 @@ ARDOUR_UI::redisplay_recent_sessions ()
TreeModel::Row row = *(recent_session_model->append()); 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; row[recent_session_columns.fullpath] = fullpath;
if (states->size() > 1) { if (states->size() > 1) {
@ -824,9 +807,11 @@ ARDOUR_UI::filter_ardour_session_dirs (const FileFilter::Info& info)
return false; return false;
} }
// XXX Portability
string session_file = info.filename; string session_file = info.filename;
session_file += '/'; session_file += '/';
session_file += PBD::basename (info.filename); session_file += Glib::path_get_basename (info.filename);
session_file += ".ardour"; session_file += ".ardour";
if (stat (session_file.c_str(), &statbuf) != 0) { if (stat (session_file.c_str(), &statbuf) != 0) {

View file

@ -652,8 +652,15 @@ ARDOUR_UI::shuttle_box_button_release (GdkEventButton* ev)
shuttle_grabbed = false; shuttle_grabbed = false;
shuttle_box.remove_modal_grab (); shuttle_box.remove_modal_grab ();
if (shuttle_behaviour == Sprung) { if (shuttle_behaviour == Sprung) {
if (session->get_auto_play() || roll_button.get_state()) {
shuttle_fract = SHUTTLE_FRACT_SPEED1; shuttle_fract = SHUTTLE_FRACT_SPEED1;
session->request_transport_speed (1.0); session->request_transport_speed (1.0);
stop_button.set_active (false);
roll_button.set_active (true);
} else {
shuttle_fract = 0;
session->request_transport_speed (0.0);
}
shuttle_box.queue_draw (); shuttle_box.queue_draw ();
} }
return true; return true;
@ -662,6 +669,8 @@ ARDOUR_UI::shuttle_box_button_release (GdkEventButton* ev)
if (session->transport_rolling()) { if (session->transport_rolling()) {
shuttle_fract = SHUTTLE_FRACT_SPEED1; shuttle_fract = SHUTTLE_FRACT_SPEED1;
session->request_transport_speed (1.0); session->request_transport_speed (1.0);
stop_button.set_active (false);
roll_button.set_active (true);
} else { } else {
shuttle_fract = 0; shuttle_fract = 0;
} }

View file

@ -41,6 +41,7 @@ using namespace sigc;
using namespace Gtk; using namespace Gtk;
using PBD::atoi; using PBD::atoi;
using PBD::atof;
const uint32_t AudioClock::field_length[(int) AudioClock::AudioFrames+1] = { const uint32_t AudioClock::field_length[(int) AudioClock::AudioFrames+1] = {
2, /* SMPTE_Hours */ 2, /* SMPTE_Hours */
@ -1286,13 +1287,13 @@ AudioClock::smpte_frame_from_display () const
SMPTE::Time smpte2; SMPTE::Time smpte2;
jack_nframes_t sample_increment; jack_nframes_t sample_increment;
sample_increment = (long)rint(session->frame_rate() / SMPTE::frames_per_second); sample_increment = (long)rint(session->frame_rate() / session->smpte_frames_per_second);
#ifdef SMPTE_SAMPLE_TEST_1 #ifdef SMPTE_SAMPLE_TEST_1
// Test 1: use_offset = false, use_subframes = false // Test 1: use_offset = false, use_subframes = false
cout << "use_offset = false, use_subframes = false" << endl; cout << "use_offset = false, use_subframes = false" << endl;
for (int i = 0; i < 108003; i++) { for (int i = 0; i < 108003; i++) {
SMPTE::to_sample( smpte1, sample1, false /* use_offset */, false /* use_subframes */ ); session->smpte_to_sample( smpte1, sample1, false /* use_offset */, false /* use_subframes */ );
session->sample_to_smpte( sample1, smpte2, false /* use_offset */, false /* use_subframes */ ); session->sample_to_smpte( sample1, smpte2, false /* use_offset */, false /* use_subframes */ );
if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) { if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
@ -1313,7 +1314,7 @@ AudioClock::smpte_frame_from_display () const
break; break;
} }
oldsample = sample1; oldsample = sample1;
SMPTE::increment( smpte1 ); session->smpte_increment( smpte1 );
} }
cout << "sample_increment: " << sample_increment << endl; cout << "sample_increment: " << sample_increment << endl;
@ -1337,7 +1338,7 @@ AudioClock::smpte_frame_from_display () const
cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl; cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
for (int i = 0; i < 108003; i++) { for (int i = 0; i < 108003; i++) {
SMPTE::to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ ); session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ ); session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
// cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
@ -1363,7 +1364,7 @@ AudioClock::smpte_frame_from_display () const
break; break;
} }
oldsample = sample1; oldsample = sample1;
SMPTE::increment( smpte1 ); session->smpte_increment( smpte1 );
} }
cout << "sample_increment: " << sample_increment << endl; cout << "sample_increment: " << sample_increment << endl;
@ -1380,7 +1381,7 @@ AudioClock::smpte_frame_from_display () const
cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl; cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
for (int i = 0; i < 108003; i++) { for (int i = 0; i < 108003; i++) {
SMPTE::to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ ); session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ ); session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
// cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
@ -1406,7 +1407,7 @@ AudioClock::smpte_frame_from_display () const
break; break;
} }
oldsample = sample1; oldsample = sample1;
SMPTE::decrement( smpte1 ); session->smpte_decrement( smpte1 );
} }
cout << "sample_decrement: " << sample_increment << endl; cout << "sample_decrement: " << sample_increment << endl;
@ -1433,7 +1434,7 @@ AudioClock::smpte_frame_from_display () const
cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl; cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
for (int i = 0; i < 108003; i++) { for (int i = 0; i < 108003; i++) {
SMPTE::to_sample( smpte1, sample1, true /* use_offset */, true /* use_subframes */ ); session->smpte_to_sample( smpte1, sample1, true /* use_offset */, true /* use_subframes */ );
session->sample_to_smpte( sample1, smpte2, true /* use_offset */, true /* use_subframes */ ); session->sample_to_smpte( sample1, smpte2, true /* use_offset */, true /* use_subframes */ );
if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) { if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
@ -1454,7 +1455,7 @@ AudioClock::smpte_frame_from_display () const
break; break;
} }
oldsample = sample1; oldsample = sample1;
SMPTE::increment( smpte1 ); session->smpte_increment( smpte1 );
} }
cout << "sample_increment: " << sample_increment << endl; cout << "sample_increment: " << sample_increment << endl;
@ -1462,7 +1463,7 @@ AudioClock::smpte_frame_from_display () const
cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
for (int i = 0; i < 108003; i++) { for (int i = 0; i < 108003; i++) {
SMPTE::to_sample( smpte1, sample1, true /* use_offset */, true /* use_subframes */ ); session->smpte_to_sample( smpte1, sample1, true /* use_offset */, true /* use_subframes */ );
session->sample_to_smpte( sample1, smpte2, true /* use_offset */, true /* use_subframes */ ); session->sample_to_smpte( sample1, smpte2, true /* use_offset */, true /* use_subframes */ );
if ((i > 0) && ( ((oldsample - sample1) != sample_increment) && ((oldsample - sample1) != (sample_increment + 1)) && ((oldsample - sample1) != (sample_increment - 1)))) { if ((i > 0) && ( ((oldsample - sample1) != sample_increment) && ((oldsample - sample1) != (sample_increment + 1)) && ((oldsample - sample1) != (sample_increment - 1)))) {
@ -1483,7 +1484,7 @@ AudioClock::smpte_frame_from_display () const
break; break;
} }
oldsample = sample1; oldsample = sample1;
SMPTE::decrement( smpte1 ); session->smpte_decrement( smpte1 );
} }
cout << "sample_decrement: " << sample_increment << endl; cout << "sample_decrement: " << sample_increment << endl;
@ -1510,7 +1511,7 @@ AudioClock::smpte_frame_from_display () const
cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl; cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
for (int i = 0; i < 3600; i++) { for (int i = 0; i < 3600; i++) {
SMPTE::to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ ); session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ ); session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
// cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
@ -1533,7 +1534,7 @@ AudioClock::smpte_frame_from_display () const
break; break;
} }
oldsample = sample1; oldsample = sample1;
SMPTE::increment_seconds( smpte1 ); session->smpte_increment_seconds( smpte1 );
} }
cout << "sample_increment: " << sample_increment << endl; cout << "sample_increment: " << sample_increment << endl;
@ -1559,7 +1560,7 @@ AudioClock::smpte_frame_from_display () const
cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl; cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
for (int i = 0; i < 60; i++) { for (int i = 0; i < 60; i++) {
SMPTE::to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ ); session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ ); session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
// cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
@ -1582,7 +1583,7 @@ AudioClock::smpte_frame_from_display () const
break; break;
} }
oldsample = sample1; oldsample = sample1;
SMPTE::increment_minutes( smpte1 ); session->smpte_increment_minutes( smpte1 );
} }
cout << "sample_increment: " << sample_increment << endl; cout << "sample_increment: " << sample_increment << endl;
@ -1607,7 +1608,7 @@ AudioClock::smpte_frame_from_display () const
cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl; cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
SMPTE::to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ ); session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ ); session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
// cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
@ -1630,7 +1631,7 @@ AudioClock::smpte_frame_from_display () const
break; break;
} }
oldsample = sample1; oldsample = sample1;
SMPTE::increment_hours( smpte1 ); session->smpte_increment_hours( smpte1 );
} }
cout << "sample_increment: " << sample_increment << endl; cout << "sample_increment: " << sample_increment << endl;

View file

@ -1048,7 +1048,7 @@ AudioTimeAxisView::get_selectables (jack_nframes_t start, jack_nframes_t end, do
jack_nframes_t start_adjusted = session_frame_to_track_frame(start, speed); jack_nframes_t start_adjusted = session_frame_to_track_frame(start, speed);
jack_nframes_t end_adjusted = session_frame_to_track_frame(end, speed); jack_nframes_t end_adjusted = session_frame_to_track_frame(end, speed);
if (view && touched (top, bot)) { if (view && ((top < 0.0 && bot < 0.0)) || touched (top, bot)) {
view->get_selectables (start_adjusted, end_adjusted, results); view->get_selectables (start_adjusted, end_adjusted, results);
} }

View file

@ -34,7 +34,7 @@ namespace ARDOUR {
} }
/** /**
* The abstract base class for time-axis trackviews and routes. * AxisView defines the abstract base class for time-axis trackviews and routes.
* *
*/ */
class AxisView : public virtual sigc::trackable class AxisView : public virtual sigc::trackable

View file

@ -490,7 +490,7 @@ ConnectionEditor::display_ports ()
void void
ConnectionEditor::display_connection_state (bool for_input) ConnectionEditor::display_connection_state (bool for_input)
{ {
LockMonitor lm (port_display_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (port_display_lock);
uint32_t limit; uint32_t limit;
if (session == 0 || current_connection == 0) { if (session == 0 || current_connection == 0) {
@ -601,7 +601,7 @@ ConnectionEditor::add_port ()
void void
ConnectionEditor::connection_port_button_press_event (GdkEventButton* ev, TreeView* tview) 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")); int which_port = reinterpret_cast<intptr_t> (treeview->get_data ("port"));

View file

@ -39,7 +39,7 @@ using __gnu_cxx::slist;
#include "ardour_dialog.h" #include "ardour_dialog.h"
#include <pbd/lockmonitor.h> #include <glibmm/thread.h>
namespace ARDOUR { namespace ARDOUR {
class Session; class Session;
@ -116,7 +116,7 @@ class ConnectionEditor : public ArdourDialog {
Gtk::Button clear_button; Gtk::Button clear_button;
Gtk::Button add_port_button; Gtk::Button add_port_button;
PBD::Lock port_display_lock; Glib::Mutex port_display_lock;
slist<Gtk::ScrolledWindow *> port_displays; slist<Gtk::ScrolledWindow *> port_displays;
Gtk::Button ok_button; Gtk::Button ok_button;

View file

@ -47,7 +47,7 @@ struct CrossfadeView : public TimeAxisViewItem
AudioRegionView& right_view; AudioRegionView& right_view;
std::string get_item_name(); std::string get_item_name();
void set_height (double h); void set_height (double);
bool valid() const { return _valid; } bool valid() const { return _valid; }
bool visible() const { return _visible; } bool visible() const { return _visible; }

View file

@ -38,7 +38,7 @@ struct DragInfo {
bool copy; bool copy;
bool was_rolling; bool was_rolling;
bool first_move; bool first_move;
bool move_threshold_passsed; bool move_threshold_passed;
bool want_move_threshold; bool want_move_threshold;
bool brushing; bool brushing;
ARDOUR::Location* copied_location; ARDOUR::Location* copied_location;

View file

@ -90,6 +90,7 @@ using namespace Gtkmm2ext;
using namespace Editing; using namespace Editing;
using PBD::internationalize; using PBD::internationalize;
using PBD::atoi;
const double Editor::timebar_height = 15.0; const double Editor::timebar_height = 15.0;
@ -326,6 +327,7 @@ Editor::Editor (AudioEngine& eng)
last_canvas_frame = 0; last_canvas_frame = 0;
edit_cursor = 0; edit_cursor = 0;
playhead_cursor = 0; playhead_cursor = 0;
button_release_can_deselect = true;
location_marker_color = color_map[cLocationMarker]; location_marker_color = color_map[cLocationMarker];
location_range_color = color_map[cLocationRange]; location_range_color = color_map[cLocationRange];
@ -2190,7 +2192,7 @@ Editor::set_state (const XMLNode& node)
} }
if ((prop = node.property ("zoom"))) { 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"))) { if ((prop = node.property ("snap-to"))) {
@ -2898,7 +2900,7 @@ Editor::convert_drop_to_paths (vector<ustring>& paths,
for (vector<ustring>::iterator i = uris.begin(); i != uris.end(); ++i) { for (vector<ustring>::iterator i = uris.begin(); i != uris.end(); ++i) {
if ((*i).substr (0,7) == "file://") { if ((*i).substr (0,7) == "file://") {
string p = *i; string p = *i;
url_decode (p); PBD::url_decode (p);
paths.push_back (p.substr (7)); paths.push_back (p.substr (7));
} }
} }
@ -2981,15 +2983,13 @@ Editor::commit_reversible_command ()
} }
} }
void bool
Editor::set_selected_track_from_click (Selection::Operation op, bool with_undo, bool no_remove) Editor::set_selected_track_from_click (bool press, Selection::Operation op, bool with_undo, bool no_remove)
{ {
if (!clicked_trackview) { bool commit = false;
return;
}
if (with_undo) { if (!clicked_trackview) {
begin_reversible_command (_("set selected trackview")); return false;
} }
switch (op) { switch (op) {
@ -2997,15 +2997,17 @@ Editor::set_selected_track_from_click (Selection::Operation op, bool with_undo,
if (selection->selected (clicked_trackview)) { if (selection->selected (clicked_trackview)) {
if (!no_remove) { if (!no_remove) {
selection->remove (clicked_trackview); selection->remove (clicked_trackview);
commit = true;
} }
} else { } else {
selection->toggle (clicked_trackview); selection->add (clicked_trackview);
commit = false;
} }
break; break;
case Selection::Set: case Selection::Set:
if (selection->selected (clicked_trackview) && selection->tracks.size() == 1) { if (selection->selected (clicked_trackview) && selection->tracks.size() == 1) {
/* no commit necessary */ /* no commit necessary */
return;
} }
selection->set (clicked_trackview); selection->set (clicked_trackview);
@ -3016,26 +3018,18 @@ Editor::set_selected_track_from_click (Selection::Operation op, bool with_undo,
break; break;
} }
if (with_undo) { return commit;
commit_reversible_command ();
}
} }
void bool
Editor::set_selected_control_point_from_click (Selection::Operation op, bool with_undo, bool no_remove) Editor::set_selected_control_point_from_click (bool press, Selection::Operation op, bool with_undo, bool no_remove)
{ {
if (!clicked_control_point) { if (!clicked_control_point) {
return; return false;
} }
/* select this point and any others that it represents */ /* select this point and any others that it represents */
bool commit;
if (with_undo) {
begin_reversible_command (_("select control points"));
}
double y1, y2; double y1, y2;
jack_nframes_t x1, x2; jack_nframes_t x1, x2;
@ -3044,18 +3038,12 @@ Editor::set_selected_control_point_from_click (Selection::Operation op, bool wit
y1 = clicked_control_point->get_x() - 10; y1 = clicked_control_point->get_x() - 10;
y2 = clicked_control_point->get_y() + 10; y2 = clicked_control_point->get_y() + 10;
commit = select_all_within (x1, x2, y1, y2, op); return select_all_within (x1, x2, y1, y2, op);
if (with_undo && commit) {
commit_reversible_command ();
}
} }
void void
Editor::mapover_audio_tracks (slot<void,AudioTimeAxisView&,uint32_t> sl) Editor::get_relevant_audio_tracks (AudioTimeAxisView& base, set<AudioTimeAxisView*>& relevant_tracks)
{ {
set<AudioTimeAxisView*> relevant_tracks;
/* step one: get all selected tracks and all tracks in the relevant edit groups */ /* step one: get all selected tracks and all tracks in the relevant edit groups */
for (TrackSelection::iterator ti = selection->tracks.begin(); ti != selection->tracks.end(); ++ti) { for (TrackSelection::iterator ti = selection->tracks.begin(); ti != selection->tracks.end(); ++ti) {
@ -3088,12 +3076,22 @@ Editor::mapover_audio_tracks (slot<void,AudioTimeAxisView&,uint32_t> sl)
/* no active group, or no group */ /* no active group, or no group */
relevant_tracks.insert (atv); relevant_tracks.insert (&base);
} }
} }
}
/* step two: apply operation to each track */ void
Editor::mapover_audio_tracks (slot<void,AudioTimeAxisView&,uint32_t> sl)
{
set<AudioTimeAxisView*> relevant_tracks;
if (!clicked_audio_trackview) {
return;
}
get_relevant_audio_tracks (*clicked_audio_trackview, relevant_tracks);
uint32_t sz = relevant_tracks.size(); uint32_t sz = relevant_tracks.size();
@ -3116,6 +3114,12 @@ Editor::mapped_set_selected_regionview_from_click (AudioTimeAxisView& atv, uint3
return; return;
} }
if (&atv == &basis->get_time_axis_view()) {
/* looking in same track as the original */
return;
}
if ((pl = ds->playlist()) != 0) { if ((pl = ds->playlist()) != 0) {
pl->get_equivalent_regions (basis->region, results); pl->get_equivalent_regions (basis->region, results);
} }
@ -3127,70 +3131,192 @@ Editor::mapped_set_selected_regionview_from_click (AudioTimeAxisView& atv, uint3
} }
} }
void bool
Editor::set_selected_regionview_from_click (Selection::Operation op, bool no_track_remove) Editor::set_selected_regionview_from_click (bool press, Selection::Operation op, bool no_track_remove)
{ {
cerr << "In SSRfC\n";
vector<AudioRegionView*> all_equivalent_regions; vector<AudioRegionView*> all_equivalent_regions;
bool commit = false;
if (!clicked_regionview) { if (!clicked_regionview || !clicked_audio_trackview) {
return; return false;
} }
if (op == Selection::Toggle || op == Selection::Set) {
mapover_audio_tracks (bind (mem_fun (*this, &Editor::mapped_set_selected_regionview_from_click), mapover_audio_tracks (bind (mem_fun (*this, &Editor::mapped_set_selected_regionview_from_click),
clicked_regionview, &all_equivalent_regions)); clicked_regionview, &all_equivalent_regions));
cerr << "mapover done\n"; /* add clicked regionview since we skipped all other regions in the same track as the one it was in */
begin_reversible_command (_("set selected regionview")); all_equivalent_regions.push_back (clicked_regionview);
switch (op) { switch (op) {
case Selection::Toggle: case Selection::Toggle:
selection->toggle (clicked_regionview);
#if 0
if (clicked_regionview->get_selected()) { if (clicked_regionview->get_selected()) {
if (/* group && group->is_active() && */ selection->audio_regions.size() > 1) { if (press) {
/* reduce selection down to just the one clicked */
selection->set (clicked_regionview); /* whatever was clicked was selected already; do nothing here but allow
the button release to deselect it
*/
button_release_can_deselect = true;
} else { } else {
if (button_release_can_deselect) {
/* just remove this one region, but only on a permitted button release */
selection->remove (clicked_regionview); selection->remove (clicked_regionview);
commit = true;
/* no more deselect action on button release till a new press
finds an already selected object.
*/
button_release_can_deselect = false;
} }
}
} else { } else {
selection->add (all_equivalent_regions);
if (press) {
/* add all the equivalent regions, but only on button press */
if (!all_equivalent_regions.empty()) {
commit = true;
}
for (vector<AudioRegionView*>::iterator i = all_equivalent_regions.begin(); i != all_equivalent_regions.end(); ++i) {
selection->add (*i);
}
}
} }
#endif
set_selected_track_from_click (op, false, no_track_remove);
break; break;
case Selection::Set: case Selection::Set:
// karsten wiese suggested these two lines to make if (!clicked_regionview->get_selected()) {
// a selected region rise to the top. but this
// leads to a mismatch between actual layering
// and visual layering. resolution required ....
//
// gnome_canvas_item_raise_to_top (clicked_regionview->get_canvas_group());
// gnome_canvas_item_raise_to_top (clicked_regionview->get_time_axis_view().canvas_display);
if (clicked_regionview->get_selected()) {
/* no commit necessary: we are the one selected. */
return;
} else {
selection->set (all_equivalent_regions); selection->set (all_equivalent_regions);
set_selected_track_from_click (op, false, false); commit = true;
} else {
/* no commit necessary: clicked on an already selected region */
goto out;
} }
break; break;
case Selection::Extend: default:
/* not defined yet */ /* silly compiler */
break; break;
} }
cerr << "case done\n";
commit_reversible_command () ; } else if (op == Selection::Extend) {
list<Selectable*> results;
jack_nframes_t last_frame;
jack_nframes_t first_frame;
/* 1. find the last selected regionview in the track that was clicked in */
last_frame = 0;
first_frame = max_frames;
for (AudioRegionSelection::iterator x = selection->audio_regions.begin(); x != selection->audio_regions.end(); ++x) {
if (&(*x)->get_time_axis_view() == &clicked_regionview->get_time_axis_view()) {
if ((*x)->region.last_frame() > last_frame) {
last_frame = (*x)->region.last_frame();
}
if ((*x)->region.first_frame() < first_frame) {
first_frame = (*x)->region.first_frame();
}
}
}
/* 2. figure out the boundaries for our search for new objects */
switch (clicked_regionview->region.coverage (first_frame, last_frame)) {
case OverlapNone:
cerr << "no overlap, first = " << first_frame << " last = " << last_frame << " region = "
<< clicked_regionview->region.first_frame() << " .. " << clicked_regionview->region.last_frame() << endl;
if (last_frame < clicked_regionview->region.first_frame()) {
first_frame = last_frame;
last_frame = clicked_regionview->region.last_frame();
} else {
last_frame = first_frame;
first_frame = clicked_regionview->region.first_frame();
}
break;
case OverlapExternal:
cerr << "external overlap, first = " << first_frame << " last = " << last_frame << " region = "
<< clicked_regionview->region.first_frame() << " .. " << clicked_regionview->region.last_frame() << endl;
if (last_frame < clicked_regionview->region.first_frame()) {
first_frame = last_frame;
last_frame = clicked_regionview->region.last_frame();
} else {
last_frame = first_frame;
first_frame = clicked_regionview->region.first_frame();
}
break;
case OverlapInternal:
cerr << "internal overlap, first = " << first_frame << " last = " << last_frame << " region = "
<< clicked_regionview->region.first_frame() << " .. " << clicked_regionview->region.last_frame() << endl;
if (last_frame < clicked_regionview->region.first_frame()) {
first_frame = last_frame;
last_frame = clicked_regionview->region.last_frame();
} else {
last_frame = first_frame;
first_frame = clicked_regionview->region.first_frame();
}
break;
case OverlapStart:
case OverlapEnd:
/* nothing to do except add clicked region to selection, since it
overlaps with the existing selection in this track.
*/
break;
}
/* 2. find all selectable objects (regionviews in this case) between that one and the end of the
one that was clicked.
*/
set<AudioTimeAxisView*> relevant_tracks;
get_relevant_audio_tracks (*clicked_audio_trackview, relevant_tracks);
for (set<AudioTimeAxisView*>::iterator t = relevant_tracks.begin(); t != relevant_tracks.end(); ++t) {
(*t)->get_selectables (first_frame, last_frame, -1.0, -1.0, results);
}
/* 3. convert to a vector of audio regions */
vector<AudioRegionView*> audio_regions;
for (list<Selectable*>::iterator x = results.begin(); x != results.end(); ++x) {
AudioRegionView* arv;
if ((arv = dynamic_cast<AudioRegionView*>(*x)) != 0) {
audio_regions.push_back (arv);
}
}
if (!audio_regions.empty()) {
selection->add (audio_regions);
commit = true;
}
}
out:
return commit;
} }
void void
@ -3237,13 +3363,13 @@ Editor::set_selected_regionview_from_region_list (Region& r, Selection::Operatio
switch (op) { switch (op) {
case Selection::Toggle: case Selection::Toggle:
/* XXX this is not correct */ /* XXX this is not correct */
selection->add (all_equivalent_regions); selection->toggle (all_equivalent_regions);
break; break;
case Selection::Set: case Selection::Set:
selection->set (all_equivalent_regions); selection->set (all_equivalent_regions);
break; break;
case Selection::Extend: case Selection::Extend:
/* not defined yet */ selection->add (all_equivalent_regions);
break; break;
} }

View file

@ -413,6 +413,7 @@ class Editor : public PublicEditor
CrossfadeView* clicked_crossfadeview; CrossfadeView* clicked_crossfadeview;
ControlPoint* clicked_control_point; ControlPoint* clicked_control_point;
void get_relevant_audio_tracks (AudioTimeAxisView& base, std::set<AudioTimeAxisView*>& relevant_tracks);
void mapover_audio_tracks (sigc::slot<void,AudioTimeAxisView&,uint32_t> sl); void mapover_audio_tracks (sigc::slot<void,AudioTimeAxisView&,uint32_t> sl);
/* functions to be passed to mapover_audio_tracks(), possibly with sigc::bind()-supplied arguments */ /* functions to be passed to mapover_audio_tracks(), possibly with sigc::bind()-supplied arguments */
@ -424,10 +425,15 @@ class Editor : public PublicEditor
/* end */ /* end */
void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
bool button_release_can_deselect;
void catch_vanishing_audio_regionview (AudioRegionView *); void catch_vanishing_audio_regionview (AudioRegionView *);
void set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool with_undo = true, bool no_remove=false);
void set_selected_track_from_click (Selection::Operation op = Selection::Set, bool with_undo = true, bool no_remove=false); bool set_selected_control_point_from_click (bool press, Selection::Operation op = Selection::Set, bool with_undo = true, bool no_remove=false);
void set_selected_regionview_from_click (Selection::Operation op = Selection::Set, bool no_track_remove=false); bool set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool with_undo = true, bool no_remove=false);
bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
void set_selected_regionview_from_region_list (ARDOUR::Region& region, Selection::Operation op = Selection::Set); void set_selected_regionview_from_region_list (ARDOUR::Region& region, Selection::Operation op = Selection::Set);
bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, ARDOUR::Region*); bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, ARDOUR::Region*);
void collect_new_region_view (AudioRegionView *); void collect_new_region_view (AudioRegionView *);
@ -1037,6 +1043,7 @@ class Editor : public PublicEditor
void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0); void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
bool end_grab (ArdourCanvas::Item*, GdkEvent*); bool end_grab (ArdourCanvas::Item*, GdkEvent*);
void swap_grab (ArdourCanvas::Item*, Gdk::Cursor* cursor, uint32_t time);
Gtk::Menu fade_context_menu; Gtk::Menu fade_context_menu;
void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType); void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);

View file

@ -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 */ /* lets see if we can link it into the session */
linked_path = session->sound_dir(); 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) { if (link (path.c_str(), linked_path.c_str()) == 0) {

View file

@ -537,7 +537,6 @@ Editor::maybe_autoscroll (GdkEvent* event)
} }
last_autoscroll_direction = autoscroll_direction; last_autoscroll_direction = autoscroll_direction;
drag_info.last_pointer_frame = drag_info.current_pointer_frame;
} }
gint gint

View file

@ -96,7 +96,6 @@ Editor::event_frame (GdkEvent* event, double* pcx, double* pcy)
break; break;
case GDK_KEY_PRESS: case GDK_KEY_PRESS:
case GDK_KEY_RELEASE: case GDK_KEY_RELEASE:
cerr << "here\n";
// track_canvas.w2c(event->key.x, event->key.y, *pcx, *pcy); // track_canvas.w2c(event->key.x, event->key.y, *pcx, *pcy);
break; break;
default: default:
@ -284,6 +283,93 @@ Editor::step_mouse_mode (bool next)
} }
} }
void
Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
{
bool commit;
bool c1;
bool c2;
/* in object/audition/timefx mode, any button press sets
the selection if the object can be selected. this is a
bit of hack, because we want to avoid this if the
mouse operation is a region alignment.
note: not dbl-click or triple-click
*/
if (((mouse_mode != MouseObject) &&
(mouse_mode != MouseAudition || item_type != RegionItem) &&
(mouse_mode != MouseTimeFX || item_type != RegionItem)) ||
(event->type != GDK_BUTTON_PRESS && event->type != GDK_BUTTON_RELEASE || event->button.button > 3)) {
return;
}
Selection::Operation op = Keyboard::selection_type (event->button.state);
bool press = (event->type == GDK_BUTTON_PRESS);
begin_reversible_command (_("select on click"));
switch (item_type) {
case RegionItem:
c1 = set_selected_track_from_click (press, op, true, true);
c2 = set_selected_regionview_from_click (press, op, true);
commit = (c1 || c2);
break;
case AudioRegionViewNameHighlight:
case AudioRegionViewName:
c1 = set_selected_track_from_click (press, op, true, true);
c2 = set_selected_regionview_from_click (press, op, true);
commit = (c1 || c2);
break;
case GainAutomationControlPointItem:
case PanAutomationControlPointItem:
case RedirectAutomationControlPointItem:
c1 = set_selected_track_from_click (press, op, true, true);
c2 = set_selected_control_point_from_click (press, op, false);
commit = (c1 || c2);
break;
case StreamItem:
commit = set_selected_track_from_click (press, op, true, true);
break;
case AutomationTrackItem:
commit = set_selected_track_from_click (press, op, true, true);
break;
default:
break;
}
#define SELECT_TRACK_FROM_CANVAS_IN_RANGE_MODE
#ifdef SELECT_TRACK_FROM_CANVAS_IN_RANGE_MODE
/* in range mode, button 1/2/3 press potentially selects a track */
if (mouse_mode == MouseRange &&
event->type == GDK_BUTTON_PRESS &&
event->button.button <= 3) {
switch (item_type) {
case StreamItem:
case RegionItem:
case AutomationTrackItem:
commit = set_selected_track_from_click (press, op, true, true);
break;
default:
break;
}
}
#endif
if (commit) {
commit_reversible_command ();
}
}
bool bool
Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type) Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
{ {
@ -295,80 +381,7 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp
return true; return true;
} }
/* in object/audition/timefx mode, any button press sets button_selection (item, event, item_type);
the selection if the object can be selected. this is a
bit of hack, because we want to avoid this if the
mouse operation is a region alignment.
*/
if (((mouse_mode == MouseObject) ||
(mouse_mode == MouseAudition && item_type == RegionItem) ||
(mouse_mode == MouseTimeFX && item_type == RegionItem)) &&
event->type == GDK_BUTTON_PRESS &&
event->button.button <= 3) {
AudioRegionView* rv;
ControlPoint* cp;
/* not dbl-click or triple-click */
switch (item_type) {
case RegionItem:
set_selected_regionview_from_click (Keyboard::selection_type (event->button.state), true);
break;
case AudioRegionViewNameHighlight:
case AudioRegionViewName:
if ((rv = static_cast<AudioRegionView *> (item->get_data ("regionview"))) != 0) {
set_selected_regionview_from_click (Keyboard::selection_type (event->button.state), true);
}
break;
case GainAutomationControlPointItem:
case PanAutomationControlPointItem:
case RedirectAutomationControlPointItem:
if ((cp = static_cast<ControlPoint *> (item->get_data ("control_point"))) != 0) {
set_selected_control_point_from_click (Keyboard::selection_type (event->button.state), false);
}
break;
case StreamItem:
set_selected_track_from_click (Keyboard::selection_type (event->button.state), true, true);
break;
case AutomationTrackItem:
break;
default:
break;
}
}
#define SELECT_TRACK_FROM_CANVAS_IN_RANGE_MODE
#ifdef SELECT_TRACK_FROM_CANVAS_IN_RANGE_MODE
/* in range mode, button 1/2/3 press potentially selects a track */
if (mouse_mode == MouseRange &&
event->type == GDK_BUTTON_PRESS &&
event->button.button <= 3) {
AudioRegionView* rv;
switch (item_type) {
case StreamItem:
case RegionItem:
case AutomationTrackItem:
set_selected_track_from_click (Keyboard::selection_type (event->button.state), true, true);
break;
case AudioRegionViewNameHighlight:
case AudioRegionViewName:
rv = reinterpret_cast<AudioRegionView *> (item->get_data ("regionview"));
default:
break;
}
}
#endif
if (drag_info.item == 0 && if (drag_info.item == 0 &&
(Keyboard::is_delete_event (&event->button) || (Keyboard::is_delete_event (&event->button) ||
@ -435,6 +448,7 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp
start_range_markerbar_op (item, event, CreateRangeMarker); start_range_markerbar_op (item, event, CreateRangeMarker);
return true; return true;
break; break;
case TransportMarkerBarItem: case TransportMarkerBarItem:
start_range_markerbar_op (item, event, CreateTransportMarker); start_range_markerbar_op (item, event, CreateTransportMarker);
return true; return true;
@ -564,6 +578,10 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp
break ; break ;
/* </CMT Additions> */ /* </CMT Additions> */
case MarkerBarItem:
break;
default: default:
break; break;
} }
@ -816,6 +834,8 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
} }
} }
button_selection (item, event, item_type);
/* edit events get handled here */ /* edit events get handled here */
if (drag_info.item == 0 && Keyboard::is_edit_event (&event->button)) { if (drag_info.item == 0 && Keyboard::is_edit_event (&event->button)) {
@ -1477,13 +1497,13 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item
if (!from_autoscroll && drag_info.item) { if (!from_autoscroll && drag_info.item) {
/* item != 0 is the best test i can think of for dragging. /* item != 0 is the best test i can think of for dragging.
*/ */
if (!drag_info.move_threshold_passsed) { if (!drag_info.move_threshold_passed) {
drag_info.move_threshold_passsed = (abs ((int) (drag_info.current_pointer_x - drag_info.grab_x)) > 4); drag_info.move_threshold_passed = (abs ((int) (drag_info.current_pointer_x - drag_info.grab_x)) > 4);
// and change the initial grab loc/frame if this drag info wants us to // and change the initial grab loc/frame if this drag info wants us to
if (drag_info.want_move_threshold && drag_info.move_threshold_passsed) { if (drag_info.want_move_threshold && drag_info.move_threshold_passed) {
drag_info.grab_frame = drag_info.current_pointer_frame; drag_info.grab_frame = drag_info.current_pointer_frame;
drag_info.grab_x = drag_info.current_pointer_x; drag_info.grab_x = drag_info.current_pointer_x;
drag_info.grab_y = drag_info.current_pointer_y; drag_info.grab_y = drag_info.current_pointer_y;
@ -1555,6 +1575,7 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item
handled: handled:
track_canvas_motion (event); track_canvas_motion (event);
// drag_info.last_pointer_frame = drag_info.current_pointer_frame;
return true; return true;
not_handled: not_handled:
@ -1597,7 +1618,7 @@ Editor::start_grab (GdkEvent* event, Gdk::Cursor *cursor)
drag_info.cumulative_x_drag = 0; drag_info.cumulative_x_drag = 0;
drag_info.cumulative_y_drag = 0; drag_info.cumulative_y_drag = 0;
drag_info.first_move = true; drag_info.first_move = true;
drag_info.move_threshold_passsed = false; drag_info.move_threshold_passed = false;
drag_info.want_move_threshold = false; drag_info.want_move_threshold = false;
drag_info.pointer_frame_offset = 0; drag_info.pointer_frame_offset = 0;
drag_info.brushing = false; drag_info.brushing = false;
@ -1625,6 +1646,19 @@ Editor::start_grab (GdkEvent* event, Gdk::Cursor *cursor)
} }
} }
void
Editor::swap_grab (ArdourCanvas::Item* new_item, Gdk::Cursor* cursor, uint32_t time)
{
drag_info.item->ungrab (0);
drag_info.item = new_item;
if (cursor == 0) {
cursor = grabber_cursor;
}
drag_info.item->grab (Gdk::POINTER_MOTION_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK, *cursor, time);
}
bool bool
Editor::end_grab (ArdourCanvas::Item* item, GdkEvent* event) Editor::end_grab (ArdourCanvas::Item* item, GdkEvent* event)
{ {
@ -2020,6 +2054,7 @@ Editor::marker_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
bool is_start; bool is_start;
bool move_both = false; bool move_both = false;
jack_nframes_t newframe; jack_nframes_t newframe;
if (drag_info.pointer_frame_offset <= (long) drag_info.current_pointer_frame) { if (drag_info.pointer_frame_offset <= (long) drag_info.current_pointer_frame) {
newframe = drag_info.current_pointer_frame - drag_info.pointer_frame_offset; newframe = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
@ -2034,7 +2069,9 @@ Editor::marker_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
snap_to (newframe, 0, true); snap_to (newframe, 0, true);
} }
if (drag_info.current_pointer_frame == drag_info.last_pointer_frame) return; if (drag_info.current_pointer_frame == drag_info.last_pointer_frame) {
return;
}
/* call this to find out if its the start or end */ /* call this to find out if its the start or end */
@ -2101,7 +2138,6 @@ Editor::marker_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
bool is_start; bool is_start;
begin_reversible_command ( _("move marker") ); begin_reversible_command ( _("move marker") );
session->add_undo( session->locations()->get_memento() ); session->add_undo( session->locations()->get_memento() );
@ -2634,6 +2670,81 @@ Editor::start_region_copy_grab (ArdourCanvas::Item* item, GdkEvent* event)
return; return;
} }
drag_info.copy = true;
drag_info.item = item;
drag_info.data = clicked_regionview;
start_grab(event);
TimeAxisView* tv = &clicked_regionview->get_time_axis_view();
AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*>(tv);
double speed = 1.0;
if (atv && atv->is_audio_track()) {
speed = atv->get_diskstream()->speed();
}
drag_info.last_trackview = &clicked_regionview->get_time_axis_view();
drag_info.last_frame_position = (jack_nframes_t) (clicked_regionview->region.position() / speed);
drag_info.pointer_frame_offset = drag_info.grab_frame - drag_info.last_frame_position;
// we want a move threshold
drag_info.want_move_threshold = true;
drag_info.motion_callback = &Editor::region_drag_motion_callback;
drag_info.finished_callback = &Editor::region_drag_finished_callback;
}
void
Editor::start_region_brush_grab (ArdourCanvas::Item* item, GdkEvent* event)
{
if (selection->audio_regions.empty() || clicked_regionview == 0) {
return;
}
drag_info.copy = false;
drag_info.item = item;
drag_info.data = clicked_regionview;
drag_info.motion_callback = &Editor::region_drag_motion_callback;
drag_info.finished_callback = &Editor::region_drag_finished_callback;
start_grab (event);
double speed = 1.0;
TimeAxisView* tvp = clicked_trackview;
AudioTimeAxisView* tv = dynamic_cast<AudioTimeAxisView*>(tvp);
if (tv && tv->is_audio_track()) {
speed = tv->get_diskstream()->speed();
}
drag_info.last_frame_position = (jack_nframes_t) (clicked_regionview->region.position() / speed);
drag_info.pointer_frame_offset = drag_info.grab_frame - drag_info.last_frame_position;
drag_info.last_trackview = &clicked_regionview->get_time_axis_view();
// we want a move threshold
drag_info.want_move_threshold = true;
drag_info.brushing = true;
begin_reversible_command (_("Drag region brush"));
}
void
Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
{
double x_delta;
double y_delta = 0;
AudioRegionView *rv = reinterpret_cast<AudioRegionView*> (drag_info.data);
jack_nframes_t pending_region_position = 0;
int32_t pointer_y_span = 0, canvas_pointer_y_span = 0, original_pointer_order;
int32_t visible_y_high = 0, visible_y_low = 512; //high meaning higher numbered.. not the height on the screen
bool clamp_y_axis = false;
vector<int32_t> height_list(512) ;
vector<int32_t>::iterator j;
show_verbose_time_cursor (drag_info.last_frame_position, 10);
if (drag_info.copy && drag_info.move_threshold_passed && drag_info.want_move_threshold) {
drag_info.want_move_threshold = false; // don't copy again
/* this is committed in the grab finished callback. */ /* this is committed in the grab finished callback. */
begin_reversible_command (_("Drag region copy")); begin_reversible_command (_("Drag region copy"));
@ -2691,79 +2802,9 @@ Editor::start_region_copy_grab (ArdourCanvas::Item* item, GdkEvent* event)
/* reset drag_info data to reflect the fact that we are dragging the copies */ /* reset drag_info data to reflect the fact that we are dragging the copies */
drag_info.data = new_regionviews.front(); drag_info.data = new_regionviews.front();
drag_info.item = new_regionviews.front()->get_canvas_group (); swap_grab (new_regionviews.front()->get_canvas_group (), 0, event->motion.time);
drag_info.copy = true;
drag_info.motion_callback = &Editor::region_drag_motion_callback;
drag_info.finished_callback = &Editor::region_drag_finished_callback;
start_grab(event);
TimeAxisView* tv = &clicked_regionview->get_time_axis_view();
AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*>(tv);
double speed = 1.0;
if (atv && atv->is_audio_track()) {
speed = atv->get_diskstream()->speed();
} }
drag_info.last_trackview = &clicked_regionview->get_time_axis_view();
drag_info.last_frame_position = (jack_nframes_t) (clicked_regionview->region.position() / speed);
drag_info.pointer_frame_offset = drag_info.grab_frame - drag_info.last_frame_position;
// we want a move threshold
drag_info.want_move_threshold = true;
show_verbose_time_cursor (drag_info.last_frame_position, 10);
//begin_reversible_command (_("copy region(s)"));
}
void
Editor::start_region_brush_grab (ArdourCanvas::Item* item, GdkEvent* event)
{
if (selection->audio_regions.empty() || clicked_regionview == 0) {
return;
}
drag_info.copy = false;
drag_info.item = item;
drag_info.data = clicked_regionview;
drag_info.motion_callback = &Editor::region_drag_motion_callback;
drag_info.finished_callback = &Editor::region_drag_finished_callback;
start_grab (event);
double speed = 1.0;
TimeAxisView* tvp = clicked_trackview;
AudioTimeAxisView* tv = dynamic_cast<AudioTimeAxisView*>(tvp);
if (tv && tv->is_audio_track()) {
speed = tv->get_diskstream()->speed();
}
drag_info.last_frame_position = (jack_nframes_t) (clicked_regionview->region.position() / speed);
drag_info.pointer_frame_offset = drag_info.grab_frame - drag_info.last_frame_position;
drag_info.last_trackview = &clicked_regionview->get_time_axis_view();
// we want a move threshold
drag_info.want_move_threshold = true;
drag_info.brushing = true;
begin_reversible_command (_("Drag region brush"));
}
void
Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
{
double x_delta;
double y_delta = 0;
AudioRegionView *rv = reinterpret_cast<AudioRegionView*> (drag_info.data);
jack_nframes_t pending_region_position = 0;
int32_t pointer_y_span = 0, canvas_pointer_y_span = 0, original_pointer_order;
int32_t visible_y_high = 0, visible_y_low = 512; //high meaning higher numbered.. not the height on the screen
bool clamp_y_axis = false;
vector<int32_t> height_list(512) ;
vector<int32_t>::iterator j;
/* Which trackview is this ? */ /* Which trackview is this ? */
TimeAxisView* tvp = trackview_by_y_position (drag_info.current_pointer_y); TimeAxisView* tvp = trackview_by_y_position (drag_info.current_pointer_y);
@ -2947,7 +2988,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
the region would be if we moved it by that much. the region would be if we moved it by that much.
*/ */
if (drag_info.move_threshold_passsed) { if (drag_info.move_threshold_passed) {
if ((int32_t)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) { if ((int32_t)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
@ -3507,7 +3548,7 @@ Editor::show_verbose_duration_cursor (jack_nframes_t start, jack_nframes_t end,
/* XXX fix this to compute min/sec properly */ /* XXX fix this to compute min/sec properly */
session->smpte_duration (end - start, smpte); session->smpte_duration (end - start, smpte);
secs = smpte.seconds + ((float) smpte.frames / session->smpte_frames_per_second); secs = smpte.seconds + ((float) smpte.frames / session->smpte_frames_per_second);
snprintf (buf, sizeof (buf), "%02ld:%02ld:%.4f", smpte.hours, smpte.minutes, secs); snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%.4f", smpte.hours, smpte.minutes, secs);
break; break;
default: default:
@ -3629,7 +3670,6 @@ Editor::start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, Selection
switch (op) { switch (op) {
case CreateSelection: case CreateSelection:
if (Keyboard::modifier_state_equals (event->button.state, Keyboard::Shift)) { if (Keyboard::modifier_state_equals (event->button.state, Keyboard::Shift)) {
drag_info.copy = true; drag_info.copy = true;
} else { } else {
@ -3639,14 +3679,18 @@ Editor::start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, Selection
break; break;
case SelectionStartTrim: case SelectionStartTrim:
if (clicked_trackview) {
clicked_trackview->order_selection_trims (item, true); clicked_trackview->order_selection_trims (item, true);
}
start_grab (event, trimmer_cursor); start_grab (event, trimmer_cursor);
start = selection->time[clicked_selection].start; start = selection->time[clicked_selection].start;
drag_info.pointer_frame_offset = drag_info.grab_frame - start; drag_info.pointer_frame_offset = drag_info.grab_frame - start;
break; break;
case SelectionEndTrim: case SelectionEndTrim:
if (clicked_trackview) {
clicked_trackview->order_selection_trims (item, false); clicked_trackview->order_selection_trims (item, false);
}
start_grab (event, trimmer_cursor); start_grab (event, trimmer_cursor);
end = selection->time[clicked_selection].end; end = selection->time[clicked_selection].end;
drag_info.pointer_frame_offset = drag_info.grab_frame - end; drag_info.pointer_frame_offset = drag_info.grab_frame - end;
@ -4239,7 +4283,6 @@ Editor::hide_marker (ArdourCanvas::Item* item, GdkEvent* event)
void void
Editor::start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp op) Editor::start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp op)
{ {
if (session == 0) { if (session == 0) {
return; return;
} }
@ -4304,7 +4347,7 @@ Editor::drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event)
} }
/* first drag: Either add to the selection /* first drag: Either add to the selection
or create a new selection-> or create a new selection.
*/ */
if (drag_info.first_move) { if (drag_info.first_move) {
@ -4371,12 +4414,39 @@ Editor::end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event)
break; break;
} }
} else { } else {
/* just a click, no pointer movement.*/ /* just a click, no pointer movement. remember that context menu stuff was handled elsewhere */
if (Keyboard::no_modifier_keys_pressed (&event->button)) { if (Keyboard::no_modifier_keys_pressed (&event->button)) {
// nothing yet jack_nframes_t start;
jack_nframes_t end;
start = session->locations()->first_mark_before (drag_info.grab_frame);
end = session->locations()->first_mark_after (drag_info.grab_frame);
if (end == max_frames) {
end = session->current_end_frame ();
}
if (start == 0) {
start = session->current_start_frame ();
}
switch (mouse_mode) {
case MouseObject:
/* find the two markers on either side and then make the selection from it */
cerr << "select between " << start << " .. " << end << endl;
select_all_within (start, end, 0.0f, FLT_MAX, Selection::Set);
break;
case MouseRange:
/* find the two markers on either side of the click and make the range out of it */
selection->set (0, start, end);
break;
default:
break;
}
} }
} }

View file

@ -24,7 +24,6 @@
#include <string> #include <string>
#include <ardour/tempo.h> #include <ardour/tempo.h>
#include <ardour/smpte.h>
#include <gtkmm2ext/gtk_ui.h> #include <gtkmm2ext/gtk_ui.h>
#include "editor.h" #include "editor.h"
@ -914,10 +913,10 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upp
if ((smpte.subframes % mark_modulo) == 0) { if ((smpte.subframes % mark_modulo) == 0) {
if (smpte.subframes == 0) { if (smpte.subframes == 0) {
(*marks)[n].style = GtkCustomRulerMarkMajor; (*marks)[n].style = GtkCustomRulerMarkMajor;
snprintf (buf, sizeof(buf), "%s%02ld:%02ld:%02ld:%02ld", smpte.negative ? "-" : "", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", smpte.negative ? "-" : "", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames);
} else { } else {
(*marks)[n].style = GtkCustomRulerMarkMinor; (*marks)[n].style = GtkCustomRulerMarkMinor;
snprintf (buf, sizeof(buf), ".%02ld", smpte.subframes); snprintf (buf, sizeof(buf), ".%02u", smpte.subframes);
} }
} else { } else {
snprintf (buf, sizeof(buf)," "); snprintf (buf, sizeof(buf)," ");
@ -946,7 +945,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upp
(*marks)[n].style = GtkCustomRulerMarkMinor; (*marks)[n].style = GtkCustomRulerMarkMinor;
(*marks)[n].position = pos; (*marks)[n].position = pos;
} }
snprintf (buf, sizeof(buf), "%s%02ld:%02ld:%02ld:%02ld", smpte.negative ? "-" : "", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", smpte.negative ? "-" : "", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames);
} else { } else {
snprintf (buf, sizeof(buf)," "); snprintf (buf, sizeof(buf)," ");
(*marks)[n].style = GtkCustomRulerMarkMicro; (*marks)[n].style = GtkCustomRulerMarkMicro;
@ -970,7 +969,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upp
} else { } else {
(*marks)[n].style = GtkCustomRulerMarkMinor; (*marks)[n].style = GtkCustomRulerMarkMinor;
} }
snprintf (buf, sizeof(buf), "%s%02ld:%02ld:%02ld:%02ld", smpte.negative ? "-" : "", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", smpte.negative ? "-" : "", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames);
} else { } else {
snprintf (buf, sizeof(buf)," "); snprintf (buf, sizeof(buf)," ");
(*marks)[n].style = GtkCustomRulerMarkMicro; (*marks)[n].style = GtkCustomRulerMarkMicro;
@ -990,7 +989,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upp
session->smpte_to_sample(smpte, pos, true /* use_offset */, false /* use_subframes */ ); session->smpte_to_sample(smpte, pos, true /* use_offset */, false /* use_subframes */ );
if ((smpte.hours % mark_modulo) == 0) { if ((smpte.hours % mark_modulo) == 0) {
(*marks)[n].style = GtkCustomRulerMarkMajor; (*marks)[n].style = GtkCustomRulerMarkMajor;
snprintf (buf, sizeof(buf), "%s%02ld:%02ld:%02ld:%02ld", smpte.negative ? "-" : "", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", smpte.negative ? "-" : "", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames);
} else { } else {
snprintf (buf, sizeof(buf)," "); snprintf (buf, sizeof(buf)," ");
(*marks)[n].style = GtkCustomRulerMarkMicro; (*marks)[n].style = GtkCustomRulerMarkMicro;
@ -1012,7 +1011,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upp
if ((smpte.frames % mark_modulo) == 0) { if ((smpte.frames % mark_modulo) == 0) {
(*marks)[n].style = GtkCustomRulerMarkMajor; (*marks)[n].style = GtkCustomRulerMarkMajor;
(*marks)[n].position = pos; (*marks)[n].position = pos;
snprintf (buf, sizeof(buf), "%s%02ld:%02ld:%02ld:%02ld", smpte.negative ? "-" : "", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", smpte.negative ? "-" : "", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames);
} else { } else {
snprintf (buf, sizeof(buf)," "); snprintf (buf, sizeof(buf)," ");
(*marks)[n].style = GtkCustomRulerMarkMicro; (*marks)[n].style = GtkCustomRulerMarkMicro;

View file

@ -27,7 +27,6 @@
#include <samplerate.h> #include <samplerate.h>
#include <pbd/convert.h> #include <pbd/convert.h>
#include <pbd/dirname.h>
#include <pbd/xml++.h> #include <pbd/xml++.h>
#include <gtkmm2ext/utils.h> #include <gtkmm2ext/utils.h>
@ -1154,7 +1153,7 @@ ExportDialog::is_filepath_valid(string &filepath)
// directory needs to exist and be writable // 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) { if (::access (dirpath.c_str(), W_OK) != 0) {
string txt = _("Cannot write file in: ") + dirpath; string txt = _("Cannot write file in: ") + dirpath;
MessageDialog msg (*this, txt, false, MESSAGE_ERROR, BUTTONS_OK, true); MessageDialog msg (*this, txt, false, MESSAGE_ERROR, BUTTONS_OK, true);

View file

@ -25,8 +25,6 @@
#include <ardour/audioengine.h> #include <ardour/audioengine.h>
#include <ardour/sndfile_helpers.h> #include <ardour/sndfile_helpers.h>
#include <pbd/dirname.h>
#include "ardour_ui.h" #include "ardour_ui.h"
#include "export_range_markers_dialog.h" #include "export_range_markers_dialog.h"
@ -149,7 +147,7 @@ ExportRangeMarkersDialog::is_filepath_valid(string &filepath)
} }
// directory needs to exist and be writable // 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) { if (::access (dirpath.c_str(), W_OK) != 0) {
string txt = _("Cannot write file in: ") + dirpath; string txt = _("Cannot write file in: ") + dirpath;
MessageDialog msg (*this, txt, false, MESSAGE_ERROR, BUTTONS_OK, true); MessageDialog msg (*this, txt, false, MESSAGE_ERROR, BUTTONS_OK, true);

View file

@ -58,7 +58,7 @@ void
FFTGraph::setWindowSize(int windowSize) FFTGraph::setWindowSize(int windowSize)
{ {
if (_a_window) { if (_a_window) {
LockMonitor lm (_a_window->track_list_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (_a_window->track_list_lock);
setWindowSize_internal(windowSize); setWindowSize_internal(windowSize);
} else { } else {
setWindowSize_internal(windowSize); setWindowSize_internal(windowSize);
@ -261,7 +261,7 @@ FFTGraph::draw_scales(Glib::RefPtr<Gdk::Window> window)
void void
FFTGraph::redraw() FFTGraph::redraw()
{ {
LockMonitor lm (_a_window->track_list_lock, __LINE__, __FILE__ ); Glib::Mutex::Lock lm (_a_window->track_list_lock);
draw_scales(get_window()); draw_scales(get_window());

View file

@ -29,8 +29,9 @@
typedef Glib::RefPtr<Gnome::Glade::Xml> GladeRef; typedef Glib::RefPtr<Gnome::Glade::Xml> GladeRef;
/** /**
* This is the base class for all glade factories so that the same domain This is the base class for all glade
* is used. factories so that the same domain is
used.
*/ */
class GladeFactory { class GladeFactory {

View file

@ -133,7 +133,6 @@ gtk_custom_hruler_draw_ticks (GtkCustomRuler * ruler)
{ {
GtkWidget *widget; GtkWidget *widget;
GdkGC *gc, *bg_gc; GdkGC *gc, *bg_gc;
GdkFont *font;
gint i; gint i;
GtkCustomRulerMark *marks; GtkCustomRulerMark *marks;
gint xthickness; gint xthickness;
@ -154,7 +153,6 @@ gtk_custom_hruler_draw_ticks (GtkCustomRuler * ruler)
gc = widget->style->fg_gc[GTK_STATE_NORMAL]; gc = widget->style->fg_gc[GTK_STATE_NORMAL];
bg_gc = widget->style->bg_gc[GTK_STATE_NORMAL]; bg_gc = widget->style->bg_gc[GTK_STATE_NORMAL];
font = gtk_style_get_font(widget->style);
layout = gtk_widget_create_pango_layout (widget, "012456789"); layout = gtk_widget_create_pango_layout (widget, "012456789");
pango_layout_get_extents (layout, &ink_rect, &logical_rect); pango_layout_get_extents (layout, &ink_rect, &logical_rect);

View file

@ -300,16 +300,18 @@ gtk_custom_ruler_set_range (GtkCustomRuler *ruler,
gtk_widget_queue_draw (GTK_WIDGET (ruler)); gtk_widget_queue_draw (GTK_WIDGET (ruler));
} }
/** Retrieves values indicating the range and current position of a #GtkCustomRuler. /**
* See gtk_custom_ruler_set_range(). * gtk_custom_ruler_get_range:
* * @ruler: a #GtkCustomRuler
* @param ruler: a #GtkCustomRuler * @lower: location to store lower limit of the ruler, or %NULL
* @param lower: location to store lower limit of the ruler, or %NULL * @upper: location to store upper limit of the ruler, or %NULL
* @param upper: location to store upper limit of the ruler, or %NULL * @position: location to store the current position of the mark on the ruler, or %NULL
* @param position: location to store the current position of the mark on the ruler, or %NULL * @max_size: location to store the maximum size of the ruler used when calculating
* @param max_size: location to store the maximum size of the ruler used when calculating
* the space to leave for the text, or %NULL. * the space to leave for the text, or %NULL.
*/ *
* Retrieves values indicating the range and current position of a #GtkCustomRuler.
* See gtk_custom_ruler_set_range().
**/
void void
gtk_custom_ruler_get_range (GtkCustomRuler *ruler, gtk_custom_ruler_get_range (GtkCustomRuler *ruler,
gdouble *lower, gdouble *lower,

View file

@ -518,13 +518,15 @@ gtk_scrolled_window_set_policy (GtkScrolledWindow *scrolled_window,
} }
} }
/** * Retrieves the current policy values for the horizontal and vertical /**
* scrollbars. See gtk_scrolled_window_set_policy(). * gtk_scrolled_window_get_policy:
* @scrolled_window: a #GtkScrolledWindow
* @hscrollbar_policy: location to store the policy for the horizontal scrollbar, or %NULL.
* @vscrollbar_policy: location to store the policy for the horizontal scrollbar, or %NULL.
* *
* @param scrolled_window a GtkScrolledWindow * Retrieves the current policy values for the horizontal and vertical
* @param hscrollbar_policy location to store the policy for the horizontal scrollbar, or %NULL. * scrollbars. See gtk_scrolled_window_set_policy().
* @param vscrollbar_policy location to store the policy for the horizontal scrollbar, or %NULL. **/
*/
void void
gtk_scrolled_window_get_policy (GtkScrolledWindow *scrolled_window, gtk_scrolled_window_get_policy (GtkScrolledWindow *scrolled_window,
GtkPolicyType *hscrollbar_policy, GtkPolicyType *hscrollbar_policy,
@ -554,11 +556,14 @@ gtk_scrolled_window_set_placement (GtkScrolledWindow *scrolled_window,
} }
} }
/** Gets the placement of the scrollbars for the scrolled window. /**
* See gtk_scrolled_window_set_placement(). * gtk_scrolled_window_get_placement:
* @scrolled_window: a #GtkScrolledWindow
* *
* @param scrolled_window a GtkScrolledWindow * Gets the placement of the scrollbars for the scrolled window. See
* \return the current placement value. * gtk_scrolled_window_set_placement().
*
* Return value: the current placement value.
**/ **/
GtkCornerType GtkCornerType
gtk_scrolled_window_get_placement (GtkScrolledWindow *scrolled_window) gtk_scrolled_window_get_placement (GtkScrolledWindow *scrolled_window)
@ -568,10 +573,15 @@ gtk_scrolled_window_get_placement (GtkScrolledWindow *scrolled_window)
return scrolled_window->window_placement; return scrolled_window->window_placement;
} }
/** Changes the type of shadow drawn around the contents of \a scrolled_window. /**
* @param scrolled_window a GtkScrolledWindow * gtk_scrolled_window_set_shadow_type:
* @param type kind of shadow to draw around scrolled window contents * @scrolled_window: a #GtkScrolledWindow
*/ * @type: kind of shadow to draw around scrolled window contents
*
* Changes the type of shadow drawn around the contents of
* @scrolled_window.
*
**/
void void
gtk_scrolled_window_set_shadow_type (GtkScrolledWindow *scrolled_window, gtk_scrolled_window_set_shadow_type (GtkScrolledWindow *scrolled_window,
GtkShadowType type) GtkShadowType type)
@ -592,12 +602,15 @@ gtk_scrolled_window_set_shadow_type (GtkScrolledWindow *scrolled_window,
} }
} }
/** Gets the shadow type of the scrolled window. /**
* See gtk_scrolled_window_set_shadow_type(). * gtk_scrolled_window_get_shadow_type:
* @scrolled_window: a #GtkScrolledWindow
* *
* @param scrolled_window a GtkScrolledWindow * Gets the shadow type of the scrolled window. See
* \return the current shadow type * gtk_scrolled_window_set_shadow_type().
*/ *
* Return value: the current shadow type
**/
GtkShadowType GtkShadowType
gtk_scrolled_window_get_shadow_type (GtkScrolledWindow *scrolled_window) gtk_scrolled_window_get_shadow_type (GtkScrolledWindow *scrolled_window)
{ {
@ -1374,11 +1387,14 @@ gtk_scrolled_window_add_with_viewport (GtkScrolledWindow *scrolled_window,
gtk_container_add (GTK_CONTAINER (viewport), child); gtk_container_add (GTK_CONTAINER (viewport), child);
} }
/** Gets the spacing between the scrolled window's scrollbars and /**
* the scrolled widget. Used by GtkCombo. * _gtk_scrolled_window_get_spacing:
* @scrolled_window: a scrolled window
* *
* @param scrolled_window: a scrolled window * Gets the spacing between the scrolled window's scrollbars and
* \return the spacing, in pixels. * the scrolled widget. Used by GtkCombo
*
* Return value: the spacing, in pixels.
**/ **/
gint gint
_gtk_scrolled_window_get_scrollbar_spacing (GtkScrolledWindow *scrolled_window) _gtk_scrolled_window_get_scrollbar_spacing (GtkScrolledWindow *scrolled_window)

View file

@ -209,10 +209,9 @@ class ImageFrameSocketHandler : public sigc::trackable
/** /**
* Send a message indicating that an ImageFrameView has been renamed * Send a message indicating that an ImageFrameView has been renamed
* *
* @param new_id the renamed item's new ID
* @param old_id the renamed item's old ID
* @param src the identity of the object that initiated the change
* @param item the ImageFrameView which has been renamed * @param item the ImageFrameView which has been renamed
* @param src the identity of the object that initiated the change
* @param item the renamed item
*/ */
void send_imageframe_view_renamed(const string & new_id, const string & old_id, void* src, ImageFrameView* item) ; void send_imageframe_view_renamed(const string & new_id, const string & old_id, void* src, ImageFrameView* item) ;

View file

@ -79,7 +79,7 @@ class ImageFrameTimeAxis : public VisualTimeAxis
* *
* @param h the TrackHeight value to set * @param h the TrackHeight value to set
*/ */
virtual void set_height(TimeAxisView::TrackHeight h) ; virtual void set_height(TimeAxisView::TrackHeight) ;
/** /**
* Sets the number of samples per unit that are used. * Sets the number of samples per unit that are used.

View file

@ -104,7 +104,7 @@ class ImageFrameTimeAxisGroup : public sigc::trackable
* *
* @param height the new height * @param height the new height
*/ */
int set_item_heights(gdouble height) ; int set_item_heights(gdouble) ;
/** /**
* Sets the current samples per unit. * Sets the current samples per unit.
@ -119,7 +119,7 @@ class ImageFrameTimeAxisGroup : public sigc::trackable
* *
* @param color the new base color * @param color the new base color
*/ */
void apply_item_color(Gdk::Color& color) ; void apply_item_color(Gdk::Color&) ;
//---------------------------------------------------------------------------------------// //---------------------------------------------------------------------------------------//
@ -130,6 +130,7 @@ class ImageFrameTimeAxisGroup : public sigc::trackable
* the new ImageFrameView is returned * the new ImageFrameView is returned
* *
* @param item_id the unique id of the new item * @param item_id the unique id of the new item
* @param image_id the id/name of the image data we are usin
* @param start the position the new item should be placed upon the time line * @param start the position the new item should be placed upon the time line
* @param duration the duration the new item should be placed upon the timeline * @param duration the duration the new item should be placed upon the timeline
* @param rgb_data the rgb data of the image * @param rgb_data the rgb data of the image
@ -138,8 +139,7 @@ class ImageFrameTimeAxisGroup : public sigc::trackable
* @param num_channels the number of channles within the rgb_data * @param num_channels the number of channles within the rgb_data
* @param src the identity of the object that initiated the change * @param src the identity of the object that initiated the change
*/ */
ImageFrameView* add_imageframe_item(const string & item_id, jack_nframes_t start, jack_nframes_t duration, ImageFrameView* add_imageframe_item(const string & item_id, jack_nframes_t start, jack_nframes_t duration, unsigned char* rgb_data, uint32_t width, uint32_t height, uint32_t num_channels, void* src) ;
unsigned char* rgb_data, uint32_t width, uint32_t height, uint32_t num_channels, void* src) ;
/** /**
* Returns the named ImageFrameView or 0 if the named view does not exist on this view helper * Returns the named ImageFrameView or 0 if the named view does not exist on this view helper
@ -171,9 +171,8 @@ class ImageFrameTimeAxisGroup : public sigc::trackable
* if ifv is not upon this TimeAxis, this method takes no action * if ifv is not upon this TimeAxis, this method takes no action
* *
* @param ifv the ImageFrameView to remove * @param ifv the ImageFrameView to remove
* @param src the identity of the object that initiated the change
*/ */
void remove_imageframe_item(ImageFrameView* ifv, void* src) ; void remove_imageframe_item(ImageFrameView*, void* src) ;
//---------------------------------------------------------------------------------------// //---------------------------------------------------------------------------------------//

View file

@ -87,7 +87,7 @@ class ImageFrameTimeAxisView : public sigc::trackable
* *
* @param height the new height * @param height the new height
*/ */
int set_height(gdouble height) ; int set_height(gdouble) ;
/** /**
* Sets the position of this view helper on the canvas * Sets the position of this view helper on the canvas
@ -117,7 +117,7 @@ class ImageFrameTimeAxisView : public sigc::trackable
* *
* @param color the new base color * @param color the new base color
*/ */
void apply_color (Gdk::Color& color) ; void apply_color (Gdk::Color&) ;
//---------------------------------------------------------------------------------------// //---------------------------------------------------------------------------------------//
// Child ImageFrameTimeAxisGroup Accessors/Mutators // Child ImageFrameTimeAxisGroup Accessors/Mutators
@ -152,7 +152,6 @@ class ImageFrameTimeAxisView : public sigc::trackable
* Removes the specified ImageFrameTimeAxisGroup from the list of ImageFrameTimeAxisGroups upon this TimeAxis. * Removes the specified ImageFrameTimeAxisGroup from the list of ImageFrameTimeAxisGroups upon this TimeAxis.
* *
* @param iftag the ImageFrameView to remove * @param iftag the ImageFrameView to remove
* @param src the identity of the object that initiated the change
*/ */
void remove_imageframe_group(ImageFrameTimeAxisGroup* iftag, void* src) ; void remove_imageframe_group(ImageFrameTimeAxisGroup* iftag, void* src) ;
@ -163,7 +162,7 @@ class ImageFrameTimeAxisView : public sigc::trackable
/** /**
* Sets the currently selected group upon this time axis * Sets the currently selected group upon this time axis
* *
* @param iftag the item to set selected * @param ifv the item to set selected
*/ */
void set_selected_imageframe_group(ImageFrameTimeAxisGroup* iftag) ; void set_selected_imageframe_group(ImageFrameTimeAxisGroup* iftag) ;

View file

@ -53,7 +53,6 @@ class ImageFrameView : public TimeAxisViewItem
* @param tv the time axis view that this item is to be placed upon * @param tv the time axis view that this item is to be placed upon
* @param group the ImageFrameGroup that this item is a member of * @param group the ImageFrameGroup that this item is a member of
* @param spu the current samples per canvas unit * @param spu the current samples per canvas unit
* @param base_color the base color of this item
* @param start the start frame ogf this item * @param start the start frame ogf this item
* @param duration the duration of this item * @param duration the duration of this item
* @param rgb_data the rgb data of the image * @param rgb_data the rgb data of the image

View file

@ -23,7 +23,7 @@
#include <gtkmm/messagedialog.h> #include <gtkmm/messagedialog.h>
#include <pbd/lockmonitor.h> #include <glibmm/thread.h>
#include <ardour/io.h> #include <ardour/io.h>
#include <ardour/route.h> #include <ardour/route.h>
@ -368,7 +368,7 @@ IOSelector::display_ports ()
TreeView *selected_port_tview = 0; TreeView *selected_port_tview = 0;
{ {
LockMonitor lm (port_display_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (port_display_lock);
Port *port; Port *port;
uint32_t limit; uint32_t limit;
@ -670,7 +670,7 @@ IOSelector::port_column_button_release (GdkEventButton* event, TreeView* treevie
if (Keyboard::is_delete_event (event)) { if (Keyboard::is_delete_event (event)) {
Port* port; Port* port;
{ {
LockMonitor lm (port_display_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (port_display_lock);
port = static_cast<Port *> (treeview->get_data (_("port"))); port = static_cast<Port *> (treeview->get_data (_("port")));
@ -724,7 +724,7 @@ IOSelector::select_treeview (TreeView* tview)
switch. switch.
*/ */
LockMonitor lm (port_display_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (port_display_lock);
Port* port = reinterpret_cast<Port *> (tview->get_data (_("port"))); Port* port = reinterpret_cast<Port *> (tview->get_data (_("port")));
if (port != selected_port) { if (port != selected_port) {

View file

@ -29,6 +29,9 @@ using __gnu_cxx::slist;
#endif #endif
#include <string> #include <string>
#include <glibmm/thread.h>
#include <gtkmm/box.h> #include <gtkmm/box.h>
#include <gtkmm/frame.h> #include <gtkmm/frame.h>
#include <gtkmm/button.h> #include <gtkmm/button.h>
@ -39,6 +42,7 @@ using __gnu_cxx::slist;
#include <ardour_dialog.h> #include <ardour_dialog.h>
namespace ARDOUR { namespace ARDOUR {
class IO; class IO;
class Session; class Session;
@ -105,7 +109,7 @@ class IOSelector : public Gtk::VBox {
Gtk::Button clear_connections_button; Gtk::Button clear_connections_button;
Gtk::ScrolledWindow port_display_scroller; Gtk::ScrolledWindow port_display_scroller;
PBD::Lock port_display_lock; Glib::Mutex port_display_lock;
slist<Gtk::TreeView *> port_displays; slist<Gtk::TreeView *> port_displays;
void display_ports (); void display_ports ();

View file

@ -367,6 +367,9 @@ main (int argc, char *argv[])
ARDOUR::AudioEngine *engine; ARDOUR::AudioEngine *engine;
vector<Glib::ustring> null_file_list; vector<Glib::ustring> null_file_list;
// needs a better home.
Glib::thread_init();
gtk_set_locale (); gtk_set_locale ();
(void) bindtextdomain (PACKAGE, LOCALEDIR); (void) bindtextdomain (PACKAGE, LOCALEDIR);

View file

@ -125,10 +125,10 @@ class MarkerTimeAxisView : public sigc::trackable
* the new MarkerView is returned * the new MarkerView is returned
* *
* @param ifv the ImageFrameView that the new item is marking up * @param ifv the ImageFrameView that the new item is marking up
* @param mark_type the text to be displayed uopn the new marker item * @param mark_text the text to be displayed uopn the new marker item
* @param mark_id the unique id of the new item * @param mark_id the unique id of the new item
* @param start the position the new item should be placed upon the time line * @param start the position the new item should be placed upon the time line
* @param dur the duration the new item should be placed upon the timeline * @param duration the duration the new item should be placed upon the timeline
* @param src the identity of the object that initiated the change * @param src the identity of the object that initiated the change
*/ */
MarkerView* add_marker_view(ImageFrameView* ifv, std::string mark_type, std::string mark_id, jack_nframes_t start, jack_nframes_t dur, void* src) ; MarkerView* add_marker_view(ImageFrameView* ifv, std::string mark_type, std::string mark_id, jack_nframes_t start, jack_nframes_t dur, void* src) ;
@ -163,7 +163,7 @@ class MarkerTimeAxisView : public sigc::trackable
/** /**
* Removes mv from the list of MarkerView upon this TimeAxis * Removes mv from the list of MarkerView upon this TimeAxis
* *
* @param item the MarkerView to remove * @param mv the MarkerView to remove
* @param src the identity of the object that initiated the change * @param src the identity of the object that initiated the change
*/ */
void remove_marker_view(MarkerView* item, void* src) ; void remove_marker_view(MarkerView* item, void* src) ;

View file

@ -24,7 +24,7 @@
#include <gtkmm/accelmap.h> #include <gtkmm/accelmap.h>
#include <pbd/convert.h> #include <pbd/convert.h>
#include <pbd/lockmonitor.h> #include <glibmm/thread.h>
#include <gtkmm2ext/gtk_ui.h> #include <gtkmm2ext/gtk_ui.h>
#include <gtkmm2ext/utils.h> #include <gtkmm2ext/utils.h>

View file

@ -24,8 +24,6 @@
#include <ardour/recent_sessions.h> #include <ardour/recent_sessions.h>
#include <ardour/session.h> #include <ardour/session.h>
#include <pbd/basename.h>
#include <gtkmm/entry.h> #include <gtkmm/entry.h>
#include <gtkmm/filechooserbutton.h> #include <gtkmm/filechooserbutton.h>
#include <gtkmm/spinbutton.h> #include <gtkmm/spinbutton.h>
@ -659,7 +657,7 @@ NewSessionDialog::reset_recent()
Gtk::TreeModel::Row row = *(recent_model->append()); 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; row[recent_columns.fullpath] = fullpath;
if (states->size() > 1) { if (states->size() > 1) {

View file

@ -36,7 +36,7 @@ bool GTK_ARDOUR::just_version = false;
bool GTK_ARDOUR::use_vst = true; bool GTK_ARDOUR::use_vst = true;
bool GTK_ARDOUR::new_session = false; bool GTK_ARDOUR::new_session = false;
char* GTK_ARDOUR::curvetest_file = 0; char* GTK_ARDOUR::curvetest_file = 0;
bool GTK_ARDOUR::try_hw_optimization = false; bool GTK_ARDOUR::try_hw_optimization = true;
using namespace GTK_ARDOUR; using namespace GTK_ARDOUR;

View file

@ -68,8 +68,8 @@ PannerUI::PannerUI (IO& io, Session& s)
ARDOUR_UI::instance()->tooltips().set_tip (pan_automation_state_button, _("Pan automation mode")); ARDOUR_UI::instance()->tooltips().set_tip (pan_automation_state_button, _("Pan automation mode"));
ARDOUR_UI::instance()->tooltips().set_tip (pan_automation_style_button, _("Pan automation type")); ARDOUR_UI::instance()->tooltips().set_tip (pan_automation_style_button, _("Pan automation type"));
set_size_request_to_display_given_text (pan_automation_state_button, X_("M"), 2, 2); //set_size_request_to_display_given_text (pan_automation_state_button, X_("O"), 2, 2);
set_size_request_to_display_given_text (pan_automation_style_button, X_("M"), 2, 2); //set_size_request_to_display_given_text (pan_automation_style_button, X_("0"), 2, 2);
pan_bar_packer.set_size_request (-1, 61); pan_bar_packer.set_size_request (-1, 61);
panning_viewport.set_size_request (61, 61); panning_viewport.set_size_request (61, 61);
@ -106,17 +106,13 @@ PannerUI::PannerUI (IO& io, Session& s)
panning_link_button.set_name (X_("PanningLinkButton")); panning_link_button.set_name (X_("PanningLinkButton"));
panning_link_direction_button.set_name (X_("PanningLinkDirectionButton")); panning_link_direction_button.set_name (X_("PanningLinkDirectionButton"));
panning_link_box.pack_start (panning_link_button, true, true);
panning_link_box.pack_start (panning_link_direction_button, true, true);
panning_link_box.pack_start (pan_automation_state_button, true, true);
/* the pixmap will be reset at some point, but the key thing is that /* the pixmap will be reset at some point, but the key thing is that
we need a pixmap in the button just to get started. we need a pixmap in the button just to get started.
*/ */
Gtk::HBox* pan_button_hbox = manage (new Gtk::HBox());
panning_link_box.pack_start (panning_link_button, true, true);
panning_link_box.pack_start (panning_link_direction_button, true, true);
pan_button_hbox->pack_start (panning_link_box, true, true);
pan_button_hbox->pack_start (pan_automation_state_button, true, true);
panning_link_direction_button.add (*(manage (new Image (get_xpm("forwardblarrow.xpm"))))); panning_link_direction_button.add (*(manage (new Image (get_xpm("forwardblarrow.xpm")))));
panning_link_direction_button.signal_clicked().connect panning_link_direction_button.signal_clicked().connect
@ -138,7 +134,7 @@ PannerUI::PannerUI (IO& io, Session& s)
pan_vbox.set_spacing (4); pan_vbox.set_spacing (4);
pan_vbox.pack_start (panning_viewport, Gtk::PACK_SHRINK); pan_vbox.pack_start (panning_viewport, Gtk::PACK_SHRINK);
pan_vbox.pack_start (*pan_button_hbox, Gtk::PACK_SHRINK); pan_vbox.pack_start (panning_link_box, Gtk::PACK_SHRINK);
pack_start (pan_vbox, true, false); pack_start (pan_vbox, true, false);
@ -500,13 +496,16 @@ PannerUI::pan_changed (void *src)
switch (_io.panner().size()) { switch (_io.panner().size()) {
case 0: case 0:
panning_link_box.set_sensitive (false); panning_link_direction_button.set_sensitive (false);
panning_link_button.set_sensitive (false);
return; return;
case 1: case 1:
panning_link_box.set_sensitive (false); panning_link_direction_button.set_sensitive (false);
panning_link_button.set_sensitive (false);
break; break;
default: default:
panning_link_box.set_sensitive (true); panning_link_direction_button.set_sensitive (true);
panning_link_button.set_sensitive (true);
} }
uint32_t nouts = _io.n_outputs(); uint32_t nouts = _io.n_outputs();

View file

@ -217,8 +217,8 @@ class VSTPluginUI : public PlugUIBase, public Gtk::VBox
~VSTPluginUI (); ~VSTPluginUI ();
gint get_preferred_height (); gint get_preferred_height ();
bool start_updating(GdkEventAny*) {} bool start_updating(GdkEventAny*) {return false;}
bool stop_updating(GdkEventAny*) {} bool stop_updating(GdkEventAny*) {return false;}
int package (Gtk::Window&); int package (Gtk::Window&);
@ -228,7 +228,7 @@ class VSTPluginUI : public PlugUIBase, public Gtk::VBox
Gtk::HBox preset_box; Gtk::HBox preset_box;
Gtk::VBox vpacker; Gtk::VBox vpacker;
gboolean configure_handler (GdkEventConfigure*, GtkSocket*); gboolean configure_handler (GdkEventConfigure*, Gtk::Socket*);
void save_plugin_setting (); void save_plugin_setting ();
}; };
#endif #endif

View file

@ -64,9 +64,9 @@ class AudioRegionView : public TimeAxisViewItem
void set_valid (bool yn) { valid = yn; } void set_valid (bool yn) { valid = yn; }
std::string get_item_name(); std::string get_item_name();
void set_height (double h); void set_height (double);
void set_samples_per_unit (double spu); void set_samples_per_unit (double);
bool set_duration (jack_nframes_t dur, void* src); bool set_duration (jack_nframes_t, void*);
void set_amplitude_above_axis (gdouble spp); void set_amplitude_above_axis (gdouble spp);
@ -193,7 +193,7 @@ class AudioRegionView : public TimeAxisViewItem
void store_flags (); void store_flags ();
void set_colors (); void set_colors ();
void compute_colors (Gdk::Color& color); void compute_colors (Gdk::Color&);
virtual void set_frame_color (); virtual void set_frame_color ();
void reset_width_dependent_items (double pixel_width); void reset_width_dependent_items (double pixel_width);
void set_waveview_data_src(); void set_waveview_data_src();

View file

@ -20,7 +20,7 @@
#include <algorithm> #include <algorithm>
#include <pbd/lockmonitor.h> #include <glibmm/thread.h>
#include <gtkmm2ext/utils.h> #include <gtkmm2ext/utils.h>
#include <gtkmm2ext/stop_signal.h> #include <gtkmm2ext/stop_signal.h>

View file

@ -199,18 +199,29 @@ Selection::toggle (AudioRegionView* r)
{ {
AudioRegionSelection::iterator i; AudioRegionSelection::iterator i;
cerr << "about to toggle a regionview\n";
if ((i = find (audio_regions.begin(), audio_regions.end(), r)) == audio_regions.end()) { if ((i = find (audio_regions.begin(), audio_regions.end(), r)) == audio_regions.end()) {
audio_regions.add (r); audio_regions.add (r);
cerr << "\tadded\n";
} else { } else {
audio_regions.erase (i); audio_regions.erase (i);
cerr << "\tremoved\n";
} }
RegionsChanged (); RegionsChanged ();
cerr << "done\n"; }
void
Selection::toggle (vector<AudioRegionView*>& r)
{
AudioRegionSelection::iterator i;
for (vector<AudioRegionView*>::iterator x = r.begin(); x != r.end(); ++x) {
if ((i = find (audio_regions.begin(), audio_regions.end(), (*x))) == audio_regions.end()) {
audio_regions.add ((*x));
} else {
audio_regions.erase (i);
}
}
RegionsChanged ();
} }
long long
@ -633,8 +644,6 @@ Selection::add (list<Selectable*>& selectables)
if (!autos.empty()) { if (!autos.empty()) {
add (autos); add (autos);
} }
cerr << "Selection @ " << this << " has " << points.size() << " points\n";
} }
void void

View file

@ -25,7 +25,6 @@
#include <gtkmm/box.h> #include <gtkmm/box.h>
#include <gtkmm/stock.h> #include <gtkmm/stock.h>
#include <pbd/basename.h>
#include <pbd/convert.h> #include <pbd/convert.h>
#include <gtkmm2ext/utils.h> #include <gtkmm2ext/utils.h>
@ -206,7 +205,7 @@ SoundFileBox::play_btn_clicked ()
} }
string result; 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); AudioRegion* a_region = new AudioRegion(srclist, 0, srclist[0]->length(), result, 0, Region::DefaultFlags, false);
region_cache[path] = a_region; region_cache[path] = a_region;
} }

View file

@ -263,7 +263,7 @@ class TimeAxisView : public virtual AxisView
/** /**
* Displays the standard LHS controls size menu for the track heights * Displays the standard LHS controls size menu for the track heights
* *
* @param when the popup activation time * @parem when the popup activation time
*/ */
void popup_size_menu(guint32 when); void popup_size_menu(guint32 when);

View file

@ -48,7 +48,6 @@ class TimeAxisViewItem : public sigc::trackable, public Selectable
* *
* @param pos the new position * @param pos the new position
* @param src the identity of the object that initiated the change * @param src the identity of the object that initiated the change
* @param delta ignored
* @return true if the position change was a success, false otherwise * @return true if the position change was a success, false otherwise
*/ */
virtual bool set_position(jack_nframes_t pos, void* src, double* delta = 0) ; virtual bool set_position(jack_nframes_t pos, void* src, double* delta = 0) ;
@ -93,7 +92,7 @@ class TimeAxisViewItem : public sigc::trackable, public Selectable
/** /**
* Sets the minimu duration that this item may be set to * Sets the minimu duration that this item may be set to
* *
* @param dur the minimum duration that this item may be set to * @param the minimum duration that this item may be set to
* @param src the identity of the object that initiated the change * @param src the identity of the object that initiated the change
*/ */
virtual void set_min_duration(jack_nframes_t dur, void* src) ; virtual void set_min_duration(jack_nframes_t dur, void* src) ;
@ -343,13 +342,12 @@ class TimeAxisViewItem : public sigc::trackable, public Selectable
* @param parent the parent canvas group * @param parent the parent canvas group
* @param tv the TimeAxisView we are going to be added to * @param tv the TimeAxisView we are going to be added to
* @param spu samples per unit * @param spu samples per unit
* @param base_color base color * @param base_color
* @param start the start point of this item * @param start the start point of this item
* @param duration the duration of this item * @param duration the duration of this item
* @param v visibility
*/ */
TimeAxisViewItem(const std::string & it_name, ArdourCanvas::Group& parent, TimeAxisView& tv, double spu, TimeAxisViewItem(const std::string & it_name, ArdourCanvas::Group& parent, TimeAxisView& tv, double spu, Gdk::Color& base_color,
Gdk::Color& base_color, jack_nframes_t start, jack_nframes_t duration, Visibility v = Visibility (0)); jack_nframes_t start, jack_nframes_t duration, Visibility v = Visibility (0));
/** /**
* Calculates some contrasting color for displaying various parts of this item, based upon the base color * Calculates some contrasting color for displaying various parts of this item, based upon the base color

View file

@ -19,16 +19,13 @@
*/ */
#include <fst.h> #include <fst.h>
#include <gdk/gdkx.h>
#include <X11/Xlib.h>
#include <ardour/insert.h> #include <ardour/insert.h>
#include <ardour/vst_plugin.h> #include <ardour/vst_plugin.h>
#include "plugin_ui.h" #include "plugin_ui.h"
#include "prompter.h"
#include "i18n.h" #include <gdk/gdkx.h>
using namespace Gtk; using namespace Gtk;
using namespace ARDOUR; using namespace ARDOUR;
@ -65,42 +62,42 @@ VSTPluginUI::package (Gtk::Window& win)
{ {
/* for GTK+2, remove this: you cannot add to a realized socket */ /* for GTK+2, remove this: you cannot add to a realized socket */
socket.realize (); //socket.realize ();
/* forward configure events to plugin window */ /* forward configure events to plugin window */
win.signal_configure_event().connect (bind (mem_fun (*this, &VSTPluginUI::configure_handler), socket.gobj())); win.signal_configure_event().connect (bind (mem_fun (*this, &VSTPluginUI::configure_handler), &socket));
/* XXX in GTK2, use add_id() instead of steal, although add_id() /* XXX in GTK2, use add_id() instead of steal, although add_id()
assumes that the window's owner understands the XEmbed protocol. assumes that the window's owner understands the XEmbed protocol.
*/ */
socket.steal (fst_get_XID (vst.fst())); socket.add_id (fst_get_XID (vst.fst()));
return 0; return 0;
} }
gboolean gboolean
VSTPluginUI::configure_handler (GdkEventConfigure* ev, GtkSocket *socket) VSTPluginUI::configure_handler (GdkEventConfigure* ev, Gtk::Socket *socket)
{ {
XEvent event; XEvent event;
gint x, y; gint x, y;
if (socket->plug_window == NULL) { if (socket->gobj() == NULL) {
return FALSE; return FALSE;
} }
event.xconfigure.type = ConfigureNotify; event.xconfigure.type = ConfigureNotify;
event.xconfigure.event = GDK_WINDOW_XWINDOW (socket->plug_window); event.xconfigure.event = GDK_WINDOW_XWINDOW (socket->get_window()->gobj());
event.xconfigure.window = GDK_WINDOW_XWINDOW (socket->plug_window); event.xconfigure.window = GDK_WINDOW_XWINDOW (socket->get_window()->gobj());
/* The ICCCM says that synthetic events should have root relative /* The ICCCM says that synthetic events should have root relative
* coordinates. We still aren't really ICCCM compliant, since * coordinates. We still aren't really ICCCM compliant, since
* we don't send events when the real toplevel is moved. * we don't send events when the real toplevel is moved.
*/ */
gdk_error_trap_push (); gdk_error_trap_push ();
gdk_window_get_origin (socket->plug_window, &x, &y); gdk_window_get_origin (socket->get_window()->gobj(), &x, &y);
gdk_error_trap_pop (); gdk_error_trap_pop ();
event.xconfigure.x = x; event.xconfigure.x = x;
@ -113,8 +110,8 @@ VSTPluginUI::configure_handler (GdkEventConfigure* ev, GtkSocket *socket)
event.xconfigure.override_redirect = False; event.xconfigure.override_redirect = False;
gdk_error_trap_push (); gdk_error_trap_push ();
XSendEvent (GDK_WINDOW_XDISPLAY (socket->plug_window), XSendEvent (GDK_WINDOW_XDISPLAY (socket->get_window()->gobj()),
GDK_WINDOW_XWINDOW (socket->plug_window), GDK_WINDOW_XWINDOW (socket->get_window()->gobj()),
False, StructureNotifyMask, &event); False, StructureNotifyMask, &event);
// gdk_display_sync (GDK_WINDOW_XDISPLAY (socket->plug_window)); // gdk_display_sync (GDK_WINDOW_XDISPLAY (socket->plug_window));
gdk_error_trap_pop (); gdk_error_trap_pop ();

View file

@ -58,7 +58,6 @@ ladspa_plugin.cc
location.cc location.cc
mtc_slave.cc mtc_slave.cc
named_selection.cc named_selection.cc
osc.cc
panner.cc panner.cc
pcm_utils.cc pcm_utils.cc
playlist.cc playlist.cc
@ -98,6 +97,7 @@ smpte.cc
arch_specific_objects = [ ] arch_specific_objects = [ ]
osc_files = [ 'osc.cc' ]
vst_files = [ 'vst_plugin.cc', 'session_vst.cc' ] vst_files = [ 'vst_plugin.cc', 'session_vst.cc' ]
coreaudio_files = [ 'coreaudio_source.cc' ] coreaudio_files = [ 'coreaudio_source.cc' ]
extra_sources = [ ] extra_sources = [ ]
@ -105,6 +105,9 @@ extra_sources = [ ]
if ardour['VST']: if ardour['VST']:
extra_sources += vst_files extra_sources += vst_files
if ardour['LIBLO']:
extra_sources += osc_files
ardour.Append(CCFLAGS="-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE") ardour.Append(CCFLAGS="-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE")
ardour.Append(CXXFLAGS="-DDATA_DIR=\\\""+final_prefix+"/share\\\"") ardour.Append(CXXFLAGS="-DDATA_DIR=\\\""+final_prefix+"/share\\\"")
ardour.Append(CXXFLAGS="-DMODULE_DIR=\\\""+final_prefix+"/lib\\\"") ardour.Append(CXXFLAGS="-DMODULE_DIR=\\\""+final_prefix+"/lib\\\"")
@ -173,7 +176,7 @@ if conf.CheckCHeader('sys/vfs.h'):
if conf.CheckCHeader('/System/Library/Frameworks/CoreMIDI.framework/Headers/CoreMIDI.h'): if conf.CheckCHeader('/System/Library/Frameworks/CoreMIDI.framework/Headers/CoreMIDI.h'):
ardour.Append(LINKFLAGS="-framework CoreMIDI") ardour.Append(LINKFLAGS="-framework CoreMIDI")
if conf.CheckCHeader('/System/Library/Frameworks/AudioToolbox.framework/Headers/ExtendedAudioFile.h'): if conf.CheckCHeader('/System/Library/Frameworks/AudioToolbox.framework/Headers/ExtendedAudioFile.h') and ardour['COREAUDIO'] == 1:
ardour.Append(CXXFLAGS="-DHAVE_COREAUDIO") ardour.Append(CXXFLAGS="-DHAVE_COREAUDIO")
ardour.Append(LINKFLAGS="-framework AudioToolbox") ardour.Append(LINKFLAGS="-framework AudioToolbox")
@ -199,9 +202,12 @@ ardour.Merge ([
libraries['pbd3'], libraries['pbd3'],
libraries['soundtouch'], libraries['soundtouch'],
libraries['midi++2'], libraries['midi++2'],
libraries['lo'], libraries['glib2'],
libraries['glibmm2']
]) ])
if ardour['LIBLO']:
ardour.Merge ([ libraries['lo'] ])
ardour.VersionBuild(['version.cc', 'ardour/version.h'], 'SConscript') ardour.VersionBuild(['version.cc', 'ardour/version.h'], 'SConscript')

View file

@ -26,14 +26,11 @@
#include <signal.h> #include <signal.h>
#include <pbd/error.h> #include <pbd/error.h>
#include <pbd/lockmonitor.h>
#include <pbd/failed_constructor.h> #include <pbd/failed_constructor.h>
#include <ardour/configuration.h> #include <ardour/configuration.h>
#include <ardour/types.h> #include <ardour/types.h>
using namespace PBD;
namespace MIDI { namespace MIDI {
class MachineControl; class MachineControl;
class Port; class Port;

View file

@ -28,7 +28,9 @@
#include <string> #include <string>
#include <sigc++/signal.h> #include <sigc++/signal.h>
#include <pthread.h>
#include <glibmm/thread.h>
#include <ardour/ardour.h> #include <ardour/ardour.h>
#include <jack/jack.h> #include <jack/jack.h>
#include <jack/transport.h> #include <jack/transport.h>
@ -59,7 +61,7 @@ class AudioEngine : public sigc::trackable
int start (); int start ();
bool running() const { return _running; } 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 frame_rate();
jack_nframes_t frames_per_cycle(); jack_nframes_t frames_per_cycle();
@ -185,10 +187,10 @@ class AudioEngine : public sigc::trackable
ARDOUR::Session *session; ARDOUR::Session *session;
jack_client_t *_jack; jack_client_t *_jack;
std::string jack_client_name; std::string jack_client_name;
PBD::NonBlockingLock port_lock; Glib::Mutex port_lock;
PBD::NonBlockingLock _process_lock; Glib::Mutex _process_lock;
PBD::Lock session_remove_lock; Glib::Mutex session_remove_lock;
pthread_cond_t session_removed; Glib::Cond session_removed;
bool session_remove_pending; bool session_remove_pending;
bool _running; bool _running;
bool _has_run; bool _has_run;
@ -202,8 +204,6 @@ class AudioEngine : public sigc::trackable
sigc::slot<int,jack_nframes_t> freewheel_action; sigc::slot<int,jack_nframes_t> freewheel_action;
bool reconnect_on_halt; bool reconnect_on_halt;
int _usecs_per_cycle; int _usecs_per_cycle;
jack_nframes_t last_meter_point;
jack_nframes_t meter_interval;
typedef std::set<Port*> Ports; typedef std::set<Port*> Ports;
Ports ports; Ports ports;

View file

@ -75,10 +75,11 @@ class AudioRegion : public Region
AudioRegion (SourceList &, const XMLNode&); AudioRegion (SourceList &, const XMLNode&);
~AudioRegion(); ~AudioRegion();
bool region_list_equivalent (const AudioRegion&); bool region_list_equivalent (const AudioRegion&) const ;
bool source_equivalent (const AudioRegion&); bool source_equivalent (const AudioRegion&) const;
bool equivalent (const AudioRegion&); bool equivalent (const AudioRegion&) const;
bool size_equivalent (const AudioRegion&); bool size_equivalent (const AudioRegion&) const;
bool overlap_equivalent (const AudioRegion&) const;
bool speed_mismatch (float) const; bool speed_mismatch (float) const;

View file

@ -22,10 +22,8 @@
#define __ardour_auditioner_h__ #define __ardour_auditioner_h__
#include <string> #include <string>
#include <pthread.h>
#include <pbd/lockmonitor.h> #include <glibmm/thread.h>
#include <pbd/atomic.h>
#include <ardour/ardour.h> #include <ardour/ardour.h>
#include <ardour/audio_track.h> #include <ardour/audio_track.h>
@ -50,10 +48,10 @@ class Auditioner : public AudioTrack
int play_audition (jack_nframes_t nframes); int play_audition (jack_nframes_t nframes);
void cancel_audition () { 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: private:
AudioRegion *the_region; AudioRegion *the_region;

View file

@ -26,7 +26,7 @@
#include <cmath> #include <cmath>
#include <sigc++/signal.h> #include <sigc++/signal.h>
#include <pbd/lockmonitor.h> #include <glibmm/thread.h>
#include <pbd/undo.h> #include <pbd/undo.h>
#include <pbd/xml++.h> #include <pbd/xml++.h>
#include <ardour/ardour.h> #include <ardour/ardour.h>
@ -144,7 +144,7 @@ class AutomationList : public StateManager
std::pair<AutomationList::iterator,AutomationList::iterator> control_points_adjacent (double when); 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&)) { 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); (obj.*method)(*this);
} }
@ -157,13 +157,13 @@ class AutomationList : public StateManager
double get_max_xval() const { return max_xval; } double get_max_xval() const { return max_xval; }
double eval (double where) { double eval (double where) {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
return unlocked_eval (where); return unlocked_eval (where);
} }
double rt_safe_eval (double where, bool& ok) { 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())) { if ((ok = lm.locked())) {
return unlocked_eval (where); return unlocked_eval (where);
@ -186,7 +186,7 @@ class AutomationList : public StateManager
}; };
AutomationEventList events; AutomationEventList events;
mutable PBD::NonBlockingLock lock; mutable Glib::Mutex lock;
bool _frozen; bool _frozen;
bool changed_when_thawed; bool changed_when_thawed;
bool _dirty; bool _dirty;

View file

@ -24,7 +24,7 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include <sigc++/signal.h> #include <sigc++/signal.h>
#include <pbd/lockmonitor.h> #include <glibmm/thread.h>
#include <ardour/stateful.h> #include <ardour/stateful.h>
using std::vector; using std::vector;
@ -67,7 +67,7 @@ class Connection : public Stateful, public sigc::trackable {
Connection (const XMLNode&); Connection (const XMLNode&);
private: private:
mutable PBD::Lock port_lock; mutable Glib::Mutex port_lock;
vector<PortList> _ports; vector<PortList> _ports;
string _name; string _name;
bool _sysdep; bool _sysdep;

View file

@ -6,7 +6,7 @@
#include <sigc++/sigc++.h> #include <sigc++/sigc++.h>
#include <pbd/lockmonitor.h> #include <glibmm/thread.h>
#include <ardour/stateful.h> #include <ardour/stateful.h>
@ -52,7 +52,7 @@ struct ControlProtocolInfo {
static ControlProtocolManager* _instance; static ControlProtocolManager* _instance;
Session* _session; Session* _session;
PBD::Lock protocols_lock; Glib::Mutex protocols_lock;
std::list<ControlProtocol*> control_protocols; std::list<ControlProtocol*> control_protocols;
void drop_session (); void drop_session ();

View file

@ -40,7 +40,7 @@ class CoreAudioSource : public ExternalSource {
mutable float *tmpbuf; mutable float *tmpbuf;
mutable jack_nframes_t tmpbufsize; mutable jack_nframes_t tmpbufsize;
mutable PBD::Lock _tmpbuf_lock; mutable Glib::Mutex _tmpbuf_lock;
void init (const string &str, bool build_peak); void init (const string &str, bool build_peak);
}; };

View file

@ -23,11 +23,10 @@
#include <sys/types.h> #include <sys/types.h>
#include <sigc++/signal.h> #include <sigc++/signal.h>
#include <pbd/lockmonitor.h> #include <glibmm/thread.h>
#include <pbd/undo.h> #include <pbd/undo.h>
#include <list> #include <list>
#include <algorithm> #include <algorithm>
#include <pthread.h>
#include <ardour/automation_event.h> #include <ardour/automation_event.h>
namespace ARDOUR { namespace ARDOUR {

View file

@ -33,7 +33,7 @@
#include <pbd/fastlog.h> #include <pbd/fastlog.h>
#include <pbd/ringbufferNPT.h> #include <pbd/ringbufferNPT.h>
#include <pbd/atomic.h>
#include <ardour/ardour.h> #include <ardour/ardour.h>
#include <ardour/configuration.h> #include <ardour/configuration.h>
@ -115,7 +115,7 @@ class DiskStream : public Stateful, public sigc::trackable
} }
void set_record_enabled (bool yn, void *src); 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_in ();
void punch_out (); void punch_out ();
@ -365,7 +365,7 @@ class DiskStream : public Stateful, public sigc::trackable
AlignStyle _persistent_alignment_style; AlignStyle _persistent_alignment_style;
bool first_input_change; bool first_input_change;
PBD::NonBlockingLock state_lock; Glib::Mutex state_lock;
jack_nframes_t scrub_start; jack_nframes_t scrub_start;
jack_nframes_t scrub_buffer_size; jack_nframes_t scrub_buffer_size;
@ -404,7 +404,7 @@ class DiskStream : public Stateful, public sigc::trackable
}; };
vector<CaptureInfo*> capture_info; vector<CaptureInfo*> capture_info;
PBD::Lock capture_info_lock; Glib::Mutex capture_info_lock;
void init (Flag); void init (Flag);

View file

@ -27,10 +27,11 @@
#include <sigc++/signal.h> #include <sigc++/signal.h>
#include <jack/jack.h> #include <jack/jack.h>
#include <pbd/lockmonitor.h> #include <glibmm/thread.h>
#include <pbd/fastlog.h> #include <pbd/fastlog.h>
#include <pbd/undo.h> #include <pbd/undo.h>
#include <pbd/atomic.h>
#include <midi++/controllable.h> #include <midi++/controllable.h>
#include <ardour/ardour.h> #include <ardour/ardour.h>
@ -205,7 +206,15 @@ class IO : public Stateful, public ARDOUR::StateManager
} }
} }
static void update_meters();
private:
static sigc::signal<void> Meter; static sigc::signal<void> Meter;
static Glib::StaticMutex m_meter_signal_lock;
sigc::connection m_meter_connection;
public:
/* automation */ /* automation */
@ -261,7 +270,7 @@ class IO : public Stateful, public ARDOUR::StateManager
int ports_became_legal (); int ports_became_legal ();
private: private:
mutable PBD::Lock io_lock; mutable Glib::Mutex io_lock;
protected: protected:
Session& _session; Session& _session;
@ -269,7 +278,7 @@ class IO : public Stateful, public ARDOUR::StateManager
gain_t _gain; gain_t _gain;
gain_t _effective_gain; gain_t _effective_gain;
gain_t _desired_gain; gain_t _desired_gain;
PBD::NonBlockingLock declick_lock; Glib::Mutex declick_lock;
vector<Port*> _outputs; vector<Port*> _outputs;
vector<Port*> _inputs; vector<Port*> _inputs;
vector<float> _peak_power; vector<float> _peak_power;
@ -331,7 +340,7 @@ class IO : public Stateful, public ARDOUR::StateManager
int save_automation (const string&); int save_automation (const string&);
int load_automation (const string&); int load_automation (const string&);
PBD::NonBlockingLock automation_lock; Glib::Mutex automation_lock;
/* AudioTrack::deprecated_use_diskstream_connections() needs these */ /* AudioTrack::deprecated_use_diskstream_connections() needs these */

View file

@ -27,10 +27,10 @@
#include <map> #include <map>
#include <sys/types.h> #include <sys/types.h>
#include <pthread.h>
#include <sigc++/signal.h> #include <sigc++/signal.h>
#include <pbd/lockmonitor.h> #include <glibmm/thread.h>
#include <pbd/undo.h> #include <pbd/undo.h>
#include "ardour.h" #include "ardour.h"
@ -159,18 +159,21 @@ class Locations : public Stateful, public StateManager
Location *first_location_before (jack_nframes_t); Location *first_location_before (jack_nframes_t);
Location *first_location_after (jack_nframes_t); Location *first_location_after (jack_nframes_t);
jack_nframes_t first_mark_before (jack_nframes_t);
jack_nframes_t first_mark_after (jack_nframes_t);
sigc::signal<void,Location*> current_changed; sigc::signal<void,Location*> current_changed;
sigc::signal<void> changed; sigc::signal<void> changed;
sigc::signal<void,Location*> added; sigc::signal<void,Location*> added;
sigc::signal<void,Location*> removed; sigc::signal<void,Location*> removed;
template<class T> void apply (T& obj, void (T::*method)(LocationList&)) { template<class T> void apply (T& obj, void (T::*method)(LocationList&)) {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
(obj.*method)(locations); (obj.*method)(locations);
} }
template<class T1, class T2> void apply (T1& obj, void (T1::*method)(LocationList&, T2& arg), T2& arg) { 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); (obj.*method)(locations, arg);
} }
@ -187,7 +190,7 @@ class Locations : public Stateful, public StateManager
LocationList locations; LocationList locations;
Location *current_location; Location *current_location;
mutable PBD::Lock lock; mutable Glib::Mutex lock;
int set_current_unlocked (Location *); int set_current_unlocked (Location *);
void location_changed (Location*); void location_changed (Location*);

View file

@ -22,7 +22,7 @@
#define __ardour_logcurve_h__ #define __ardour_logcurve_h__
#include <pbd/fastlog.h> #include <pbd/fastlog.h>
#include <pbd/lockmonitor.h> #include <glibmm/thread.h>
namespace ARDOUR { namespace ARDOUR {
@ -94,7 +94,7 @@ class LogCurve {
} }
void set_length (uint32_t len) { l = len; } void set_length (uint32_t len) { l = len; }
mutable PBD::NonBlockingLock lock; mutable Glib::Mutex lock;
protected: protected:
float a; float a;

View file

@ -28,8 +28,9 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <glib.h>
#include <sigc++/signal.h> #include <sigc++/signal.h>
#include <pbd/atomic.h>
#include <pbd/undo.h> #include <pbd/undo.h>
#include <ardour/ardour.h> #include <ardour/ardour.h>
@ -197,8 +198,8 @@ class Playlist : public Stateful, public StateManager {
void init (bool hide); void init (bool hide);
bool holding_state () const { bool holding_state () const {
return atomic_read (&block_notifications) != 0 || return g_atomic_int_get (&block_notifications) != 0 ||
atomic_read (&ignore_state_changes) != 0; g_atomic_int_get (&ignore_state_changes) != 0;
} }
/* prevent the compiler from ever generating these */ /* prevent the compiler from ever generating these */

View file

@ -27,7 +27,8 @@
#include <map> #include <map>
#include <sigc++/signal.h> #include <sigc++/signal.h>
#include <pbd/lockmonitor.h> #include <glibmm/thread.h>
#include <pbd/undo.h> #include <pbd/undo.h>
#include <ardour/ardour.h> #include <ardour/ardour.h>
@ -131,7 +132,7 @@ class Redirect : public IO
map<uint32_t,AutomationList*> parameter_automation; map<uint32_t,AutomationList*> parameter_automation;
set<uint32_t> visible_parameter_automation; set<uint32_t> visible_parameter_automation;
mutable PBD::NonBlockingLock _automation_lock; mutable Glib::Mutex _automation_lock;
void can_automate (uint32_t); void can_automate (uint32_t);
set<uint32_t> can_automate_list; set<uint32_t> can_automate_list;

View file

@ -221,7 +221,7 @@ class Region : public Stateful, public StateManager
string _name; string _name;
mutable RegionEditState _first_edit; mutable RegionEditState _first_edit;
int _frozen; int _frozen;
PBD::Lock lock; Glib::Mutex lock;
ARDOUR::id_t _id; ARDOUR::id_t _id;
ARDOUR::Playlist* _playlist; ARDOUR::Playlist* _playlist;
mutable uint32_t _read_data_count; // modified in read() mutable uint32_t _read_data_count; // modified in read()

View file

@ -27,11 +27,8 @@
#include <map> #include <map>
#include <string> #include <string>
#include <pthread.h>
#include <pbd/atomic.h>
#include <pbd/fastlog.h> #include <pbd/fastlog.h>
#include <pbd/lockmonitor.h> #include <glibmm/thread.h>
#include <pbd/xml++.h> #include <pbd/xml++.h>
#include <pbd/undo.h> #include <pbd/undo.h>
#include <midi++/controllable.h> #include <midi++/controllable.h>
@ -142,14 +139,14 @@ class Route : public IO
void flush_redirects (); void flush_redirects ();
template<class T> void foreach_redirect (T *obj, void (T::*func)(Redirect *)) { 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) { for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
(obj->*func) (*i); (obj->*func) (*i);
} }
} }
Redirect *nth_redirect (uint32_t n) { Redirect *nth_redirect (uint32_t n) {
RWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__); Glib::RWLock::ReaderLock lm (redirect_lock);
RedirectList::iterator i; RedirectList::iterator i;
for (i = _redirects.begin(); i != _redirects.end() && n; ++i, --n); for (i = _redirects.begin(); i != _redirects.end() && n; ++i, --n);
if (i == _redirects.end()) { if (i == _redirects.end()) {
@ -294,9 +291,9 @@ class Route : public IO
jack_nframes_t _roll_delay; jack_nframes_t _roll_delay;
jack_nframes_t _own_latency; jack_nframes_t _own_latency;
RedirectList _redirects; RedirectList _redirects;
PBD::NonBlockingRWLock redirect_lock; Glib::RWLock redirect_lock;
IO *_control_outs; IO *_control_outs;
PBD::NonBlockingLock control_outs_lock; Glib::Mutex control_outs_lock;
RouteGroup *_edit_group; RouteGroup *_edit_group;
RouteGroup *_mix_group; RouteGroup *_mix_group;
std::string _comment; std::string _comment;

View file

@ -31,9 +31,9 @@
#include <sndfile.h> #include <sndfile.h>
#include <glibmm/thread.h>
#include <pbd/error.h> #include <pbd/error.h>
#include <pbd/atomic.h>
#include <pbd/lockmonitor.h>
#include <pbd/undo.h> #include <pbd/undo.h>
#include <pbd/pool.h> #include <pbd/pool.h>
@ -47,6 +47,8 @@
#include <ardour/gain.h> #include <ardour/gain.h>
#include <ardour/io.h> #include <ardour/io.h>
#include <ardour/smpte.h>
class XMLTree; class XMLTree;
class XMLNode; class XMLNode;
class AEffect; class AEffect;
@ -274,7 +276,7 @@ class Session : public sigc::trackable, public Stateful
typedef list<DiskStream *> DiskStreamList; typedef list<DiskStream *> DiskStreamList;
Session::DiskStreamList disk_streams() const { 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 */ return diskstreams; /* XXX yes, force a copy */
} }
@ -284,7 +286,7 @@ class Session : public sigc::trackable, public Stateful
typedef list<Route *> RouteList; typedef list<Route *> RouteList;
RouteList get_routes() const { RouteList get_routes() const {
RWLockMonitor rlock (route_lock, false, __LINE__, __FILE__); Glib::RWLock::ReaderLock rlock (route_lock);
return routes; /* XXX yes, force a copy */ return routes; /* XXX yes, force a copy */
} }
@ -310,7 +312,7 @@ class Session : public sigc::trackable, public Stateful
} }
RecordState record_status() const { RecordState record_status() const {
return (RecordState) atomic_read (&_record_status); return (RecordState) g_atomic_int_get (&_record_status);
} }
bool actively_recording () { bool actively_recording () {
@ -1402,22 +1404,14 @@ class Session : public sigc::trackable, public Stateful
static MultiAllocSingleReleasePool pool; static MultiAllocSingleReleasePool pool;
}; };
<<<<<<< .working mutable gint butler_active;
//PBD::Lock midi_lock; //PBD::Lock midi_lock;
//pthread_t midi_thread; //pthread_t midi_thread;
//int midi_request_pipe[2]; //int midi_request_pipe[2];
atomic_t butler_active;
//RingBuffer<MIDIRequest*> midi_requests;
/*
=======
Glib::Mutex midi_lock;
pthread_t midi_thread;
int midi_request_pipe[2];
mutable gint butler_active;
RingBuffer<MIDIRequest*> midi_requests;
>>>>>>> .merge-right.r579 //RingBuffer<MIDIRequest*> midi_requests;
int start_midi_thread (); /*int start_midi_thread ();
void terminate_midi_thread (); void terminate_midi_thread ();
void poke_midi_thread (); void poke_midi_thread ();
static void *_midi_thread_work (void *arg); static void *_midi_thread_work (void *arg);
@ -1465,7 +1459,7 @@ class Session : public sigc::trackable, public Stateful
/* disk-streams */ /* disk-streams */
DiskStreamList diskstreams; DiskStreamList diskstreams;
mutable PBD::NonBlockingRWLock diskstream_lock; mutable Glib::RWLock diskstream_lock;
uint32_t dstream_buffer_size; uint32_t dstream_buffer_size;
void add_diskstream (DiskStream*); void add_diskstream (DiskStream*);
int load_diskstreams (const XMLNode&); int load_diskstreams (const XMLNode&);
@ -1473,7 +1467,7 @@ class Session : public sigc::trackable, public Stateful
/* routes stuff */ /* routes stuff */
RouteList routes; RouteList routes;
mutable PBD::NonBlockingRWLock route_lock; mutable Glib::RWLock route_lock;
void add_route (Route*); void add_route (Route*);
uint32_t destructive_index; uint32_t destructive_index;
@ -1496,7 +1490,7 @@ class Session : public sigc::trackable, public Stateful
/* REGION MANAGEMENT */ /* REGION MANAGEMENT */
mutable PBD::Lock region_lock; mutable Glib::Mutex region_lock;
typedef map<ARDOUR::id_t,AudioRegion *> AudioRegionList; typedef map<ARDOUR::id_t,AudioRegion *> AudioRegionList;
AudioRegionList audio_regions; AudioRegionList audio_regions;
@ -1509,7 +1503,7 @@ class Session : public sigc::trackable, public Stateful
/* SOURCES */ /* SOURCES */
mutable PBD::Lock source_lock; mutable Glib::Mutex source_lock;
typedef std::map<id_t, Source *> SourceList; typedef std::map<id_t, Source *> SourceList;
SourceList sources; SourceList sources;
@ -1523,7 +1517,7 @@ class Session : public sigc::trackable, public Stateful
/* PLAYLISTS */ /* PLAYLISTS */
mutable PBD::Lock playlist_lock; mutable Glib::Mutex playlist_lock;
typedef set<Playlist *> PlaylistList; typedef set<Playlist *> PlaylistList;
PlaylistList playlists; PlaylistList playlists;
PlaylistList unused_playlists; PlaylistList unused_playlists;
@ -1541,7 +1535,7 @@ class Session : public sigc::trackable, public Stateful
/* NAMED SELECTIONS */ /* NAMED SELECTIONS */
mutable PBD::Lock named_selection_lock; mutable Glib::Mutex named_selection_lock;
typedef set<NamedSelection *> NamedSelectionList; typedef set<NamedSelection *> NamedSelectionList;
NamedSelectionList named_selections; NamedSelectionList named_selections;
@ -1601,7 +1595,7 @@ class Session : public sigc::trackable, public Stateful
vector<space_and_path> session_dirs; vector<space_and_path> session_dirs;
vector<space_and_path>::iterator last_rr_session_dir; vector<space_and_path>::iterator last_rr_session_dir;
uint32_t _total_free_4k_blocks; uint32_t _total_free_4k_blocks;
PBD::Lock space_lock; Glib::Mutex space_lock;
static const char* sound_dir_name; static const char* sound_dir_name;
static const char* tape_dir_name; static const char* tape_dir_name;
@ -1612,22 +1606,15 @@ class Session : public sigc::trackable, public Stateful
int ensure_sound_dir (string, string&); int ensure_sound_dir (string, string&);
void refresh_disk_space (); void refresh_disk_space ();
<<<<<<< .working
atomic_t _playback_load;
atomic_t _capture_load;
atomic_t _playback_load_min;
atomic_t _capture_load_min;
=======
mutable gint _playback_load; mutable gint _playback_load;
mutable gint _capture_load; mutable gint _capture_load;
mutable gint _playback_load_min; mutable gint _playback_load_min;
mutable gint _capture_load_min; mutable gint _capture_load_min;
>>>>>>> .merge-right.r579
/* I/O Connections */ /* I/O Connections */
typedef list<Connection *> ConnectionList; typedef list<Connection *> ConnectionList;
mutable PBD::Lock connection_lock; mutable Glib::Mutex connection_lock;
ConnectionList _connections; ConnectionList _connections;
int load_connections (const XMLNode&); int load_connections (const XMLNode&);
@ -1686,7 +1673,7 @@ class Session : public sigc::trackable, public Stateful
Sample* click_emphasis_data; Sample* click_emphasis_data;
jack_nframes_t click_length; jack_nframes_t click_length;
jack_nframes_t click_emphasis_length; jack_nframes_t click_emphasis_length;
mutable PBD::NonBlockingRWLock click_lock; mutable Glib::RWLock click_lock;
static const Sample default_click[]; static const Sample default_click[];
static const jack_nframes_t default_click_length; static const jack_nframes_t default_click_length;

View file

@ -29,7 +29,7 @@ namespace ARDOUR {
template<class T> void template<class T> void
Session::foreach_connection (T *obj, void (T::*func)(Connection *)) 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++) { for (ConnectionList::iterator i = _connections.begin(); i != _connections.end(); i++) {
(obj->*func) (*i); (obj->*func) (*i);
} }

View file

@ -29,7 +29,7 @@ namespace ARDOUR {
template<class T> void template<class T> void
Session::foreach_diskstream (T *obj, void (T::*func)(DiskStream&)) 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++) { for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); i++) {
if (!(*i)->hidden()) { if (!(*i)->hidden()) {
(obj->*func) (**i); (obj->*func) (**i);

View file

@ -29,7 +29,7 @@ namespace ARDOUR {
template<class T> void template<class T> void
Session::foreach_playlist (T *obj, void (T::*func)(Playlist *)) 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++) { for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); i++) {
if (!(*i)->hidden()) { if (!(*i)->hidden()) {
(obj->*func) (*i); (obj->*func) (*i);

View file

@ -8,7 +8,7 @@ namespace ARDOUR {
template<class T> void Session::foreach_audio_region (T *obj, void (T::*func)(AudioRegion *)) 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++) { for (AudioRegionList::iterator i = audio_regions.begin(); i != audio_regions.end(); i++) {
(obj->*func) ((*i).second); (obj->*func) ((*i).second);
} }

View file

@ -23,7 +23,8 @@
#include <iostream> #include <iostream>
#include <pbd/lockmonitor.h> #include <glibmm/thread.h>
#include <ardour/session.h> #include <ardour/session.h>
#include <ardour/route.h> #include <ardour/route.h>
@ -35,7 +36,7 @@ Session::foreach_route (T *obj, void (T::*func)(Route&))
RouteList public_order; RouteList public_order;
{ {
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__); Glib::RWLock::ReaderLock lm (route_lock);
public_order = routes; public_order = routes;
} }
@ -53,7 +54,7 @@ Session::foreach_route (T *obj, void (T::*func)(Route*))
RouteList public_order; RouteList public_order;
{ {
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__); Glib::RWLock::ReaderLock lm (route_lock);
public_order = routes; public_order = routes;
} }
@ -72,7 +73,7 @@ Session::foreach_route (T *obj, void (T::*func)(Route&, A), A arg1)
RouteList public_order; RouteList public_order;
{ {
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__); Glib::RWLock::ReaderLock lm (route_lock);
public_order = routes; public_order = routes;
} }

View file

@ -29,7 +29,7 @@ namespace ARDOUR {
template<class T> void template<class T> void
Session::foreach_named_selection (T& obj, void (T::*func)(NamedSelection&)) 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++) { for (NamedSelectionList::iterator i = named_selections.begin(); i != named_selections.end(); i++) {
(obj.*func) (**i); (obj.*func) (**i);
} }

View file

@ -25,7 +25,6 @@
#include <jack/jack.h> #include <jack/jack.h>
#include <pthread.h>
#include <sigc++/signal.h> #include <sigc++/signal.h>
#include <ardour/ardour.h> #include <ardour/ardour.h>
#include <midi++/parser.h> #include <midi++/parser.h>

View file

@ -43,7 +43,7 @@ class SndFileSource : public ExternalSource {
mutable float *tmpbuf; mutable float *tmpbuf;
mutable jack_nframes_t tmpbufsize; mutable jack_nframes_t tmpbufsize;
mutable PBD::Lock _tmpbuf_lock; mutable Glib::Mutex _tmpbuf_lock;
void init (const string &str, bool build_peak); void init (const string &str, bool build_peak);
}; };

View file

@ -25,10 +25,12 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include <time.h> #include <ctime>
#include <sigc++/signal.h> #include <sigc++/signal.h>
#include <glibmm/thread.h>
#include <ardour/ardour.h> #include <ardour/ardour.h>
#include <ardour/stateful.h> #include <ardour/stateful.h>
#include <pbd/xml++.h> #include <pbd/xml++.h>
@ -125,7 +127,7 @@ class Source : public Stateful, public sigc::trackable
string _name; string _name;
uint32_t _use_cnt; uint32_t _use_cnt;
bool _peaks_built; bool _peaks_built;
mutable PBD::Lock _lock; mutable Glib::Mutex _lock;
jack_nframes_t _length; jack_nframes_t _length;
bool next_peak_clear_should_notify; bool next_peak_clear_should_notify;
string peakpath; string peakpath;
@ -156,7 +158,7 @@ class Source : public Stateful, public sigc::trackable
}; };
static vector<Source*> pending_peak_sources; 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 queue_for_peaks (Source&);
static void clear_queue_for_peaks (); static void clear_queue_for_peaks ();

View file

@ -25,8 +25,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <cmath> #include <cmath>
#include <pthread.h> #include <glibmm/thread.h>
#include <pbd/lockmonitor.h>
#include <pbd/undo.h> #include <pbd/undo.h>
#include <sigc++/signal.h> #include <sigc++/signal.h>
@ -198,7 +197,7 @@ class TempoMap : public Stateful, public StateManager {
typedef vector<BBTPoint> BBTPointList; typedef vector<BBTPoint> BBTPointList;
template<class T> void apply_with_metrics (T& obj, void (T::*method)(const Metrics&)) { 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); (obj.*method)(*metrics);
} }
@ -285,7 +284,7 @@ class TempoMap : public Stateful, public StateManager {
jack_nframes_t last_bbt_when; jack_nframes_t last_bbt_when;
bool last_bbt_valid; bool last_bbt_valid;
BBT_Time last_bbt; BBT_Time last_bbt;
mutable PBD::Lock lock; mutable Glib::Mutex lock;
void timestamp_metrics (); void timestamp_metrics ();

View file

@ -29,7 +29,6 @@
#include <inttypes.h> #include <inttypes.h>
#include <jack/types.h> #include <jack/types.h>
#include <ardour/smpte.h>
#include <map> #include <map>
#if __GNUC__ < 3 #if __GNUC__ < 3
@ -100,6 +99,33 @@ namespace ARDOUR {
Destructive Destructive
}; };
enum smpte_wrap_t {
smpte_wrap_none = 0,
smpte_wrap_frames,
smpte_wrap_seconds,
smpte_wrap_minutes,
smpte_wrap_hours
};
struct SMPTE_Time {
bool negative;
uint32_t hours;
uint32_t minutes;
uint32_t seconds;
uint32_t frames;
uint32_t subframes; // mostly not used
SMPTE_Time() {
negative = false;
hours = 0;
minutes = 0;
seconds = 0;
frames = 0;
subframes = 0;
}
};
struct BBT_Time { struct BBT_Time {
uint32_t bars; uint32_t bars;
uint32_t beats; uint32_t beats;
@ -138,7 +164,7 @@ namespace ARDOUR {
Type type; Type type;
SMPTE::Time smpte; SMPTE_Time smpte;
BBT_Time bbt; BBT_Time bbt;
union { union {

View file

@ -35,7 +35,6 @@
#include <ardour/stateful.h> #include <ardour/stateful.h>
#include <ardour/plugin_state.h> #include <ardour/plugin_state.h>
#include <ardour/plugin.h> #include <ardour/plugin.h>
#include <ardour/vst_plugin.h>
using std::string; using std::string;
using std::vector; using std::vector;

View file

@ -203,7 +203,7 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, ch
its OK to block (for short intervals). its OK to block (for short intervals).
*/ */
LockMonitor rm (region_lock, __LINE__, __FILE__); Glib::Mutex::Lock rm (region_lock);
end = start + cnt - 1; end = start + cnt - 1;
@ -504,7 +504,7 @@ AudioPlaylist::add_crossfade (Crossfade& xfade)
void AudioPlaylist::notify_crossfade_added (Crossfade *x) 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); _pending_xfade_adds.insert (_pending_xfade_adds.end(), x);
} else { } else {
NewCrossfade (x); /* EMIT SIGNAL */ NewCrossfade (x); /* EMIT SIGNAL */
@ -886,8 +886,14 @@ AudioPlaylist::get_equivalent_regions (const AudioRegion& other, vector<AudioReg
AudioRegion* ar = dynamic_cast<AudioRegion*> (*i); AudioRegion* ar = dynamic_cast<AudioRegion*> (*i);
if (ar && ar->equivalent (other)) { if (ar) {
if (Config->get_use_overlap_equivalency()) {
if (ar->overlap_equivalent (other)) {
results.push_back (ar); results.push_back (ar);
} else if (ar->equivalent (other)) {
results.push_back (ar);
}
}
} }
} }
} }

View file

@ -625,7 +625,7 @@ AudioTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nfram
jack_nframes_t transport_frame; jack_nframes_t transport_frame;
{ {
TentativeRWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__); Glib::RWLock::ReaderLock lm (redirect_lock, Glib::TRY_LOCK);
if (lm.locked()) { if (lm.locked()) {
// automation snapshot can also be called from the non-rt context // automation snapshot can also be called from the non-rt context
// and it uses the redirect list, so we take the lock out here // 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) */ /* 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()) { 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()) { 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); 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; vector<Sample*>::iterator bi;
Sample * b; 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) { if (diskstream->playlist()->read (buffers[0], mix_buffer, gain_buffer, workbuf, start, nframes) != nframes) {
return -1; return -1;
@ -958,7 +958,7 @@ AudioTrack::freeze (InterThreadInfo& itt)
_freeze_record.have_mementos = true; _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) { for (RedirectList::iterator r = _redirects.begin(); r != _redirects.end(); ++r) {
@ -1015,7 +1015,7 @@ AudioTrack::unfreeze ()
} else { } 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 (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) { for (vector<FreezeRecordInsertInfo*>::iterator ii = _freeze_record.insert_info.begin(); ii != _freeze_record.insert_info.end(); ++ii) {
if ((*ii)->id == (*i)->id()) { if ((*ii)->id == (*i)->id()) {

View file

@ -22,6 +22,7 @@
#include <cerrno> #include <cerrno>
#include <vector> #include <vector>
#include <glibmm/timer.h>
#include <pbd/pthread_utils.h> #include <pbd/pthread_utils.h>
#include <ardour/audioengine.h> #include <ardour/audioengine.h>
@ -45,7 +46,6 @@ jack_nframes_t Port::long_over_length = 10;
AudioEngine::AudioEngine (string client_name) AudioEngine::AudioEngine (string client_name)
{ {
pthread_cond_init (&session_removed, 0);
session = 0; session = 0;
session_remove_pending = false; session_remove_pending = false;
_running = false; _running = false;
@ -60,9 +60,11 @@ AudioEngine::AudioEngine (string client_name)
_buffer_size = 0; _buffer_size = 0;
_freewheeling = false; _freewheeling = false;
_freewheel_thread_registered = false; _freewheel_thread_registered = false;
last_meter_point = 0;
meter_interval = 0; m_meter_thread = 0;
meter_thread_id = (pthread_t) 0; m_meter_exit = false;
start_metering_thread();
if (connect_to_jack (client_name)) { if (connect_to_jack (client_name)) {
throw NoBackendAvailable (); throw NoBackendAvailable ();
@ -76,8 +78,8 @@ AudioEngine::~AudioEngine ()
jack_client_close (_jack); jack_client_close (_jack);
} }
if (meter_thread_id != (pthread_t) 0) { if(m_meter_thread) {
pthread_cancel (meter_thread_id); g_atomic_int_inc(&m_meter_exit);
} }
} }
@ -212,7 +214,6 @@ AudioEngine::_graph_order_callback (void *arg)
return 0; return 0;
} }
/** @callgraph */
int int
AudioEngine::_process_callback (jack_nframes_t nframes, void *arg) AudioEngine::_process_callback (jack_nframes_t nframes, void *arg)
{ {
@ -225,11 +226,10 @@ AudioEngine::_freewheel_callback (int onoff, void *arg)
static_cast<AudioEngine*>(arg)->_freewheeling = onoff; static_cast<AudioEngine*>(arg)->_freewheeling = onoff;
} }
/** @callgraph */
int int
AudioEngine::process_callback (jack_nframes_t nframes) 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; jack_nframes_t next_processed_frames;
/* handle wrap around of total frames counter */ /* handle wrap around of total frames counter */
@ -248,7 +248,7 @@ AudioEngine::process_callback (jack_nframes_t nframes)
if (session_remove_pending) { if (session_remove_pending) {
session = 0; session = 0;
session_remove_pending = false; session_remove_pending = false;
pthread_cond_signal (&session_removed); session_removed.signal();
_processed_frames = next_processed_frames; _processed_frames = next_processed_frames;
return 0; return 0;
} }
@ -272,13 +272,6 @@ AudioEngine::process_callback (jack_nframes_t nframes)
return 0; 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) { if (last_monitor_check + monitor_check_interval < next_processed_frames) {
for (Ports::iterator i = ports.begin(); i != ports.end(); ++i) { for (Ports::iterator i = ports.begin(); i != ports.end(); ++i) {
@ -317,11 +310,6 @@ AudioEngine::jack_sample_rate_callback (jack_nframes_t nframes)
monitor_check_interval = nframes / 10; monitor_check_interval = nframes / 10;
last_monitor_check = 0; last_monitor_check = 0;
meter_interval = nframes / 100;
last_meter_point = 0;
maybe_start_metering_thread ();
if (session) { if (session) {
session->set_frame_rate (nframes); session->set_frame_rate (nframes);
} }
@ -352,48 +340,25 @@ AudioEngine::jack_bufsize_callback (jack_nframes_t nframes)
session->set_block_size (_buffer_size); session->set_block_size (_buffer_size);
} }
maybe_start_metering_thread ();
return 0; return 0;
} }
void void
AudioEngine::maybe_start_metering_thread () AudioEngine::start_metering_thread ()
{ {
if (meter_interval == 0) { if(m_meter_thread == 0) {
return; m_meter_thread = Glib::Thread::create (sigc::mem_fun(this, &AudioEngine::meter_thread), false);
}
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* void
AudioEngine::_meter_thread (void *arg)
{
return static_cast<AudioEngine*>(arg)->meter_thread ();
}
void*
AudioEngine::meter_thread () AudioEngine::meter_thread ()
{ {
PBD::ThreadCreated (pthread_self(), "Metering"); while (g_atomic_int_get(&m_meter_exit) != true) {
Glib::usleep (10000); /* 1/100th sec interval */
while (true) { IO::update_meters ();
usleep (10000); /* 1/100th sec interval */
pthread_testcancel();
IO::Meter ();
} }
return;
return 0;
} }
void void
@ -407,13 +372,13 @@ AudioEngine::set_session (Session *s)
void void
AudioEngine::remove_session () AudioEngine::remove_session ()
{ {
LockMonitor lm (_process_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (_process_lock);
if (_running) { if (_running) {
if (session) { if (session) {
session_remove_pending = true; session_remove_pending = true;
pthread_cond_wait (&session_removed, _process_lock.mutex()); session_removed.wait(_process_lock);
} }
} else { } else {
@ -450,7 +415,7 @@ AudioEngine::register_audio_input_port (const string& portname)
} else { } else {
pthread_mutex_unlock (_process_lock.mutex()); _process_lock.unlock();
throw PortRegistrationFailure(); throw PortRegistrationFailure();
} }
@ -478,7 +443,7 @@ AudioEngine::register_audio_output_port (const string& portname)
} else { } else {
pthread_mutex_unlock (_process_lock.mutex()); _process_lock.unlock();
throw PortRegistrationFailure (); throw PortRegistrationFailure ();
} }
@ -635,7 +600,7 @@ AudioEngine::frames_per_cycle ()
Port * Port *
AudioEngine::get_port_by_name (const string& portname, bool keep) 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 (!_running) {
if (!_has_run) { if (!_has_run) {
@ -968,7 +933,7 @@ AudioEngine::reconnect_to_jack ()
if (_jack) { if (_jack) {
disconnect_from_jack (); disconnect_from_jack ();
/* XXX give jackd a chance */ /* XXX give jackd a chance */
usleep (250000); Glib::usleep (250000);
} }
if (connect_to_jack (jack_client_name)) { if (connect_to_jack (jack_client_name)) {

View file

@ -27,8 +27,9 @@
#include <sigc++/bind.h> #include <sigc++/bind.h>
#include <sigc++/class_slot.h> #include <sigc++/class_slot.h>
#include <glibmm/thread.h>
#include <pbd/basename.h> #include <pbd/basename.h>
#include <pbd/lockmonitor.h>
#include <pbd/xml++.h> #include <pbd/xml++.h>
#include <ardour/audioregion.h> #include <ardour/audioregion.h>
@ -1139,15 +1140,15 @@ AudioRegion::master_source_names ()
} }
bool bool
AudioRegion::region_list_equivalent (const AudioRegion& other) AudioRegion::region_list_equivalent (const AudioRegion& other) const
{ {
return size_equivalent (other) && source_equivalent (other) && _name == other._name; return size_equivalent (other) && source_equivalent (other) && _name == other._name;
} }
bool bool
AudioRegion::source_equivalent (const AudioRegion& other) AudioRegion::source_equivalent (const AudioRegion& other) const
{ {
SourceList::iterator i; SourceList::const_iterator i;
SourceList::const_iterator io; SourceList::const_iterator io;
for (i = sources.begin(), io = other.sources.begin(); i != sources.end() && io != other.sources.end(); ++i, ++io) { for (i = sources.begin(), io = other.sources.begin(); i != sources.end() && io != other.sources.end(); ++i, ++io) {
@ -1166,7 +1167,13 @@ AudioRegion::source_equivalent (const AudioRegion& other)
} }
bool bool
AudioRegion::equivalent (const AudioRegion& other) AudioRegion::overlap_equivalent (const AudioRegion& other) const
{
return coverage (other.first_frame(), other.last_frame()) != OverlapNone;
}
bool
AudioRegion::equivalent (const AudioRegion& other) const
{ {
return _start == other._start && return _start == other._start &&
_position == other._position && _position == other._position &&
@ -1174,7 +1181,7 @@ AudioRegion::equivalent (const AudioRegion& other)
} }
bool bool
AudioRegion::size_equivalent (const AudioRegion& other) AudioRegion::size_equivalent (const AudioRegion& other) const
{ {
return _start == other._start && return _start == other._start &&
_length == other._length; _length == other._length;

View file

@ -18,7 +18,7 @@
$Id$ $Id$
*/ */
#include <pbd/lockmonitor.h> #include <glibmm/thread.h>
#include <ardour/diskstream.h> #include <ardour/diskstream.h>
#include <ardour/audioregion.h> #include <ardour/audioregion.h>
@ -57,7 +57,7 @@ Auditioner::Auditioner (Session& s)
IO::output_changed.connect (mem_fun (*this, &Auditioner::output_changed)); IO::output_changed.connect (mem_fun (*this, &Auditioner::output_changed));
the_region = 0; the_region = 0;
atomic_set (&_active, 0); g_atomic_int_set (&_active, 0);
} }
Auditioner::~Auditioner () Auditioner::~Auditioner ()
@ -74,14 +74,14 @@ Auditioner::prepare_playlist ()
void void
Auditioner::audition_current_playlist () 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 /* don't go via session for this, because we are going
to remain active. to remain active.
*/ */
cancel_audition (); cancel_audition ();
} }
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
diskstream->seek (0); diskstream->seek (0);
length = diskstream->playlist()->get_maximum_extent(); length = diskstream->playlist()->get_maximum_extent();
current_frame = 0; current_frame = 0;
@ -90,20 +90,20 @@ Auditioner::audition_current_playlist ()
_panner->reset (n_outputs(), diskstream->n_channels()); _panner->reset (n_outputs(), diskstream->n_channels());
atomic_set (&_active, 1); g_atomic_int_set (&_active, 1);
} }
void void
Auditioner::audition_region (AudioRegion& region) 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 /* don't go via session for this, because we are going
to remain active. to remain active.
*/ */
cancel_audition (); cancel_audition ();
} }
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
the_region = new AudioRegion (region); the_region = new AudioRegion (region);
the_region->set_position (0, this); the_region->set_position (0, this);
@ -126,7 +126,7 @@ Auditioner::audition_region (AudioRegion& region)
length = the_region->length(); length = the_region->length();
diskstream->seek (0); diskstream->seek (0);
current_frame = 0; current_frame = 0;
atomic_set (&_active, 1); g_atomic_int_set (&_active, 1);
} }
int int
@ -136,7 +136,7 @@ Auditioner::play_audition (jack_nframes_t nframes)
jack_nframes_t this_nframes; jack_nframes_t this_nframes;
int ret; int ret;
if (atomic_read (&_active) == 0) { if (g_atomic_int_get (&_active) == 0) {
silence (nframes, 0); silence (nframes, 0);
return 0; return 0;
} }

View file

@ -225,7 +225,7 @@ void
AutomationList::clear () AutomationList::clear ()
{ {
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
events.clear (); events.clear ();
if (!no_state) { if (!no_state) {
save_state (_("cleared")); save_state (_("cleared"));
@ -239,14 +239,14 @@ AutomationList::clear ()
void void
AutomationList::x_scale (double factor) AutomationList::x_scale (double factor)
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
_x_scale (factor); _x_scale (factor);
} }
bool bool
AutomationList::extend_to (double when) AutomationList::extend_to (double when)
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
if (events.empty() || events.back()->when == when) { if (events.empty() || events.back()->when == when) {
return false; return false;
} }
@ -285,7 +285,7 @@ AutomationList::rt_add (double when, double value)
// cerr << "RT: alist @ " << this << " add " << value << " @ " << when << endl; // cerr << "RT: alist @ " << this << " add " << value << " @ " << when << endl;
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
iterator where; iterator where;
TimeComparator cmp; 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 */ /* this is for graphical editing and loading data from storage */
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
TimeComparator cmp; TimeComparator cmp;
ControlEvent cp (when, 0.0f); ControlEvent cp (when, 0.0f);
bool insert = true; bool insert = true;
@ -413,7 +413,7 @@ void
AutomationList::erase (AutomationList::iterator i) AutomationList::erase (AutomationList::iterator i)
{ {
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
events.erase (i); events.erase (i);
reposition_for_rt_add (0); reposition_for_rt_add (0);
if (!no_state) { if (!no_state) {
@ -428,7 +428,7 @@ void
AutomationList::erase (AutomationList::iterator start, AutomationList::iterator end) AutomationList::erase (AutomationList::iterator start, AutomationList::iterator end)
{ {
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
events.erase (start, end); events.erase (start, end);
reposition_for_rt_add (0); reposition_for_rt_add (0);
if (!no_state) { if (!no_state) {
@ -445,7 +445,7 @@ AutomationList::reset_range (double start, double endt)
bool reset = false; bool reset = false;
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
TimeComparator cmp; TimeComparator cmp;
ControlEvent cp (start, 0.0f); ControlEvent cp (start, 0.0f);
iterator s; iterator s;
@ -481,7 +481,7 @@ AutomationList::erase_range (double start, double endt)
bool erased = false; bool erased = false;
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
TimeComparator cmp; TimeComparator cmp;
ControlEvent cp (start, 0.0f); ControlEvent cp (start, 0.0f);
iterator s; 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) { while (start != end) {
(*start)->when += xdelta; (*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)->when = when;
(*iter)->value = val; (*iter)->value = val;
if (!no_state) { if (!no_state) {
@ -558,7 +558,7 @@ AutomationList::modify (iterator iter, double when, double val)
std::pair<AutomationList::iterator,AutomationList::iterator> std::pair<AutomationList::iterator,AutomationList::iterator>
AutomationList::control_points_adjacent (double xval) AutomationList::control_points_adjacent (double xval)
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
iterator i; iterator i;
TimeComparator cmp; TimeComparator cmp;
ControlEvent cp (xval, 0.0f); ControlEvent cp (xval, 0.0f);
@ -620,7 +620,7 @@ Change
AutomationList::restore_state (StateManager::State& state) AutomationList::restore_state (StateManager::State& state)
{ {
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
State* lstate = dynamic_cast<State*> (&state); State* lstate = dynamic_cast<State*> (&state);
events.clear (); events.clear ();
@ -655,7 +655,7 @@ void
AutomationList::truncate_end (double last_coordinate) AutomationList::truncate_end (double last_coordinate)
{ {
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
ControlEvent cp (last_coordinate, 0); ControlEvent cp (last_coordinate, 0);
list<ControlEvent*>::reverse_iterator i; list<ControlEvent*>::reverse_iterator i;
double last_val; double last_val;
@ -760,7 +760,7 @@ void
AutomationList::truncate_start (double overall_length) AutomationList::truncate_start (double overall_length)
{ {
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
AutomationList::iterator i; AutomationList::iterator i;
double first_legal_value; double first_legal_value;
double first_legal_coordinate; double first_legal_coordinate;
@ -998,7 +998,7 @@ AutomationList::cut (iterator start, iterator end)
AutomationList* nal = new AutomationList (default_value); AutomationList* nal = new AutomationList (default_value);
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
for (iterator x = start; x != end; ) { for (iterator x = start; x != end; ) {
iterator tmp; iterator tmp;
@ -1032,7 +1032,7 @@ AutomationList::cut_copy_clear (double start, double end, int op)
bool changed = false; 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()) { if ((s = lower_bound (events.begin(), events.end(), &cp, cmp)) == events.end()) {
return nal; return nal;
@ -1094,7 +1094,7 @@ AutomationList::copy (iterator start, iterator end)
AutomationList* nal = new AutomationList (default_value); AutomationList* nal = new AutomationList (default_value);
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
for (iterator x = start; x != end; ) { for (iterator x = start; x != end; ) {
iterator tmp; 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 where;
iterator prev; iterator prev;
double end = 0; double end = 0;

View file

@ -28,7 +28,6 @@
#include "i18n.h" #include "i18n.h"
using namespace ARDOUR; using namespace ARDOUR;
using namespace PBD;
Connection::Connection (const XMLNode& node) Connection::Connection (const XMLNode& node)
{ {
@ -58,7 +57,7 @@ void
Connection::add_connection (int port, string portname) Connection::add_connection (int port, string portname)
{ {
{ {
LockMonitor lm (port_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (port_lock);
_ports[port].push_back (portname); _ports[port].push_back (portname);
} }
ConnectionsChanged (port); /* EMIT SIGNAL */ ConnectionsChanged (port); /* EMIT SIGNAL */
@ -70,7 +69,7 @@ Connection::remove_connection (int port, string portname)
bool changed = false; bool changed = false;
{ {
LockMonitor lm (port_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (port_lock);
PortList& pl = _ports[port]; PortList& pl = _ports[port];
PortList::iterator i = find (pl.begin(), pl.end(), portname); PortList::iterator i = find (pl.begin(), pl.end(), portname);
@ -88,7 +87,7 @@ Connection::remove_connection (int port, string portname)
const Connection::PortList& const Connection::PortList&
Connection::port_connections (int port) const Connection::port_connections (int port) const
{ {
LockMonitor lm (port_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (port_lock);
return _ports[port]; return _ports[port];
} }
@ -102,7 +101,7 @@ void
Connection::add_port () Connection::add_port ()
{ {
{ {
LockMonitor lm (port_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (port_lock);
_ports.push_back (PortList()); _ports.push_back (PortList());
} }
ConfigurationChanged(); /* EMIT SIGNAL */ ConfigurationChanged(); /* EMIT SIGNAL */
@ -114,7 +113,7 @@ Connection::remove_port (int which_port)
bool changed = false; bool changed = false;
{ {
LockMonitor lm (port_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (port_lock);
vector<PortList>::iterator i; vector<PortList>::iterator i;
int n; int n;
@ -135,7 +134,7 @@ void
Connection::clear () Connection::clear ()
{ {
{ {
LockMonitor lm (port_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (port_lock);
_ports.clear (); _ports.clear ();
} }

View file

@ -13,7 +13,6 @@
using namespace ARDOUR; using namespace ARDOUR;
using namespace PBD;
using namespace std; using namespace std;
#include "i18n.h" #include "i18n.h"
@ -32,7 +31,7 @@ ControlProtocolManager::ControlProtocolManager ()
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) { for (list<ControlProtocol*>::iterator i = control_protocols.begin(); i != control_protocols.end(); ++i) {
delete (*i); delete (*i);
@ -62,7 +61,7 @@ ControlProtocolManager::drop_session ()
_session = 0; _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) { for (list<ControlProtocol*>::iterator p = control_protocols.begin(); p != control_protocols.end(); ++p) {
delete *p; delete *p;
} }
@ -89,7 +88,7 @@ ControlProtocolManager::instantiate (ControlProtocolInfo& cpi)
return 0; return 0;
} }
LockMonitor lm (protocols_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (protocols_lock);
control_protocols.push_back (cpi.protocol); control_protocols.push_back (cpi.protocol);
return cpi.protocol; return cpi.protocol;
@ -113,7 +112,7 @@ ControlProtocolManager::teardown (ControlProtocolInfo& cpi)
cpi.descriptor->destroy (cpi.descriptor, cpi.protocol); 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); list<ControlProtocol*>::iterator p = find (control_protocols.begin(), control_protocols.end(), cpi.protocol);
if (p != control_protocols.end()) { if (p != control_protocols.end()) {
control_protocols.erase (p); control_protocols.erase (p);
@ -281,7 +280,7 @@ XMLNode&
ControlProtocolManager::get_state (void) ControlProtocolManager::get_state (void)
{ {
XMLNode* root = new XMLNode (state_node_name); 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) { for (list<ControlProtocolInfo*>::iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) {
XMLNode* child = new XMLNode (X_("Protocol")); XMLNode* child = new XMLNode (X_("Protocol"));

View file

@ -66,29 +66,34 @@ CoreAudioSource::init (const string& idstr, bool build_peak)
} }
/* note that we temporarily truncated _id at the colon */ /* note that we temporarily truncated _id at the colon */
FSRef ref; FSRef fsr;
err = FSPathMakeRef ((UInt8*)file.c_str(), &ref, 0); err = FSPathMakeRef ((UInt8*)file.c_str(), &fsr, 0);
if (err != noErr) { if (err != noErr) {
cerr << "FSPathMakeRef " << err << endl;
throw failed_constructor(); throw failed_constructor();
} }
err = ExtAudioFileOpen (&ref, &af); err = ExtAudioFileOpen (&fsr, &af);
if (err != noErr) { if (err != noErr) {
cerr << "ExtAudioFileOpen " << err << endl;
ExtAudioFileDispose (af); ExtAudioFileDispose (af);
throw failed_constructor(); throw failed_constructor();
} }
AudioStreamBasicDescription file_asbd; AudioStreamBasicDescription file_asbd;
memset(&file_asbd, 0, sizeof(file_asbd)); memset(&file_asbd, 0, sizeof(AudioStreamBasicDescription));
size_t asbd_size = sizeof(file_asbd); size_t asbd_size = sizeof(AudioStreamBasicDescription);
err = ExtAudioFileGetProperty(af, err = ExtAudioFileGetProperty(af,
kExtAudioFileProperty_FileDataFormat, &asbd_size, &file_asbd); kExtAudioFileProperty_FileDataFormat, &asbd_size, &file_asbd);
if (err != noErr) { if (err != noErr) {
cerr << "ExtAudioFileGetProperty1 " << err << endl;
ExtAudioFileDispose (af); ExtAudioFileDispose (af);
throw failed_constructor(); throw failed_constructor();
} }
n_channels = file_asbd.mChannelsPerFrame; n_channels = file_asbd.mChannelsPerFrame;
cerr << "number of channels: " << n_channels << endl;
if (channel >= n_channels) { if (channel >= n_channels) {
error << string_compose(_("CoreAudioSource: file only contains %1 channels; %2 is invalid as a channel number"), n_channels, channel) << endmsg; error << string_compose(_("CoreAudioSource: file only contains %1 channels; %2 is invalid as a channel number"), n_channels, channel) << endmsg;
ExtAudioFileDispose (af); ExtAudioFileDispose (af);
@ -96,17 +101,36 @@ CoreAudioSource::init (const string& idstr, bool build_peak)
} }
int64_t ca_frames; int64_t ca_frames;
size_t prop_size = sizeof(ca_frames); size_t prop_size = sizeof(int64_t);
err = ExtAudioFileGetProperty(af, kExtAudioFileProperty_FileLengthFrames, &prop_size, &ca_frames); err = ExtAudioFileGetProperty(af, kExtAudioFileProperty_FileLengthFrames, &prop_size, &ca_frames);
if (err != noErr) { if (err != noErr) {
cerr << "ExtAudioFileGetProperty2 " << err << endl;
ExtAudioFileDispose (af); ExtAudioFileDispose (af);
throw failed_constructor(); throw failed_constructor();
} }
_length = ca_frames;
_length = ca_frames;
_path = file; _path = file;
AudioStreamBasicDescription client_asbd;
memset(&client_asbd, 0, sizeof(AudioStreamBasicDescription));
client_asbd.mSampleRate = file_asbd.mSampleRate;
client_asbd.mFormatID = kAudioFormatLinearPCM;
client_asbd.mFormatFlags = kLinearPCMFormatFlagIsFloat;
client_asbd.mBytesPerPacket = file_asbd.mChannelsPerFrame * 4;
client_asbd.mFramesPerPacket = 1;
client_asbd.mBytesPerFrame = client_asbd.mBytesPerPacket;
client_asbd.mChannelsPerFrame = file_asbd.mChannelsPerFrame;
client_asbd.mBitsPerChannel = 32;
err = ExtAudioFileSetProperty (af, kExtAudioFileProperty_ClientDataFormat, asbd_size, &client_asbd);
if (err != noErr) {
cerr << "ExtAudioFileSetProperty3 " << err << endl;
ExtAudioFileDispose (af);
throw failed_constructor ();
}
if (build_peak) { if (build_peak) {
if (initialize_peakfile (false, file)) { if (initialize_peakfile (false, file)) {
error << "initialize peakfile failed" << endmsg; error << "initialize peakfile failed" << endmsg;
@ -114,24 +138,6 @@ CoreAudioSource::init (const string& idstr, bool build_peak)
throw failed_constructor (); throw failed_constructor ();
} }
} }
AudioStreamBasicDescription client_asbd;
memset(&client_asbd, 0, sizeof(client_asbd));
client_asbd.mFormatID = kAudioFormatLinearPCM;
client_asbd.mFormatFlags = kLinearPCMFormatFlagIsFloat;
client_asbd.mSampleRate = file_asbd.mSampleRate;
err = AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, 0, NULL, &asbd_size, &client_asbd);
if (err != noErr) {
ExtAudioFileDispose (af);
throw failed_constructor ();
}
err = ExtAudioFileSetProperty (af, kExtAudioFileProperty_ClientDataFormat, asbd_size, &client_asbd);
if (err != noErr) {
ExtAudioFileDispose (af);
throw failed_constructor ();
}
} }
CoreAudioSource::~CoreAudioSource () CoreAudioSource::~CoreAudioSource ()
@ -173,7 +179,7 @@ CoreAudioSource::read (Sample *dst, jack_nframes_t start, jack_nframes_t cnt, ch
uint32_t real_cnt = cnt * n_channels; uint32_t real_cnt = cnt * n_channels;
{ {
LockMonitor lm (_tmpbuf_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (_tmpbuf_lock);
if (tmpbufsize < real_cnt) { if (tmpbufsize < real_cnt) {

View file

@ -28,7 +28,7 @@
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <pbd/lockmonitor.h> #include <glibmm/thread.h>
#include <sigc++/bind.h> #include <sigc++/bind.h>
#include "ardour/curve.h" #include "ardour/curve.h"
@ -37,7 +37,6 @@
using namespace std; using namespace std;
using namespace ARDOUR; using namespace ARDOUR;
using namespace PBD;
using namespace sigc; using namespace sigc;
Curve::Curve (double minv, double maxv, double canv, bool nostate) Curve::Curve (double minv, double maxv, double canv, bool nostate)
@ -204,7 +203,7 @@ Curve::solve ()
bool bool
Curve::rt_safe_get_vector (double x0, double x1, float *vec, int32_t veclen) 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()) { if (!lm.locked()) {
return false; return false;
@ -217,7 +216,7 @@ Curve::rt_safe_get_vector (double x0, double x1, float *vec, int32_t veclen)
void void
Curve::get_vector (double x0, double x1, float *vec, int32_t veclen) 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); _get_vector (x0, x1, vec, veclen);
} }

View file

@ -268,7 +268,7 @@ jack_nframes_t
DestructiveFileSource::write (Sample* data, jack_nframes_t cnt, char * workbuf) 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; jack_nframes_t old_file_pos;

View file

@ -33,7 +33,7 @@
#include <pbd/error.h> #include <pbd/error.h>
#include <pbd/basename.h> #include <pbd/basename.h>
#include <pbd/lockmonitor.h> #include <glibmm/thread.h>
#include <pbd/xml++.h> #include <pbd/xml++.h>
#include <ardour/ardour.h> #include <ardour/ardour.h>
@ -139,7 +139,7 @@ DiskStream::init (Flag f)
first_input_change = true; first_input_change = true;
_playlist = 0; _playlist = 0;
i_am_the_modifier = 0; i_am_the_modifier = 0;
atomic_set (&_record_enabled, 0); g_atomic_int_set (&_record_enabled, 0);
was_recording = false; was_recording = false;
capture_start_frame = 0; capture_start_frame = 0;
capture_captured = 0; capture_captured = 0;
@ -213,7 +213,7 @@ DiskStream::destroy_channel (ChannelInfo &chan)
DiskStream::~DiskStream () DiskStream::~DiskStream ()
{ {
LockMonitor lm (state_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (state_lock);
if (_playlist) { if (_playlist) {
_playlist->unref (); _playlist->unref ();
@ -229,7 +229,7 @@ DiskStream::~DiskStream ()
void void
DiskStream::handle_input_change (IOChange change, void *src) 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)) { if (!(input_change_pending & change)) {
input_change_pending = IOChange (input_change_pending|change); input_change_pending = IOChange (input_change_pending|change);
@ -241,7 +241,7 @@ void
DiskStream::non_realtime_input_change () DiskStream::non_realtime_input_change ()
{ {
{ {
LockMonitor lm (state_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (state_lock);
if (input_change_pending == NoChange) { if (input_change_pending == NoChange) {
return; return;
@ -349,7 +349,7 @@ int
DiskStream::use_playlist (AudioPlaylist* playlist) DiskStream::use_playlist (AudioPlaylist* playlist)
{ {
{ {
LockMonitor lm (state_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (state_lock);
if (playlist == _playlist) { if (playlist == _playlist) {
return 0; return 0;
@ -565,7 +565,7 @@ DiskStream::non_realtime_set_speed ()
{ {
if (_buffer_reallocation_required) if (_buffer_reallocation_required)
{ {
LockMonitor lm (state_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (state_lock);
allocate_temporary_buffers (); allocate_temporary_buffers ();
_buffer_reallocation_required = false; _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. 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; return 1;
} }
@ -1002,7 +1003,7 @@ DiskStream::process (jack_nframes_t transport_frame, jack_nframes_t nframes, jac
be called. unlock the state lock. be called. unlock the state lock.
*/ */
pthread_mutex_unlock (state_lock.mutex()); state_lock.unlock();
} }
return ret; return ret;
@ -1011,7 +1012,7 @@ DiskStream::process (jack_nframes_t transport_frame, jack_nframes_t nframes, jac
void void
DiskStream::recover () DiskStream::recover ()
{ {
pthread_mutex_unlock (state_lock.mutex()); state_lock.unlock();
_processed = false; _processed = false;
} }
@ -1047,7 +1048,7 @@ DiskStream::commit (jack_nframes_t nframes)
|| channels[0].capture_buf->read_space() >= disk_io_chunk_frames; || channels[0].capture_buf->read_space() >= disk_io_chunk_frames;
} }
pthread_mutex_unlock (state_lock.mutex()); state_lock.unlock();
_processed = false; _processed = false;
@ -1140,7 +1141,7 @@ DiskStream::overwrite_existing_buffers ()
int int
DiskStream::seek (jack_nframes_t frame, bool complete_refill) DiskStream::seek (jack_nframes_t frame, bool complete_refill)
{ {
LockMonitor lm (state_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (state_lock);
uint32_t n; uint32_t n;
int ret; int ret;
ChannelList::iterator chan; 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 ? */ /* 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()) { if (capture_info.empty()) {
return; return;
@ -1925,7 +1926,7 @@ DiskStream::set_record_enabled (bool yn, void* src)
if (record_enabled() != yn) { if (record_enabled() != yn) {
if (yn) { if (yn) {
atomic_set (&_record_enabled, 1); g_atomic_int_set (&_record_enabled, 1);
capturing_sources.clear (); capturing_sources.clear ();
if (Config->get_use_hardware_monitoring()) { if (Config->get_use_hardware_monitoring()) {
for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) { for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) {
@ -1941,7 +1942,7 @@ DiskStream::set_record_enabled (bool yn, void* src)
} }
} else { } else {
atomic_set (&_record_enabled, 0); g_atomic_int_set (&_record_enabled, 0);
if (Config->get_use_hardware_monitoring()) { if (Config->get_use_hardware_monitoring()) {
for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) { for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) {
if ((*chan).source) { if ((*chan).source) {
@ -2415,7 +2416,7 @@ DiskStream::set_loop (Location *location)
jack_nframes_t jack_nframes_t
DiskStream::get_capture_start_frame (uint32_t n) 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) { if (capture_info.size() > n) {
return capture_info[n]->start; return capture_info[n]->start;
@ -2428,7 +2429,7 @@ DiskStream::get_capture_start_frame (uint32_t n)
jack_nframes_t jack_nframes_t
DiskStream::get_captured_frames (uint32_t n) 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) { if (capture_info.size() > n) {
return capture_info[n]->frames; return capture_info[n]->frames;

View file

@ -53,10 +53,11 @@
#include <vector> #include <vector>
#include <cstdio> /* for rename(2) */ #include <cstdio> /* for rename(2) */
#include <glibmm.h>
#include <pbd/stl_delete.h> #include <pbd/stl_delete.h>
#include <pbd/basename.h>
#include <pbd/dirname.h> #include <glibmm/thread.h>
#include <pbd/lockmonitor.h>
#include <pbd/pathscanner.h> #include <pbd/pathscanner.h>
#include <ardour/ardour.h> #include <ardour/ardour.h>
@ -351,7 +352,7 @@ FileSource::set_allow_remove_if_empty (bool yn)
int int
FileSource::set_name (string newname, bool destructive) FileSource::set_name (string newname, bool destructive)
{ {
LockMonitor lm (_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (_lock);
string oldpath = _path; string oldpath = _path;
string newpath = Session::change_audio_path_by_name (oldpath, _name, newname, destructive); 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; return -1;
} }
_name = basename (newpath); _name = Glib::path_get_basename (newpath);
_path = newpath; _path = newpath;
return rename_peakfile (peak_path (_path)); return rename_peakfile (peak_path (_path));
@ -680,7 +681,7 @@ FileSource::compute_header_size ()
int int
FileSource::update_header (jack_nframes_t when, struct tm& now, time_t tnow) 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) { if (is_bwf) {
/* random code is 9 digits */ /* random code is 9 digits */
@ -1009,7 +1010,7 @@ FileSource::mark_for_remove ()
jack_nframes_t jack_nframes_t
FileSource::read (Sample *dst, jack_nframes_t start, jack_nframes_t cnt, char * workbuf) const 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); return read_unlocked (dst, start, cnt, workbuf);
} }
@ -1055,7 +1056,7 @@ jack_nframes_t
FileSource::write (Sample *data, jack_nframes_t cnt, char * workbuf) FileSource::write (Sample *data, jack_nframes_t cnt, char * workbuf)
{ {
{ {
LockMonitor lm (_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (_lock);
jack_nframes_t oldlen; jack_nframes_t oldlen;
int32_t frame_pos = _length; int32_t frame_pos = _length;
@ -1287,7 +1288,7 @@ FileSource::is_empty (string path)
void void
FileSource::mark_streaming_write_completed () FileSource::mark_streaming_write_completed ()
{ {
LockMonitor lm (_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (_lock);
next_peak_clear_should_notify = true; 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. on whichever filesystem it was already on.
*/ */
newpath = PBD::dirname (_path); // XXX Portability
newpath = PBD::dirname (newpath);
newpath = Glib::path_get_dirname (_path);
newpath = Glib::path_get_dirname (newpath);
newpath += '/'; newpath += '/';
newpath += trash_dir_name; newpath += trash_dir_name;
newpath += '/'; newpath += '/';
newpath += PBD::basename (_path); newpath += Glib::path_get_basename (_path);
if (access (newpath.c_str(), F_OK) == 0) { if (access (newpath.c_str(), F_OK) == 0) {

View file

@ -175,7 +175,7 @@ inline static void gdither_innner_loop(const GDitherType dt,
const int clamp_l) const int clamp_l)
{ {
uint32_t pos, i; uint32_t pos, i;
u_int8_t *o8 = (u_int8_t*) y; uint8_t *o8 = (uint8_t*) y;
int16_t *o16 = (int16_t*) y; int16_t *o16 = (int16_t*) y;
int32_t *o32 = (int32_t*) y; int32_t *o32 = (int32_t*) y;
float tmp, r, ideal; float tmp, r, ideal;

View file

@ -40,7 +40,6 @@
#include <midi++/mmc.h> #include <midi++/mmc.h>
#include <ardour/ardour.h> #include <ardour/ardour.h>
#include <ardour/audioengine.h>
#include <ardour/audio_library.h> #include <ardour/audio_library.h>
#include <ardour/configuration.h> #include <ardour/configuration.h>
#include <ardour/plugin_manager.h> #include <ardour/plugin_manager.h>
@ -48,7 +47,10 @@
#include <ardour/utils.h> #include <ardour/utils.h>
#include <ardour/session.h> #include <ardour/session.h>
#include <ardour/control_protocol_manager.h> #include <ardour/control_protocol_manager.h>
#ifdef HAVE_LIBLO
#include <ardour/osc.h> #include <ardour/osc.h>
#endif
#include <ardour/mix.h> #include <ardour/mix.h>
@ -60,7 +62,10 @@
ARDOUR::Configuration* ARDOUR::Config = 0; ARDOUR::Configuration* ARDOUR::Config = 0;
ARDOUR::AudioLibrary* ARDOUR::Library = 0; ARDOUR::AudioLibrary* ARDOUR::Library = 0;
#ifdef HAVE_LIBLO
ARDOUR::OSC* ARDOUR::osc = 0; ARDOUR::OSC* ARDOUR::osc = 0;
#endif
using namespace ARDOUR; using namespace ARDOUR;
using namespace std; using namespace std;
@ -75,6 +80,7 @@ Change ARDOUR::PositionChanged = ARDOUR::new_change ();
Change ARDOUR::NameChanged = ARDOUR::new_change (); Change ARDOUR::NameChanged = ARDOUR::new_change ();
Change ARDOUR::BoundsChanged = Change (0); // see init(), below Change ARDOUR::BoundsChanged = Change (0); // see init(), below
#ifdef HAVE_LIBLO
static int static int
setup_osc () setup_osc ()
{ {
@ -90,9 +96,10 @@ setup_osc ()
return 0; return 0;
} }
} }
#endif
static int static int
setup_midi (AudioEngine& engine) setup_midi ()
{ {
std::map<string,Configuration::MidiPortDescriptor*>::iterator i; std::map<string,Configuration::MidiPortDescriptor*>::iterator i;
int nports; int nports;
@ -102,8 +109,6 @@ setup_midi (AudioEngine& engine)
return 0; return 0;
} }
MIDI::Manager::instance()->set_api_data(engine.jack());
for (i = Config->midi_ports.begin(); i != Config->midi_ports.end(); ++i) { for (i = Config->midi_ports.begin(); i != Config->midi_ports.end(); ++i) {
Configuration::MidiPortDescriptor* port_descriptor; Configuration::MidiPortDescriptor* port_descriptor;
@ -115,9 +120,7 @@ setup_midi (AudioEngine& engine)
port_descriptor->type); port_descriptor->type);
if (request.status != MIDI::PortRequest::OK) { if (request.status != MIDI::PortRequest::OK) {
error << string_compose( error << string_compose(_("MIDI port specifications for \"%1\" are not understandable."), port_descriptor->tag) << endmsg;
_("MIDI port specifications for \"%1\" (%2, %3) are not understandable."),
port_descriptor->tag, port_descriptor->mode, port_descriptor->type) << endmsg;
continue; continue;
} }
@ -168,6 +171,7 @@ setup_midi (AudioEngine& engine)
if (default_mmc_port == 0) { if (default_mmc_port == 0) {
warning << string_compose (_("No MMC control (MIDI port \"%1\" not available)"), Config->get_mmc_port_name()) warning << string_compose (_("No MMC control (MIDI port \"%1\" not available)"), Config->get_mmc_port_name())
<< endmsg; << endmsg;
return 0;
} }
if (default_mtc_port == 0) { if (default_mtc_port == 0) {
@ -198,13 +202,15 @@ ARDOUR::init (AudioEngine& engine, bool use_vst, bool try_optimization, void (*s
Config->set_use_vst (use_vst); Config->set_use_vst (use_vst);
if (setup_midi (engine)) { if (setup_midi ()) {
return -1; return -1;
} }
#ifdef HAVE_LIBLO
if (setup_osc ()) { if (setup_osc ()) {
return -1; return -1;
} }
#endif
#ifdef VST_SUPPORT #ifdef VST_SUPPORT
if (Config->get_use_vst() && fst_init (sighandler)) { if (Config->get_use_vst() && fst_init (sighandler)) {
@ -327,10 +333,17 @@ ARDOUR::new_change ()
Change c; Change c;
static uint32_t change_bit = 1; static uint32_t change_bit = 1;
/* XXX catch out-of-range */ /* catch out-of-range */
if (!change_bit)
{
fatal << _("programming error: ")
<< "change_bit out of range in ARDOUR::new_change()"
<< endmsg;
/*NOTREACHED*/
}
c = Change (change_bit); c = Change (change_bit);
change_bit <<= 1; change_bit <<= 1; // if it shifts too far, change_bit == 0
return c; return c;
} }

View file

@ -30,7 +30,10 @@
#include <sndfile.h> #include <sndfile.h>
#include <samplerate.h> #include <samplerate.h>
#include <glibmm.h>
#include <pbd/basename.h> #include <pbd/basename.h>
#include <ardour/ardour.h> #include <ardour/ardour.h>
#include <ardour/session.h> #include <ardour/session.h>
#include <ardour/diskstream.h> #include <ardour/diskstream.h>
@ -212,7 +215,7 @@ Session::import_audiofile (import_status& status)
sources.push_back(newfiles[n]); 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)); 0, AudioRegion::Flag (AudioRegion::DefaultFlags | AudioRegion::WholeFile));
status.new_regions.push_back (r); 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. 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)); 0, AudioRegion::Flag (AudioRegion::DefaultFlags | AudioRegion::WholeFile | AudioRegion::Import));
status.new_regions.push_back (r); status.new_regions.push_back (r);
@ -285,7 +288,7 @@ Session::import_audiofile (import_status& status)
string string
Session::build_tmp_convert_name(string infile) 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]; char* tmp = new char[tmp_name.length() + 1];
tmp_name.copy(tmp, string::npos); tmp_name.copy(tmp, string::npos);
tmp[tmp_name.length()] = 0; tmp[tmp_name.length()] = 0;

View file

@ -76,7 +76,7 @@ PluginInsert::PluginInsert (Session& s, Plugin& plug, Placement placement)
save_state (_("initial state")); save_state (_("initial state"));
{ {
LockMonitor em (_session.engine().process_lock(), __LINE__, __FILE__); Glib::Mutex::Lock em (_session.engine().process_lock());
IO::MoreOutputs (output_streams ()); 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)); _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()); 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 now = _session.transport_frame ();
jack_nframes_t end = now + nframes; jack_nframes_t end = now + nframes;
TentativeLockMonitor lm (_automation_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (_automation_lock, Glib::TRY_LOCK);
if (!lm.locked()) { if (!lm.locked()) {
connect_and_run (bufs, nbufs, nframes, offset, false); connect_and_run (bufs, nbufs, nframes, offset, false);

View file

@ -25,7 +25,8 @@
#include <sigc++/bind.h> #include <sigc++/bind.h>
#include <pbd/lockmonitor.h> #include <glibmm/thread.h>
#include <pbd/xml++.h> #include <pbd/xml++.h>
#include <ardour/audioengine.h> #include <ardour/audioengine.h>
@ -70,6 +71,8 @@ sigc::signal<int> IO::PannersLegal;
sigc::signal<void,uint32_t> IO::MoreOutputs; sigc::signal<void,uint32_t> IO::MoreOutputs;
sigc::signal<int> IO::PortsCreated; 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. /* this is a default mapper of MIDI control values to a gain coefficient.
others can be imagined. see IO::set_midi_to_gain_function(). others can be imagined. see IO::set_midi_to_gain_function().
*/ */
@ -127,12 +130,19 @@ IO::IO (Session& s, string name,
_gain_automation_state = Off; _gain_automation_state = Off;
_gain_automation_style = Absolute; _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 () 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; vector<Port *>::iterator i;
for (i = _inputs.begin(); i != _inputs.end(); ++i) { for (i = _inputs.begin(); i != _inputs.end(); ++i) {
@ -142,6 +152,8 @@ IO::~IO ()
for (i = _outputs.begin(); i != _outputs.end(); ++i) { for (i = _outputs.begin(); i != _outputs.end(); ++i) {
_session.engine().unregister_port (*i); _session.engine().unregister_port (*i);
} }
m_meter_connection.disconnect();
} }
void void
@ -380,7 +392,7 @@ IO::deliver_output (vector<Sample *>& bufs, uint32_t nbufs, jack_nframes_t nfram
gain_t pangain = _gain; gain_t pangain = _gain;
{ {
TentativeLockMonitor dm (declick_lock, __LINE__, __FILE__); Glib::Mutex::Lock dm (declick_lock, Glib::TRY_LOCK);
if (dm.locked()) { if (dm.locked()) {
dg = _desired_gain; dg = _desired_gain;
@ -427,7 +439,7 @@ IO::deliver_output_no_pan (vector<Sample *>& bufs, uint32_t nbufs, jack_nframes_
} else { } else {
TentativeLockMonitor dm (declick_lock, __LINE__, __FILE__); Glib::Mutex::Lock dm (declick_lock, Glib::TRY_LOCK);
if (dm.locked()) { if (dm.locked()) {
dg = _desired_gain; 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 */ /* 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 */ /* 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()) { if (find (_outputs.begin(), _outputs.end(), our_port) == _outputs.end()) {
return -1; 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 */ /* check that our_port is really one of ours */
@ -730,10 +742,10 @@ IO::remove_output_port (Port* port, void* src)
IOChange change (NoChange); 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) { if (_noutputs - 1 == (uint32_t) _output_minimum) {
/* sorry, you can't do this */ /* sorry, you can't do this */
@ -779,10 +791,10 @@ IO::add_output_port (string destination, void* src)
char buf[64]; 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) { if (_output_maximum >= 0 && (int) _noutputs == _output_maximum) {
return -1; return -1;
@ -830,10 +842,10 @@ IO::remove_input_port (Port* port, void* src)
IOChange change (NoChange); 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) { if (((int)_ninputs - 1) < _input_minimum) {
/* sorry, you can't do this */ /* sorry, you can't do this */
@ -880,10 +892,10 @@ IO::add_input_port (string source, void* src)
char buf[64]; 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) { if (_input_maximum >= 0 && (int) _ninputs == _input_maximum) {
return -1; return -1;
@ -931,10 +943,10 @@ int
IO::disconnect_inputs (void* src) 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) { for (vector<Port *>::iterator i = _inputs.begin(); i != _inputs.end(); ++i) {
_session.engine().disconnect (*i); _session.engine().disconnect (*i);
@ -951,10 +963,10 @@ int
IO::disconnect_outputs (void* src) 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) { for (vector<Port *>::iterator i = _outputs.begin(); i != _outputs.end(); ++i) {
_session.engine().disconnect (*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__); Glib::Mutex::Lock em (_session.engine().process_lock());
LockMonitor lm (io_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (io_lock);
Port* port; Port* port;
@ -1212,8 +1224,8 @@ IO::ensure_inputs (uint32_t n, bool clear, bool lockit, void* src)
} }
if (lockit) { if (lockit) {
LockMonitor em (_session.engine().process_lock(), __LINE__, __FILE__); Glib::Mutex::Lock em (_session.engine().process_lock());
LockMonitor im (io_lock, __LINE__, __FILE__); Glib::Mutex::Lock im (io_lock);
changed = ensure_inputs_locked (n, clear, src); changed = ensure_inputs_locked (n, clear, src);
} else { } else {
changed = ensure_inputs_locked (n, clear, src); 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 */ /* XXX caller should hold io_lock, but generally doesn't */
if (lockit) { if (lockit) {
LockMonitor em (_session.engine().process_lock(), __LINE__, __FILE__); Glib::Mutex::Lock em (_session.engine().process_lock());
LockMonitor im (io_lock, __LINE__, __FILE__); Glib::Mutex::Lock im (io_lock);
changed = ensure_outputs_locked (n, clear, src); changed = ensure_outputs_locked (n, clear, src);
} else { } else {
changed = ensure_outputs_locked (n, clear, src); changed = ensure_outputs_locked (n, clear, src);
@ -1389,7 +1401,7 @@ IO::state (bool full_state)
bool need_ins = true; bool need_ins = true;
bool need_outs = true; bool need_outs = true;
LocaleGuard lg (X_("POSIX")); LocaleGuard lg (X_("POSIX"));
LockMonitor lm (io_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (io_lock);
node->add_property("name", _name); node->add_property("name", _name);
snprintf (buf, sizeof(buf), "%" PRIu64, id()); snprintf (buf, sizeof(buf), "%" PRIu64, id());
@ -2058,7 +2070,7 @@ IO::set_output_maximum (int n)
void void
IO::set_port_latency (jack_nframes_t nframes) 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) { for (vector<Port *>::iterator i = _outputs.begin(); i != _outputs.end(); ++i) {
(*i)->set_latency (nframes); (*i)->set_latency (nframes);
@ -2109,8 +2121,8 @@ IO::use_input_connection (Connection& c, void* src)
uint32_t limit; uint32_t limit;
{ {
LockMonitor lm (_session.engine().process_lock(), __LINE__, __FILE__); Glib::Mutex::Lock lm (_session.engine().process_lock());
LockMonitor lm2 (io_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm2 (io_lock);
limit = c.nports(); limit = c.nports();
@ -2187,8 +2199,8 @@ IO::use_output_connection (Connection& c, void* src)
uint32_t limit; uint32_t limit;
{ {
LockMonitor lm (_session.engine().process_lock(), __LINE__, __FILE__); Glib::Mutex::Lock lm (_session.engine().process_lock());
LockMonitor lm2 (io_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm2 (io_lock);
limit = c.nports(); limit = c.nports();
@ -2437,10 +2449,26 @@ IO::send_state_changed ()
return; 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 void
IO::meter () IO::meter ()
{ {
LockMonitor lm (io_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (io_lock); // READER: meter thread.
uint32_t limit = max (_ninputs, _noutputs); uint32_t limit = max (_ninputs, _noutputs);
for (uint32_t n = 0; n < limit; ++n) { for (uint32_t n = 0; n < limit; ++n) {
@ -2602,7 +2630,7 @@ IO::load_automation (const string& path)
void void
IO::clear_automation () IO::clear_automation ()
{ {
LockMonitor lm (automation_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (automation_lock);
_gain_automation_curve.clear (); _gain_automation_curve.clear ();
_panner->clear_automation (); _panner->clear_automation ();
} }
@ -2613,7 +2641,7 @@ IO::set_gain_automation_state (AutoState state)
bool changed = false; bool changed = false;
{ {
LockMonitor lm (automation_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (automation_lock);
if (state != _gain_automation_curve.automation_state()) { if (state != _gain_automation_curve.automation_state()) {
changed = true; changed = true;
@ -2638,7 +2666,7 @@ IO::set_gain_automation_style (AutoStyle style)
bool changed = false; bool changed = false;
{ {
LockMonitor lm (automation_lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (automation_lock);
if (style != _gain_automation_curve.automation_style()) { if (style != _gain_automation_curve.automation_style()) {
changed = true; changed = true;
@ -2666,7 +2694,7 @@ IO::set_gain (gain_t val, void *src)
if (val>1.99526231f) val=1.99526231f; if (val>1.99526231f) val=1.99526231f;
{ {
LockMonitor dm (declick_lock, __LINE__, __FILE__); Glib::Mutex::Lock dm (declick_lock);
_desired_gain = val; _desired_gain = val;
} }

View file

@ -371,7 +371,7 @@ Locations::set_current (Location *loc, bool want_lock)
int ret; int ret;
if (want_lock) { if (want_lock) {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
ret = set_current_unlocked (loc); ret = set_current_unlocked (loc);
} else { } else {
ret = set_current_unlocked (loc); ret = set_current_unlocked (loc);
@ -399,7 +399,7 @@ void
Locations::clear () Locations::clear ()
{ {
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
LocationList::iterator tmp; LocationList::iterator tmp;
for (LocationList::iterator i = locations.begin(); i != locations.end(); ) { for (LocationList::iterator i = locations.begin(); i != locations.end(); ) {
tmp = i; tmp = i;
@ -424,7 +424,7 @@ void
Locations::clear_markers () Locations::clear_markers ()
{ {
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
LocationList::iterator tmp; LocationList::iterator tmp;
for (LocationList::iterator i = locations.begin(); i != locations.end(); ) { for (LocationList::iterator i = locations.begin(); i != locations.end(); ) {
@ -448,7 +448,7 @@ void
Locations::clear_ranges () Locations::clear_ranges ()
{ {
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
LocationList::iterator tmp; LocationList::iterator tmp;
for (LocationList::iterator i = locations.begin(); i != locations.end(); ) { for (LocationList::iterator i = locations.begin(); i != locations.end(); ) {
@ -477,7 +477,7 @@ void
Locations::add (Location *loc, bool make_current) Locations::add (Location *loc, bool make_current)
{ {
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
locations.push_back (loc); locations.push_back (loc);
if (make_current) { 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) { for (i = locations.begin(); i != locations.end(); ++i) {
if ((*i) == loc) { if ((*i) == loc) {
@ -547,7 +547,7 @@ Locations::get_state ()
{ {
XMLNode *node = new XMLNode ("Locations"); XMLNode *node = new XMLNode ("Locations");
LocationList::iterator iter; LocationList::iterator iter;
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
for (iter = locations.begin(); iter != locations.end(); ++iter) { for (iter = locations.begin(); iter != locations.end(); ++iter) {
node->add_child_nocopy ((*iter)->get_state ()); node->add_child_nocopy ((*iter)->get_state ());
@ -570,7 +570,7 @@ Locations::set_state (const XMLNode& node)
nlist = node.children(); nlist = node.children();
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
for (niter = nlist.begin(); niter != nlist.end(); ++niter) { for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
Location *loc = new Location; Location *loc = new Location;
@ -614,7 +614,7 @@ Locations::first_location_before (jack_nframes_t frame)
LocationList locs; LocationList locs;
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
locs = locations; locs = locations;
} }
@ -638,7 +638,7 @@ Locations::first_location_after (jack_nframes_t frame)
LocationList locs; LocationList locs;
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
locs = locations; locs = locations;
} }
@ -656,6 +656,80 @@ Locations::first_location_after (jack_nframes_t frame)
return 0; return 0;
} }
jack_nframes_t
Locations::first_mark_before (jack_nframes_t frame)
{
LocationList locs;
{
Glib::Mutex::Lock lm (lock);
locs = locations;
}
LocationStartLaterComparison cmp;
locs.sort (cmp);
/* locs is now sorted latest..earliest */
for (LocationList::iterator i = locs.begin(); i != locs.end(); ++i) {
if (!(*i)->is_hidden()) {
if ((*i)->is_mark()) {
/* MARK: start == end */
if ((*i)->start() < frame) {
return (*i)->start();
}
} else {
/* RANGE: start != end, compare start and end */
if ((*i)->end() < frame) {
return (*i)->end();
}
if ((*i)->start () < frame) {
return (*i)->start();
}
}
}
}
return 0;
}
jack_nframes_t
Locations::first_mark_after (jack_nframes_t frame)
{
LocationList locs;
{
Glib::Mutex::Lock lm (lock);
locs = locations;
}
LocationStartEarlierComparison cmp;
locs.sort (cmp);
/* locs is now sorted earliest..latest */
for (LocationList::iterator i = locs.begin(); i != locs.end(); ++i) {
if (!(*i)->is_hidden()) {
if ((*i)->is_mark()) {
/* MARK, start == end so just compare start */
if ((*i)->start() > frame) {
return (*i)->start();
}
} else {
/* RANGE, start != end, compare start and end */
if ((*i)->start() > frame ) {
return (*i)->start ();
}
if ((*i)->end() > frame) {
return (*i)->end ();
}
}
}
}
return max_frames;
}
Location* Location*
Locations::end_location () const Locations::end_location () const
{ {
@ -718,7 +792,7 @@ Change
Locations::restore_state (StateManager::State& state) Locations::restore_state (StateManager::State& state)
{ {
{ {
LockMonitor lm (lock, __LINE__, __FILE__); Glib::Mutex::Lock lm (lock);
State* lstate = dynamic_cast<State*> (&state); State* lstate = dynamic_cast<State*> (&state);
locations = lstate->locations; locations = lstate->locations;
@ -743,7 +817,7 @@ uint32_t
Locations::num_range_markers () const Locations::num_range_markers () const
{ {
uint32_t cnt = 0; 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) { for (LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) {
if ((*i)->is_range_marker()) { if ((*i)->is_range_marker()) {
++cnt; ++cnt;

View file

@ -28,9 +28,10 @@
#include <unistd.h> #include <unistd.h>
#include <float.h> #include <float.h>
#include <glibmm.h>
#include <pbd/error.h> #include <pbd/error.h>
#include <pbd/failed_constructor.h> #include <pbd/failed_constructor.h>
#include <pbd/basename.h>
#include <pbd/xml++.h> #include <pbd/xml++.h>
#include <ardour/session.h> #include <ardour/session.h>
@ -1369,7 +1370,7 @@ Panner::state (bool full)
if (full) { if (full) {
if (save () == 0) { if (save () == 0) {
root->add_property (X_("automation"), PBD::basename (automation_path)); root->add_property (X_("automation"), Glib::path_get_basename (automation_path));
} }
} }

View file

@ -225,8 +225,8 @@ Playlist::copy_regions (RegionList& newlist) const
void void
Playlist::init (bool hide) Playlist::init (bool hide)
{ {
atomic_set (&block_notifications, 0); g_atomic_int_set (&block_notifications, 0);
atomic_set (&ignore_state_changes, 0); g_atomic_int_set (&ignore_state_changes, 0);
pending_modified = false; pending_modified = false;
pending_length = false; pending_length = false;
_refcnt = 0; _refcnt = 0;
@ -292,13 +292,13 @@ void
Playlist::freeze () Playlist::freeze ()
{ {
delay_notifications (); delay_notifications ();
atomic_inc (&ignore_state_changes); g_atomic_int_inc (&ignore_state_changes);
} }
void void
Playlist::thaw () Playlist::thaw ()
{ {
atomic_dec (&ignore_state_changes); g_atomic_int_dec_and_test (&ignore_state_changes);
release_notifications (); release_notifications ();
} }
@ -306,14 +306,14 @@ Playlist::thaw ()
void void
Playlist::delay_notifications () Playlist::delay_notifications ()
{ {
atomic_inc (&block_notifications); g_atomic_int_inc (&block_notifications);
freeze_length = _get_maximum_extent(); freeze_length = _get_maximum_extent();
} }
void void
Playlist::release_notifications () Playlist::release_notifications ()
{ {
if (atomic_dec_and_test(&block_notifications)) { if (g_atomic_int_dec_and_test (&block_notifications)) {
flush_notifications (); flush_notifications ();
} }
} }

Some files were not shown because too many files have changed in this diff Show more