** requires svn jack ** Hardware monitoring should work, some canvas scrolling speed improvement, don't disconcertingly churn the disk if jack auto-start fails, mixer visibility state is saved per session, slow down meters a bit (too much?), zoom cleanups, remove some unused variables, use rwlock for tempo state for no reason other than that it might be useful one day, fix compiler warning.

git-svn-id: svn://localhost/ardour2/trunk@873 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Nick Mainsbridge 2006-08-30 20:48:16 +00:00
parent 6535cd1b1d
commit a61f25dfe9
26 changed files with 296 additions and 266 deletions

View file

@ -136,8 +136,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
theArdourUI = this; theArdourUI = this;
} }
ActionManager::init ();
/* load colors */ /* load colors */
color_manager = new ColorManager(); color_manager = new ColorManager();
@ -146,7 +144,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
color_manager->load (color_file); color_manager->load (color_file);
m_new_session_dialog = new NewSessionDialog();
editor = 0; editor = 0;
mixer = 0; mixer = 0;
session = 0; session = 0;
@ -205,6 +202,9 @@ ARDOUR_UI::set_engine (AudioEngine& e)
engine->Halted.connect (mem_fun(*this, &ARDOUR_UI::engine_halted)); engine->Halted.connect (mem_fun(*this, &ARDOUR_UI::engine_halted));
engine->SampleRateChanged.connect (mem_fun(*this, &ARDOUR_UI::update_sample_rate)); engine->SampleRateChanged.connect (mem_fun(*this, &ARDOUR_UI::update_sample_rate));
ActionManager::init ();
new_session_dialog = new NewSessionDialog();
_tooltips.enable(); _tooltips.enable();
keyboard = new Keyboard; keyboard = new Keyboard;
@ -1375,7 +1375,7 @@ ARDOUR_UI::start_blinking ()
if (blink_timeout_tag < 0) { if (blink_timeout_tag < 0) {
blink_on = false; blink_on = false;
blink_timeout_tag = gtk_timeout_add (240, _blink, this); blink_timeout_tag = g_timeout_add (240, _blink, this);
} }
} }
@ -1383,7 +1383,7 @@ void
ARDOUR_UI::stop_blinking () ARDOUR_UI::stop_blinking ()
{ {
if (blink_timeout_tag >= 0) { if (blink_timeout_tag >= 0) {
gtk_timeout_remove (blink_timeout_tag); g_source_remove (blink_timeout_tag);
blink_timeout_tag = -1; blink_timeout_tag = -1;
} }
} }
@ -1616,48 +1616,53 @@ ARDOUR_UI::save_template ()
void void
ARDOUR_UI::new_session (bool startup, std::string predetermined_path) ARDOUR_UI::new_session (bool startup, std::string predetermined_path)
{ {
m_new_session_dialog->show(); int response = Gtk::RESPONSE_NONE;
m_new_session_dialog->set_modal(true);
m_new_session_dialog->set_name(predetermined_path);
m_new_session_dialog->reset_recent();
int response = Gtk::RESPONSE_CANCEL; new_session_dialog->set_modal(true);
new_session_dialog->set_name(predetermined_path);
new_session_dialog->reset_recent();
new_session_dialog->show();
//Glib::RefPtr<Gdk::Window> nsd_window = new_session_dialog->get_window();
do { do {
response = m_new_session_dialog->run (); response = new_session_dialog->run ();
//nsd_window ->set_cursor(Gdk::Cursor(Gdk::WATCH));
if(response == Gtk::RESPONSE_CANCEL || response == Gtk::RESPONSE_DELETE_EVENT) { if(response == Gtk::RESPONSE_CANCEL || response == Gtk::RESPONSE_DELETE_EVENT) {
quit(); quit();
return; return;
} else if (response == Gtk::RESPONSE_NONE) { } else if (response == Gtk::RESPONSE_NONE) {
/* Clear was pressed */ /* Clear was pressed */
m_new_session_dialog->reset(); new_session_dialog->reset();
} else if (response == Gtk::RESPONSE_YES) { } else if (response == Gtk::RESPONSE_YES) {
/* YES == OPEN, but there's no enum for that */ /* YES == OPEN, but there's no enum for that */
std::string session_name = m_new_session_dialog->session_name();
std::string session_path = m_new_session_dialog->session_folder(); std::string session_name = new_session_dialog->session_name();
std::string session_path = new_session_dialog->session_folder();
load_session (session_path, session_name); load_session (session_path, session_name);
} else if (response == Gtk::RESPONSE_OK) { } else if (response == Gtk::RESPONSE_OK) {
if (m_new_session_dialog->get_current_page() == 1) { if (new_session_dialog->get_current_page() == 1) {
/* XXX this is a bit of a hack.. /* XXX this is a bit of a hack..
i really want the new sesion dialog to return RESPONSE_YES i really want the new sesion dialog to return RESPONSE_YES
if we're on page 1 (the load page) if we're on page 1 (the load page)
Unfortunately i can't see how atm.. Unfortunately i can't see how atm..
*/ */
std::string session_name = m_new_session_dialog->session_name();
std::string session_path = m_new_session_dialog->session_folder(); std::string session_name = new_session_dialog->session_name();
std::string session_path = new_session_dialog->session_folder();
load_session (session_path, session_name); load_session (session_path, session_name);
} else { } else {
_session_is_new = true; _session_is_new = true;
std::string session_name = m_new_session_dialog->session_name(); std::string session_name = new_session_dialog->session_name();
std::string session_path = m_new_session_dialog->session_folder(); std::string session_path = new_session_dialog->session_folder();
//XXX This is needed because session constructor wants a //XXX This is needed because session constructor wants a
@ -1665,9 +1670,9 @@ ARDOUR_UI::new_session (bool startup, std::string predetermined_path)
session_path = Glib::build_filename(session_path, session_name); session_path = Glib::build_filename(session_path, session_name);
std::string template_name = m_new_session_dialog->session_template_name(); std::string template_name = new_session_dialog->session_template_name();
if (m_new_session_dialog->use_session_template()) { if (new_session_dialog->use_session_template()) {
load_session (session_path, session_name, &template_name); load_session (session_path, session_name, &template_name);
@ -1678,19 +1683,19 @@ ARDOUR_UI::new_session (bool startup, std::string predetermined_path)
Session::AutoConnectOption iconnect; Session::AutoConnectOption iconnect;
Session::AutoConnectOption oconnect; Session::AutoConnectOption oconnect;
if (m_new_session_dialog->create_control_bus()) { if (new_session_dialog->create_control_bus()) {
cchns = (uint32_t) m_new_session_dialog->control_channel_count(); cchns = (uint32_t) new_session_dialog->control_channel_count();
} else { } else {
cchns = 0; cchns = 0;
} }
if (m_new_session_dialog->create_master_bus()) { if (new_session_dialog->create_master_bus()) {
mchns = (uint32_t) m_new_session_dialog->master_channel_count(); mchns = (uint32_t) new_session_dialog->master_channel_count();
} else { } else {
mchns = 0; mchns = 0;
} }
if (m_new_session_dialog->connect_inputs()) { if (new_session_dialog->connect_inputs()) {
iconnect = Session::AutoConnectPhysical; iconnect = Session::AutoConnectPhysical;
} else { } else {
iconnect = Session::AutoConnectOption (0); iconnect = Session::AutoConnectOption (0);
@ -1698,16 +1703,16 @@ ARDOUR_UI::new_session (bool startup, std::string predetermined_path)
/// @todo some minor tweaks. /// @todo some minor tweaks.
if (m_new_session_dialog->connect_outs_to_master()) { if (new_session_dialog->connect_outs_to_master()) {
oconnect = Session::AutoConnectMaster; oconnect = Session::AutoConnectMaster;
} else if (m_new_session_dialog->connect_outs_to_physical()) { } else if (new_session_dialog->connect_outs_to_physical()) {
oconnect = Session::AutoConnectPhysical; oconnect = Session::AutoConnectPhysical;
} else { } else {
oconnect = Session::AutoConnectOption (0); oconnect = Session::AutoConnectOption (0);
} }
uint32_t nphysin = (uint32_t) m_new_session_dialog->input_limit_count(); uint32_t nphysin = (uint32_t) new_session_dialog->input_limit_count();
uint32_t nphysout = (uint32_t) m_new_session_dialog->output_limit_count(); uint32_t nphysout = (uint32_t) new_session_dialog->output_limit_count();
build_session (session_path, build_session (session_path,
session_name, session_name,
@ -1723,9 +1728,10 @@ ARDOUR_UI::new_session (bool startup, std::string predetermined_path)
} }
} while (response == Gtk::RESPONSE_NONE); } while (response == Gtk::RESPONSE_NONE);
m_new_session_dialog->hide();
show(); show();
new_session_dialog->get_window()->set_cursor();
new_session_dialog->hide();
} }
void void
@ -1771,9 +1777,6 @@ This prevents the session from being loaded."));
connect_to_session (new_session); connect_to_session (new_session);
//if (engine->running()) {
//mixer->show_window();
//}
session_loaded = true; session_loaded = true;
return 0; return 0;
} }
@ -1826,9 +1829,6 @@ ARDOUR_UI::build_session (const string & path, const string & snap_name,
connect_to_session (new_session); connect_to_session (new_session);
//if (engine->running()) {
//mixer->show_window();
//}
session_loaded = true; session_loaded = true;
return 0; return 0;
} }
@ -1841,10 +1841,6 @@ ARDOUR_UI::show ()
shown_flag = true; shown_flag = true;
} }
if (session && mixer) {
// mixer->show_window ();
}
if (about) { if (about) {
about->present (); about->present ();
} }
@ -1863,7 +1859,8 @@ void
ARDOUR_UI::hide_splash () ARDOUR_UI::hide_splash ()
{ {
if (about) { if (about) {
// about->hide(); about->get_window()->set_cursor ();
about->hide();
} }
} }

View file

@ -524,7 +524,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
bool _will_create_new_session_automatically; bool _will_create_new_session_automatically;
NewSessionDialog* m_new_session_dialog; NewSessionDialog* new_session_dialog;
void open_session (); void open_session ();
void open_recent_session (); void open_recent_session ();

View file

@ -133,10 +133,10 @@ class AudioClock : public Gtk::HBox
jack_nframes_t last_when; jack_nframes_t last_when;
long last_hrs; uint32_t last_hrs;
long last_mins; uint32_t last_mins;
long last_secs; uint32_t last_secs;
long last_frames; uint32_t last_frames;
bool last_negative; bool last_negative;
long ms_last_hrs; long ms_last_hrs;

View file

@ -271,7 +271,6 @@ Editor::Editor (AudioEngine& eng)
first_action_message = 0; first_action_message = 0;
export_dialog = 0; export_dialog = 0;
show_gain_after_trim = false; show_gain_after_trim = false;
no_zoom_repos_update = false;
ignore_route_list_reorder = false; ignore_route_list_reorder = false;
no_route_list_redisplay = false; no_route_list_redisplay = false;
verbose_cursor_on = true; verbose_cursor_on = true;
@ -284,7 +283,6 @@ Editor::Editor (AudioEngine& eng)
_xfade_visibility = true; _xfade_visibility = true;
editor_ruler_menu = 0; editor_ruler_menu = 0;
no_ruler_shown_update = false; no_ruler_shown_update = false;
edit_hscroll_dragging = false;
edit_group_list_menu = 0; edit_group_list_menu = 0;
route_list_menu = 0; route_list_menu = 0;
region_list_menu = 0; region_list_menu = 0;
@ -832,16 +830,6 @@ Editor::set_frames_per_unit (double fpu)
zoom_range_clock.set (frames); zoom_range_clock.set (frames);
} }
/* only update these if we not about to call reposition_x_origin,
which will do the same updates.
*/
if (!no_zoom_repos_update) {
horizontal_adjustment.set_value (leftmost_frame/frames_per_unit);
update_fixed_rulers ();
tempo_map_changed (Change (0));
}
if (mouse_mode == MouseRange && selection->time.start () != selection->time.end_frame ()) { if (mouse_mode == MouseRange && selection->time.start () != selection->time.end_frame ()) {
if (!selection->tracks.empty()) { if (!selection->tracks.empty()) {
for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) { for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
@ -909,7 +897,7 @@ Editor::edit_cursor_clock_changed()
void void
Editor::zoom_adjustment_changed () Editor::zoom_adjustment_changed ()
{ {
if (session == 0 || no_zoom_repos_update) { if (session == 0) {
return; return;
} }
@ -976,40 +964,39 @@ Editor::deferred_control_scroll (jack_nframes_t target)
void void
Editor::canvas_horizontally_scrolled () Editor::canvas_horizontally_scrolled ()
{ {
Glib::signal_idle().connect (mem_fun(*this, &Editor::lazy_canvas_horizontally_scrolled));
}
bool
Editor::lazy_canvas_horizontally_scrolled ()
{
leftmost_frame = (jack_nframes_t) floor (horizontal_adjustment.get_value() * frames_per_unit); leftmost_frame = (jack_nframes_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
update_fixed_rulers (); update_fixed_rulers ();
if (!edit_hscroll_dragging) {
tempo_map_changed (Change (0)); tempo_map_changed (Change (0));
} else {
update_tempo_based_rulers(); return false;
}
} }
void void
Editor::reposition_and_zoom (jack_nframes_t frame, double nfpu) Editor::reposition_and_zoom (jack_nframes_t frame, double nfpu)
{ {
if (!repos_zoom_queued) { if (!repos_zoom_queued) {
Glib::signal_idle().connect (bind (mem_fun(*this, &Editor::deferred_reposition_and_zoom), frame, nfpu));
repos_zoom_queued = true; repos_zoom_queued = true;
Glib::signal_idle().connect (bind (mem_fun(*this, &Editor::deferred_reposition_and_zoom), frame, nfpu));
} }
} }
gint gint
Editor::deferred_reposition_and_zoom (jack_nframes_t frame, double nfpu) Editor::deferred_reposition_and_zoom (jack_nframes_t frame, double nfpu)
{ {
/* if we need to force an update to the hscroller stuff,
don't set no_zoom_repos_update.
*/
no_zoom_repos_update = (frame != leftmost_frame);
set_frames_per_unit (nfpu); set_frames_per_unit (nfpu);
if (no_zoom_repos_update) {
reposition_x_origin (frame); reposition_x_origin (frame);
}
no_zoom_repos_update = false;
repos_zoom_queued = false; repos_zoom_queued = false;
return FALSE; return FALSE;
@ -1062,7 +1049,6 @@ void
Editor::stop_scrolling () Editor::stop_scrolling ()
{ {
scroll_connection.disconnect (); scroll_connection.disconnect ();
slower_update_connection.disconnect ();
} }
void void
@ -1307,6 +1293,7 @@ Editor::connect_to_session (Session *t)
restore_ruler_visibility (); restore_ruler_visibility ();
tempo_map_changed (Change (0)); tempo_map_changed (Change (0));
session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
edit_cursor->set_position (0); edit_cursor->set_position (0);
playhead_cursor->set_position (0); playhead_cursor->set_position (0);
@ -2244,6 +2231,7 @@ Editor::set_state (const XMLNode& node)
} }
} }
return 0; return 0;
} }

View file

@ -651,7 +651,6 @@ class Editor : public PublicEditor
void controls_layout_size_request (Gtk::Requisition*); void controls_layout_size_request (Gtk::Requisition*);
Gtk::HScrollbar edit_hscrollbar; Gtk::HScrollbar edit_hscrollbar;
bool edit_hscroll_dragging;
void reset_hscrollbar_stepping (); void reset_hscrollbar_stepping ();
@ -684,12 +683,11 @@ class Editor : public PublicEditor
void tie_vertical_scrolling (); void tie_vertical_scrolling ();
void canvas_horizontally_scrolled (); void canvas_horizontally_scrolled ();
bool lazy_canvas_horizontally_scrolled ();
void reposition_and_zoom (jack_nframes_t sample, double fpu); void reposition_and_zoom (jack_nframes_t sample, double fpu);
gint deferred_reposition_and_zoom (jack_nframes_t sample, double fpu); gint deferred_reposition_and_zoom (jack_nframes_t sample, double fpu);
void end_location_changed (ARDOUR::Location*); void end_location_changed (ARDOUR::Location*);
bool repos_zoom_queued; bool repos_zoom_queued;
bool no_zoom_repos_update;
bool no_tempo_map_update;
struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord { struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
RegionListDisplayModelColumns() { RegionListDisplayModelColumns() {
@ -808,8 +806,6 @@ class Editor : public PublicEditor
void center_screen_internal (jack_nframes_t, float); void center_screen_internal (jack_nframes_t, float);
void update_current_screen (); void update_current_screen ();
sigc::connection slower_update_connection;
void update_slower ();
gint show_track_context_menu (GdkEventButton *); gint show_track_context_menu (GdkEventButton *);
void hide_track_context_menu (); void hide_track_context_menu ();

View file

@ -92,6 +92,7 @@ Editor::initialize_canvas ()
/* don't try to center the canvas */ /* don't try to center the canvas */
track_canvas.set_center_scroll_region (false); track_canvas.set_center_scroll_region (false);
track_canvas.set_dither (Gdk::RGB_DITHER_NONE);
track_canvas.signal_event().connect (bind (mem_fun (*this, &Editor::track_canvas_event), (ArdourCanvas::Item*) 0)); track_canvas.signal_event().connect (bind (mem_fun (*this, &Editor::track_canvas_event), (ArdourCanvas::Item*) 0));
track_canvas.set_name ("EditorMainCanvas"); track_canvas.set_name ("EditorMainCanvas");
@ -133,6 +134,7 @@ Editor::initialize_canvas ()
time_canvas.add_events (Gdk::POINTER_MOTION_HINT_MASK); time_canvas.add_events (Gdk::POINTER_MOTION_HINT_MASK);
time_canvas.set_flags (CAN_FOCUS); time_canvas.set_flags (CAN_FOCUS);
time_canvas.set_center_scroll_region (false); time_canvas.set_center_scroll_region (false);
time_canvas.set_dither (Gdk::RGB_DITHER_NONE);
meter_group = new ArdourCanvas::Group (*time_canvas.root(), 0.0, 0.0); meter_group = new ArdourCanvas::Group (*time_canvas.root(), 0.0, 0.0);
tempo_group = new ArdourCanvas::Group (*time_canvas.root(), 0.0, timebar_height); tempo_group = new ArdourCanvas::Group (*time_canvas.root(), 0.0, timebar_height);
@ -594,7 +596,7 @@ Editor::autoscroll_canvas ()
/* connect the timeout so that we get called repeatedly */ /* connect the timeout so that we get called repeatedly */
autoscroll_timeout_tag = gtk_timeout_add (20, _autoscroll_canvas, this); autoscroll_timeout_tag = g_timeout_add (20, _autoscroll_canvas, this);
keep_calling = false; keep_calling = false;
} else if (autoscroll_cnt == 50) { /* 0.5 seconds */ } else if (autoscroll_cnt == 50) { /* 0.5 seconds */
@ -640,7 +642,7 @@ void
Editor::stop_canvas_autoscroll () Editor::stop_canvas_autoscroll ()
{ {
if (autoscroll_timeout_tag >= 0) { if (autoscroll_timeout_tag >= 0) {
gtk_timeout_remove (autoscroll_timeout_tag); g_source_remove (autoscroll_timeout_tag);
autoscroll_timeout_tag = -1; autoscroll_timeout_tag = -1;
} }
} }

View file

@ -34,7 +34,6 @@ Editor::hscrollbar_allocate (Gtk::Allocation &alloc)
bool bool
Editor::hscrollbar_button_press (GdkEventButton *ev) Editor::hscrollbar_button_press (GdkEventButton *ev)
{ {
edit_hscroll_dragging = true;
return true; return true;
} }
@ -42,11 +41,7 @@ bool
Editor::hscrollbar_button_release (GdkEventButton *ev) Editor::hscrollbar_button_release (GdkEventButton *ev)
{ {
if (session) { if (session) {
if (edit_hscroll_dragging) {
// lets do a tempo redisplay only on button release, because it is dog slow
tempo_map_changed (Change (0));
edit_hscroll_dragging = false;
}
} }
return true; return true;

View file

@ -140,27 +140,27 @@ Editor::set_meter_falloff (int intval)
Config->set_meter_falloff_off(true); Config->set_meter_falloff_off(true);
break; break;
case 1: case 1:
val = 0.266f; val = 0.125f;
Config->set_meter_falloff_slowest(true); Config->set_meter_falloff_slowest(true);
break; break;
case 2: case 2:
val = 0.342f; val = 0.250f;
Config->set_meter_falloff_slow(true); Config->set_meter_falloff_slow(true);
break; break;
case 3: case 3:
val = 0.7f; val = 0.375f;
Config->set_meter_falloff_medium(true); Config->set_meter_falloff_medium(true);
break; break;
case 4: case 4:
val = 1.1f; val = 0.500f;
Config->set_meter_falloff_fast(true); Config->set_meter_falloff_fast(true);
break; break;
case 5: case 5:
val = 1.5f; val = 0.750f;
Config->set_meter_falloff_faster(true); Config->set_meter_falloff_faster(true);
break; break;
case 6: case 6:
val = 2.5f; val = 0.875f;
Config->set_meter_falloff_fastest(true); Config->set_meter_falloff_fastest(true);
break; break;
} }

View file

@ -69,11 +69,15 @@ Editor::remove_metric_marks ()
void void
Editor::draw_metric_marks (const Metrics& metrics) Editor::draw_metric_marks (const Metrics& metrics)
{ {
for (Metrics::const_iterator i = metrics.begin(); i != metrics.end(); ++i) {
const MeterSection *ms; const MeterSection *ms;
const TempoSection *ts; const TempoSection *ts;
char buf[64]; char buf[64];
remove_metric_marks ();
for (Metrics::const_iterator i = metrics.begin(); i != metrics.end(); ++i) {
if ((ms = dynamic_cast<const MeterSection*>(*i)) != 0) { if ((ms = dynamic_cast<const MeterSection*>(*i)) != 0) {
snprintf (buf, sizeof(buf), "%g/%g", ms->beats_per_bar(), ms->note_divisor ()); snprintf (buf, sizeof(buf), "%g/%g", ms->beats_per_bar(), ms->note_divisor ());
metric_marks.push_back (new MeterMarker (*this, *meter_group, color_map[cMeterMarker], buf, metric_marks.push_back (new MeterMarker (*this, *meter_group, color_map[cMeterMarker], buf,
@ -85,6 +89,7 @@ Editor::draw_metric_marks (const Metrics& metrics)
} }
} }
} }
void void
@ -109,16 +114,12 @@ Editor::tempo_map_changed (Change ignored)
void void
Editor::redisplay_tempo () Editor::redisplay_tempo ()
{ {
update_tempo_based_rulers ();
remove_metric_marks ();
hide_measures (); hide_measures ();
if (session && current_bbt_points) { if (session && current_bbt_points) {
session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
draw_measures (); draw_measures ();
update_tempo_based_rulers ();
} }
} }
void void
@ -155,8 +156,8 @@ Editor::draw_measures ()
return; return;
} }
TempoMap::BBTPointList::iterator i; TempoMap::BBTPointList::iterator i = current_bbt_points->begin();
TempoMap::BBTPointList *all_bbt_points; TempoMap::BBTPoint& p = (*i);
ArdourCanvas::SimpleLine *line; ArdourCanvas::SimpleLine *line;
gdouble xpos, last_xpos; gdouble xpos, last_xpos;
uint32_t cnt; uint32_t cnt;
@ -166,8 +167,6 @@ Editor::draw_measures ()
return; return;
} }
all_bbt_points = session->tempo_map().get_points (leftmost_frame, leftmost_frame + current_page_frames());
cnt = 0; cnt = 0;
last_xpos = 0; last_xpos = 0;
@ -176,7 +175,7 @@ Editor::draw_measures ()
gdouble last_beat = DBL_MAX; gdouble last_beat = DBL_MAX;
gdouble beat_spacing = 0; gdouble beat_spacing = 0;
for (i = all_bbt_points->begin(); i != all_bbt_points->end() && beat_spacing == 0; ++i) { for (i = current_bbt_points->begin(); i != current_bbt_points->end() && beat_spacing == 0; ++i) {
TempoMap::BBTPoint& p = (*i); TempoMap::BBTPoint& p = (*i);
switch (p.type) { switch (p.type) {
@ -194,11 +193,11 @@ Editor::draw_measures ()
double x1, x2, y1, y2; double x1, x2, y1, y2;
track_canvas.get_scroll_region (x1, y1, x2, y2); track_canvas.get_scroll_region (x1, y1, x2, y2);
y2 = 1000000000.0f; //y2 = 1000000000.0f;
for (i = all_bbt_points->begin(); i != all_bbt_points->end(); ++i) { for (i = current_bbt_points->begin(); i != current_bbt_points->end(); ++i) {
TempoMap::BBTPoint& p = (*i); p = (*i);
switch (p.type) { switch (p.type) {
case TempoMap::Bar: case TempoMap::Bar:
@ -236,8 +235,6 @@ Editor::draw_measures ()
} }
} }
delete all_bbt_points;
/* the cursors are always on top of everything */ /* the cursors are always on top of everything */
cursor_group->raise_to_top(); cursor_group->raise_to_top();
@ -282,6 +279,8 @@ Editor::mouse_add_new_tempo_event (jack_nframes_t frame)
commit_reversible_command (); commit_reversible_command ();
map.dump (cerr); map.dump (cerr);
session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
} }
void void
@ -322,6 +321,8 @@ Editor::mouse_add_new_meter_event (jack_nframes_t frame)
commit_reversible_command (); commit_reversible_command ();
map.dump (cerr); map.dump (cerr);
session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
} }
void void
@ -372,6 +373,8 @@ Editor::edit_meter_section (MeterSection* section)
XMLNode &after = session->tempo_map().get_state(); XMLNode &after = session->tempo_map().get_state();
session->add_command(new MementoCommand<TempoMap>(session->tempo_map(), &before, &after)); session->add_command(new MementoCommand<TempoMap>(session->tempo_map(), &before, &after));
commit_reversible_command (); commit_reversible_command ();
session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
} }
void void
@ -402,6 +405,8 @@ Editor::edit_tempo_section (TempoSection* section)
XMLNode &after = session->tempo_map().get_state(); XMLNode &after = session->tempo_map().get_state();
session->add_command (new MementoCommand<TempoMap>(session->tempo_map(), &before, &after)); session->add_command (new MementoCommand<TempoMap>(session->tempo_map(), &before, &after));
commit_reversible_command (); commit_reversible_command ();
session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
} }
void void
@ -452,6 +457,8 @@ Editor::real_remove_tempo_marker (TempoSection *section)
session->add_command(new MementoCommand<TempoMap>(session->tempo_map(), &before, &after)); session->add_command(new MementoCommand<TempoMap>(session->tempo_map(), &before, &after));
commit_reversible_command (); commit_reversible_command ();
session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
return FALSE; return FALSE;
} }
@ -485,5 +492,8 @@ Editor::real_remove_meter_marker (MeterSection *section)
XMLNode &after = session->tempo_map().get_state(); XMLNode &after = session->tempo_map().get_state();
session->add_command(new MementoCommand<TempoMap>(session->tempo_map(), &before, &after)); session->add_command(new MementoCommand<TempoMap>(session->tempo_map(), &before, &after));
commit_reversible_command (); commit_reversible_command ();
session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
return FALSE; return FALSE;
} }

