2005-09-25 14:42:24 -04:00
|
|
|
/*
|
2009-10-14 12:10:01 -04:00
|
|
|
Copyright (C) 2000 Paul Davis
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2010-11-13 00:14:48 -05:00
|
|
|
#ifdef WAF_BUILD
|
|
|
|
#include "gtk2ardour-config.h"
|
|
|
|
#endif
|
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
#include <cstdio> // for sprintf, grrr
|
2005-09-25 14:42:24 -04:00
|
|
|
#include <cmath>
|
2009-10-30 11:30:22 -04:00
|
|
|
#include <inttypes.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
#include <gtk/gtkaction.h>
|
|
|
|
|
2009-10-30 11:30:22 -04:00
|
|
|
#include "ardour/session.h"
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/tempo.h"
|
|
|
|
#include "ardour/profile.h"
|
2005-09-25 16:33:00 -04:00
|
|
|
#include <gtkmm2ext/gtk_ui.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include "editor.h"
|
|
|
|
#include "editing.h"
|
2008-03-17 16:54:03 -04:00
|
|
|
#include "actions.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "gtk-custom-hruler.h"
|
|
|
|
#include "gui_thread.h"
|
2008-12-12 09:43:24 -05:00
|
|
|
#include "time_axis_view.h"
|
2009-06-14 09:31:46 -04:00
|
|
|
#include "editor_drag.h"
|
2010-11-16 09:53:16 -05:00
|
|
|
#include "editor_cursors.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include "i18n.h"
|
|
|
|
|
|
|
|
using namespace ARDOUR;
|
Large nasty commit in the form of a 5000 line patch chock-full of completely
unecessary changes. (Sorry, doing a "sprint" based thing, this is the end of the first one)
Achieved MIDI track and bus creation, associated Jack port and diskstream creation, and minimal GUI stuff for creating them. Should be set to start work on actually recording and playing midi to/from disk now.
Relevant (significant) changes:
- Creation of a Buffer class. Base class is type agnostic so things can point to a buffer but not care what kind it is (otherwise it'd be a template). Derived into AudioBuffer and MidiBuffer, with a type tag because checking type is necessary in parts of the code where dynamic_cast wouldn't be wise. Originally I considered this a hack, but passing around a type proved to be a very good solution to all the other problems (below). There is a 1:1 mapping between jack port data types and ardour Buffer types (with a conversion function), but that's easily removed if it ever becomes necessary. Having the type scoped in the Buffer class is maybe not the best spot for it, but whatever (this is proof of concept kinda stuff right now...)
- IO now has a "default" port type (passed to the constructor and stored as a member), used by ensure_io (and similar) to create n ports. IO::register_***_port has a type argument that defaults to the default type if not passed. Rationale: previous IO API is identical, no changes needed to existing code, but path is paved for multiple port types in one IO, which we will need for eg synth plugin inserts, among other things. This is not quite ideal (best would be to only have the two port register functions and have them take a type), but the alternative is a lot of work (namely destroying the 'ensure' functions and everything that uses them) for very little gain. (I am convinced after quite a few tries at the whiteboard that subclassing IO in any way is not a feasible option, look at it's inheritance diagram in Doxygen and you can see why)
- AudioEngine::register_audio_input_port is now register_input_port and takes a type argument. Ditto for output.
- (Most significant change) AudioDiskstream abstracted into Distream, and sibling MidiDiskstream created. Very much still a work in progress, but Diskstream is there to switch references over to (most already are), which is the important part. It is still unclear what the MIDI diskstream's relation to channels is, but I'm pretty sure they will be single channel only (so SMF Type 0) since noone can come up with a reason otherwise.
- MidiTrack creation. Same thing as AudioTrack but with a different default type basically. No big deal here.
- Random cleanups and variable renamings etc. because I have OCD and can't help myself. :)
Known broken: Loading of sessions containing MIDI tracks.
git-svn-id: svn://localhost/ardour2/branches/midi@641 d708f5d6-7413-0410-9779-e7cbd77b26cf
2006-06-26 12:01:34 -04:00
|
|
|
using namespace PBD;
|
2005-09-25 14:42:24 -04:00
|
|
|
using namespace Gtk;
|
|
|
|
using namespace Editing;
|
|
|
|
|
|
|
|
Editor *Editor::ruler_editor;
|
|
|
|
|
|
|
|
/* the order here must match the "metric" enums in editor.h */
|
|
|
|
|
|
|
|
GtkCustomMetric Editor::ruler_metrics[4] = {
|
2009-10-26 10:38:58 -04:00
|
|
|
{1, Editor::_metric_get_timecode },
|
2005-09-25 14:42:24 -04:00
|
|
|
{1, Editor::_metric_get_bbt },
|
2011-01-18 07:51:02 -05:00
|
|
|
{1, Editor::_metric_get_samples },
|
2005-09-25 14:42:24 -04:00
|
|
|
{1, Editor::_metric_get_minsec }
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
Editor::initialize_rulers ()
|
|
|
|
{
|
|
|
|
ruler_editor = this;
|
|
|
|
ruler_grabbed_widget = 0;
|
2008-10-22 02:41:51 -04:00
|
|
|
|
2007-03-19 03:07:38 -04:00
|
|
|
_ruler_separator = new Gtk::HSeparator();
|
|
|
|
_ruler_separator->set_size_request(-1, 2);
|
2007-08-05 19:17:40 -04:00
|
|
|
_ruler_separator->set_name("TimebarPadding");
|
2007-03-19 03:07:38 -04:00
|
|
|
_ruler_separator->show();
|
2008-10-22 02:41:51 -04:00
|
|
|
|
2008-12-12 09:43:24 -05:00
|
|
|
_minsec_ruler = gtk_custom_hruler_new ();
|
|
|
|
minsec_ruler = Glib::wrap (_minsec_ruler);
|
|
|
|
minsec_ruler->set_name ("MinSecRuler");
|
|
|
|
minsec_ruler->set_size_request (-1, (int)timebar_height);
|
|
|
|
gtk_custom_ruler_set_metric (GTK_CUSTOM_RULER(_minsec_ruler), &ruler_metrics[ruler_metric_minsec]);
|
|
|
|
minsec_ruler->hide ();
|
|
|
|
minsec_ruler->set_no_show_all();
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
_timecode_ruler = gtk_custom_hruler_new ();
|
|
|
|
timecode_ruler = Glib::wrap (_timecode_ruler);
|
|
|
|
timecode_ruler->set_name ("TimecodeRuler");
|
|
|
|
timecode_ruler->set_size_request (-1, (int)timebar_height);
|
|
|
|
gtk_custom_ruler_set_metric (GTK_CUSTOM_RULER(_timecode_ruler), &ruler_metrics[ruler_metric_timecode]);
|
|
|
|
timecode_ruler->hide ();
|
|
|
|
timecode_ruler->set_no_show_all();
|
|
|
|
timecode_nmarks = 0;
|
2008-10-22 02:41:51 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
_bbt_ruler = gtk_custom_hruler_new ();
|
2005-10-09 01:03:29 -04:00
|
|
|
bbt_ruler = Glib::wrap (_bbt_ruler);
|
2005-09-25 14:42:24 -04:00
|
|
|
bbt_ruler->set_name ("BBTRuler");
|
2005-09-25 16:33:00 -04:00
|
|
|
bbt_ruler->set_size_request (-1, (int)timebar_height);
|
2005-09-25 14:42:24 -04:00
|
|
|
gtk_custom_ruler_set_metric (GTK_CUSTOM_RULER(_bbt_ruler), &ruler_metrics[ruler_metric_bbt]);
|
2008-10-22 02:41:51 -04:00
|
|
|
bbt_ruler->hide ();
|
|
|
|
bbt_ruler->set_no_show_all();
|
|
|
|
bbt_nmarks = 0;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2011-01-18 07:51:02 -05:00
|
|
|
_samples_ruler = gtk_custom_hruler_new ();
|
|
|
|
samples_ruler = Glib::wrap (_samples_ruler);
|
|
|
|
samples_ruler->set_name ("SamplesRuler");
|
|
|
|
samples_ruler->set_size_request (-1, (int) timebar_height);
|
|
|
|
gtk_custom_ruler_set_metric (GTK_CUSTOM_RULER (_samples_ruler), &ruler_metrics[ruler_metric_samples]);
|
|
|
|
samples_ruler->hide ();
|
|
|
|
samples_ruler->set_no_show_all ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-12-12 09:43:24 -05:00
|
|
|
_bbt_ruler = gtk_custom_hruler_new ();
|
|
|
|
bbt_ruler = Glib::wrap (_bbt_ruler);
|
|
|
|
bbt_ruler->set_name ("BBTRuler");
|
|
|
|
bbt_ruler->set_size_request (-1, (int)timebar_height);
|
|
|
|
gtk_custom_ruler_set_metric (GTK_CUSTOM_RULER(_bbt_ruler), &ruler_metrics[ruler_metric_bbt]);
|
|
|
|
bbt_ruler->hide ();
|
|
|
|
bbt_ruler->set_no_show_all();
|
2008-10-22 02:41:51 -04:00
|
|
|
minsec_ruler->hide ();
|
|
|
|
minsec_ruler->set_no_show_all();
|
|
|
|
minsec_nmarks = 0;
|
|
|
|
|
|
|
|
using namespace Box_Helpers;
|
|
|
|
BoxList & ruler_lab_children = ruler_label_vbox.children();
|
|
|
|
BoxList & ruler_children = time_canvas_vbox.children();
|
|
|
|
BoxList & lab_children = time_button_vbox.children();
|
|
|
|
|
|
|
|
BoxList::iterator canvaspos = ruler_children.begin();
|
|
|
|
|
|
|
|
lab_children.push_back (Element(meter_label, PACK_SHRINK, PACK_START));
|
|
|
|
lab_children.push_back (Element(tempo_label, PACK_SHRINK, PACK_START));
|
|
|
|
lab_children.push_back (Element(range_mark_label, PACK_SHRINK, PACK_START));
|
|
|
|
lab_children.push_back (Element(transport_mark_label, PACK_SHRINK, PACK_START));
|
|
|
|
lab_children.push_back (Element(cd_mark_label, PACK_SHRINK, PACK_START));
|
|
|
|
lab_children.push_back (Element(mark_label, PACK_SHRINK, PACK_START));
|
|
|
|
|
|
|
|
ruler_lab_children.push_back (Element(minsec_label, PACK_SHRINK, PACK_START));
|
|
|
|
ruler_children.insert (canvaspos, Element(*minsec_ruler, PACK_SHRINK, PACK_START));
|
2009-10-26 10:38:58 -04:00
|
|
|
ruler_lab_children.push_back (Element(timecode_label, PACK_SHRINK, PACK_START));
|
|
|
|
ruler_children.insert (canvaspos, Element(*timecode_ruler, PACK_SHRINK, PACK_START));
|
2011-01-18 07:51:02 -05:00
|
|
|
ruler_lab_children.push_back (Element(samples_label, PACK_SHRINK, PACK_START));
|
|
|
|
ruler_children.insert (canvaspos, Element (*samples_ruler, PACK_SHRINK, PACK_START));
|
2008-10-22 02:41:51 -04:00
|
|
|
ruler_lab_children.push_back (Element(bbt_label, PACK_SHRINK, PACK_START));
|
|
|
|
ruler_children.insert (canvaspos, Element(*bbt_ruler, PACK_SHRINK, PACK_START));
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode_ruler->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::SCROLL_MASK);
|
2008-10-22 02:41:51 -04:00
|
|
|
bbt_ruler->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::SCROLL_MASK);
|
2011-01-18 07:51:02 -05:00
|
|
|
samples_ruler->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::SCROLL_MASK);
|
2008-10-22 02:41:51 -04:00
|
|
|
minsec_ruler->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::SCROLL_MASK);
|
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
timecode_ruler->signal_button_release_event().connect (sigc::mem_fun(*this, &Editor::ruler_button_release));
|
|
|
|
bbt_ruler->signal_button_release_event().connect (sigc::mem_fun(*this, &Editor::ruler_button_release));
|
2011-01-18 07:51:02 -05:00
|
|
|
samples_ruler->signal_button_release_event().connect (sigc::mem_fun(*this, &Editor::ruler_button_release));
|
2009-12-11 18:29:48 -05:00
|
|
|
minsec_ruler->signal_button_release_event().connect (sigc::mem_fun(*this, &Editor::ruler_button_release));
|
|
|
|
|
|
|
|
timecode_ruler->signal_button_press_event().connect (sigc::mem_fun(*this, &Editor::ruler_button_press));
|
|
|
|
bbt_ruler->signal_button_press_event().connect (sigc::mem_fun(*this, &Editor::ruler_button_press));
|
2011-01-18 07:51:02 -05:00
|
|
|
samples_ruler->signal_button_press_event().connect (sigc::mem_fun(*this, &Editor::ruler_button_press));
|
2009-12-11 18:29:48 -05:00
|
|
|
minsec_ruler->signal_button_press_event().connect (sigc::mem_fun(*this, &Editor::ruler_button_press));
|
|
|
|
|
|
|
|
timecode_ruler->signal_motion_notify_event().connect (sigc::mem_fun(*this, &Editor::ruler_mouse_motion));
|
|
|
|
bbt_ruler->signal_motion_notify_event().connect (sigc::mem_fun(*this, &Editor::ruler_mouse_motion));
|
2011-01-18 07:51:02 -05:00
|
|
|
samples_ruler->signal_motion_notify_event().connect (sigc::mem_fun(*this, &Editor::ruler_mouse_motion));
|
2009-12-11 18:29:48 -05:00
|
|
|
minsec_ruler->signal_motion_notify_event().connect (sigc::mem_fun(*this, &Editor::ruler_mouse_motion));
|
|
|
|
|
|
|
|
timecode_ruler->signal_scroll_event().connect (sigc::mem_fun(*this, &Editor::ruler_scroll));
|
|
|
|
bbt_ruler->signal_scroll_event().connect (sigc::mem_fun(*this, &Editor::ruler_scroll));
|
2011-01-18 07:51:02 -05:00
|
|
|
samples_ruler->signal_scroll_event().connect (sigc::mem_fun(*this, &Editor::ruler_scroll));
|
2009-12-11 18:29:48 -05:00
|
|
|
minsec_ruler->signal_scroll_event().connect (sigc::mem_fun(*this, &Editor::ruler_scroll));
|
2008-10-22 02:41:51 -04:00
|
|
|
|
|
|
|
visible_timebars = 0; /*this will be changed below */
|
2008-09-17 15:04:16 -04:00
|
|
|
canvas_timebars_vsize = 0;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
bool
|
|
|
|
Editor::ruler_scroll (GdkEventScroll* event)
|
|
|
|
{
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t xdelta;
|
2008-01-10 16:20:59 -05:00
|
|
|
int direction = event->direction;
|
|
|
|
bool handled = false;
|
|
|
|
|
|
|
|
switch (direction) {
|
|
|
|
case GDK_SCROLL_UP:
|
|
|
|
temporal_zoom_step (true);
|
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_SCROLL_DOWN:
|
|
|
|
temporal_zoom_step (false);
|
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_SCROLL_LEFT:
|
|
|
|
xdelta = (current_page_frames() / 2);
|
|
|
|
if (leftmost_frame > xdelta) {
|
|
|
|
reset_x_origin (leftmost_frame - xdelta);
|
|
|
|
} else {
|
|
|
|
reset_x_origin (0);
|
|
|
|
}
|
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_SCROLL_RIGHT:
|
|
|
|
xdelta = (current_page_frames() / 2);
|
2010-09-17 12:24:22 -04:00
|
|
|
if (max_framepos - xdelta > leftmost_frame) {
|
2008-01-10 16:20:59 -05:00
|
|
|
reset_x_origin (leftmost_frame + xdelta);
|
|
|
|
} else {
|
2010-09-17 12:24:22 -04:00
|
|
|
reset_x_origin (max_framepos - current_page_frames());
|
2008-01-10 16:20:59 -05:00
|
|
|
}
|
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
/* what? */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return handled;
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
gint
|
|
|
|
Editor::ruler_button_press (GdkEventButton* ev)
|
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session == 0) {
|
2005-09-25 14:42:24 -04:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// jlc: grab ev->window ?
|
|
|
|
//Gtk::Main::grab_add (*minsec_ruler);
|
|
|
|
Widget * grab_widget = 0;
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode_ruler->is_realized() && ev->window == timecode_ruler->get_window()->gobj()) {
|
|
|
|
grab_widget = timecode_ruler;
|
2009-06-14 09:31:46 -04:00
|
|
|
} else if (bbt_ruler->is_realized() && ev->window == bbt_ruler->get_window()->gobj()) {
|
|
|
|
grab_widget = bbt_ruler;
|
2011-01-18 07:51:02 -05:00
|
|
|
} else if (samples_ruler->is_realized() && ev->window == samples_ruler->get_window()->gobj()) {
|
|
|
|
grab_widget = samples_ruler;
|
2009-06-14 09:31:46 -04:00
|
|
|
} else if (minsec_ruler->is_realized() && ev->window == minsec_ruler->get_window()->gobj()) {
|
|
|
|
grab_widget = minsec_ruler;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
if (grab_widget) {
|
2005-11-12 17:07:07 -05:00
|
|
|
grab_widget->add_modal_grab ();
|
2005-09-25 14:42:24 -04:00
|
|
|
ruler_grabbed_widget = grab_widget;
|
|
|
|
}
|
|
|
|
|
2009-06-14 09:31:46 -04:00
|
|
|
if (ev->button == 1) {
|
2007-10-11 18:07:47 -04:00
|
|
|
// Since we will locate the playhead on button release, cancel any running
|
2007-04-12 19:20:37 -04:00
|
|
|
// auditions.
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session->is_auditioning()) {
|
|
|
|
_session->cancel_audition ();
|
2007-04-12 19:20:37 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
/* playhead cursor */
|
2010-01-12 11:14:49 -05:00
|
|
|
_drags->set (new CursorDrag (this, &playhead_cursor->canvas_item, false), reinterpret_cast<GdkEvent *> (ev));
|
2007-04-14 14:39:01 -04:00
|
|
|
_dragging_playhead = true;
|
2006-11-19 11:45:16 -05:00
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
|
|
|
Editor::ruler_button_release (GdkEventButton* ev)
|
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session == 0) {
|
2005-09-25 14:42:24 -04:00
|
|
|
return FALSE;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-06-14 09:31:46 -04:00
|
|
|
gint x,y;
|
|
|
|
Gdk::ModifierType state;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2010-01-12 11:14:49 -05:00
|
|
|
if (_drags->active ()) {
|
|
|
|
_drags->end_grab (reinterpret_cast<GdkEvent*> (ev));
|
2007-04-14 14:39:01 -04:00
|
|
|
_dragging_playhead = false;
|
2009-06-14 09:31:46 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-06-14 09:31:46 -04:00
|
|
|
if (ev->button == 3) {
|
|
|
|
/* need to use the correct x,y, the event lies */
|
|
|
|
time_canvas_event_box.get_window()->get_pointer (x, y, state);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-06-14 09:31:46 -04:00
|
|
|
stop_canvas_autoscroll();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t where = leftmost_frame + pixel_to_frame (x);
|
2005-09-25 14:42:24 -04:00
|
|
|
snap_to (where);
|
|
|
|
popup_ruler_menu (where);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ruler_grabbed_widget) {
|
2005-11-12 17:07:07 -05:00
|
|
|
ruler_grabbed_widget->remove_modal_grab();
|
2005-09-25 14:42:24 -04:00
|
|
|
ruler_grabbed_widget = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
|
|
|
Editor::ruler_label_button_release (GdkEventButton* ev)
|
|
|
|
{
|
2008-03-17 16:54:03 -04:00
|
|
|
if (ev->button == 3) {
|
|
|
|
Gtk::Menu* m= dynamic_cast<Gtk::Menu*> (ActionManager::get_widget (X_("/RulerMenuPopup")));
|
|
|
|
if (m) {
|
|
|
|
m->popup (1, ev->time);
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
gint
|
|
|
|
Editor::ruler_mouse_motion (GdkEventMotion* ev)
|
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session == 0) {
|
2005-09-25 14:42:24 -04:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-01-12 11:14:49 -05:00
|
|
|
if (_drags->active ()) {
|
|
|
|
_drags->motion_handler (reinterpret_cast<GdkEvent*> (ev), false);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2010-09-17 14:20:37 -04:00
|
|
|
Editor::popup_ruler_menu (framepos_t where, ItemType t)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
using namespace Menu_Helpers;
|
|
|
|
|
|
|
|
if (editor_ruler_menu == 0) {
|
|
|
|
editor_ruler_menu = new Menu;
|
|
|
|
editor_ruler_menu->set_name ("ArdourContextMenu");
|
|
|
|
}
|
|
|
|
|
|
|
|
// always build from scratch
|
|
|
|
MenuList& ruler_items = editor_ruler_menu->items();
|
|
|
|
editor_ruler_menu->set_name ("ArdourContextMenu");
|
|
|
|
ruler_items.clear();
|
|
|
|
|
|
|
|
switch (t) {
|
|
|
|
case MarkerBarItem:
|
2009-12-11 18:29:48 -05:00
|
|
|
ruler_items.push_back (MenuElem (_("New location marker"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, false, false)));
|
|
|
|
ruler_items.push_back (MenuElem (_("Clear all locations"), sigc::mem_fun(*this, &Editor::clear_markers)));
|
|
|
|
ruler_items.push_back (MenuElem (_("Unhide locations"), sigc::mem_fun(*this, &Editor::unhide_markers)));
|
2005-09-25 14:42:24 -04:00
|
|
|
ruler_items.push_back (SeparatorElem ());
|
|
|
|
break;
|
|
|
|
case RangeMarkerBarItem:
|
|
|
|
//ruler_items.push_back (MenuElem (_("New Range")));
|
2009-12-11 18:29:48 -05:00
|
|
|
ruler_items.push_back (MenuElem (_("Clear all ranges"), sigc::mem_fun(*this, &Editor::clear_ranges)));
|
|
|
|
ruler_items.push_back (MenuElem (_("Unhide ranges"), sigc::mem_fun(*this, &Editor::unhide_ranges)));
|
2005-09-25 14:42:24 -04:00
|
|
|
ruler_items.push_back (SeparatorElem ());
|
|
|
|
|
|
|
|
break;
|
|
|
|
case TransportMarkerBarItem:
|
|
|
|
|
|
|
|
break;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
case CdMarkerBarItem:
|
|
|
|
// TODO
|
2009-12-11 18:29:48 -05:00
|
|
|
ruler_items.push_back (MenuElem (_("New CD track marker"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, true, false)));
|
2008-01-10 16:20:59 -05:00
|
|
|
break;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
case TempoBarItem:
|
2009-12-11 18:29:48 -05:00
|
|
|
ruler_items.push_back (MenuElem (_("New Tempo"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_tempo_event), where)));
|
2005-09-25 14:42:24 -04:00
|
|
|
ruler_items.push_back (SeparatorElem ());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MeterBarItem:
|
2009-12-11 18:29:48 -05:00
|
|
|
ruler_items.push_back (MenuElem (_("New Meter"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_meter_event), where)));
|
2005-09-25 14:42:24 -04:00
|
|
|
ruler_items.push_back (SeparatorElem ());
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
Glib::RefPtr<Action> action;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
action = ActionManager::get_action ("Rulers", "toggle-minsec-ruler");
|
|
|
|
if (action) {
|
|
|
|
ruler_items.push_back (MenuElem (*action->create_menu_item()));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2008-03-17 16:54:03 -04:00
|
|
|
if (!Profile->get_sae()) {
|
|
|
|
action = ActionManager::get_action ("Rulers", "toggle-timecode-ruler");
|
|
|
|
if (action) {
|
|
|
|
ruler_items.push_back (MenuElem (*action->create_menu_item()));
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2011-01-18 07:51:02 -05:00
|
|
|
action = ActionManager::get_action ("Rulers", "toggle-samples-ruler");
|
2008-03-17 16:54:03 -04:00
|
|
|
if (action) {
|
|
|
|
ruler_items.push_back (MenuElem (*action->create_menu_item()));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2008-03-17 16:54:03 -04:00
|
|
|
action = ActionManager::get_action ("Rulers", "toggle-bbt-ruler");
|
|
|
|
if (action) {
|
|
|
|
ruler_items.push_back (MenuElem (*action->create_menu_item()));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2008-03-17 16:54:03 -04:00
|
|
|
action = ActionManager::get_action ("Rulers", "toggle-meter-ruler");
|
|
|
|
if (action) {
|
|
|
|
ruler_items.push_back (MenuElem (*action->create_menu_item()));
|
|
|
|
}
|
|
|
|
action = ActionManager::get_action ("Rulers", "toggle-tempo-ruler");
|
|
|
|
if (action) {
|
|
|
|
ruler_items.push_back (MenuElem (*action->create_menu_item()));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2008-01-10 16:20:59 -05:00
|
|
|
if (!Profile->get_sae()) {
|
2008-03-17 16:54:03 -04:00
|
|
|
action = ActionManager::get_action ("Rulers", "toggle-range-ruler");
|
|
|
|
if (action) {
|
|
|
|
ruler_items.push_back (MenuElem (*action->create_menu_item()));
|
2008-01-10 16:20:59 -05:00
|
|
|
}
|
|
|
|
}
|
2008-03-17 16:54:03 -04:00
|
|
|
action = ActionManager::get_action ("Rulers", "toggle-loop-punch-ruler");
|
|
|
|
if (action) {
|
|
|
|
ruler_items.push_back (MenuElem (*action->create_menu_item()));
|
|
|
|
}
|
|
|
|
action = ActionManager::get_action ("Rulers", "toggle-cd-marker-ruler");
|
|
|
|
if (action) {
|
|
|
|
ruler_items.push_back (MenuElem (*action->create_menu_item()));
|
|
|
|
}
|
|
|
|
action = ActionManager::get_action ("Rulers", "toggle-marker-ruler");
|
|
|
|
if (action) {
|
|
|
|
ruler_items.push_back (MenuElem (*action->create_menu_item()));
|
|
|
|
}
|
2008-01-10 16:20:59 -05:00
|
|
|
|
2009-02-15 12:30:42 -05:00
|
|
|
editor_ruler_menu->popup (1, gtk_get_current_event_time());
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
no_ruler_shown_update = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Editor::store_ruler_visibility ()
|
|
|
|
{
|
|
|
|
XMLNode* node = new XMLNode(X_("RulerVisibility"));
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
node->add_property (X_("timecode"), ruler_timecode_action->get_active() ? "yes": "no");
|
2008-03-17 16:54:03 -04:00
|
|
|
node->add_property (X_("bbt"), ruler_bbt_action->get_active() ? "yes": "no");
|
2011-01-18 07:51:02 -05:00
|
|
|
node->add_property (X_("samples"), ruler_samples_action->get_active() ? "yes": "no");
|
2008-03-17 16:54:03 -04:00
|
|
|
node->add_property (X_("minsec"), ruler_minsec_action->get_active() ? "yes": "no");
|
|
|
|
node->add_property (X_("tempo"), ruler_tempo_action->get_active() ? "yes": "no");
|
|
|
|
node->add_property (X_("meter"), ruler_meter_action->get_active() ? "yes": "no");
|
|
|
|
node->add_property (X_("marker"), ruler_marker_action->get_active() ? "yes": "no");
|
|
|
|
node->add_property (X_("rangemarker"), ruler_range_action->get_active() ? "yes": "no");
|
|
|
|
node->add_property (X_("transportmarker"), ruler_loop_punch_action->get_active() ? "yes": "no");
|
|
|
|
node->add_property (X_("cdmarker"), ruler_cd_marker_action->get_active() ? "yes": "no");
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
_session->add_extra_xml (*node);
|
|
|
|
_session->set_dirty ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2007-01-09 18:24:54 -05:00
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
void
|
2005-09-25 14:42:24 -04:00
|
|
|
Editor::restore_ruler_visibility ()
|
|
|
|
{
|
|
|
|
XMLProperty* prop;
|
2009-12-17 13:24:23 -05:00
|
|
|
XMLNode * node = _session->extra_xml (X_("RulerVisibility"));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
no_ruler_shown_update = true;
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (node) {
|
2009-10-26 10:38:58 -04:00
|
|
|
if ((prop = node->property ("timecode")) != 0) {
|
2009-10-02 16:53:31 -04:00
|
|
|
if (string_is_affirmative (prop->value())) {
|
2008-03-17 16:54:03 -04:00
|
|
|
ruler_timecode_action->set_active (true);
|
2008-12-12 09:43:24 -05:00
|
|
|
} else {
|
2008-03-17 16:54:03 -04:00
|
|
|
ruler_timecode_action->set_active (false);
|
2008-12-12 09:43:24 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
if ((prop = node->property ("bbt")) != 0) {
|
2009-10-02 16:53:31 -04:00
|
|
|
if (string_is_affirmative (prop->value())) {
|
2008-03-17 16:54:03 -04:00
|
|
|
ruler_bbt_action->set_active (true);
|
2008-12-12 09:43:24 -05:00
|
|
|
} else {
|
2008-03-17 16:54:03 -04:00
|
|
|
ruler_bbt_action->set_active (false);
|
2008-12-12 09:43:24 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2011-01-18 07:51:02 -05:00
|
|
|
if ((prop = node->property ("samples")) != 0) {
|
2009-10-02 16:53:31 -04:00
|
|
|
if (string_is_affirmative (prop->value())) {
|
2011-01-18 07:51:02 -05:00
|
|
|
ruler_samples_action->set_active (true);
|
2008-12-12 09:43:24 -05:00
|
|
|
} else {
|
2011-01-18 07:51:02 -05:00
|
|
|
ruler_samples_action->set_active (false);
|
2008-12-12 09:43:24 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
if ((prop = node->property ("minsec")) != 0) {
|
2009-10-02 16:53:31 -04:00
|
|
|
if (string_is_affirmative (prop->value())) {
|
2008-03-17 16:54:03 -04:00
|
|
|
ruler_minsec_action->set_active (true);
|
2008-12-12 09:43:24 -05:00
|
|
|
} else {
|
2008-03-17 16:54:03 -04:00
|
|
|
ruler_minsec_action->set_active (false);
|
2008-12-12 09:43:24 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
if ((prop = node->property ("tempo")) != 0) {
|
2009-10-02 16:53:31 -04:00
|
|
|
if (string_is_affirmative (prop->value())) {
|
2008-03-17 16:54:03 -04:00
|
|
|
ruler_tempo_action->set_active (true);
|
2008-12-12 09:43:24 -05:00
|
|
|
} else {
|
2008-03-17 16:54:03 -04:00
|
|
|
ruler_tempo_action->set_active (false);
|
2008-12-12 09:43:24 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
if ((prop = node->property ("meter")) != 0) {
|
2009-10-02 16:53:31 -04:00
|
|
|
if (string_is_affirmative (prop->value())) {
|
2008-03-17 16:54:03 -04:00
|
|
|
ruler_meter_action->set_active (true);
|
2008-12-12 09:43:24 -05:00
|
|
|
} else {
|
2008-03-17 16:54:03 -04:00
|
|
|
ruler_meter_action->set_active (false);
|
2008-12-12 09:43:24 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
if ((prop = node->property ("marker")) != 0) {
|
2009-10-02 16:53:31 -04:00
|
|
|
if (string_is_affirmative (prop->value())) {
|
2008-03-17 16:54:03 -04:00
|
|
|
ruler_marker_action->set_active (true);
|
2008-12-12 09:43:24 -05:00
|
|
|
} else {
|
2008-03-17 16:54:03 -04:00
|
|
|
ruler_marker_action->set_active (false);
|
2008-12-12 09:43:24 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
if ((prop = node->property ("rangemarker")) != 0) {
|
2009-10-02 16:53:31 -04:00
|
|
|
if (string_is_affirmative (prop->value())) {
|
2008-03-17 16:54:03 -04:00
|
|
|
ruler_range_action->set_active (true);
|
2008-12-12 09:43:24 -05:00
|
|
|
} else {
|
2008-03-17 16:54:03 -04:00
|
|
|
ruler_range_action->set_active (false);
|
2008-12-12 09:43:24 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2008-01-10 16:20:59 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if ((prop = node->property ("transportmarker")) != 0) {
|
2009-10-02 16:53:31 -04:00
|
|
|
if (string_is_affirmative (prop->value())) {
|
2008-03-17 16:54:03 -04:00
|
|
|
ruler_loop_punch_action->set_active (true);
|
2008-12-12 09:43:24 -05:00
|
|
|
} else {
|
2008-03-17 16:54:03 -04:00
|
|
|
ruler_loop_punch_action->set_active (false);
|
2008-12-12 09:43:24 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
if ((prop = node->property ("cdmarker")) != 0) {
|
2009-10-02 16:53:31 -04:00
|
|
|
if (string_is_affirmative (prop->value())) {
|
2008-03-17 16:54:03 -04:00
|
|
|
ruler_cd_marker_action->set_active (true);
|
2008-12-12 09:43:24 -05:00
|
|
|
} else {
|
2008-03-17 16:54:03 -04:00
|
|
|
ruler_cd_marker_action->set_active (false);
|
2008-12-12 09:43:24 -05:00
|
|
|
}
|
2008-01-10 16:20:59 -05:00
|
|
|
|
|
|
|
} else {
|
2009-12-17 13:24:23 -05:00
|
|
|
// this _session doesn't yet know about the cdmarker ruler
|
2009-10-14 12:10:01 -04:00
|
|
|
// as a benefit to the user who doesn't know the feature exists, show the ruler if
|
2008-01-10 16:20:59 -05:00
|
|
|
// any cd marks exist
|
2008-03-17 16:54:03 -04:00
|
|
|
ruler_cd_marker_action->set_active (false);
|
2009-12-17 13:24:23 -05:00
|
|
|
const Locations::LocationList & locs = _session->locations()->list();
|
2008-01-10 16:20:59 -05:00
|
|
|
for (Locations::LocationList::const_iterator i = locs.begin(); i != locs.end(); ++i) {
|
|
|
|
if ((*i)->is_cd_marker()) {
|
2008-03-17 16:54:03 -04:00
|
|
|
ruler_cd_marker_action->set_active (true);
|
2008-01-10 16:20:59 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
no_ruler_shown_update = false;
|
2005-09-25 14:42:24 -04:00
|
|
|
update_ruler_visibility ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Editor::update_ruler_visibility ()
|
|
|
|
{
|
2008-09-10 17:27:39 -04:00
|
|
|
int visible_rulers = 0;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
if (no_ruler_shown_update) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
visible_timebars = 0;
|
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
if (ruler_minsec_action->get_active()) {
|
2008-09-10 17:27:39 -04:00
|
|
|
visible_rulers++;
|
2008-10-22 02:41:51 -04:00
|
|
|
minsec_label.show ();
|
|
|
|
minsec_ruler->show ();
|
|
|
|
} else {
|
|
|
|
minsec_label.hide ();
|
|
|
|
minsec_ruler->hide ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
if (ruler_timecode_action->get_active()) {
|
2008-09-10 17:27:39 -04:00
|
|
|
visible_rulers++;
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode_label.show ();
|
|
|
|
timecode_ruler->show ();
|
2008-10-22 02:41:51 -04:00
|
|
|
} else {
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode_label.hide ();
|
|
|
|
timecode_ruler->hide ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2011-01-18 07:51:02 -05:00
|
|
|
if (ruler_samples_action->get_active()) {
|
2008-09-10 17:27:39 -04:00
|
|
|
visible_rulers++;
|
2011-01-18 07:51:02 -05:00
|
|
|
samples_label.show ();
|
|
|
|
samples_ruler->show ();
|
2008-10-22 02:41:51 -04:00
|
|
|
} else {
|
2011-01-18 07:51:02 -05:00
|
|
|
samples_label.hide ();
|
|
|
|
samples_ruler->hide ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
if (ruler_bbt_action->get_active()) {
|
2008-09-10 17:27:39 -04:00
|
|
|
visible_rulers++;
|
2008-10-22 02:41:51 -04:00
|
|
|
bbt_label.show ();
|
|
|
|
bbt_ruler->show ();
|
|
|
|
} else {
|
|
|
|
bbt_label.hide ();
|
|
|
|
bbt_ruler->hide ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2008-09-10 17:27:39 -04:00
|
|
|
double tbpos = 0.0;
|
|
|
|
double tbgpos = 0.0;
|
|
|
|
double old_unit_pos;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-10-22 02:41:51 -04:00
|
|
|
#ifdef GTKOSX
|
|
|
|
/* gtk update probs require this (damn) */
|
|
|
|
meter_label.hide();
|
|
|
|
tempo_label.hide();
|
|
|
|
range_mark_label.hide();
|
|
|
|
transport_mark_label.hide();
|
|
|
|
cd_mark_label.hide();
|
|
|
|
mark_label.hide();
|
|
|
|
#endif
|
|
|
|
if (ruler_meter_action->get_active()) {
|
2005-11-24 09:59:36 -05:00
|
|
|
old_unit_pos = meter_group->property_y();
|
2005-09-25 14:42:24 -04:00
|
|
|
if (tbpos != old_unit_pos) {
|
2005-10-28 18:19:45 -04:00
|
|
|
meter_group->move ( 0.0, tbpos - old_unit_pos);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2008-09-10 17:27:39 -04:00
|
|
|
old_unit_pos = meter_bar_group->property_y();
|
|
|
|
if (tbgpos != old_unit_pos) {
|
|
|
|
meter_bar_group->move ( 0.0, tbgpos - old_unit_pos);
|
2009-10-14 12:10:01 -04:00
|
|
|
}
|
2008-09-10 17:27:39 -04:00
|
|
|
meter_bar_group->show();
|
2005-10-28 18:19:45 -04:00
|
|
|
meter_group->show();
|
2008-10-22 02:41:51 -04:00
|
|
|
meter_label.show();
|
2005-09-25 14:42:24 -04:00
|
|
|
tbpos += timebar_height;
|
2008-09-10 17:27:39 -04:00
|
|
|
tbgpos += timebar_height;
|
2005-09-25 14:42:24 -04:00
|
|
|
visible_timebars++;
|
2008-09-10 17:27:39 -04:00
|
|
|
} else {
|
|
|
|
meter_bar_group->hide();
|
2005-10-28 18:19:45 -04:00
|
|
|
meter_group->hide();
|
2008-10-22 02:41:51 -04:00
|
|
|
meter_label.hide();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
if (ruler_tempo_action->get_active()) {
|
2005-11-28 17:36:26 -05:00
|
|
|
old_unit_pos = tempo_group->property_y();
|
2005-09-25 14:42:24 -04:00
|
|
|
if (tbpos != old_unit_pos) {
|
2005-10-28 18:19:45 -04:00
|
|
|
tempo_group->move(0.0, tbpos - old_unit_pos);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2008-09-10 17:27:39 -04:00
|
|
|
old_unit_pos = tempo_bar_group->property_y();
|
|
|
|
if (tbgpos != old_unit_pos) {
|
|
|
|
tempo_bar_group->move ( 0.0, tbgpos - old_unit_pos);
|
|
|
|
}
|
|
|
|
tempo_bar_group->show();
|
2005-10-28 18:19:45 -04:00
|
|
|
tempo_group->show();
|
2008-10-22 02:41:51 -04:00
|
|
|
tempo_label.show();
|
2005-09-25 14:42:24 -04:00
|
|
|
tbpos += timebar_height;
|
2008-09-10 17:27:39 -04:00
|
|
|
tbgpos += timebar_height;
|
2005-09-25 14:42:24 -04:00
|
|
|
visible_timebars++;
|
2008-09-10 17:27:39 -04:00
|
|
|
} else {
|
|
|
|
tempo_bar_group->hide();
|
2005-10-28 18:19:45 -04:00
|
|
|
tempo_group->hide();
|
2008-10-22 02:41:51 -04:00
|
|
|
tempo_label.hide();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
if (!Profile->get_sae() && ruler_range_action->get_active()) {
|
2005-11-24 09:59:36 -05:00
|
|
|
old_unit_pos = range_marker_group->property_y();
|
2005-09-25 14:42:24 -04:00
|
|
|
if (tbpos != old_unit_pos) {
|
2005-10-28 18:19:45 -04:00
|
|
|
range_marker_group->move (0.0, tbpos - old_unit_pos);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2008-09-10 17:27:39 -04:00
|
|
|
old_unit_pos = range_marker_bar_group->property_y();
|
|
|
|
if (tbgpos != old_unit_pos) {
|
|
|
|
range_marker_bar_group->move (0.0, tbgpos - old_unit_pos);
|
|
|
|
}
|
|
|
|
range_marker_bar_group->show();
|
2005-10-28 18:19:45 -04:00
|
|
|
range_marker_group->show();
|
2008-10-22 02:41:51 -04:00
|
|
|
range_mark_label.show();
|
2008-12-08 12:09:57 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
tbpos += timebar_height;
|
2008-09-10 17:27:39 -04:00
|
|
|
tbgpos += timebar_height;
|
2005-09-25 14:42:24 -04:00
|
|
|
visible_timebars++;
|
2008-01-10 16:20:59 -05:00
|
|
|
} else {
|
2008-09-10 17:27:39 -04:00
|
|
|
range_marker_bar_group->hide();
|
2005-10-28 18:19:45 -04:00
|
|
|
range_marker_group->hide();
|
2008-10-22 02:41:51 -04:00
|
|
|
range_mark_label.hide();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
if (ruler_loop_punch_action->get_active()) {
|
2005-11-24 09:59:36 -05:00
|
|
|
old_unit_pos = transport_marker_group->property_y();
|
2005-09-25 14:42:24 -04:00
|
|
|
if (tbpos != old_unit_pos) {
|
2005-10-28 18:19:45 -04:00
|
|
|
transport_marker_group->move ( 0.0, tbpos - old_unit_pos);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2008-09-10 17:27:39 -04:00
|
|
|
old_unit_pos = transport_marker_bar_group->property_y();
|
|
|
|
if (tbgpos != old_unit_pos) {
|
|
|
|
transport_marker_bar_group->move ( 0.0, tbgpos - old_unit_pos);
|
|
|
|
}
|
|
|
|
transport_marker_bar_group->show();
|
2005-10-28 18:19:45 -04:00
|
|
|
transport_marker_group->show();
|
2008-10-22 02:41:51 -04:00
|
|
|
transport_mark_label.show();
|
2005-09-25 14:42:24 -04:00
|
|
|
tbpos += timebar_height;
|
2008-09-10 17:27:39 -04:00
|
|
|
tbgpos += timebar_height;
|
2005-09-25 14:42:24 -04:00
|
|
|
visible_timebars++;
|
2008-09-10 17:27:39 -04:00
|
|
|
} else {
|
|
|
|
transport_marker_bar_group->hide();
|
2005-10-28 18:19:45 -04:00
|
|
|
transport_marker_group->hide();
|
2008-10-22 02:41:51 -04:00
|
|
|
transport_mark_label.hide();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2008-01-10 16:20:59 -05:00
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
if (ruler_cd_marker_action->get_active()) {
|
2008-01-10 16:20:59 -05:00
|
|
|
old_unit_pos = cd_marker_group->property_y();
|
|
|
|
if (tbpos != old_unit_pos) {
|
|
|
|
cd_marker_group->move (0.0, tbpos - old_unit_pos);
|
|
|
|
}
|
2008-09-10 17:27:39 -04:00
|
|
|
old_unit_pos = cd_marker_bar_group->property_y();
|
|
|
|
if (tbgpos != old_unit_pos) {
|
|
|
|
cd_marker_bar_group->move (0.0, tbgpos - old_unit_pos);
|
|
|
|
}
|
|
|
|
cd_marker_bar_group->show();
|
2008-01-10 16:20:59 -05:00
|
|
|
cd_marker_group->show();
|
2008-10-22 02:41:51 -04:00
|
|
|
cd_mark_label.show();
|
2008-01-10 16:20:59 -05:00
|
|
|
tbpos += timebar_height;
|
2008-09-10 17:27:39 -04:00
|
|
|
tbgpos += timebar_height;
|
2008-01-10 16:20:59 -05:00
|
|
|
visible_timebars++;
|
|
|
|
// make sure all cd markers show up in their respective places
|
|
|
|
update_cd_marker_display();
|
2008-09-10 17:27:39 -04:00
|
|
|
} else {
|
|
|
|
cd_marker_bar_group->hide();
|
2008-01-10 16:20:59 -05:00
|
|
|
cd_marker_group->hide();
|
2008-10-22 02:41:51 -04:00
|
|
|
cd_mark_label.hide();
|
2008-01-10 16:20:59 -05:00
|
|
|
// make sure all cd markers show up in their respective places
|
|
|
|
update_cd_marker_display();
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
if (ruler_marker_action->get_active()) {
|
2007-11-12 17:23:01 -05:00
|
|
|
old_unit_pos = marker_group->property_y();
|
|
|
|
if (tbpos != old_unit_pos) {
|
|
|
|
marker_group->move ( 0.0, tbpos - old_unit_pos);
|
|
|
|
}
|
2008-09-10 17:27:39 -04:00
|
|
|
old_unit_pos = marker_bar_group->property_y();
|
|
|
|
if (tbgpos != old_unit_pos) {
|
|
|
|
marker_bar_group->move ( 0.0, tbgpos - old_unit_pos);
|
|
|
|
}
|
|
|
|
marker_bar_group->show();
|
2007-11-12 17:23:01 -05:00
|
|
|
marker_group->show();
|
2008-10-22 02:41:51 -04:00
|
|
|
mark_label.show();
|
2007-11-12 17:23:01 -05:00
|
|
|
tbpos += timebar_height;
|
2008-09-10 17:27:39 -04:00
|
|
|
tbgpos += timebar_height;
|
2007-11-12 17:23:01 -05:00
|
|
|
visible_timebars++;
|
2008-09-10 17:27:39 -04:00
|
|
|
} else {
|
|
|
|
marker_bar_group->hide();
|
2007-11-12 17:23:01 -05:00
|
|
|
marker_group->hide();
|
2008-10-22 02:41:51 -04:00
|
|
|
mark_label.hide();
|
2007-11-12 17:23:01 -05:00
|
|
|
}
|
2008-10-22 02:41:51 -04:00
|
|
|
|
2008-09-10 17:27:39 -04:00
|
|
|
gdouble old_canvas_timebars_vsize = canvas_timebars_vsize;
|
2008-10-03 14:24:38 -04:00
|
|
|
canvas_timebars_vsize = (timebar_height * visible_timebars) - 1;
|
2008-09-10 17:27:39 -04:00
|
|
|
gdouble vertical_pos_delta = canvas_timebars_vsize - old_canvas_timebars_vsize;
|
2008-10-10 20:04:33 -04:00
|
|
|
vertical_adjustment.set_upper(vertical_adjustment.get_upper() + vertical_pos_delta);
|
|
|
|
full_canvas_height += vertical_pos_delta;
|
2008-09-10 17:27:39 -04:00
|
|
|
|
2009-06-13 13:52:51 -04:00
|
|
|
if (vertical_adjustment.get_value() != 0 && (vertical_adjustment.get_value() + _canvas_height >= full_canvas_height)) {
|
2008-10-10 20:04:33 -04:00
|
|
|
/*if we're at the bottom of the canvas, don't move the _trackview_group*/
|
2009-06-13 13:52:51 -04:00
|
|
|
vertical_adjustment.set_value (full_canvas_height - _canvas_height + 1);
|
2008-09-10 17:27:39 -04:00
|
|
|
} else {
|
2008-10-10 20:04:33 -04:00
|
|
|
_trackview_group->property_y () = - get_trackview_group_vertical_offset ();
|
2008-12-12 09:43:24 -05:00
|
|
|
_background_group->property_y () = - get_trackview_group_vertical_offset ();
|
2008-10-10 20:04:33 -04:00
|
|
|
_trackview_group->move (0, 0);
|
2008-12-12 09:43:24 -05:00
|
|
|
_background_group->move (0, 0);
|
2008-10-10 20:04:33 -04:00
|
|
|
last_trackview_group_vertical_offset = get_trackview_group_vertical_offset ();
|
2008-09-10 17:27:39 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-06-13 13:52:51 -04:00
|
|
|
gdouble bottom_track_pos = vertical_adjustment.get_value() + _canvas_height - canvas_timebars_vsize;
|
2009-07-09 13:58:13 -04:00
|
|
|
std::pair<TimeAxisView*, int> const p = trackview_by_y_position (bottom_track_pos);
|
2009-01-05 22:18:09 -05:00
|
|
|
if (p.first) {
|
|
|
|
p.first->clip_to_viewport ();
|
2008-12-12 09:43:24 -05:00
|
|
|
}
|
|
|
|
|
2008-09-10 17:27:39 -04:00
|
|
|
ruler_label_vbox.set_size_request (-1, (int)(timebar_height * visible_rulers));
|
|
|
|
time_canvas_vbox.set_size_request (-1,-1);
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
|
2011-01-14 19:59:58 -05:00
|
|
|
compute_fixed_ruler_scale ();
|
2008-10-22 02:41:51 -04:00
|
|
|
update_fixed_rulers();
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
redisplay_tempo (false);
|
2010-11-11 10:21:37 -05:00
|
|
|
|
|
|
|
/* Changing ruler visibility means that any lines on markers might need updating */
|
|
|
|
for (LocationMarkerMap::iterator i = location_markers.begin(); i != location_markers.end(); ++i) {
|
|
|
|
i->second->setup_lines ();
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-10-26 10:38:58 -04:00
|
|
|
Editor::update_just_timecode ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &Editor::update_just_timecode)
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session == 0) {
|
2005-09-25 14:42:24 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t rightmost_frame = leftmost_frame + current_page_frames();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
if (ruler_timecode_action->get_active()) {
|
2009-10-26 10:38:58 -04:00
|
|
|
gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_timecode_ruler), leftmost_frame, rightmost_frame,
|
2009-12-17 13:24:23 -05:00
|
|
|
leftmost_frame, _session->current_end_frame());
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
void
|
|
|
|
Editor::compute_fixed_ruler_scale ()
|
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session == 0) {
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
if (ruler_timecode_action->get_active()) {
|
2011-01-17 20:16:05 -05:00
|
|
|
set_timecode_ruler_scale (leftmost_frame, leftmost_frame + current_page_frames());
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
if (ruler_minsec_action->get_active()) {
|
2011-01-17 20:16:05 -05:00
|
|
|
set_minsec_ruler_scale (leftmost_frame, leftmost_frame + current_page_frames());
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
}
|
2011-01-17 20:00:27 -05:00
|
|
|
|
2011-01-18 07:51:02 -05:00
|
|
|
if (ruler_samples_action->get_active()) {
|
|
|
|
set_samples_ruler_scale (leftmost_frame, leftmost_frame + current_page_frames());
|
2011-01-17 20:00:27 -05:00
|
|
|
}
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
|
|
|
Editor::update_fixed_rulers ()
|
|
|
|
{
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t rightmost_frame;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session == 0) {
|
2005-09-25 14:42:24 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
ruler_metrics[ruler_metric_timecode].units_per_pixel = frames_per_unit;
|
2011-01-18 07:51:02 -05:00
|
|
|
ruler_metrics[ruler_metric_samples].units_per_pixel = frames_per_unit;
|
2005-09-25 14:42:24 -04:00
|
|
|
ruler_metrics[ruler_metric_minsec].units_per_pixel = frames_per_unit;
|
|
|
|
|
2008-10-22 02:41:51 -04:00
|
|
|
rightmost_frame = leftmost_frame + current_page_frames();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
/* these force a redraw, which in turn will force execution of the metric callbacks
|
|
|
|
to compute the relevant ticks to display.
|
|
|
|
*/
|
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
if (ruler_timecode_action->get_active()) {
|
2009-10-26 10:38:58 -04:00
|
|
|
gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_timecode_ruler), leftmost_frame, rightmost_frame,
|
2009-12-17 13:24:23 -05:00
|
|
|
leftmost_frame, _session->current_end_frame());
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2011-01-18 07:51:02 -05:00
|
|
|
if (ruler_samples_action->get_active()) {
|
|
|
|
gtk_custom_ruler_set_range (GTK_CUSTOM_RULER (_samples_ruler), leftmost_frame, rightmost_frame,
|
2009-12-17 13:24:23 -05:00
|
|
|
leftmost_frame, _session->current_end_frame());
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
if (ruler_minsec_action->get_active()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_minsec_ruler), leftmost_frame, rightmost_frame,
|
2009-12-17 13:24:23 -05:00
|
|
|
leftmost_frame, _session->current_end_frame());
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
Editor::update_tempo_based_rulers ()
|
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session == 0) {
|
2005-09-25 14:42:24 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ruler_metrics[ruler_metric_bbt].units_per_pixel = frames_per_unit;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
if (ruler_bbt_action->get_active()) {
|
2007-05-31 17:15:28 -04:00
|
|
|
gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_bbt_ruler), leftmost_frame, leftmost_frame+current_page_frames(),
|
2009-12-17 13:24:23 -05:00
|
|
|
leftmost_frame, _session->current_end_frame());
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Mark generation */
|
|
|
|
|
|
|
|
gint
|
2009-10-26 10:38:58 -04:00
|
|
|
Editor::_metric_get_timecode (GtkCustomRulerMark **marks, gdouble lower, gdouble upper, gint maxchars)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-10-26 10:38:58 -04:00
|
|
|
return ruler_editor->metric_get_timecode (marks, lower, upper, maxchars);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
2005-11-25 19:06:46 -05:00
|
|
|
Editor::_metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble upper, gint maxchars)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
return ruler_editor->metric_get_bbt (marks, lower, upper, maxchars);
|
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
2011-01-18 07:51:02 -05:00
|
|
|
Editor::_metric_get_samples (GtkCustomRulerMark **marks, gdouble lower, gdouble upper, gint maxchars)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2011-01-18 07:51:02 -05:00
|
|
|
return ruler_editor->metric_get_samples (marks, lower, upper, maxchars);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
2005-11-25 19:06:46 -05:00
|
|
|
Editor::_metric_get_minsec (GtkCustomRulerMark **marks, gdouble lower, gdouble upper, gint maxchars)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
return ruler_editor->metric_get_minsec (marks, lower, upper, maxchars);
|
|
|
|
}
|
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
void
|
2011-01-17 20:16:05 -05:00
|
|
|
Editor::set_timecode_ruler_scale (framepos_t lower, framepos_t upper)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t spacer;
|
|
|
|
framepos_t fr;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session == 0) {
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
return;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
fr = _session->frame_rate();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2011-01-17 20:16:05 -05:00
|
|
|
if (lower > (spacer = (framepos_t) (128 * Editor::get_current_zoom ()))) {
|
2005-09-25 14:42:24 -04:00
|
|
|
lower = lower - spacer;
|
|
|
|
} else {
|
|
|
|
lower = 0;
|
|
|
|
}
|
2006-09-18 23:29:16 -04:00
|
|
|
upper = upper + spacer;
|
2011-01-17 20:16:05 -05:00
|
|
|
framecnt_t const range = upper - lower;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
if (range < (2 * _session->frames_per_timecode_frame())) { /* 0 - 2 frames */
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode_ruler_scale = timecode_show_bits;
|
|
|
|
timecode_mark_modulo = 20;
|
2009-12-17 13:24:23 -05:00
|
|
|
timecode_nmarks = 2 + (2 * _session->config.get_subframes_per_frame());
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= (fr / 4)) { /* 2 frames - 0.250 second */
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode_ruler_scale = timecode_show_frames;
|
|
|
|
timecode_mark_modulo = 1;
|
2010-09-17 14:20:37 -04:00
|
|
|
timecode_nmarks = 2 + (range / (framepos_t)_session->frames_per_timecode_frame());
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= (fr / 2)) { /* 0.25-0.5 second */
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode_ruler_scale = timecode_show_frames;
|
|
|
|
timecode_mark_modulo = 2;
|
2010-09-17 14:20:37 -04:00
|
|
|
timecode_nmarks = 2 + (range / (framepos_t)_session->frames_per_timecode_frame());
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= fr) { /* 0.5-1 second */
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode_ruler_scale = timecode_show_frames;
|
|
|
|
timecode_mark_modulo = 5;
|
2010-09-17 14:20:37 -04:00
|
|
|
timecode_nmarks = 2 + (range / (framepos_t)_session->frames_per_timecode_frame());
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 2 * fr) { /* 1-2 seconds */
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode_ruler_scale = timecode_show_frames;
|
|
|
|
timecode_mark_modulo = 10;
|
2010-09-17 14:20:37 -04:00
|
|
|
timecode_nmarks = 2 + (range / (framepos_t)_session->frames_per_timecode_frame());
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 8 * fr) { /* 2-8 seconds */
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode_ruler_scale = timecode_show_seconds;
|
|
|
|
timecode_mark_modulo = 1;
|
|
|
|
timecode_nmarks = 2 + (range / fr);
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 16 * fr) { /* 8-16 seconds */
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode_ruler_scale = timecode_show_seconds;
|
|
|
|
timecode_mark_modulo = 2;
|
|
|
|
timecode_nmarks = 2 + (range / fr);
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 30 * fr) { /* 16-30 seconds */
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode_ruler_scale = timecode_show_seconds;
|
|
|
|
timecode_mark_modulo = 5;
|
|
|
|
timecode_nmarks = 2 + (range / fr);
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 60 * fr) { /* 30-60 seconds */
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode_ruler_scale = timecode_show_seconds;
|
|
|
|
timecode_mark_modulo = 5;
|
|
|
|
timecode_nmarks = 2 + (range / fr);
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 2 * 60 * fr) { /* 1-2 minutes */
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode_ruler_scale = timecode_show_seconds;
|
|
|
|
timecode_mark_modulo = 15;
|
|
|
|
timecode_nmarks = 2 + (range / fr);
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 4 * 60 * fr) { /* 2-4 minutes */
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode_ruler_scale = timecode_show_seconds;
|
|
|
|
timecode_mark_modulo = 30;
|
|
|
|
timecode_nmarks = 2 + (range / fr);
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 10 * 60 * fr) { /* 4-10 minutes */
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode_ruler_scale = timecode_show_minutes;
|
|
|
|
timecode_mark_modulo = 2;
|
|
|
|
timecode_nmarks = 2 + 10;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 30 * 60 * fr) { /* 10-30 minutes */
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode_ruler_scale = timecode_show_minutes;
|
|
|
|
timecode_mark_modulo = 5;
|
|
|
|
timecode_nmarks = 2 + 30;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 60 * 60 * fr) { /* 30 minutes - 1hr */
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode_ruler_scale = timecode_show_minutes;
|
|
|
|
timecode_mark_modulo = 10;
|
|
|
|
timecode_nmarks = 2 + 60;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 4 * 60 * 60 * fr) { /* 1 - 4 hrs*/
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode_ruler_scale = timecode_show_minutes;
|
|
|
|
timecode_mark_modulo = 30;
|
|
|
|
timecode_nmarks = 2 + (60 * 4);
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 8 * 60 * 60 * fr) { /* 4 - 8 hrs*/
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode_ruler_scale = timecode_show_hours;
|
|
|
|
timecode_mark_modulo = 1;
|
|
|
|
timecode_nmarks = 2 + 8;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 16 * 60 * 60 * fr) { /* 16-24 hrs*/
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode_ruler_scale = timecode_show_hours;
|
|
|
|
timecode_mark_modulo = 1;
|
|
|
|
timecode_nmarks = 2 + 24;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-09-17 14:20:37 -04:00
|
|
|
/* not possible if framepos_t is a 32 bit quantity */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode_ruler_scale = timecode_show_hours;
|
|
|
|
timecode_mark_modulo = 4;
|
|
|
|
timecode_nmarks = 2 + 24;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
2009-10-26 10:38:58 -04:00
|
|
|
Editor::metric_get_timecode (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upper*/, gint /*maxchars*/)
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
{
|
2010-09-17 12:24:22 -04:00
|
|
|
framepos_t pos;
|
|
|
|
framecnt_t spacer;
|
2009-10-26 10:38:58 -04:00
|
|
|
Timecode::Time timecode;
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
gchar buf[16];
|
|
|
|
gint n;
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session == 0) {
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-09-17 12:24:22 -04:00
|
|
|
if (lower > (spacer = (framecnt_t)(128 * Editor::get_current_zoom ()))) {
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
lower = lower - spacer;
|
|
|
|
} else {
|
|
|
|
lower = 0;
|
|
|
|
}
|
|
|
|
|
2010-12-03 17:26:29 -05:00
|
|
|
pos = (framecnt_t) floor (lower);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * timecode_nmarks);
|
|
|
|
switch (timecode_ruler_scale) {
|
|
|
|
case timecode_show_bits:
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
// Find timecode time of this sample (pos) with subframe accuracy
|
2010-12-01 12:51:17 -05:00
|
|
|
_session->sample_to_timecode(pos, timecode, true /* use_offset */, true /* use_subframes */ );
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
for (n = 0; n < timecode_nmarks; n++) {
|
2010-12-01 12:51:17 -05:00
|
|
|
_session->timecode_to_sample(timecode, pos, true /* use_offset */, true /* use_subframes */ );
|
2009-10-26 10:38:58 -04:00
|
|
|
if ((timecode.subframes % timecode_mark_modulo) == 0) {
|
|
|
|
if (timecode.subframes == 0) {
|
2005-09-25 14:42:24 -04:00
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMajor;
|
2009-10-26 10:38:58 -04:00
|
|
|
snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMinor;
|
2009-10-26 10:38:58 -04:00
|
|
|
snprintf (buf, sizeof(buf), ".%02u", timecode.subframes);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
snprintf (buf, sizeof(buf)," ");
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMicro;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
(*marks)[n].label = g_strdup (buf);
|
|
|
|
(*marks)[n].position = pos;
|
|
|
|
|
|
|
|
// Increment subframes by one
|
2009-12-17 13:24:23 -05:00
|
|
|
Timecode::increment_subframes( timecode, _session->config.get_subframes_per_frame() );
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
break;
|
2009-10-26 10:38:58 -04:00
|
|
|
case timecode_show_seconds:
|
|
|
|
// Find timecode time of this sample (pos)
|
2010-12-01 12:51:17 -05:00
|
|
|
_session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
|
2005-09-25 14:42:24 -04:00
|
|
|
// Go to next whole second down
|
2009-10-26 10:38:58 -04:00
|
|
|
Timecode::seconds_floor( timecode );
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
for (n = 0; n < timecode_nmarks; n++) {
|
2010-12-01 12:51:17 -05:00
|
|
|
_session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
|
2009-10-26 10:38:58 -04:00
|
|
|
if ((timecode.seconds % timecode_mark_modulo) == 0) {
|
|
|
|
if (timecode.seconds == 0) {
|
2005-09-25 14:42:24 -04:00
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMajor;
|
|
|
|
(*marks)[n].position = pos;
|
|
|
|
} else {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMinor;
|
|
|
|
(*marks)[n].position = pos;
|
|
|
|
}
|
2009-10-26 10:38:58 -04:00
|
|
|
snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
|
|
|
snprintf (buf, sizeof(buf)," ");
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMicro;
|
|
|
|
(*marks)[n].position = pos;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
(*marks)[n].label = g_strdup (buf);
|
2009-12-17 13:24:23 -05:00
|
|
|
Timecode::increment_seconds( timecode, _session->config.get_subframes_per_frame() );
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
break;
|
2009-10-26 10:38:58 -04:00
|
|
|
case timecode_show_minutes:
|
|
|
|
// Find timecode time of this sample (pos)
|
2010-12-01 12:51:17 -05:00
|
|
|
_session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
|
2005-09-25 14:42:24 -04:00
|
|
|
// Go to next whole minute down
|
2009-10-26 10:38:58 -04:00
|
|
|
Timecode::minutes_floor( timecode );
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
for (n = 0; n < timecode_nmarks; n++) {
|
2010-12-01 12:51:17 -05:00
|
|
|
_session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
|
2009-10-26 10:38:58 -04:00
|
|
|
if ((timecode.minutes % timecode_mark_modulo) == 0) {
|
|
|
|
if (timecode.minutes == 0) {
|
2005-09-25 14:42:24 -04:00
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMajor;
|
|
|
|
} else {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMinor;
|
|
|
|
}
|
2009-10-26 10:38:58 -04:00
|
|
|
snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
|
|
|
snprintf (buf, sizeof(buf)," ");
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMicro;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
(*marks)[n].label = g_strdup (buf);
|
|
|
|
(*marks)[n].position = pos;
|
2009-12-17 13:24:23 -05:00
|
|
|
Timecode::increment_minutes( timecode, _session->config.get_subframes_per_frame() );
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
|
|
|
|
break;
|
2009-10-26 10:38:58 -04:00
|
|
|
case timecode_show_hours:
|
|
|
|
// Find timecode time of this sample (pos)
|
2010-12-01 12:51:17 -05:00
|
|
|
_session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
|
2005-09-25 14:42:24 -04:00
|
|
|
// Go to next whole hour down
|
2009-10-26 10:38:58 -04:00
|
|
|
Timecode::hours_floor( timecode );
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
for (n = 0; n < timecode_nmarks; n++) {
|
2010-12-01 12:51:17 -05:00
|
|
|
_session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
|
2009-10-26 10:38:58 -04:00
|
|
|
if ((timecode.hours % timecode_mark_modulo) == 0) {
|
2005-09-25 14:42:24 -04:00
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMajor;
|
2009-10-26 10:38:58 -04:00
|
|
|
snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
|
|
|
snprintf (buf, sizeof(buf)," ");
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMicro;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
(*marks)[n].label = g_strdup (buf);
|
|
|
|
(*marks)[n].position = pos;
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
Timecode::increment_hours( timecode, _session->config.get_subframes_per_frame() );
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
break;
|
2009-10-26 10:38:58 -04:00
|
|
|
case timecode_show_frames:
|
|
|
|
// Find timecode time of this sample (pos)
|
2010-12-01 12:51:17 -05:00
|
|
|
_session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
|
2005-09-25 14:42:24 -04:00
|
|
|
// Go to next whole frame down
|
2009-10-26 10:38:58 -04:00
|
|
|
Timecode::frames_floor( timecode );
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
for (n = 0; n < timecode_nmarks; n++) {
|
2010-12-01 12:51:17 -05:00
|
|
|
_session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
|
2009-10-26 10:38:58 -04:00
|
|
|
if ((timecode.frames % timecode_mark_modulo) == 0) {
|
|
|
|
if (timecode.frames == 0) {
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMajor;
|
|
|
|
} else {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMinor;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
(*marks)[n].position = pos;
|
2009-10-26 10:38:58 -04:00
|
|
|
snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
|
|
|
snprintf (buf, sizeof(buf)," ");
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMicro;
|
|
|
|
(*marks)[n].position = pos;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
(*marks)[n].label = g_strdup (buf);
|
2009-12-17 13:24:23 -05:00
|
|
|
Timecode::increment( timecode, _session->config.get_subframes_per_frame() );
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
|
|
|
|
break;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
return timecode_nmarks;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
void
|
2010-09-17 14:20:37 -04:00
|
|
|
Editor::compute_bbt_ruler_scale (framepos_t lower, framepos_t upper)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2010-12-14 13:13:37 -05:00
|
|
|
if (_session == 0) {
|
|
|
|
return;
|
|
|
|
}
|
2006-09-18 23:29:16 -04:00
|
|
|
TempoMap::BBTPointList::iterator i;
|
2010-12-14 13:13:37 -05:00
|
|
|
Timecode::BBT_Time lower_beat, upper_beat; // the beats at each end of the ruler
|
2006-09-18 23:29:16 -04:00
|
|
|
|
2010-12-14 13:13:37 -05:00
|
|
|
_session->bbt_time (lower, lower_beat);
|
|
|
|
_session->bbt_time (upper, upper_beat);
|
|
|
|
uint32_t beats = 0;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
bbt_accent_modulo = 1;
|
|
|
|
bbt_bar_helper_on = false;
|
2010-12-14 13:13:37 -05:00
|
|
|
bbt_bars = 0;
|
|
|
|
bbt_nmarks = 1;
|
2006-09-18 23:29:16 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
bbt_ruler_scale = bbt_over;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-10-26 19:43:04 -04:00
|
|
|
switch (_snap_type) {
|
2010-05-24 20:35:53 -04:00
|
|
|
case SnapToBeatDiv2:
|
|
|
|
bbt_beat_subdivision = 2;
|
|
|
|
break;
|
2010-05-13 14:51:59 -04:00
|
|
|
case SnapToBeatDiv3:
|
2005-09-25 14:42:24 -04:00
|
|
|
bbt_beat_subdivision = 3;
|
2006-09-18 23:29:16 -04:00
|
|
|
break;
|
2010-05-13 14:51:59 -04:00
|
|
|
case SnapToBeatDiv4:
|
2005-09-25 14:42:24 -04:00
|
|
|
bbt_beat_subdivision = 4;
|
2006-09-18 23:29:16 -04:00
|
|
|
break;
|
2010-05-24 20:35:53 -04:00
|
|
|
case SnapToBeatDiv5:
|
|
|
|
bbt_beat_subdivision = 5;
|
|
|
|
bbt_accent_modulo = 2; // XXX YIKES
|
|
|
|
break;
|
|
|
|
case SnapToBeatDiv6:
|
|
|
|
bbt_beat_subdivision = 6;
|
|
|
|
bbt_accent_modulo = 2; // XXX YIKES
|
|
|
|
break;
|
|
|
|
case SnapToBeatDiv7:
|
|
|
|
bbt_beat_subdivision = 7;
|
|
|
|
bbt_accent_modulo = 2; // XXX YIKES
|
|
|
|
break;
|
2010-05-13 14:51:59 -04:00
|
|
|
case SnapToBeatDiv8:
|
2005-09-25 14:42:24 -04:00
|
|
|
bbt_beat_subdivision = 8;
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
bbt_accent_modulo = 2;
|
2006-09-18 23:29:16 -04:00
|
|
|
break;
|
2010-05-24 20:35:53 -04:00
|
|
|
case SnapToBeatDiv10:
|
|
|
|
bbt_beat_subdivision = 10;
|
|
|
|
bbt_accent_modulo = 2; // XXX YIKES
|
2010-05-13 14:51:59 -04:00
|
|
|
break;
|
2010-05-24 20:35:53 -04:00
|
|
|
case SnapToBeatDiv12:
|
|
|
|
bbt_beat_subdivision = 12;
|
|
|
|
bbt_accent_modulo = 3;
|
2010-05-13 14:51:59 -04:00
|
|
|
break;
|
|
|
|
case SnapToBeatDiv14:
|
|
|
|
bbt_beat_subdivision = 14;
|
|
|
|
bbt_accent_modulo = 3; // XXX YIKES!
|
|
|
|
break;
|
2010-05-24 20:35:53 -04:00
|
|
|
case SnapToBeatDiv16:
|
|
|
|
bbt_beat_subdivision = 16;
|
|
|
|
bbt_accent_modulo = 4;
|
2010-05-13 14:51:59 -04:00
|
|
|
break;
|
2010-08-15 06:33:31 -04:00
|
|
|
case SnapToBeatDiv20:
|
|
|
|
bbt_beat_subdivision = 20;
|
|
|
|
bbt_accent_modulo = 5;
|
|
|
|
break;
|
2010-05-24 20:35:53 -04:00
|
|
|
case SnapToBeatDiv24:
|
|
|
|
bbt_beat_subdivision = 24;
|
|
|
|
bbt_accent_modulo = 6;
|
2010-05-13 14:51:59 -04:00
|
|
|
break;
|
2010-05-24 20:35:53 -04:00
|
|
|
case SnapToBeatDiv28:
|
|
|
|
bbt_beat_subdivision = 28;
|
|
|
|
bbt_accent_modulo = 7;
|
2010-05-13 14:51:59 -04:00
|
|
|
break;
|
2010-05-24 20:35:53 -04:00
|
|
|
case SnapToBeatDiv32:
|
|
|
|
bbt_beat_subdivision = 32;
|
|
|
|
bbt_accent_modulo = 8;
|
2010-05-13 14:51:59 -04:00
|
|
|
break;
|
2006-09-18 23:29:16 -04:00
|
|
|
default:
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
bbt_beat_subdivision = 4;
|
2006-09-18 23:29:16 -04:00
|
|
|
break;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2006-09-18 23:29:16 -04:00
|
|
|
if (current_bbt_points == 0 || current_bbt_points->empty()) {
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
return;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2006-09-18 23:29:16 -04:00
|
|
|
i = current_bbt_points->end();
|
|
|
|
i--;
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
if ((*i).beat >= (*current_bbt_points->begin()).beat) {
|
2011-01-17 20:16:05 -05:00
|
|
|
bbt_bars = (*i).bar - (*current_bbt_points->begin()).bar;
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
} else {
|
2011-01-17 20:16:05 -05:00
|
|
|
bbt_bars = (*i).bar - (*current_bbt_points->begin()).bar - 1;
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
}
|
|
|
|
beats = current_bbt_points->size() - bbt_bars;
|
2006-09-18 23:29:16 -04:00
|
|
|
|
2011-01-17 20:16:05 -05:00
|
|
|
/* Only show the bar helper if there aren't many bars on the screen */
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
if ((bbt_bars < 2) || (beats < 5)) {
|
|
|
|
bbt_bar_helper_on = true;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
if (bbt_bars > 8192) {
|
2011-01-17 20:16:05 -05:00
|
|
|
bbt_ruler_scale = bbt_over;
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
} else if (bbt_bars > 1024) {
|
2011-01-17 20:16:05 -05:00
|
|
|
bbt_ruler_scale = bbt_show_64;
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
} else if (bbt_bars > 256) {
|
2011-01-17 20:16:05 -05:00
|
|
|
bbt_ruler_scale = bbt_show_16;
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
} else if (bbt_bars > 64) {
|
2011-01-17 20:16:05 -05:00
|
|
|
bbt_ruler_scale = bbt_show_4;
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
} else if (bbt_bars > 10) {
|
2011-01-17 20:16:05 -05:00
|
|
|
bbt_ruler_scale = bbt_show_1;
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
} else if (bbt_bars > 2) {
|
2011-01-17 20:16:05 -05:00
|
|
|
bbt_ruler_scale = bbt_show_beats;
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
} else if (bbt_bars > 0) {
|
2011-01-17 20:16:05 -05:00
|
|
|
bbt_ruler_scale = bbt_show_ticks;
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
} else {
|
2011-01-17 20:16:05 -05:00
|
|
|
bbt_ruler_scale = bbt_show_ticks_detail;
|
2009-10-14 12:10:01 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2010-12-14 15:28:37 -05:00
|
|
|
if ((bbt_ruler_scale == bbt_show_ticks_detail) && (lower_beat.beats == upper_beat.beats) && (upper_beat.ticks - lower_beat.ticks <= Timecode::BBT_Time::ticks_per_beat / 4)) {
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
bbt_ruler_scale = bbt_show_ticks_super_detail;
|
|
|
|
}
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
gint
|
2009-07-21 11:55:17 -04:00
|
|
|
Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upper*/, gint /*maxchars*/)
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
{
|
2010-12-14 13:13:37 -05:00
|
|
|
if (_session == 0) {
|
|
|
|
return 0;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
TempoMap::BBTPointList::iterator i;
|
|
|
|
|
2010-12-14 13:13:37 -05:00
|
|
|
char buf[64];
|
|
|
|
gint n = 0;
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t pos;
|
2010-12-14 13:13:37 -05:00
|
|
|
Timecode::BBT_Time next_beat;
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t next_beat_pos;
|
2010-12-14 13:13:37 -05:00
|
|
|
uint32_t beats = 0;
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
|
|
|
|
uint32_t tick = 0;
|
|
|
|
uint32_t skip;
|
|
|
|
uint32_t t;
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t frame_skip;
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
double frame_skip_error;
|
|
|
|
double bbt_position_of_helper;
|
|
|
|
double accumulated_error;
|
|
|
|
bool i_am_accented = false;
|
|
|
|
bool helper_active = false;
|
|
|
|
|
|
|
|
if (current_bbt_points == 0 || current_bbt_points->empty()) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (bbt_ruler_scale) {
|
|
|
|
|
|
|
|
case bbt_show_beats:
|
|
|
|
beats = current_bbt_points->size();
|
|
|
|
bbt_nmarks = beats + 2;
|
|
|
|
|
|
|
|
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks);
|
|
|
|
|
|
|
|
(*marks)[0].label = g_strdup(" ");
|
|
|
|
(*marks)[0].position = lower;
|
|
|
|
(*marks)[0].style = GtkCustomRulerMarkMicro;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
for (n = 1, i = current_bbt_points->begin(); n < bbt_nmarks && i != current_bbt_points->end(); ++i) {
|
|
|
|
if ((*i).type != TempoMap::Beat) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if ((*i).frame < lower && (bbt_bar_helper_on)) {
|
|
|
|
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat);
|
2009-10-14 12:10:01 -04:00
|
|
|
(*marks)[0].label = g_strdup (buf);
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
helper_active = true;
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if ((*i).beat == 1) {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMajor;
|
|
|
|
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
|
|
|
|
} else if (((*i).beat % 2 == 1)) {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMinor;
|
|
|
|
snprintf (buf, sizeof(buf), " ");
|
|
|
|
} else {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMicro;
|
|
|
|
snprintf (buf, sizeof(buf), " ");
|
|
|
|
}
|
|
|
|
(*marks)[n].label = g_strdup (buf);
|
|
|
|
(*marks)[n].position = (*i).frame;
|
|
|
|
n++;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
break;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
case bbt_show_ticks:
|
|
|
|
|
|
|
|
beats = current_bbt_points->size();
|
|
|
|
bbt_nmarks = (beats + 2) * bbt_beat_subdivision;
|
|
|
|
|
|
|
|
bbt_position_of_helper = lower + (30 * Editor::get_current_zoom ());
|
|
|
|
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
(*marks)[0].label = g_strdup(" ");
|
2006-11-19 11:45:16 -05:00
|
|
|
(*marks)[0].position = lower;
|
2005-09-25 14:42:24 -04:00
|
|
|
(*marks)[0].style = GtkCustomRulerMarkMicro;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
for (n = 1, i = current_bbt_points->begin(); n < bbt_nmarks && i != current_bbt_points->end(); ++i) {
|
|
|
|
if ((*i).type != TempoMap::Beat) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if ((*i).frame < lower && (bbt_bar_helper_on)) {
|
|
|
|
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat);
|
2009-10-14 12:10:01 -04:00
|
|
|
(*marks)[0].label = g_strdup (buf);
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
helper_active = true;
|
|
|
|
} else {
|
2006-09-18 23:29:16 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
if ((*i).beat == 1) {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMajor;
|
|
|
|
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
|
|
|
|
} else {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMinor;
|
|
|
|
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).beat);
|
|
|
|
}
|
|
|
|
if (((*i).frame < bbt_position_of_helper) && helper_active) {
|
|
|
|
snprintf (buf, sizeof(buf), " ");
|
|
|
|
}
|
|
|
|
(*marks)[n].label = g_strdup (buf);
|
|
|
|
(*marks)[n].position = (*i).frame;
|
|
|
|
n++;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
/* Add the tick marks */
|
|
|
|
|
|
|
|
/* Find the next beat */
|
|
|
|
next_beat.beats = (*i).beat;
|
|
|
|
next_beat.bars = (*i).bar;
|
|
|
|
next_beat.ticks = 0;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
if ((*i).meter->beats_per_bar() > (next_beat.beats + 1)) {
|
|
|
|
next_beat.beats += 1;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
next_beat.bars += 1;
|
|
|
|
next_beat.beats = 1;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
next_beat_pos = _session->tempo_map().frame_time(next_beat);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-09-17 14:20:37 -04:00
|
|
|
frame_skip = (framepos_t) floor (frame_skip_error = (_session->frame_rate() * 60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute()));
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
frame_skip_error -= frame_skip;
|
2010-12-14 15:28:37 -05:00
|
|
|
skip = (uint32_t) (Timecode::BBT_Time::ticks_per_beat / bbt_beat_subdivision);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
pos = (*i).frame + frame_skip;
|
|
|
|
accumulated_error = frame_skip_error;
|
|
|
|
|
|
|
|
tick = skip;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-12-14 15:28:37 -05:00
|
|
|
for (t = 0; (tick < Timecode::BBT_Time::ticks_per_beat) && (n < bbt_nmarks) && (pos < next_beat_pos) ; pos += frame_skip, tick += skip, ++t) {
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
|
|
|
|
if (t % bbt_accent_modulo == (bbt_accent_modulo - 1)) {
|
|
|
|
i_am_accented = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
snprintf (buf, sizeof(buf), " ");
|
|
|
|
(*marks)[n].label = g_strdup (buf);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2010-09-17 14:20:37 -04:00
|
|
|
/* Error compensation for float to framepos_t*/
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
accumulated_error += frame_skip_error;
|
|
|
|
if (accumulated_error > 1) {
|
|
|
|
pos += 1;
|
|
|
|
accumulated_error -= 1.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
(*marks)[n].position = pos;
|
|
|
|
|
|
|
|
if ((bbt_beat_subdivision > 4) && i_am_accented) {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMinor;
|
|
|
|
} else {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMicro;
|
|
|
|
}
|
|
|
|
i_am_accented = false;
|
|
|
|
n++;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
break;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
case bbt_show_ticks_detail:
|
2005-09-25 14:42:24 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
beats = current_bbt_points->size();
|
|
|
|
bbt_nmarks = (beats + 2) * bbt_beat_subdivision;
|
2006-09-18 23:29:16 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
bbt_position_of_helper = lower + (30 * Editor::get_current_zoom ());
|
|
|
|
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks);
|
2006-09-18 23:29:16 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
(*marks)[0].label = g_strdup(" ");
|
|
|
|
(*marks)[0].position = lower;
|
|
|
|
(*marks)[0].style = GtkCustomRulerMarkMicro;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
for (n = 1, i = current_bbt_points->begin(); n < bbt_nmarks && i != current_bbt_points->end(); ++i) {
|
|
|
|
if ((*i).type != TempoMap::Beat) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if ((*i).frame < lower && (bbt_bar_helper_on)) {
|
|
|
|
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat);
|
2009-10-14 12:10:01 -04:00
|
|
|
(*marks)[0].label = g_strdup (buf);
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
helper_active = true;
|
|
|
|
} else {
|
2006-09-18 23:29:16 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
if ((*i).beat == 1) {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMajor;
|
|
|
|
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
|
2006-09-18 23:29:16 -04:00
|
|
|
} else {
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMinor;
|
|
|
|
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).beat);
|
|
|
|
}
|
|
|
|
if (((*i).frame < bbt_position_of_helper) && helper_active) {
|
|
|
|
snprintf (buf, sizeof(buf), " ");
|
|
|
|
}
|
|
|
|
(*marks)[n].label = g_strdup (buf);
|
|
|
|
(*marks)[n].position = (*i).frame;
|
|
|
|
n++;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
/* Add the tick marks */
|
|
|
|
|
|
|
|
/* Find the next beat */
|
|
|
|
|
|
|
|
next_beat.beats = (*i).beat;
|
|
|
|
next_beat.bars = (*i).bar;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
if ((*i).meter->beats_per_bar() > (next_beat.beats + 1)) {
|
|
|
|
next_beat.beats += 1;
|
|
|
|
} else {
|
2006-09-18 23:29:16 -04:00
|
|
|
next_beat.bars += 1;
|
|
|
|
next_beat.beats = 1;
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
next_beat_pos = _session->tempo_map().frame_time(next_beat);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-09-17 14:20:37 -04:00
|
|
|
frame_skip = (framepos_t) floor (frame_skip_error = (_session->frame_rate() * 60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute()));
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
frame_skip_error -= frame_skip;
|
2010-12-14 15:28:37 -05:00
|
|
|
skip = (uint32_t) (Timecode::BBT_Time::ticks_per_beat / bbt_beat_subdivision);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
pos = (*i).frame + frame_skip;
|
|
|
|
accumulated_error = frame_skip_error;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
tick = skip;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-12-14 15:28:37 -05:00
|
|
|
for (t = 0; (tick < Timecode::BBT_Time::ticks_per_beat) && (n < bbt_nmarks) && (pos < next_beat_pos) ; pos += frame_skip, tick += skip, ++t) {
|
2005-09-25 14:42:24 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
if (t % bbt_accent_modulo == (bbt_accent_modulo - 1)) {
|
|
|
|
i_am_accented = true;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
if (i_am_accented && (pos > bbt_position_of_helper)){
|
|
|
|
snprintf (buf, sizeof(buf), "%" PRIu32, tick);
|
|
|
|
} else {
|
|
|
|
snprintf (buf, sizeof(buf), " ");
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
(*marks)[n].label = g_strdup (buf);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2010-09-17 14:20:37 -04:00
|
|
|
/* Error compensation for float to framepos_t*/
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
accumulated_error += frame_skip_error;
|
|
|
|
if (accumulated_error > 1) {
|
|
|
|
pos += 1;
|
|
|
|
accumulated_error -= 1.0f;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
(*marks)[n].position = pos;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
if ((bbt_beat_subdivision > 4) && i_am_accented) {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMinor;
|
|
|
|
} else {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMicro;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
i_am_accented = false;
|
2009-10-14 12:10:01 -04:00
|
|
|
n++;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case bbt_show_ticks_super_detail:
|
2005-09-25 14:42:24 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
beats = current_bbt_points->size();
|
|
|
|
bbt_nmarks = (beats + 2) * bbt_beat_subdivision;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
bbt_position_of_helper = lower + (30 * Editor::get_current_zoom ());
|
|
|
|
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks);
|
|
|
|
|
|
|
|
(*marks)[0].label = g_strdup(" ");
|
|
|
|
(*marks)[0].position = lower;
|
|
|
|
(*marks)[0].style = GtkCustomRulerMarkMicro;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
for (n = 1, i = current_bbt_points->begin(); n < bbt_nmarks && i != current_bbt_points->end(); ++i) {
|
|
|
|
if ((*i).type != TempoMap::Beat) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if ((*i).frame < lower && (bbt_bar_helper_on)) {
|
|
|
|
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat);
|
2009-10-14 12:10:01 -04:00
|
|
|
(*marks)[0].label = g_strdup (buf);
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
helper_active = true;
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if ((*i).beat == 1) {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMajor;
|
|
|
|
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
|
|
|
|
} else {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMinor;
|
|
|
|
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).beat);
|
|
|
|
}
|
|
|
|
if (((*i).frame < bbt_position_of_helper) && helper_active) {
|
|
|
|
snprintf (buf, sizeof(buf), " ");
|
|
|
|
}
|
|
|
|
(*marks)[n].label = g_strdup (buf);
|
|
|
|
(*marks)[n].position = (*i).frame;
|
|
|
|
n++;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
/* Add the tick marks */
|
|
|
|
|
|
|
|
/* Find the next beat */
|
|
|
|
|
|
|
|
next_beat.beats = (*i).beat;
|
|
|
|
next_beat.bars = (*i).bar;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
if ((*i).meter->beats_per_bar() > (next_beat.beats + 1)) {
|
|
|
|
next_beat.beats += 1;
|
|
|
|
} else {
|
|
|
|
next_beat.bars += 1;
|
|
|
|
next_beat.beats = 1;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
next_beat_pos = _session->tempo_map().frame_time(next_beat);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-09-17 14:20:37 -04:00
|
|
|
frame_skip = (framepos_t) floor (frame_skip_error = (_session->frame_rate() * 60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute()));
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
frame_skip_error -= frame_skip;
|
2010-12-14 15:28:37 -05:00
|
|
|
skip = (uint32_t) (Timecode::BBT_Time::ticks_per_beat / bbt_beat_subdivision);
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
|
|
|
|
pos = (*i).frame + frame_skip;
|
|
|
|
accumulated_error = frame_skip_error;
|
|
|
|
|
|
|
|
tick = skip;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-12-14 15:28:37 -05:00
|
|
|
for (t = 0; (tick < Timecode::BBT_Time::ticks_per_beat) && (n < bbt_nmarks) && (pos < next_beat_pos) ; pos += frame_skip, tick += skip, ++t) {
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
|
|
|
|
if (t % bbt_accent_modulo == (bbt_accent_modulo - 1)) {
|
|
|
|
i_am_accented = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pos > bbt_position_of_helper) {
|
|
|
|
snprintf (buf, sizeof(buf), "%" PRIu32, tick);
|
|
|
|
} else {
|
|
|
|
snprintf (buf, sizeof(buf), " ");
|
|
|
|
}
|
|
|
|
|
|
|
|
(*marks)[n].label = g_strdup (buf);
|
|
|
|
|
2010-09-17 14:20:37 -04:00
|
|
|
/* Error compensation for float to framepos_t*/
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
accumulated_error += frame_skip_error;
|
|
|
|
if (accumulated_error > 1) {
|
|
|
|
pos += 1;
|
|
|
|
accumulated_error -= 1.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
(*marks)[n].position = pos;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
if ((bbt_beat_subdivision > 4) && i_am_accented) {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMinor;
|
|
|
|
} else {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMicro;
|
|
|
|
}
|
|
|
|
i_am_accented = false;
|
2009-10-14 12:10:01 -04:00
|
|
|
n++;
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case bbt_over:
|
|
|
|
bbt_nmarks = 1;
|
|
|
|
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks);
|
|
|
|
snprintf (buf, sizeof(buf), "cannot handle %" PRIu32 " bars", bbt_bars );
|
2005-09-25 14:42:24 -04:00
|
|
|
(*marks)[0].style = GtkCustomRulerMarkMajor;
|
|
|
|
(*marks)[0].label = g_strdup (buf);
|
2006-11-19 11:45:16 -05:00
|
|
|
(*marks)[0].position = lower;
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
n = 1;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case bbt_show_64:
|
|
|
|
bbt_nmarks = (gint) (bbt_bars / 64) + 1;
|
|
|
|
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks);
|
|
|
|
for (n = 0, i = current_bbt_points->begin(); i != current_bbt_points->end() && n < bbt_nmarks; i++) {
|
2005-09-25 14:42:24 -04:00
|
|
|
if ((*i).type == TempoMap::Bar) {
|
|
|
|
if ((*i).bar % 64 == 1) {
|
|
|
|
if ((*i).bar % 256 == 1) {
|
|
|
|
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMajor;
|
|
|
|
} else {
|
|
|
|
snprintf (buf, sizeof(buf), " ");
|
|
|
|
if ((*i).bar % 256 == 129) {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMinor;
|
|
|
|
} else {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMicro;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
(*marks)[n].label = g_strdup (buf);
|
|
|
|
(*marks)[n].position = (*i).frame;
|
|
|
|
n++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case bbt_show_16:
|
|
|
|
bbt_nmarks = (bbt_bars / 16) + 1;
|
|
|
|
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks);
|
|
|
|
for (n = 0, i = current_bbt_points->begin(); i != current_bbt_points->end() && n < bbt_nmarks; i++) {
|
|
|
|
if ((*i).type == TempoMap::Bar) {
|
|
|
|
if ((*i).bar % 16 == 1) {
|
|
|
|
if ((*i).bar % 64 == 1) {
|
|
|
|
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMajor;
|
|
|
|
} else {
|
|
|
|
snprintf (buf, sizeof(buf), " ");
|
|
|
|
if ((*i).bar % 64 == 33) {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMinor;
|
|
|
|
} else {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMicro;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
(*marks)[n].label = g_strdup (buf);
|
|
|
|
(*marks)[n].position = (*i).frame;
|
|
|
|
n++;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case bbt_show_4:
|
|
|
|
bbt_nmarks = (bbt_bars / 4) + 1;
|
|
|
|
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks);
|
|
|
|
for (n = 0, i = current_bbt_points->begin(); i != current_bbt_points->end() && n < bbt_nmarks; ++i) {
|
|
|
|
if ((*i).type == TempoMap::Bar) {
|
|
|
|
if ((*i).bar % 4 == 1) {
|
|
|
|
if ((*i).bar % 16 == 1) {
|
|
|
|
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMajor;
|
|
|
|
} else {
|
|
|
|
snprintf (buf, sizeof(buf), " ");
|
|
|
|
if ((*i).bar % 16 == 9) {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMinor;
|
|
|
|
} else {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMicro;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
(*marks)[n].label = g_strdup (buf);
|
|
|
|
(*marks)[n].position = (*i).frame;
|
|
|
|
n++;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case bbt_show_1:
|
|
|
|
// default:
|
|
|
|
bbt_nmarks = bbt_bars + 2;
|
|
|
|
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks );
|
|
|
|
for (n = 0, i = current_bbt_points->begin(); i != current_bbt_points->end() && n < bbt_nmarks; i++) {
|
|
|
|
if ((*i).type == TempoMap::Bar) {
|
|
|
|
if ((*i).bar % 4 == 1) {
|
|
|
|
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMajor;
|
|
|
|
} else {
|
|
|
|
snprintf (buf, sizeof(buf), " ");
|
|
|
|
if ((*i).bar % 4 == 3) {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMinor;
|
|
|
|
} else {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMicro;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
(*marks)[n].label = g_strdup (buf);
|
|
|
|
(*marks)[n].position = (*i).frame;
|
|
|
|
n++;
|
|
|
|
}
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
break;
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
return n; //return the actual number of marks made, since we might have skipped some from fractional time signatures
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2011-01-17 20:00:27 -05:00
|
|
|
void
|
2011-01-18 07:51:02 -05:00
|
|
|
Editor::set_samples_ruler_scale (framepos_t lower, framepos_t upper)
|
2011-01-17 20:00:27 -05:00
|
|
|
{
|
2011-01-18 07:51:02 -05:00
|
|
|
_samples_ruler_interval = (upper - lower) / 5;
|
2011-01-17 20:00:27 -05:00
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
gint
|
2011-01-18 07:51:02 -05:00
|
|
|
Editor::metric_get_samples (GtkCustomRulerMark **marks, gdouble lower, gdouble upper, gint /*maxchars*/)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t pos;
|
2011-01-17 20:00:27 -05:00
|
|
|
framepos_t const ilower = (framepos_t) floor (lower);
|
2005-09-25 14:42:24 -04:00
|
|
|
gchar buf[16];
|
|
|
|
gint nmarks;
|
|
|
|
gint n;
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session == 0) {
|
2005-09-25 14:42:24 -04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
nmarks = 5;
|
|
|
|
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * nmarks);
|
2011-01-18 07:51:02 -05:00
|
|
|
for (n = 0, pos = ilower; n < nmarks; pos += _samples_ruler_interval, ++n) {
|
2008-09-10 17:27:39 -04:00
|
|
|
snprintf (buf, sizeof(buf), "%" PRIi64, pos);
|
2005-09-25 14:42:24 -04:00
|
|
|
(*marks)[n].label = g_strdup (buf);
|
|
|
|
(*marks)[n].position = pos;
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMajor;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
return nmarks;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-09-17 14:20:37 -04:00
|
|
|
sample_to_clock_parts ( framepos_t sample,
|
|
|
|
framepos_t sample_rate,
|
2005-09-25 14:42:24 -04:00
|
|
|
long *hrs_p,
|
|
|
|
long *mins_p,
|
|
|
|
long *secs_p,
|
|
|
|
long *millisecs_p)
|
|
|
|
|
|
|
|
{
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t left;
|
2005-09-25 14:42:24 -04:00
|
|
|
long hrs;
|
|
|
|
long mins;
|
|
|
|
long secs;
|
|
|
|
long millisecs;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
left = sample;
|
|
|
|
hrs = left / (sample_rate * 60 * 60);
|
|
|
|
left -= hrs * sample_rate * 60 * 60;
|
|
|
|
mins = left / (sample_rate * 60);
|
|
|
|
left -= mins * sample_rate * 60;
|
|
|
|
secs = left / sample_rate;
|
|
|
|
left -= secs * sample_rate;
|
|
|
|
millisecs = left * 1000 / sample_rate;
|
|
|
|
|
|
|
|
*millisecs_p = millisecs;
|
|
|
|
*secs_p = secs;
|
|
|
|
*mins_p = mins;
|
|
|
|
*hrs_p = hrs;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
void
|
2011-01-17 20:16:05 -05:00
|
|
|
Editor::set_minsec_ruler_scale (framepos_t lower, framepos_t upper)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t fr;
|
|
|
|
framepos_t spacer;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session == 0) {
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
return;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
fr = _session->frame_rate();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
/* to prevent 'flashing' */
|
2010-09-17 14:20:37 -04:00
|
|
|
if (lower > (spacer = (framepos_t)(128 * Editor::get_current_zoom ()))) {
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
lower -= spacer;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
|
|
|
lower = 0;
|
|
|
|
}
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
upper += spacer;
|
2011-01-17 20:16:05 -05:00
|
|
|
framecnt_t const range = upper - lower;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
if (range < (fr / 50)) {
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
minsec_mark_interval = fr / 1000; /* show 1/1000 seconds */
|
|
|
|
minsec_ruler_scale = minsec_show_frames;
|
|
|
|
minsec_mark_modulo = 10;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= (fr / 10)) { /* 0-0.1 second */
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
minsec_mark_interval = fr / 1000; /* show 1/1000 seconds */
|
|
|
|
minsec_ruler_scale = minsec_show_frames;
|
|
|
|
minsec_mark_modulo = 10;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= (fr / 2)) { /* 0-0.5 second */
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
minsec_mark_interval = fr / 100; /* show 1/100 seconds */
|
|
|
|
minsec_ruler_scale = minsec_show_frames;
|
|
|
|
minsec_mark_modulo = 100;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= fr) { /* 0-1 second */
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
minsec_mark_interval = fr / 10; /* show 1/10 seconds */
|
|
|
|
minsec_ruler_scale = minsec_show_frames;
|
|
|
|
minsec_mark_modulo = 200;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 2 * fr) { /* 1-2 seconds */
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
minsec_mark_interval = fr / 10; /* show 1/10 seconds */
|
|
|
|
minsec_ruler_scale = minsec_show_frames;
|
|
|
|
minsec_mark_modulo = 500;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 8 * fr) { /* 2-5 seconds */
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
minsec_mark_interval = fr / 5; /* show 2 seconds */
|
|
|
|
minsec_ruler_scale = minsec_show_frames;
|
|
|
|
minsec_mark_modulo = 1000;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 16 * fr) { /* 8-16 seconds */
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
minsec_mark_interval = fr; /* show 1 seconds */
|
|
|
|
minsec_ruler_scale = minsec_show_seconds;
|
|
|
|
minsec_mark_modulo = 2;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 30 * fr) { /* 10-30 seconds */
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
minsec_mark_interval = fr; /* show 1 seconds */
|
|
|
|
minsec_ruler_scale = minsec_show_seconds;
|
|
|
|
minsec_mark_modulo = 5;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 60 * fr) { /* 30-60 seconds */
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
minsec_mark_interval = fr; /* show 1 seconds */
|
|
|
|
minsec_ruler_scale = minsec_show_seconds;
|
|
|
|
minsec_mark_modulo = 5;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 2 * 60 * fr) { /* 1-2 minutes */
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
minsec_mark_interval = 5 * fr; /* show 5 seconds */
|
|
|
|
minsec_ruler_scale = minsec_show_seconds;
|
|
|
|
minsec_mark_modulo = 3;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 4 * 60 * fr) { /* 4 minutes */
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
minsec_mark_interval = 5 * fr; /* show 10 seconds */
|
|
|
|
minsec_ruler_scale = minsec_show_seconds;
|
|
|
|
minsec_mark_modulo = 30;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 10 * 60 * fr) { /* 10 minutes */
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
minsec_mark_interval = 30 * fr; /* show 30 seconds */
|
|
|
|
minsec_ruler_scale = minsec_show_seconds;
|
|
|
|
minsec_mark_modulo = 120;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 30 * 60 * fr) { /* 10-30 minutes */
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
minsec_mark_interval = 60 * fr; /* show 1 minute */
|
|
|
|
minsec_ruler_scale = minsec_show_minutes;
|
|
|
|
minsec_mark_modulo = 5;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 60 * 60 * fr) { /* 30 minutes - 1hr */
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
minsec_mark_interval = 2 * 60 * fr; /* show 2 minutes */
|
|
|
|
minsec_ruler_scale = minsec_show_minutes;
|
|
|
|
minsec_mark_modulo = 10;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 4 * 60 * 60 * fr) { /* 1 - 4 hrs*/
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
minsec_mark_interval = 5 * 60 * fr; /* show 10 minutes */
|
|
|
|
minsec_ruler_scale = minsec_show_minutes;
|
|
|
|
minsec_mark_modulo = 30;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 8 * 60 * 60 * fr) { /* 4 - 8 hrs*/
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
minsec_mark_interval = 20 * 60 * fr; /* show 20 minutes */
|
|
|
|
minsec_ruler_scale = minsec_show_minutes;
|
|
|
|
minsec_mark_modulo = 60;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (range <= 16 * 60 * 60 * fr) { /* 16-24 hrs*/
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
minsec_mark_interval = 60 * 60 * fr; /* show 60 minutes */
|
|
|
|
minsec_ruler_scale = minsec_show_hours;
|
|
|
|
minsec_mark_modulo = 2;
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-09-17 14:20:37 -04:00
|
|
|
/* not possible if framepos_t is a 32 bit quantity */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
minsec_mark_interval = 4 * 60 * 60 * fr; /* show 4 hrs */
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
minsec_nmarks = 2 + (range / minsec_mark_interval);
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
gint
|
2009-07-21 11:55:17 -04:00
|
|
|
Editor::metric_get_minsec (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upper*/, gint /*maxchars*/)
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
{
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t pos;
|
|
|
|
framepos_t spacer;
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
long hrs, mins, secs, millisecs;
|
|
|
|
gchar buf[16];
|
|
|
|
gint n;
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session == 0) {
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* to prevent 'flashing' */
|
2011-01-17 20:16:05 -05:00
|
|
|
if (lower > (spacer = (framepos_t) (128 * Editor::get_current_zoom ()))) {
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
lower = lower - spacer;
|
|
|
|
} else {
|
|
|
|
lower = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * minsec_nmarks);
|
2010-09-17 14:20:37 -04:00
|
|
|
pos = ((((framepos_t) floor(lower)) + (minsec_mark_interval/2))/minsec_mark_interval) * minsec_mark_interval;
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
switch (minsec_ruler_scale) {
|
|
|
|
case minsec_show_seconds:
|
|
|
|
for (n = 0; n < minsec_nmarks; pos += minsec_mark_interval, ++n) {
|
2009-12-17 13:24:23 -05:00
|
|
|
sample_to_clock_parts (pos, _session->frame_rate(), &hrs, &mins, &secs, &millisecs);
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
if (secs % minsec_mark_modulo == 0) {
|
2005-09-25 14:42:24 -04:00
|
|
|
if (secs == 0) {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMajor;
|
|
|
|
} else {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMinor;
|
|
|
|
}
|
|
|
|
snprintf (buf, sizeof(buf), "%02ld:%02ld:%02ld.%03ld", hrs, mins, secs, millisecs);
|
|
|
|
} else {
|
|
|
|
snprintf (buf, sizeof(buf), " ");
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMicro;
|
|
|
|
}
|
|
|
|
(*marks)[n].label = g_strdup (buf);
|
|
|
|
(*marks)[n].position = pos;
|
|
|
|
}
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
break;
|
|
|
|
case minsec_show_minutes:
|
|
|
|
for (n = 0; n < minsec_nmarks; pos += minsec_mark_interval, ++n) {
|
2009-12-17 13:24:23 -05:00
|
|
|
sample_to_clock_parts (pos, _session->frame_rate(), &hrs, &mins, &secs, &millisecs);
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
if (mins % minsec_mark_modulo == 0) {
|
2005-09-25 14:42:24 -04:00
|
|
|
if (mins == 0) {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMajor;
|
|
|
|
} else {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMinor;
|
|
|
|
}
|
|
|
|
snprintf (buf, sizeof(buf), "%02ld:%02ld:%02ld.%03ld", hrs, mins, secs, millisecs);
|
|
|
|
} else {
|
|
|
|
snprintf (buf, sizeof(buf), " ");
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMicro;
|
|
|
|
}
|
|
|
|
(*marks)[n].label = g_strdup (buf);
|
|
|
|
(*marks)[n].position = pos;
|
|
|
|
}
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
break;
|
|
|
|
case minsec_show_hours:
|
|
|
|
for (n = 0; n < minsec_nmarks; pos += minsec_mark_interval, ++n) {
|
2009-12-17 13:24:23 -05:00
|
|
|
sample_to_clock_parts (pos, _session->frame_rate(), &hrs, &mins, &secs, &millisecs);
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
if (hrs % minsec_mark_modulo == 0) {
|
2005-09-25 14:42:24 -04:00
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMajor;
|
|
|
|
snprintf (buf, sizeof(buf), "%02ld:%02ld:%02ld.%03ld", hrs, mins, secs, millisecs);
|
|
|
|
} else {
|
|
|
|
snprintf (buf, sizeof(buf), " ");
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMicro;
|
|
|
|
}
|
|
|
|
(*marks)[n].label = g_strdup (buf);
|
|
|
|
(*marks)[n].position = pos;
|
|
|
|
}
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
break;
|
|
|
|
case minsec_show_frames:
|
|
|
|
for (n = 0; n < minsec_nmarks; pos += minsec_mark_interval, ++n) {
|
2009-12-17 13:24:23 -05:00
|
|
|
sample_to_clock_parts (pos, _session->frame_rate(), &hrs, &mins, &secs, &millisecs);
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
if (millisecs % minsec_mark_modulo == 0) {
|
|
|
|
if (secs == 0) {
|
2005-09-25 14:42:24 -04:00
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMajor;
|
|
|
|
} else {
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMinor;
|
|
|
|
}
|
|
|
|
snprintf (buf, sizeof(buf), "%02ld:%02ld:%02ld.%03ld", hrs, mins, secs, millisecs);
|
|
|
|
} else {
|
|
|
|
snprintf (buf, sizeof(buf), " ");
|
|
|
|
(*marks)[n].style = GtkCustomRulerMarkMicro;
|
|
|
|
}
|
|
|
|
(*marks)[n].label = g_strdup (buf);
|
|
|
|
(*marks)[n].position = pos;
|
|
|
|
}
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
break;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
use filechooser widget in export dialog, selected files set format combos, hide progress bar until use in export dialog, speed up 'separate regions in range' operation on larger sessions, ruler scale now calculated separately to mark generation, fix for non-stacked layering regression, try not to generate 'buried' crossfades, use playlist->freeze() to speed up copying/moving regions on large playlists (not done for undo), width dependent items now reset on regionview init, get rid of jack_port_ensure_monitor check, remove audiosourse _length (only source has a length.. i think), make overlapend differ to overlapexternal where start points coincide.
git-svn-id: svn://localhost/ardour2/trunk@2576 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-10-26 09:32:24 -04:00
|
|
|
return minsec_nmarks;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|