View file

@ -465,7 +465,7 @@ GainMeter::reset_peak_display ()
{ {
max_peak = minus_infinity(); max_peak = minus_infinity();
peak_display_label.set_text (_("-Inf")); peak_display_label.set_text (_("-Inf"));
peak_display.set_name ("Mixerstrippeakdisplay"); peak_display.set_name ("MixerStripPeakDisplay");
} }
void void

View file

@ -285,7 +285,11 @@ Please consider the possibilities, and perhaps (re)start JACK."));
win.show_all (); win.show_all ();
win.set_position (Gtk::WIN_POS_CENTER); win.set_position (Gtk::WIN_POS_CENTER);
/* we just don't care about the result */ if (!no_splash) {
ui->hide_splash ();
}
/* we just don't care about the result, but we want to block */
win.run (); win.run ();
} }
@ -354,9 +358,6 @@ int 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);
@ -410,11 +411,12 @@ int main (int argc, char *argv[])
<< endl; << endl;
} }
// needs a better home.
Glib::thread_init();
try { try {
ui = new ARDOUR_UI (&argc, &argv, which_ui_rcfile()); ui = new ARDOUR_UI (&argc, &argv, which_ui_rcfile());
} } catch (failed_constructor& err) {
catch (failed_constructor& err) {
error << _("could not create ARDOUR GUI") << endmsg; error << _("could not create ARDOUR GUI") << endmsg;
exit (1); exit (1);
} }
@ -423,23 +425,29 @@ int main (int argc, char *argv[])
if (!no_splash) { if (!no_splash) {
ui->show_splash (); ui->show_splash ();
if (session_name.length()) { if (session_name.length()) {
gtk_timeout_add (4000, show_ui_callback, ui); g_timeout_add (4000, show_ui_callback, ui);
} }
} }
try { try {
engine = new ARDOUR::AudioEngine (jack_client_name); engine = new ARDOUR::AudioEngine (jack_client_name);
ARDOUR::init (use_vst, try_hw_optimization);
ui->set_engine (*engine);
} catch (AudioEngine::NoBackendAvailable& err) { } catch (AudioEngine::NoBackendAvailable& err) {
gui_jack_error (); gui_jack_error ();
error << string_compose (_("Could not connect to JACK server as \"%1\""), jack_client_name) << endmsg; error << string_compose (_("Could not connect to JACK server as \"%1\""), jack_client_name) << endmsg;
return -1; return -1;
}
try {
ARDOUR::init (use_vst, try_hw_optimization);
ui->set_engine (*engine);
} catch (failed_constructor& err) { } catch (failed_constructor& err) {
error << _("could not initialize Ardour.") << endmsg; error << _("could not initialize Ardour.") << endmsg;
return -1; return -1;
} }
if (maybe_load_session ()) { if (maybe_load_session ()) {
ui->run (text_receiver); ui->run (text_receiver);
ui = 0; ui = 0;

View file

@ -67,9 +67,7 @@ Mixer_UI::Mixer_UI (AudioEngine& eng)
mix_group_context_menu = 0; mix_group_context_menu = 0;
no_track_list_redisplay = false; no_track_list_redisplay = false;
in_group_row_change = false; in_group_row_change = false;
_visible = false;
XMLNode* node = ARDOUR_UI::instance()->mixer_settings();
set_state (*node);
scroller_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK); scroller_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
scroller_base.set_name ("MixerWindow"); scroller_base.set_name ("MixerWindow");
@ -213,7 +211,7 @@ Mixer_UI::Mixer_UI (AudioEngine& eng)
add_accel_group (ActionManager::ui_manager->get_accel_group()); add_accel_group (ActionManager::ui_manager->get_accel_group());
signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), static_cast<Gtk::Window *>(this))); signal_delete_event().connect (mem_fun (*this, &Mixer_UI::hide_window));
add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK); add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
_plugin_selector = new PluginSelector (PluginManager::the_manager()); _plugin_selector = new PluginSelector (PluginManager::the_manager());
@ -248,8 +246,17 @@ Mixer_UI::show_window ()
ms = (*ri)[track_columns.strip]; ms = (*ri)[track_columns.strip];
ms->set_width (ms->get_width()); ms->set_width (ms->get_width());
} }
_visible = true;
} }
bool
Mixer_UI::hide_window (GdkEventAny *ev)
{
_visible = false;
return just_hide_it(ev, static_cast<Gtk::Window *>(this));
}
void void
Mixer_UI::add_strip (Session::RouteList& routes) Mixer_UI::add_strip (Session::RouteList& routes)
{ {
@ -345,8 +352,12 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip)
void void
Mixer_UI::connect_to_session (Session* sess) Mixer_UI::connect_to_session (Session* sess)
{ {
session = sess; session = sess;
XMLNode* node = ARDOUR_UI::instance()->mixer_settings();
set_state (*node);
string wintitle = _("ardour: mixer: "); string wintitle = _("ardour: mixer: ");
wintitle += session->name(); wintitle += session->name();
set_title (wintitle); set_title (wintitle);
@ -362,6 +373,10 @@ Mixer_UI::connect_to_session (Session* sess)
_plugin_selector->set_session (session); _plugin_selector->set_session (session);
if (_visible) {
show_window();
}
start_updating (); start_updating ();
} }
@ -1048,6 +1063,12 @@ Mixer_UI::set_state (const XMLNode& node)
} }
} }
if ((prop = node.property ("show-mixer"))) {
if (prop->value() == "yes") {
_visible = true;
}
}
return 0; return 0;
} }
@ -1089,6 +1110,8 @@ Mixer_UI::get_state (void)
node->add_property ("narrow-strips", _strip_width == Narrow ? "yes" : "no"); node->add_property ("narrow-strips", _strip_width == Narrow ? "yes" : "no");
node->add_property ("show-mixer", _visible ? "yes" : "no");
return *node; return *node;
} }

View file

@ -73,6 +73,7 @@ class Mixer_UI : public Gtk::Window
int set_state (const XMLNode& ); int set_state (const XMLNode& );
void show_window (); void show_window ();
bool hide_window (GdkEventAny *ev);
void show_strip (MixerStrip *); void show_strip (MixerStrip *);
void hide_strip (MixerStrip *); void hide_strip (MixerStrip *);
@ -84,6 +85,8 @@ class Mixer_UI : public Gtk::Window
ARDOUR::AudioEngine& engine; ARDOUR::AudioEngine& engine;
ARDOUR::Session *session; ARDOUR::Session *session;
bool _visible;
Gtk::HBox global_hpacker; Gtk::HBox global_hpacker;
Gtk::VBox global_vpacker; Gtk::VBox global_vpacker;
Gtk::ScrolledWindow scroller; Gtk::ScrolledWindow scroller;

View file

@ -31,6 +31,7 @@
#include <gtkmm/radiobutton.h> #include <gtkmm/radiobutton.h>
#include <gtkmm/filefilter.h> #include <gtkmm/filefilter.h>
#include <gtkmm/stock.h> #include <gtkmm/stock.h>
#include <gdkmm/cursor.h>
#include "opts.h" #include "opts.h"
@ -63,7 +64,7 @@ NewSessionDialog::NewSessionDialog()
input_port_limit_hbox = Gtk::manage(new class Gtk::HBox(false, 0)); input_port_limit_hbox = Gtk::manage(new class Gtk::HBox(false, 0));
input_port_vbox = Gtk::manage(new class Gtk::VBox(false, 0)); input_port_vbox = Gtk::manage(new class Gtk::VBox(false, 0));
input_table = Gtk::manage(new class Gtk::Table(2, 2, false)); input_table = Gtk::manage(new class Gtk::Table(2, 2, false));
input_port_alignment = Gtk::manage(new class Gtk::Alignment(0.5, 0.5, 1, 1));
input_label = Gtk::manage(new class Gtk::Label(_("<b>Track/Bus Inputs</b>"))); input_label = Gtk::manage(new class Gtk::Label(_("<b>Track/Bus Inputs</b>")));
input_frame = Gtk::manage(new class Gtk::Frame()); input_frame = Gtk::manage(new class Gtk::Frame());
m_connect_outputs = Gtk::manage(new class Gtk::CheckButton(_("Automatically Connect Outputs"))); m_connect_outputs = Gtk::manage(new class Gtk::CheckButton(_("Automatically Connect Outputs")));
@ -79,7 +80,7 @@ NewSessionDialog::NewSessionDialog()
m_connect_outputs_to_physical = Gtk::manage(new class Gtk::RadioButton(_RadioBGroup_m_connect_outputs_to_master, _("Connect to Physical Outputs"))); m_connect_outputs_to_physical = Gtk::manage(new class Gtk::RadioButton(_RadioBGroup_m_connect_outputs_to_master, _("Connect to Physical Outputs")));
output_conn_vbox = Gtk::manage(new class Gtk::VBox(false, 0)); output_conn_vbox = Gtk::manage(new class Gtk::VBox(false, 0));
output_vbox = Gtk::manage(new class Gtk::VBox(false, 0)); output_vbox = Gtk::manage(new class Gtk::VBox(false, 0));
output_port_alignment = Gtk::manage(new class Gtk::Alignment(0.5, 0.5, 1, 1));
output_label = Gtk::manage(new class Gtk::Label(_("<b>Track/Bus Outputs</b>"))); output_label = Gtk::manage(new class Gtk::Label(_("<b>Track/Bus Outputs</b>")));
output_frame = Gtk::manage(new class Gtk::Frame()); output_frame = Gtk::manage(new class Gtk::Frame());
advanced_vbox = Gtk::manage(new class Gtk::VBox(false, 0)); advanced_vbox = Gtk::manage(new class Gtk::VBox(false, 0));
@ -90,7 +91,7 @@ NewSessionDialog::NewSessionDialog()
open_session_hbox = Gtk::manage(new class Gtk::HBox(false, 0)); open_session_hbox = Gtk::manage(new class Gtk::HBox(false, 0));
m_treeview = Gtk::manage(new class Gtk::TreeView()); m_treeview = Gtk::manage(new class Gtk::TreeView());
recent_scrolledwindow = Gtk::manage(new class Gtk::ScrolledWindow()); recent_scrolledwindow = Gtk::manage(new class Gtk::ScrolledWindow());
recent_alignment = Gtk::manage(new class Gtk::Alignment(0.5, 0.5, 1, 1));
recent_sesion_label = Gtk::manage(new class Gtk::Label(_("Open Recent Session"))); recent_sesion_label = Gtk::manage(new class Gtk::Label(_("Open Recent Session")));
recent_frame = Gtk::manage(new class Gtk::Frame()); recent_frame = Gtk::manage(new class Gtk::Frame());
open_session_vbox = Gtk::manage(new class Gtk::VBox(false, 0)); open_session_vbox = Gtk::manage(new class Gtk::VBox(false, 0));
@ -167,7 +168,7 @@ NewSessionDialog::NewSessionDialog()
input_table->set_row_spacings(0); input_table->set_row_spacings(0);
input_table->set_col_spacings(0); input_table->set_col_spacings(0);
input_table->attach(*input_port_vbox, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 6, 6); input_table->attach(*input_port_vbox, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 6, 6);
input_port_alignment->add(*input_table);
input_label->set_alignment(0, 0.5); input_label->set_alignment(0, 0.5);
input_label->set_padding(0,0); input_label->set_padding(0,0);
input_label->set_line_wrap(false); input_label->set_line_wrap(false);
@ -175,7 +176,7 @@ NewSessionDialog::NewSessionDialog()
input_label->set_use_markup(true); input_label->set_use_markup(true);
input_frame->set_shadow_type(Gtk::SHADOW_NONE); input_frame->set_shadow_type(Gtk::SHADOW_NONE);
input_frame->set_label_align(0,0.5); input_frame->set_label_align(0,0.5);
input_frame->add(*input_port_alignment); input_frame->add(*input_table);
input_frame->set_label_widget(*input_label); input_frame->set_label_widget(*input_label);
m_connect_outputs->set_flags(Gtk::CAN_FOCUS); m_connect_outputs->set_flags(Gtk::CAN_FOCUS);
m_connect_outputs->set_relief(Gtk::RELIEF_NORMAL); m_connect_outputs->set_relief(Gtk::RELIEF_NORMAL);
@ -212,7 +213,7 @@ NewSessionDialog::NewSessionDialog()
output_vbox->set_border_width(6); output_vbox->set_border_width(6);
output_vbox->pack_start(*output_port_vbox); output_vbox->pack_start(*output_port_vbox);
output_vbox->pack_start(*output_conn_vbox); output_vbox->pack_start(*output_conn_vbox);
output_port_alignment->add(*output_vbox);
output_label->set_alignment(0, 0.5); output_label->set_alignment(0, 0.5);
output_label->set_padding(0,0); output_label->set_padding(0,0);
output_label->set_line_wrap(false); output_label->set_line_wrap(false);
@ -220,7 +221,7 @@ NewSessionDialog::NewSessionDialog()
output_label->set_use_markup(true); output_label->set_use_markup(true);
output_frame->set_shadow_type(Gtk::SHADOW_NONE); output_frame->set_shadow_type(Gtk::SHADOW_NONE);
output_frame->set_label_align(0,0.5); output_frame->set_label_align(0,0.5);
output_frame->add(*output_port_alignment); output_frame->add(*output_vbox);
output_frame->set_label_widget(*output_label); output_frame->set_label_widget(*output_label);
advanced_vbox->pack_start(*advanced_table, Gtk::PACK_SHRINK, 0); advanced_vbox->pack_start(*advanced_table, Gtk::PACK_SHRINK, 0);
advanced_vbox->pack_start(*input_frame, Gtk::PACK_SHRINK, 12); advanced_vbox->pack_start(*input_frame, Gtk::PACK_SHRINK, 12);
@ -265,13 +266,13 @@ NewSessionDialog::NewSessionDialog()
recent_scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); recent_scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
recent_scrolledwindow->property_window_placement().set_value(Gtk::CORNER_TOP_LEFT); recent_scrolledwindow->property_window_placement().set_value(Gtk::CORNER_TOP_LEFT);
recent_scrolledwindow->add(*m_treeview); recent_scrolledwindow->add(*m_treeview);
recent_alignment->add(*recent_scrolledwindow);
recent_sesion_label->set_padding(0,0); recent_sesion_label->set_padding(0,0);
recent_sesion_label->set_line_wrap(false); recent_sesion_label->set_line_wrap(false);
recent_sesion_label->set_selectable(false); recent_sesion_label->set_selectable(false);
recent_frame->set_border_width(12); recent_frame->set_border_width(12);
recent_frame->set_shadow_type(Gtk::SHADOW_IN); recent_frame->set_shadow_type(Gtk::SHADOW_IN);
recent_frame->add(*recent_alignment); recent_frame->add(*recent_scrolledwindow);
recent_frame->set_label_widget(*recent_sesion_label); recent_frame->set_label_widget(*recent_sesion_label);
open_session_vbox->pack_start(*open_session_hbox, Gtk::PACK_SHRINK, 12); open_session_vbox->pack_start(*open_session_hbox, Gtk::PACK_SHRINK, 12);
open_session_vbox->pack_start(*recent_frame, Gtk::PACK_EXPAND_WIDGET, 0); open_session_vbox->pack_start(*recent_frame, Gtk::PACK_EXPAND_WIDGET, 0);
@ -573,8 +574,11 @@ NewSessionDialog::file_chosen ()
m_treeview->get_selection()->unselect_all(); m_treeview->get_selection()->unselect_all();
get_window()->set_cursor(Gdk::Cursor(Gdk::WATCH));
if (!m_open_filechooser->get_filename().empty()) { if (!m_open_filechooser->get_filename().empty()) {
set_response_sensitive (Gtk::RESPONSE_OK, true); set_response_sensitive (Gtk::RESPONSE_OK, true);
response (Gtk::RESPONSE_OK);
} else { } else {
set_response_sensitive (Gtk::RESPONSE_OK, false); set_response_sensitive (Gtk::RESPONSE_OK, false);
} }

View file

@ -101,14 +101,14 @@ protected:
Gtk::HBox * input_port_limit_hbox; Gtk::HBox * input_port_limit_hbox;
Gtk::VBox * input_port_vbox; Gtk::VBox * input_port_vbox;
Gtk::Table * input_table; Gtk::Table * input_table;
Gtk::Alignment * input_port_alignment;
Gtk::Label * input_label; Gtk::Label * input_label;
Gtk::Frame * input_frame; Gtk::Frame * input_frame;
Gtk::HBox * output_port_limit_hbox; Gtk::HBox * output_port_limit_hbox;
Gtk::VBox * output_port_vbox; Gtk::VBox * output_port_vbox;
Gtk::VBox * output_conn_vbox; Gtk::VBox * output_conn_vbox;
Gtk::VBox * output_vbox; Gtk::VBox * output_vbox;
Gtk::Alignment * output_port_alignment;
Gtk::Label * output_label; Gtk::Label * output_label;
Gtk::Frame * output_frame; Gtk::Frame * output_frame;
Gtk::VBox * advanced_vbox; Gtk::VBox * advanced_vbox;
@ -117,7 +117,7 @@ protected:
Gtk::Table * new_session_table; Gtk::Table * new_session_table;
Gtk::HBox * open_session_hbox; Gtk::HBox * open_session_hbox;
Gtk::ScrolledWindow * recent_scrolledwindow; Gtk::ScrolledWindow * recent_scrolledwindow;
Gtk::Alignment * recent_alignment;
Gtk::Label * recent_sesion_label; Gtk::Label * recent_sesion_label;
Gtk::Frame * recent_frame; Gtk::Frame * recent_frame;
Gtk::VBox * open_session_vbox; Gtk::VBox * open_session_vbox;

View file

@ -136,9 +136,10 @@ class Port : public sigc::trackable {
} }
void ensure_monitor_input (bool yn) { void ensure_monitor_input (bool yn) {
jack_port_request_monitor (_port, yn); jack_port_ensure_monitor (_port, yn);
} }
/*XXX completely bloody useless imho*/
void request_monitor_input (bool yn) { void request_monitor_input (bool yn) {
jack_port_request_monitor (_port, yn); jack_port_request_monitor (_port, yn);
} }

View file

@ -201,7 +201,7 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible
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&)) {
Glib::Mutex::Lock lm (lock); Glib::RWLock::ReaderLock lm (lock);
(obj.*method)(*metrics); (obj.*method)(*metrics);
} }
@ -289,7 +289,7 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible
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 Glib::Mutex lock; mutable Glib::RWLock lock;
void timestamp_metrics (); void timestamp_metrics ();

View file

@ -1713,7 +1713,7 @@ AudioDiskstream::engage_record_enable ()
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) {
(*chan).source->request_monitor_input (!(_session.get_auto_input() && rolling)); (*chan).source->ensure_monitor_input (!(_session.get_auto_input() && rolling));
} }
capturing_sources.push_back ((*chan).write_source); capturing_sources.push_back ((*chan).write_source);
} }
@ -1733,7 +1733,7 @@ AudioDiskstream::disengage_record_enable ()
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) {
(*chan).source->request_monitor_input (false); (*chan).source->ensure_monitor_input (false);
} }
} }
} }
@ -2066,7 +2066,7 @@ AudioDiskstream::monitor_input (bool yn)
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) {
(*chan).source->request_monitor_input (yn); (*chan).source->ensure_monitor_input (yn);
} }
} }
} }

View file

@ -334,7 +334,7 @@ AudioRegion::restore_state (StateManager::State& sstate)
if (_fade_in_disabled != state->_fade_in_disabled) { if (_fade_in_disabled != state->_fade_in_disabled) {
if (_fade_in_disabled == 0 && state->_fade_in_disabled) { if (_fade_in_disabled == 0 && state->_fade_in_disabled) {
set_fade_in_active (false); set_fade_in_active (false);
} if (_fade_in_disabled && state->_fade_in_disabled == 0) { } else if (_fade_in_disabled && state->_fade_in_disabled == 0) {
set_fade_in_active (true); set_fade_in_active (true);
} }
_fade_in_disabled = state->_fade_in_disabled; _fade_in_disabled = state->_fade_in_disabled;
@ -343,7 +343,7 @@ AudioRegion::restore_state (StateManager::State& sstate)
if (_fade_out_disabled != state->_fade_out_disabled) { if (_fade_out_disabled != state->_fade_out_disabled) {
if (_fade_out_disabled == 0 && state->_fade_out_disabled) { if (_fade_out_disabled == 0 && state->_fade_out_disabled) {
set_fade_out_active (false); set_fade_out_active (false);
} if (_fade_out_disabled && state->_fade_out_disabled == 0) { } else if (_fade_out_disabled && state->_fade_out_disabled == 0) {
set_fade_out_active (true); set_fade_out_active (true);
} }
_fade_out_disabled = state->_fade_out_disabled; _fade_out_disabled = state->_fade_out_disabled;

View file

@ -2110,7 +2110,7 @@ void
Route::toggle_monitor_input () Route::toggle_monitor_input ()
{ {
for (vector<Port*>::iterator i = _inputs.begin(); i != _inputs.end(); ++i) { for (vector<Port*>::iterator i = _inputs.begin(); i != _inputs.end(); ++i) {
(*i)->request_monitor_input(!(*i)->monitoring_input()); (*i)->ensure_monitor_input(!(*i)->monitoring_input());
} }
} }

View file

@ -243,7 +243,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
shuttle_speed_threshold = 5; shuttle_speed_threshold = 5;
rf_speed = 2.0; rf_speed = 2.0;
_meter_hold = 100; // XXX unknown units: number of calls to meter::set() _meter_hold = 100; // XXX unknown units: number of calls to meter::set()
_meter_falloff = 1.5f; // XXX unknown units: refresh_rate _meter_falloff = 0.375f; // XXX unknown units: refresh_rate
max_level = 0; max_level = 0;
min_level = 0; min_level = 0;

View file

@ -241,7 +241,7 @@ TempoMap::move_metric_section (MetricSection& section, const BBT_Time& when)
return 1; return 1;
} }
Glib::Mutex::Lock lm (lock); Glib::RWLock::WriterLock lm (lock);
MetricSectionSorter cmp; MetricSectionSorter cmp;
BBT_Time corrected (when); BBT_Time corrected (when);
@ -284,7 +284,7 @@ TempoMap::remove_tempo (const TempoSection& tempo)
bool removed = false; bool removed = false;
{ {
Glib::Mutex::Lock lm (lock); Glib::RWLock::WriterLock lm (lock);
Metrics::iterator i; Metrics::iterator i;
for (i = metrics->begin(); i != metrics->end(); ++i) { for (i = metrics->begin(); i != metrics->end(); ++i) {
@ -311,7 +311,7 @@ TempoMap::remove_meter (const MeterSection& tempo)
bool removed = false; bool removed = false;
{ {
Glib::Mutex::Lock lm (lock); Glib::RWLock::WriterLock lm (lock);
Metrics::iterator i; Metrics::iterator i;
for (i = metrics->begin(); i != metrics->end(); ++i) { for (i = metrics->begin(); i != metrics->end(); ++i) {
@ -362,7 +362,7 @@ void
TempoMap::add_tempo (const Tempo& tempo, BBT_Time where) TempoMap::add_tempo (const Tempo& tempo, BBT_Time where)
{ {
{ {
Glib::Mutex::Lock lm (lock); Glib::RWLock::WriterLock lm (lock);
/* new tempos always start on a beat */ /* new tempos always start on a beat */
@ -382,7 +382,7 @@ TempoMap::replace_tempo (TempoSection& existing, const Tempo& replacement)
bool replaced = false; bool replaced = false;
{ {
Glib::Mutex::Lock lm (lock); Glib::RWLock::WriterLock lm (lock);
Metrics::iterator i; Metrics::iterator i;
for (i = metrics->begin(); i != metrics->end(); ++i) { for (i = metrics->begin(); i != metrics->end(); ++i) {
@ -412,7 +412,7 @@ void
TempoMap::add_meter (const Meter& meter, BBT_Time where) TempoMap::add_meter (const Meter& meter, BBT_Time where)
{ {
{ {
Glib::Mutex::Lock lm (lock); Glib::RWLock::WriterLock lm (lock);
/* a new meter always starts a new bar on the first beat. so /* a new meter always starts a new bar on the first beat. so
round the start time appropriately. remember that round the start time appropriately. remember that
@ -444,7 +444,7 @@ TempoMap::replace_meter (MeterSection& existing, const Meter& replacement)
bool replaced = false; bool replaced = false;
{ {
Glib::Mutex::Lock lm (lock); Glib::RWLock::WriterLock lm (lock);
Metrics::iterator i; Metrics::iterator i;
for (i = metrics->begin(); i != metrics->end(); ++i) { for (i = metrics->begin(); i != metrics->end(); ++i) {
@ -612,8 +612,10 @@ TempoMap::metric_at (BBT_Time bbt) const
void void
TempoMap::bbt_time (jack_nframes_t frame, BBT_Time& bbt) const TempoMap::bbt_time (jack_nframes_t frame, BBT_Time& bbt) const
{ {
Glib::Mutex::Lock lm (lock); {
Glib::RWLock::ReaderLock lm (lock);
bbt_time_unlocked (frame, bbt); bbt_time_unlocked (frame, bbt);
}
} }
void void
@ -760,7 +762,7 @@ TempoMap::bbt_duration_at (jack_nframes_t pos, const BBT_Time& bbt, int dir) con
bbt_time(pos,when); bbt_time(pos,when);
{ {
Glib::Mutex::Lock lm (lock); Glib::RWLock::ReaderLock lm (lock);
frames = bbt_duration_at_unlocked (when, bbt,dir); frames = bbt_duration_at_unlocked (when, bbt,dir);
} }
@ -897,23 +899,26 @@ TempoMap::bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, i
jack_nframes_t jack_nframes_t
TempoMap::round_to_bar (jack_nframes_t fr, int dir) TempoMap::round_to_bar (jack_nframes_t fr, int dir)
{ {
Glib::Mutex::Lock lm (lock); {
Glib::RWLock::ReaderLock lm (lock);
return round_to_type (fr, dir, Bar); return round_to_type (fr, dir, Bar);
}
} }
jack_nframes_t jack_nframes_t
TempoMap::round_to_beat (jack_nframes_t fr, int dir) TempoMap::round_to_beat (jack_nframes_t fr, int dir)
{ {
Glib::Mutex::Lock lm (lock); {
Glib::RWLock::ReaderLock lm (lock);
return round_to_type (fr, dir, Beat); return round_to_type (fr, dir, Beat);
}
} }
jack_nframes_t jack_nframes_t
TempoMap::round_to_beat_subdivision (jack_nframes_t fr, int sub_num) TempoMap::round_to_beat_subdivision (jack_nframes_t fr, int sub_num)
{ {
Glib::Mutex::Lock lm (lock);
TempoMap::BBTPointList::iterator i; TempoMap::BBTPointList::iterator i;
TempoMap::BBTPointList *more_zoomed_bbt_points; TempoMap::BBTPointList *more_zoomed_bbt_points;
jack_nframes_t frame_one_beats_worth; jack_nframes_t frame_one_beats_worth;
@ -926,9 +931,11 @@ TempoMap::round_to_beat_subdivision (jack_nframes_t fr, int sub_num)
int n; int n;
frame_one_beats_worth = (jack_nframes_t) ::floor ((double) _frame_rate * 60 / 20 ); //one beat @ 20 bpm frame_one_beats_worth = (jack_nframes_t) ::floor ((double) _frame_rate * 60 / 20 ); //one beat @ 20 bpm
{
Glib::RWLock::ReaderLock lm (lock);
more_zoomed_bbt_points = get_points((fr >= frame_one_beats_worth) ? more_zoomed_bbt_points = get_points((fr >= frame_one_beats_worth) ?
fr - frame_one_beats_worth : 0, fr+frame_one_beats_worth ); fr - frame_one_beats_worth : 0, fr+frame_one_beats_worth );
}
if (more_zoomed_bbt_points == 0 || more_zoomed_bbt_points->empty()) { if (more_zoomed_bbt_points == 0 || more_zoomed_bbt_points->empty()) {
return fr; return fr;
} }
@ -1030,6 +1037,11 @@ TempoMap::get_points (jack_nframes_t lower, jack_nframes_t upper) const
const TempoSection* t; const TempoSection* t;
uint32_t bar; uint32_t bar;
uint32_t beat; uint32_t beat;
double beats_per_bar;
double beat_frame;
double beat_frames;
double frames_per_bar;
jack_nframes_t limit;
meter = &first_meter (); meter = &first_meter ();
tempo = &first_tempo (); tempo = &first_tempo ();
@ -1070,17 +1082,12 @@ TempoMap::get_points (jack_nframes_t lower, jack_nframes_t upper) const
points = new BBTPointList; points = new BBTPointList;
do {
double beats_per_bar;
double beat_frame;
double beat_frames;
double frames_per_bar;
jack_nframes_t limit;
beats_per_bar = meter->beats_per_bar (); beats_per_bar = meter->beats_per_bar ();
frames_per_bar = meter->frames_per_bar (*tempo, _frame_rate); frames_per_bar = meter->frames_per_bar (*tempo, _frame_rate);
beat_frames = tempo->frames_per_beat (_frame_rate); beat_frames = tempo->frames_per_beat (_frame_rate);
do {
if (i == metrics->end()) { if (i == metrics->end()) {
limit = upper; limit = upper;
} else { } else {
@ -1186,13 +1193,15 @@ TempoMap::meter_at (jack_nframes_t frame)
XMLNode& XMLNode&
TempoMap::get_state () TempoMap::get_state ()
{ {
Glib::Mutex::Lock lm (lock);
Metrics::const_iterator i; Metrics::const_iterator i;
XMLNode *root = new XMLNode ("TempoMap"); XMLNode *root = new XMLNode ("TempoMap");
{
Glib::RWLock::ReaderLock lm (lock);
for (i = metrics->begin(); i != metrics->end(); ++i) { for (i = metrics->begin(); i != metrics->end(); ++i) {
root->add_child_nocopy ((*i)->get_state()); root->add_child_nocopy ((*i)->get_state());
} }
}
return *root; return *root;
} }
@ -1201,7 +1210,7 @@ int
TempoMap::set_state (const XMLNode& node) TempoMap::set_state (const XMLNode& node)
{ {
{ {
Glib::Mutex::Lock lm (lock); Glib::RWLock::WriterLock lm (lock);
XMLNodeList nlist; XMLNodeList nlist;
XMLNodeConstIterator niter; XMLNodeConstIterator niter;
@ -1293,7 +1302,7 @@ TempoMap::get_memento () const
Change Change
TempoMap::restore_state (StateManager::State& state) TempoMap::restore_state (StateManager::State& state)
{ {
Glib::Mutex::Lock lm (lock); Glib::RWLock::ReaderLock lm (lock);
TempoMapState* tmstate = dynamic_cast<TempoMapState*> (&state); TempoMapState* tmstate = dynamic_cast<TempoMapState*> (&state);

View file

@ -84,7 +84,7 @@ void
Track::toggle_monitor_input () Track::toggle_monitor_input ()
{ {
for (vector<Port*>::iterator i = _inputs.begin(); i != _inputs.end(); ++i) { for (vector<Port*>::iterator i = _inputs.begin(); i != _inputs.end(); ++i) {
(*i)->request_monitor_input(!(*i)->monitoring_input()); (*i)->ensure_monitor_input(!(*i)->monitoring_input());
} }
} }
@ -167,12 +167,6 @@ Track::set_record_enable (bool yn, void *src)
return; return;
} }
// Do not set rec enabled if the track can't record.
if (yn && !can_record()) {
error << string_compose( _("Can not arm track '%1'. Check the input connections"), name() ) << endmsg;
return;
}
/* keep track of the meter point as it was before we rec-enabled */ /* keep track of the meter point as it was before we rec-enabled */
if (!_diskstream->record_enabled()) { if (!_diskstream->record_enabled()) {
_saved_meter_point = _meter_point; _saved_meter_point = _meter_point;

View file

@ -51,7 +51,7 @@ void
AutoSpin::stop_timer () AutoSpin::stop_timer ()
{ {
if (have_timer) { if (have_timer) {
gtk_timeout_remove (timeout_tag); g_source_remove (timeout_tag);
have_timer = false; have_timer = false;
} }
} }
@ -151,7 +151,7 @@ AutoSpin::start_spinning (bool decrement, bool page)
have_timer = true; have_timer = true;
timer_calls = 0; timer_calls = 0;
timeout_tag = gtk_timeout_add (initial_timer_interval, timeout_tag = g_timeout_add (initial_timer_interval,
AutoSpin::_timer, AutoSpin::_timer,
this); this);
} }
@ -216,7 +216,7 @@ AutoSpin::timer ()
request a much more frequent update. request a much more frequent update.
*/ */
timeout_tag = gtk_timeout_add (timer_interval, timeout_tag = g_timeout_add (timer_interval,
_timer, _timer,
this); this);
have_timer = true; have_timer = true;

View file

@ -74,7 +74,7 @@ PopUp::remove ()
hide (); hide ();
if (popdown_time != 0 && timeout != -1) { if (popdown_time != 0 && timeout != -1) {
gtk_timeout_remove (timeout); g_source_remove (timeout);
} }
if (delete_on_hide) { if (delete_on_hide) {
@ -94,7 +94,7 @@ PopUp::touch ()
show_all (); show_all ();
if (popdown_time != 0) { if (popdown_time != 0) {
timeout = gtk_timeout_add (popdown_time, timeout = g_timeout_add (popdown_time,
remove_prompt_timeout, remove_prompt_timeout,
this); this);
} }
@ -127,12 +127,12 @@ PopUp::on_delete_event (GdkEventAny* ev)
hide(); hide();
if (popdown_time != 0 && timeout != -1) { if (popdown_time != 0 && timeout != -1) {
gtk_timeout_remove (timeout); g_source_remove (timeout);
} }
if (delete_on_hide) { if (delete_on_hide) {
std::cerr << "deleting prompter\n" << endl; std::cerr << "deleting prompter\n" << endl;
gtk_idle_add (idle_delete, this); g_idle_add (idle_delete, this);
} }
return true; return true;

View file

@ -220,13 +220,13 @@ TreeView_Selector::on_button_press_event(GdkEventButton* ev)
if (ev && (ev->type == GDK_BUTTON_RELEASE || ev->type == GDK_2BUTTON_PRESS)) { if (ev && (ev->type == GDK_BUTTON_RELEASE || ev->type == GDK_2BUTTON_PRESS)) {
if (ev->state & Gdk::CONTROL_MASK) { if (ev->state & Gdk::CONTROL_MASK) {
gtk_idle_add (Selector::_control_clicked, this); g_idle_add (Selector::_control_clicked, this);
} else if (ev->state & Gdk::SHIFT_MASK) { } else if (ev->state & Gdk::SHIFT_MASK) {
gtk_idle_add (Selector::_shift_clicked, this); g_idle_add (Selector::_shift_clicked, this);
} else if (ev->type == GDK_2BUTTON_PRESS) { } else if (ev->type == GDK_2BUTTON_PRESS) {
gtk_idle_add (Selector::_accept, this); g_idle_add (Selector::_accept, this);
} else { } else {
gtk_idle_add (Selector::_chosen, this); g_idle_add (Selector::_chosen, this);
} }
} }