Initial commit
[fillmore] / src / marina / marina / TimeSystem.c
diff --git a/src/marina/marina/TimeSystem.c b/src/marina/marina/TimeSystem.c
new file mode 100644 (file)
index 0000000..163403d
--- /dev/null
@@ -0,0 +1,1709 @@
+/* TimeSystem.c generated by valac, the Vala compiler
+ * generated from TimeSystem.vala, do not modify */
+
+/* Copyright 2009-2010 Yorba Foundation
+ *
+ * This software is licensed under the GNU Lesser General Public License
+ * (version 2.1 or later).  See the COPYING file in this distribution. 
+ */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <float.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gst/gst.h>
+
+
+#define MODEL_TYPE_TIME_SYSTEM (model_time_system_get_type ())
+#define MODEL_TIME_SYSTEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MODEL_TYPE_TIME_SYSTEM, ModelTimeSystem))
+#define MODEL_IS_TIME_SYSTEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MODEL_TYPE_TIME_SYSTEM))
+#define MODEL_TIME_SYSTEM_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MODEL_TYPE_TIME_SYSTEM, ModelTimeSystemIface))
+
+typedef struct _ModelTimeSystem ModelTimeSystem;
+typedef struct _ModelTimeSystemIface ModelTimeSystemIface;
+
+#define MODEL_TYPE_TIME_SYSTEM_BASE (model_time_system_base_get_type ())
+#define MODEL_TIME_SYSTEM_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MODEL_TYPE_TIME_SYSTEM_BASE, ModelTimeSystemBase))
+#define MODEL_TIME_SYSTEM_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MODEL_TYPE_TIME_SYSTEM_BASE, ModelTimeSystemBaseClass))
+#define MODEL_IS_TIME_SYSTEM_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MODEL_TYPE_TIME_SYSTEM_BASE))
+#define MODEL_IS_TIME_SYSTEM_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MODEL_TYPE_TIME_SYSTEM_BASE))
+#define MODEL_TIME_SYSTEM_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MODEL_TYPE_TIME_SYSTEM_BASE, ModelTimeSystemBaseClass))
+
+typedef struct _ModelTimeSystemBase ModelTimeSystemBase;
+typedef struct _ModelTimeSystemBaseClass ModelTimeSystemBaseClass;
+typedef struct _ModelTimeSystemBasePrivate ModelTimeSystemBasePrivate;
+
+#define MODEL_TYPE_TIMECODE_TIME_SYSTEM (model_timecode_time_system_get_type ())
+#define MODEL_TIMECODE_TIME_SYSTEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MODEL_TYPE_TIMECODE_TIME_SYSTEM, ModelTimecodeTimeSystem))
+#define MODEL_TIMECODE_TIME_SYSTEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MODEL_TYPE_TIMECODE_TIME_SYSTEM, ModelTimecodeTimeSystemClass))
+#define MODEL_IS_TIMECODE_TIME_SYSTEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MODEL_TYPE_TIMECODE_TIME_SYSTEM))
+#define MODEL_IS_TIMECODE_TIME_SYSTEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MODEL_TYPE_TIMECODE_TIME_SYSTEM))
+#define MODEL_TIMECODE_TIME_SYSTEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MODEL_TYPE_TIMECODE_TIME_SYSTEM, ModelTimecodeTimeSystemClass))
+
+typedef struct _ModelTimecodeTimeSystem ModelTimecodeTimeSystem;
+typedef struct _ModelTimecodeTimeSystemClass ModelTimecodeTimeSystemClass;
+typedef struct _ModelTimecodeTimeSystemPrivate ModelTimecodeTimeSystemPrivate;
+
+#define TYPE_FRACTION (fraction_get_type ())
+typedef struct _Fraction Fraction;
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define TYPE_TIME_CODE (time_code_get_type ())
+typedef struct _TimeCode TimeCode;
+
+#define MODEL_TYPE_TEMPO_INFORMATION (model_tempo_information_get_type ())
+#define MODEL_TEMPO_INFORMATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MODEL_TYPE_TEMPO_INFORMATION, ModelTempoInformation))
+#define MODEL_IS_TEMPO_INFORMATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MODEL_TYPE_TEMPO_INFORMATION))
+#define MODEL_TEMPO_INFORMATION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MODEL_TYPE_TEMPO_INFORMATION, ModelTempoInformationIface))
+
+typedef struct _ModelTempoInformation ModelTempoInformation;
+typedef struct _ModelTempoInformationIface ModelTempoInformationIface;
+
+#define MODEL_TYPE_BAR_BEAT_TIME_SYSTEM (model_bar_beat_time_system_get_type ())
+#define MODEL_BAR_BEAT_TIME_SYSTEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MODEL_TYPE_BAR_BEAT_TIME_SYSTEM, ModelBarBeatTimeSystem))
+#define MODEL_BAR_BEAT_TIME_SYSTEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MODEL_TYPE_BAR_BEAT_TIME_SYSTEM, ModelBarBeatTimeSystemClass))
+#define MODEL_IS_BAR_BEAT_TIME_SYSTEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MODEL_TYPE_BAR_BEAT_TIME_SYSTEM))
+#define MODEL_IS_BAR_BEAT_TIME_SYSTEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MODEL_TYPE_BAR_BEAT_TIME_SYSTEM))
+#define MODEL_BAR_BEAT_TIME_SYSTEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MODEL_TYPE_BAR_BEAT_TIME_SYSTEM, ModelBarBeatTimeSystemClass))
+
+typedef struct _ModelBarBeatTimeSystem ModelBarBeatTimeSystem;
+typedef struct _ModelBarBeatTimeSystemClass ModelBarBeatTimeSystemClass;
+typedef struct _ModelBarBeatTimeSystemPrivate ModelBarBeatTimeSystemPrivate;
+
+#define LOGGING_TYPE_FACILITY (logging_facility_get_type ())
+
+#define LOGGING_TYPE_LEVEL (logging_level_get_type ())
+
+struct _ModelTimeSystemIface {
+       GTypeInterface parent_iface;
+       void (*calculate_pixel_step) (ModelTimeSystem* self, float inc, float pixel_min, float pixel_div);
+       gint64 (*xpos_to_time) (ModelTimeSystem* self, gint x);
+       gint64 (*xsize_to_time) (ModelTimeSystem* self, gint x);
+       gint (*time_to_xpos) (ModelTimeSystem* self, gint64 time);
+       gint64 (*get_pixel_snap_time) (ModelTimeSystem* self);
+       gint (*time_to_xsize) (ModelTimeSystem* self, gint64 time);
+       float (*get_pixel_percentage) (ModelTimeSystem* self);
+       gint (*get_start_token) (ModelTimeSystem* self, gint xsize);
+       gint (*get_next_position) (ModelTimeSystem* self, gint token);
+       gint (*get_pixel_height) (ModelTimeSystem* self, gint token);
+       char* (*get_display_string) (ModelTimeSystem* self, gint token);
+       gint (*frame_to_xsize) (ModelTimeSystem* self, gint frame);
+       gint (*xsize_to_frame) (ModelTimeSystem* self, gint xsize);
+       char* (*get_time_string) (ModelTimeSystem* self, gint64 time);
+       char* (*get_time_duration) (ModelTimeSystem* self, gint64 time);
+};
+
+struct _ModelTimeSystemBase {
+       GObject parent_instance;
+       ModelTimeSystemBasePrivate * priv;
+       float pixel_percentage;
+       float pixels_per_second;
+       gint64 pixel_snap_time;
+};
+
+struct _ModelTimeSystemBaseClass {
+       GObjectClass parent_class;
+       gint* (*get_timeline_seconds) (ModelTimeSystemBase* self, int* result_length1);
+       gint (*correct_sub_second_value) (ModelTimeSystemBase* self, float seconds, gint div, gint fps);
+};
+
+struct _Fraction {
+       gint numerator;
+       gint denominator;
+};
+
+struct _ModelTimecodeTimeSystem {
+       ModelTimeSystemBase parent_instance;
+       ModelTimecodeTimeSystemPrivate * priv;
+       Fraction frame_rate_fraction;
+};
+
+struct _ModelTimecodeTimeSystemClass {
+       ModelTimeSystemBaseClass parent_class;
+};
+
+struct _ModelTimecodeTimeSystemPrivate {
+       float pixels_per_frame;
+       gint small_pixel_frames;
+       gint medium_pixel_frames;
+       gint large_pixel_frames;
+};
+
+struct _TimeCode {
+       gint hour;
+       gint minute;
+       gint second;
+       gint frame;
+       gboolean drop_code;
+};
+
+struct _ModelTempoInformationIface {
+       GTypeInterface parent_iface;
+       void (*get_time_signature) (ModelTempoInformation* self, Fraction* result);
+       gint (*get_bpm) (ModelTempoInformation* self);
+};
+
+struct _ModelBarBeatTimeSystem {
+       ModelTimeSystemBase parent_instance;
+       ModelBarBeatTimeSystemPrivate * priv;
+};
+
+struct _ModelBarBeatTimeSystemClass {
+       ModelTimeSystemBaseClass parent_class;
+};
+
+struct _ModelBarBeatTimeSystemPrivate {
+       float pixels_per_sixteenth;
+       gint small_pixel_sixteenth;
+       gint medium_pixel_sixteenth;
+       gint large_pixel_sixteenth;
+       gint* timeline_bars;
+       gint timeline_bars_length1;
+       gint _timeline_bars_size_;
+       gint bpm;
+       Fraction time_signature;
+       float bars_per_minute;
+       float bars_per_second;
+       gint sixteenths_per_bar;
+       gint sixteenths_per_beat;
+};
+
+typedef enum  {
+       LOGGING_FACILITY_SIGNAL_HANDLERS,
+       LOGGING_FACILITY_DEVELOPER_WARNINGS,
+       LOGGING_FACILITY_GRAPH,
+       LOGGING_FACILITY_LOADING,
+       LOGGING_FACILITY_IMPORT,
+       LOGGING_FACILITY_SINGLEDECODEBIN
+} LoggingFacility;
+
+typedef enum  {
+       LOGGING_LEVEL_CRITICAL,
+       LOGGING_LEVEL_HIGH,
+       LOGGING_LEVEL_MEDIUM,
+       LOGGING_LEVEL_LOW,
+       LOGGING_LEVEL_INFO,
+       LOGGING_LEVEL_VERBOSE
+} LoggingLevel;
+
+
+static gpointer model_time_system_base_parent_class = NULL;
+static gpointer model_timecode_time_system_parent_class = NULL;
+static ModelTimeSystemIface* model_timecode_time_system_model_time_system_parent_iface = NULL;
+static gpointer model_bar_beat_time_system_parent_class = NULL;
+static ModelTimeSystemIface* model_bar_beat_time_system_model_time_system_parent_iface = NULL;
+
+GType model_time_system_get_type (void);
+void model_time_system_calculate_pixel_step (ModelTimeSystem* self, float inc, float pixel_min, float pixel_div);
+gint64 model_time_system_xpos_to_time (ModelTimeSystem* self, gint x);
+gint64 model_time_system_xsize_to_time (ModelTimeSystem* self, gint x);
+gint model_time_system_time_to_xpos (ModelTimeSystem* self, gint64 time);
+gint64 model_time_system_get_pixel_snap_time (ModelTimeSystem* self);
+gint model_time_system_time_to_xsize (ModelTimeSystem* self, gint64 time);
+float model_time_system_get_pixel_percentage (ModelTimeSystem* self);
+gint model_time_system_get_start_token (ModelTimeSystem* self, gint xsize);
+gint model_time_system_get_next_position (ModelTimeSystem* self, gint token);
+gint model_time_system_get_pixel_height (ModelTimeSystem* self, gint token);
+char* model_time_system_get_display_string (ModelTimeSystem* self, gint token);
+gint model_time_system_frame_to_xsize (ModelTimeSystem* self, gint frame);
+gint model_time_system_xsize_to_frame (ModelTimeSystem* self, gint xsize);
+char* model_time_system_get_time_string (ModelTimeSystem* self, gint64 time);
+char* model_time_system_get_time_duration (ModelTimeSystem* self, gint64 time);
+GType model_time_system_base_get_type (void);
+enum  {
+       MODEL_TIME_SYSTEM_BASE_DUMMY_PROPERTY
+};
+#define MODEL_TIME_SYSTEM_BASE_PIXEL_SNAP_INTERVAL 10
+#define MODEL_TIME_SYSTEM_BASE_BORDER 4
+static gint* model_time_system_base_get_timeline_seconds (ModelTimeSystemBase* self, int* result_length1);
+static gint* model_time_system_base_real_get_timeline_seconds (ModelTimeSystemBase* self, int* result_length1);
+static gint model_time_system_base_correct_sub_second_value (ModelTimeSystemBase* self, float seconds, gint div, gint fps);
+static gint model_time_system_base_real_correct_sub_second_value (ModelTimeSystemBase* self, float seconds, gint div, gint fps);
+gint model_time_system_base_correct_seconds_value (ModelTimeSystemBase* self, float seconds, gint div, gint fps);
+gint64 model_time_system_base_get_pixel_snap_time (ModelTimeSystemBase* self);
+float model_time_system_base_get_pixel_percentage (ModelTimeSystemBase* self);
+gint64 model_time_system_base_xsize_to_time (ModelTimeSystemBase* self, gint size);
+gint64 model_time_system_base_xpos_to_time (ModelTimeSystemBase* self, gint x);
+gint model_time_system_base_time_to_xsize (ModelTimeSystemBase* self, gint64 time);
+gint model_time_system_base_time_to_xpos (ModelTimeSystemBase* self, gint64 time);
+ModelTimeSystemBase* model_time_system_base_construct (GType object_type);
+static void model_time_system_base_finalize (GObject* obj);
+GType model_timecode_time_system_get_type (void);
+GType fraction_get_type (void);
+Fraction* fraction_dup (const Fraction* self);
+void fraction_free (Fraction* self);
+#define MODEL_TIMECODE_TIME_SYSTEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MODEL_TYPE_TIMECODE_TIME_SYSTEM, ModelTimecodeTimeSystemPrivate))
+enum  {
+       MODEL_TIMECODE_TIME_SYSTEM_DUMMY_PROPERTY
+};
+void fraction_init (Fraction *self, gint numerator, gint denominator);
+static gint model_timecode_time_system_real_correct_sub_second_value (ModelTimeSystemBase* base, float seconds, gint div, gint fps);
+gint time_to_frame_with_rate (gint64 time, Fraction* rate);
+char* frame_to_string (gint frame, Fraction* rate);
+static char* model_timecode_time_system_real_get_time_string (ModelTimeSystem* base, gint64 the_time);
+static char* model_timecode_time_system_real_get_time_duration (ModelTimeSystem* base, gint64 the_time);
+gint fraction_nearest_int (Fraction *self);
+static void model_timecode_time_system_real_calculate_pixel_step (ModelTimeSystem* base, float inc, float pixel_min, float pixel_div);
+static gint model_timecode_time_system_real_frame_to_xsize (ModelTimeSystem* base, gint frame);
+static gint model_timecode_time_system_real_xsize_to_frame (ModelTimeSystem* base, gint xsize);
+static gint model_timecode_time_system_real_get_start_token (ModelTimeSystem* base, gint xsize);
+static gint model_timecode_time_system_real_get_next_position (ModelTimeSystem* base, gint token);
+GType time_code_get_type (void);
+TimeCode* time_code_dup (const TimeCode* self);
+void time_code_free (TimeCode* self);
+void frame_to_time (gint frame, Fraction* rate, TimeCode* result);
+char* time_code_to_string (TimeCode *self);
+static char* model_timecode_time_system_real_get_display_string (ModelTimeSystem* base, gint frame);
+static gint model_timecode_time_system_real_get_pixel_height (ModelTimeSystem* base, gint frame);
+static gint* model_timecode_time_system_real_get_timeline_seconds (ModelTimeSystemBase* base, int* result_length1);
+ModelTimecodeTimeSystem* model_timecode_time_system_new (void);
+ModelTimecodeTimeSystem* model_timecode_time_system_construct (GType object_type);
+static void model_timecode_time_system_finalize (GObject* obj);
+GType model_tempo_information_get_type (void);
+void model_tempo_information_get_time_signature (ModelTempoInformation* self, Fraction* result);
+gint model_tempo_information_get_bpm (ModelTempoInformation* self);
+GType model_bar_beat_time_system_get_type (void);
+#define MODEL_BAR_BEAT_TIME_SYSTEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MODEL_TYPE_BAR_BEAT_TIME_SYSTEM, ModelBarBeatTimeSystemPrivate))
+enum  {
+       MODEL_BAR_BEAT_TIME_SYSTEM_DUMMY_PROPERTY
+};
+static void model_bar_beat_time_system_on_bpm_changed (ModelBarBeatTimeSystem* self, gint bpm);
+static void _model_bar_beat_time_system_on_bpm_changed_model_tempo_information_bpm_changed (ModelTempoInformation* _sender, gint bpm, gpointer self);
+static void model_bar_beat_time_system_on_time_signature_changed (ModelBarBeatTimeSystem* self, Fraction* time_signature);
+static void _model_bar_beat_time_system_on_time_signature_changed_model_tempo_information_time_signature_changed (ModelTempoInformation* _sender, Fraction* time_signature, gpointer self);
+static void model_bar_beat_time_system_set_constants (ModelBarBeatTimeSystem* self);
+ModelBarBeatTimeSystem* model_bar_beat_time_system_new (ModelTempoInformation* tempo_information);
+ModelBarBeatTimeSystem* model_bar_beat_time_system_construct (GType object_type, ModelTempoInformation* tempo_information);
+GType logging_facility_get_type (void);
+GType logging_level_get_type (void);
+void logging_emit (GObject* object, LoggingFacility facility, LoggingLevel level, const char* message);
+static gint model_bar_beat_time_system_real_correct_sub_second_value (ModelTimeSystemBase* base, float bars, gint div, gint unused);
+static char* model_bar_beat_time_system_beats_to_string (ModelBarBeatTimeSystem* self, gint total_sixteenths, gboolean maximum_resolution, gboolean zero_based);
+static char* model_bar_beat_time_system_real_get_time_string (ModelTimeSystem* base, gint64 the_time);
+static char* model_bar_beat_time_system_real_get_time_duration (ModelTimeSystem* base, gint64 the_time);
+static void model_bar_beat_time_system_real_calculate_pixel_step (ModelTimeSystem* base, float inc, float pixel_min, float pixel_div);
+static gint model_bar_beat_time_system_real_frame_to_xsize (ModelTimeSystem* base, gint frame);
+static gint model_bar_beat_time_system_real_xsize_to_frame (ModelTimeSystem* base, gint xsize);
+static gint model_bar_beat_time_system_real_get_start_token (ModelTimeSystem* base, gint xsize);
+static gint model_bar_beat_time_system_real_get_next_position (ModelTimeSystem* base, gint token);
+static char* model_bar_beat_time_system_real_get_display_string (ModelTimeSystem* base, gint frame);
+static gint model_bar_beat_time_system_real_get_pixel_height (ModelTimeSystem* base, gint frame);
+static gint* _vala_array_dup1 (gint* self, int length);
+static gint* model_bar_beat_time_system_real_get_timeline_seconds (ModelTimeSystemBase* base, int* result_length1);
+static void model_bar_beat_time_system_finalize (GObject* obj);
+
+
+static void g_cclosure_user_marshal_VOID__BOXED (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
+
+#line 12 "TimeSystem.vala"
+void model_time_system_calculate_pixel_step (ModelTimeSystem* self, float inc, float pixel_min, float pixel_div) {
+#line 12 "TimeSystem.vala"
+       MODEL_TIME_SYSTEM_GET_INTERFACE (self)->calculate_pixel_step (self, inc, pixel_min, pixel_div);
+#line 305 "TimeSystem.c"
+}
+
+
+#line 13 "TimeSystem.vala"
+gint64 model_time_system_xpos_to_time (ModelTimeSystem* self, gint x) {
+#line 13 "TimeSystem.vala"
+       return MODEL_TIME_SYSTEM_GET_INTERFACE (self)->xpos_to_time (self, x);
+#line 313 "TimeSystem.c"
+}
+
+
+#line 14 "TimeSystem.vala"
+gint64 model_time_system_xsize_to_time (ModelTimeSystem* self, gint x) {
+#line 14 "TimeSystem.vala"
+       return MODEL_TIME_SYSTEM_GET_INTERFACE (self)->xsize_to_time (self, x);
+#line 321 "TimeSystem.c"
+}
+
+
+#line 15 "TimeSystem.vala"
+gint model_time_system_time_to_xpos (ModelTimeSystem* self, gint64 time) {
+#line 15 "TimeSystem.vala"
+       return MODEL_TIME_SYSTEM_GET_INTERFACE (self)->time_to_xpos (self, time);
+#line 329 "TimeSystem.c"
+}
+
+
+#line 16 "TimeSystem.vala"
+gint64 model_time_system_get_pixel_snap_time (ModelTimeSystem* self) {
+#line 16 "TimeSystem.vala"
+       return MODEL_TIME_SYSTEM_GET_INTERFACE (self)->get_pixel_snap_time (self);
+#line 337 "TimeSystem.c"
+}
+
+
+#line 17 "TimeSystem.vala"
+gint model_time_system_time_to_xsize (ModelTimeSystem* self, gint64 time) {
+#line 17 "TimeSystem.vala"
+       return MODEL_TIME_SYSTEM_GET_INTERFACE (self)->time_to_xsize (self, time);
+#line 345 "TimeSystem.c"
+}
+
+
+#line 18 "TimeSystem.vala"
+float model_time_system_get_pixel_percentage (ModelTimeSystem* self) {
+#line 18 "TimeSystem.vala"
+       return MODEL_TIME_SYSTEM_GET_INTERFACE (self)->get_pixel_percentage (self);
+#line 353 "TimeSystem.c"
+}
+
+
+#line 19 "TimeSystem.vala"
+gint model_time_system_get_start_token (ModelTimeSystem* self, gint xsize) {
+#line 19 "TimeSystem.vala"
+       return MODEL_TIME_SYSTEM_GET_INTERFACE (self)->get_start_token (self, xsize);
+#line 361 "TimeSystem.c"
+}
+
+
+#line 20 "TimeSystem.vala"
+gint model_time_system_get_next_position (ModelTimeSystem* self, gint token) {
+#line 20 "TimeSystem.vala"
+       return MODEL_TIME_SYSTEM_GET_INTERFACE (self)->get_next_position (self, token);
+#line 369 "TimeSystem.c"
+}
+
+
+#line 21 "TimeSystem.vala"
+gint model_time_system_get_pixel_height (ModelTimeSystem* self, gint token) {
+#line 21 "TimeSystem.vala"
+       return MODEL_TIME_SYSTEM_GET_INTERFACE (self)->get_pixel_height (self, token);
+#line 377 "TimeSystem.c"
+}
+
+
+#line 22 "TimeSystem.vala"
+char* model_time_system_get_display_string (ModelTimeSystem* self, gint token) {
+#line 22 "TimeSystem.vala"
+       return MODEL_TIME_SYSTEM_GET_INTERFACE (self)->get_display_string (self, token);
+#line 385 "TimeSystem.c"
+}
+
+
+#line 23 "TimeSystem.vala"
+gint model_time_system_frame_to_xsize (ModelTimeSystem* self, gint frame) {
+#line 23 "TimeSystem.vala"
+       return MODEL_TIME_SYSTEM_GET_INTERFACE (self)->frame_to_xsize (self, frame);
+#line 393 "TimeSystem.c"
+}
+
+
+#line 24 "TimeSystem.vala"
+gint model_time_system_xsize_to_frame (ModelTimeSystem* self, gint xsize) {
+#line 24 "TimeSystem.vala"
+       return MODEL_TIME_SYSTEM_GET_INTERFACE (self)->xsize_to_frame (self, xsize);
+#line 401 "TimeSystem.c"
+}
+
+
+#line 25 "TimeSystem.vala"
+char* model_time_system_get_time_string (ModelTimeSystem* self, gint64 time) {
+#line 25 "TimeSystem.vala"
+       return MODEL_TIME_SYSTEM_GET_INTERFACE (self)->get_time_string (self, time);
+#line 409 "TimeSystem.c"
+}
+
+
+#line 26 "TimeSystem.vala"
+char* model_time_system_get_time_duration (ModelTimeSystem* self, gint64 time) {
+#line 26 "TimeSystem.vala"
+       return MODEL_TIME_SYSTEM_GET_INTERFACE (self)->get_time_duration (self, time);
+#line 417 "TimeSystem.c"
+}
+
+
+static void model_time_system_base_init (ModelTimeSystemIface * iface) {
+       static gboolean initialized = FALSE;
+       if (!initialized) {
+               initialized = TRUE;
+               g_signal_new ("geometry_changed", MODEL_TYPE_TIME_SYSTEM, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+       }
+}
+
+
+GType model_time_system_get_type (void) {
+       static volatile gsize model_time_system_type_id__volatile = 0;
+       if (g_once_init_enter (&model_time_system_type_id__volatile)) {
+               static const GTypeInfo g_define_type_info = { sizeof (ModelTimeSystemIface), (GBaseInitFunc) model_time_system_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
+               GType model_time_system_type_id;
+               model_time_system_type_id = g_type_register_static (G_TYPE_INTERFACE, "ModelTimeSystem", &g_define_type_info, 0);
+               g_type_interface_add_prerequisite (model_time_system_type_id, G_TYPE_OBJECT);
+               g_once_init_leave (&model_time_system_type_id__volatile, model_time_system_type_id);
+       }
+       return model_time_system_type_id__volatile;
+}
+
+
+#line 39 "TimeSystem.vala"
+static gint* model_time_system_base_real_get_timeline_seconds (ModelTimeSystemBase* self, int* result_length1) {
+#line 445 "TimeSystem.c"
+       g_return_val_if_fail (MODEL_IS_TIME_SYSTEM_BASE (self), NULL);
+       g_critical ("Type `%s' does not implement abstract method `model_time_system_base_get_timeline_seconds'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
+       return NULL;
+}
+
+
+#line 39 "TimeSystem.vala"
+gint* model_time_system_base_get_timeline_seconds (ModelTimeSystemBase* self, int* result_length1) {
+#line 39 "TimeSystem.vala"
+       return MODEL_TIME_SYSTEM_BASE_GET_CLASS (self)->get_timeline_seconds (self, result_length1);
+#line 456 "TimeSystem.c"
+}
+
+
+#line 40 "TimeSystem.vala"
+static gint model_time_system_base_real_correct_sub_second_value (ModelTimeSystemBase* self, float seconds, gint div, gint fps) {
+#line 462 "TimeSystem.c"
+       g_return_val_if_fail (MODEL_IS_TIME_SYSTEM_BASE (self), 0);
+       g_critical ("Type `%s' does not implement abstract method `model_time_system_base_correct_sub_second_value'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
+       return 0;
+}
+
+
+#line 40 "TimeSystem.vala"
+gint model_time_system_base_correct_sub_second_value (ModelTimeSystemBase* self, float seconds, gint div, gint fps) {
+#line 40 "TimeSystem.vala"
+       return MODEL_TIME_SYSTEM_BASE_GET_CLASS (self)->correct_sub_second_value (self, seconds, div, fps);
+#line 473 "TimeSystem.c"
+}
+
+
+#line 42 "TimeSystem.vala"
+gint model_time_system_base_correct_seconds_value (ModelTimeSystemBase* self, float seconds, gint div, gint fps) {
+#line 479 "TimeSystem.c"
+       gint result = 0;
+       gint i = 0;
+       gint secs;
+       gint* _tmp1_;
+       gint _timeline_seconds_size_;
+       gint timeline_seconds_length1;
+       gint _tmp0_;
+       gint* timeline_seconds;
+#line 42 "TimeSystem.vala"
+       g_return_val_if_fail (MODEL_IS_TIME_SYSTEM_BASE (self), 0);
+#line 43 "TimeSystem.vala"
+       if (seconds < 1.0f) {
+#line 492 "TimeSystem.c"
+               result = model_time_system_base_correct_sub_second_value (self, seconds, div, fps);
+#line 44 "TimeSystem.vala"
+               return result;
+#line 496 "TimeSystem.c"
+       }
+#line 48 "TimeSystem.vala"
+       secs = (gint) seconds;
+#line 500 "TimeSystem.c"
+       timeline_seconds = (_tmp1_ = model_time_system_base_get_timeline_seconds (self, &_tmp0_), timeline_seconds_length1 = _tmp0_, _timeline_seconds_size_ = timeline_seconds_length1, _tmp1_);
+       {
+               gboolean _tmp2_;
+#line 50 "TimeSystem.vala"
+               i = timeline_seconds_length1 - 1;
+#line 50 "TimeSystem.vala"
+               _tmp2_ = TRUE;
+#line 50 "TimeSystem.vala"
+               while (TRUE) {
+#line 510 "TimeSystem.c"
+                       gboolean _tmp3_ = FALSE;
+#line 50 "TimeSystem.vala"
+                       if (!_tmp2_) {
+#line 50 "TimeSystem.vala"
+                               i--;
+#line 516 "TimeSystem.c"
+                       }
+#line 50 "TimeSystem.vala"
+                       _tmp2_ = FALSE;
+#line 50 "TimeSystem.vala"
+                       if (!(i > 0)) {
+#line 50 "TimeSystem.vala"
+                               break;
+#line 524 "TimeSystem.c"
+                       }
+#line 51 "TimeSystem.vala"
+                       if (secs <= timeline_seconds[i]) {
+#line 52 "TimeSystem.vala"
+                               _tmp3_ = secs >= timeline_seconds[i - 1];
+#line 530 "TimeSystem.c"
+                       } else {
+#line 51 "TimeSystem.vala"
+                               _tmp3_ = FALSE;
+#line 534 "TimeSystem.c"
+                       }
+#line 51 "TimeSystem.vala"
+                       if (_tmp3_) {
+#line 53 "TimeSystem.vala"
+                               if ((div % (timeline_seconds[i] * fps)) == 0) {
+#line 54 "TimeSystem.vala"
+                                       break;
+#line 542 "TimeSystem.c"
+                               }
+#line 56 "TimeSystem.vala"
+                               if ((div % (timeline_seconds[i - 1] * fps)) == 0) {
+#line 57 "TimeSystem.vala"
+                                       i--;
+#line 58 "TimeSystem.vala"
+                                       break;
+#line 550 "TimeSystem.c"
+                               }
+                       }
+               }
+       }
+       result = timeline_seconds[i] * fps;
+       timeline_seconds = (g_free (timeline_seconds), NULL);
+#line 62 "TimeSystem.vala"
+       return result;
+#line 559 "TimeSystem.c"
+}
+
+
+#line 65 "TimeSystem.vala"
+gint64 model_time_system_base_get_pixel_snap_time (ModelTimeSystemBase* self) {
+#line 565 "TimeSystem.c"
+       gint64 result = 0LL;
+#line 65 "TimeSystem.vala"
+       g_return_val_if_fail (MODEL_IS_TIME_SYSTEM_BASE (self), 0LL);
+#line 569 "TimeSystem.c"
+       result = self->pixel_snap_time;
+#line 66 "TimeSystem.vala"
+       return result;
+#line 573 "TimeSystem.c"
+}
+
+
+#line 69 "TimeSystem.vala"
+float model_time_system_base_get_pixel_percentage (ModelTimeSystemBase* self) {
+#line 579 "TimeSystem.c"
+       float result = 0.0F;
+#line 69 "TimeSystem.vala"
+       g_return_val_if_fail (MODEL_IS_TIME_SYSTEM_BASE (self), 0.0F);
+#line 583 "TimeSystem.c"
+       result = self->pixel_percentage;
+#line 70 "TimeSystem.vala"
+       return result;
+#line 587 "TimeSystem.c"
+}
+
+
+#line 73 "TimeSystem.vala"
+gint64 model_time_system_base_xpos_to_time (ModelTimeSystemBase* self, gint x) {
+#line 593 "TimeSystem.c"
+       gint64 result = 0LL;
+#line 73 "TimeSystem.vala"
+       g_return_val_if_fail (MODEL_IS_TIME_SYSTEM_BASE (self), 0LL);
+#line 597 "TimeSystem.c"
+       result = model_time_system_base_xsize_to_time (self, x - MODEL_TIME_SYSTEM_BASE_BORDER);
+#line 74 "TimeSystem.vala"
+       return result;
+#line 601 "TimeSystem.c"
+}
+
+
+#line 77 "TimeSystem.vala"
+gint64 model_time_system_base_xsize_to_time (ModelTimeSystemBase* self, gint size) {
+#line 607 "TimeSystem.c"
+       gint64 result = 0LL;
+#line 77 "TimeSystem.vala"
+       g_return_val_if_fail (MODEL_IS_TIME_SYSTEM_BASE (self), 0LL);
+#line 611 "TimeSystem.c"
+       result = (gint64) (((float) (size * GST_SECOND)) / self->pixels_per_second);
+#line 78 "TimeSystem.vala"
+       return result;
+#line 615 "TimeSystem.c"
+}
+
+
+#line 81 "TimeSystem.vala"
+gint model_time_system_base_time_to_xsize (ModelTimeSystemBase* self, gint64 time) {
+#line 621 "TimeSystem.c"
+       gint result = 0;
+#line 81 "TimeSystem.vala"
+       g_return_val_if_fail (MODEL_IS_TIME_SYSTEM_BASE (self), 0);
+#line 625 "TimeSystem.c"
+       result = (gint) ((time * self->pixels_per_second) / GST_SECOND);
+#line 82 "TimeSystem.vala"
+       return result;
+#line 629 "TimeSystem.c"
+}
+
+
+#line 85 "TimeSystem.vala"
+gint model_time_system_base_time_to_xpos (ModelTimeSystemBase* self, gint64 time) {
+#line 635 "TimeSystem.c"
+       gint result = 0;
+       gint pos;
+#line 85 "TimeSystem.vala"
+       g_return_val_if_fail (MODEL_IS_TIME_SYSTEM_BASE (self), 0);
+#line 86 "TimeSystem.vala"
+       pos = model_time_system_base_time_to_xsize (self, time) + MODEL_TIME_SYSTEM_BASE_BORDER;
+#line 88 "TimeSystem.vala"
+       if (model_time_system_base_xpos_to_time (self, pos) != time) {
+#line 89 "TimeSystem.vala"
+               pos++;
+#line 646 "TimeSystem.c"
+       }
+       result = pos;
+#line 90 "TimeSystem.vala"
+       return result;
+#line 651 "TimeSystem.c"
+}
+
+
+#line 29 "TimeSystem.vala"
+ModelTimeSystemBase* model_time_system_base_construct (GType object_type) {
+#line 657 "TimeSystem.c"
+       ModelTimeSystemBase * self;
+#line 29 "TimeSystem.vala"
+       self = (ModelTimeSystemBase*) g_object_new (object_type, NULL);
+#line 661 "TimeSystem.c"
+       return self;
+}
+
+
+static void model_time_system_base_class_init (ModelTimeSystemBaseClass * klass) {
+       model_time_system_base_parent_class = g_type_class_peek_parent (klass);
+       MODEL_TIME_SYSTEM_BASE_CLASS (klass)->get_timeline_seconds = model_time_system_base_real_get_timeline_seconds;
+       MODEL_TIME_SYSTEM_BASE_CLASS (klass)->correct_sub_second_value = model_time_system_base_real_correct_sub_second_value;
+       G_OBJECT_CLASS (klass)->finalize = model_time_system_base_finalize;
+}
+
+
+static void model_time_system_base_instance_init (ModelTimeSystemBase * self) {
+       self->pixel_percentage = 0.0f;
+}
+
+
+static void model_time_system_base_finalize (GObject* obj) {
+       ModelTimeSystemBase * self;
+       self = MODEL_TIME_SYSTEM_BASE (obj);
+       G_OBJECT_CLASS (model_time_system_base_parent_class)->finalize (obj);
+}
+
+
+GType model_time_system_base_get_type (void) {
+       static volatile gsize model_time_system_base_type_id__volatile = 0;
+       if (g_once_init_enter (&model_time_system_base_type_id__volatile)) {
+               static const GTypeInfo g_define_type_info = { sizeof (ModelTimeSystemBaseClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) model_time_system_base_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ModelTimeSystemBase), 0, (GInstanceInitFunc) model_time_system_base_instance_init, NULL };
+               GType model_time_system_base_type_id;
+               model_time_system_base_type_id = g_type_register_static (G_TYPE_OBJECT, "ModelTimeSystemBase", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
+               g_once_init_leave (&model_time_system_base_type_id__volatile, model_time_system_base_type_id);
+       }
+       return model_time_system_base_type_id__volatile;
+}
+
+
+#line 103 "TimeSystem.vala"
+static gint model_timecode_time_system_real_correct_sub_second_value (ModelTimeSystemBase* base, float seconds, gint div, gint fps) {
+#line 700 "TimeSystem.c"
+       ModelTimecodeTimeSystem * self;
+       gint result = 0;
+       gint frames;
+       gint mod;
+       self = MODEL_TIMECODE_TIME_SYSTEM (base);
+#line 104 "TimeSystem.vala"
+       frames = (gint) (fps * seconds);
+#line 105 "TimeSystem.vala"
+       if (frames == 0) {
+#line 710 "TimeSystem.c"
+               result = 1;
+#line 106 "TimeSystem.vala"
+               return result;
+#line 714 "TimeSystem.c"
+       }
+#line 109 "TimeSystem.vala"
+       if (div == 0) {
+#line 110 "TimeSystem.vala"
+               div = fps;
+#line 720 "TimeSystem.c"
+       }
+#line 113 "TimeSystem.vala"
+       mod = div % frames;
+#line 114 "TimeSystem.vala"
+       while (TRUE) {
+#line 114 "TimeSystem.vala"
+               if (!(mod != 0)) {
+#line 114 "TimeSystem.vala"
+                       break;
+#line 730 "TimeSystem.c"
+               }
+#line 115 "TimeSystem.vala"
+               mod = div % (frames = frames + 1);
+#line 734 "TimeSystem.c"
+       }
+       result = frames;
+#line 117 "TimeSystem.vala"
+       return result;
+#line 739 "TimeSystem.c"
+}
+
+
+#line 120 "TimeSystem.vala"
+static char* model_timecode_time_system_real_get_time_string (ModelTimeSystem* base, gint64 the_time) {
+#line 745 "TimeSystem.c"
+       ModelTimecodeTimeSystem * self;
+       char* result = NULL;
+       char* time;
+       gint frame;
+       char* _tmp0_;
+       self = MODEL_TIMECODE_TIME_SYSTEM (base);
+       time = NULL;
+#line 123 "TimeSystem.vala"
+       frame = time_to_frame_with_rate (the_time, &self->frame_rate_fraction);
+#line 124 "TimeSystem.vala"
+       time = (_tmp0_ = frame_to_string (frame, &self->frame_rate_fraction), _g_free0 (time), _tmp0_);
+#line 757 "TimeSystem.c"
+       result = time;
+#line 126 "TimeSystem.vala"
+       return result;
+#line 761 "TimeSystem.c"
+}
+
+
+#line 129 "TimeSystem.vala"
+static char* model_timecode_time_system_real_get_time_duration (ModelTimeSystem* base, gint64 the_time) {
+#line 767 "TimeSystem.c"
+       ModelTimecodeTimeSystem * self;
+       char* result = NULL;
+       self = MODEL_TIMECODE_TIME_SYSTEM (base);
+       result = model_time_system_get_time_string (MODEL_TIME_SYSTEM (self), the_time);
+#line 131 "TimeSystem.vala"
+       return result;
+#line 774 "TimeSystem.c"
+}
+
+
+#line 133 "TimeSystem.vala"
+static void model_timecode_time_system_real_calculate_pixel_step (ModelTimeSystem* base, float inc, float pixel_min, float pixel_div) {
+#line 780 "TimeSystem.c"
+       ModelTimecodeTimeSystem * self;
+       gint pixels_per_large;
+       gint pixels_per_medium;
+       gint pixels_per_small;
+       gint fps;
+       self = MODEL_TIMECODE_TIME_SYSTEM (base);
+#line 134 "TimeSystem.vala"
+       pixels_per_large = 300;
+#line 135 "TimeSystem.vala"
+       pixels_per_medium = 50;
+#line 136 "TimeSystem.vala"
+       pixels_per_small = 20;
+#line 138 "TimeSystem.vala"
+       MODEL_TIME_SYSTEM_BASE (self)->pixel_percentage = MODEL_TIME_SYSTEM_BASE (self)->pixel_percentage + inc;
+#line 139 "TimeSystem.vala"
+       if (MODEL_TIME_SYSTEM_BASE (self)->pixel_percentage < 0.0f) {
+#line 140 "TimeSystem.vala"
+               MODEL_TIME_SYSTEM_BASE (self)->pixel_percentage = 0.0f;
+#line 799 "TimeSystem.c"
+       } else {
+#line 141 "TimeSystem.vala"
+               if (MODEL_TIME_SYSTEM_BASE (self)->pixel_percentage > 1.0f) {
+#line 142 "TimeSystem.vala"
+                       MODEL_TIME_SYSTEM_BASE (self)->pixel_percentage = 1.0f;
+#line 805 "TimeSystem.c"
+               }
+       }
+#line 144 "TimeSystem.vala"
+       MODEL_TIME_SYSTEM_BASE (self)->pixels_per_second = pixel_min * powf (pixel_div, MODEL_TIME_SYSTEM_BASE (self)->pixel_percentage);
+#line 145 "TimeSystem.vala"
+       fps = fraction_nearest_int (&self->frame_rate_fraction);
+#line 146 "TimeSystem.vala"
+       self->priv->large_pixel_frames = model_time_system_base_correct_seconds_value (MODEL_TIME_SYSTEM_BASE (self), pixels_per_large / MODEL_TIME_SYSTEM_BASE (self)->pixels_per_second, 0, fps);
+#line 147 "TimeSystem.vala"
+       self->priv->medium_pixel_frames = model_time_system_base_correct_seconds_value (MODEL_TIME_SYSTEM_BASE (self), pixels_per_medium / MODEL_TIME_SYSTEM_BASE (self)->pixels_per_second, self->priv->large_pixel_frames, fps);
+#line 149 "TimeSystem.vala"
+       self->priv->small_pixel_frames = model_time_system_base_correct_seconds_value (MODEL_TIME_SYSTEM_BASE (self), pixels_per_small / MODEL_TIME_SYSTEM_BASE (self)->pixels_per_second, self->priv->medium_pixel_frames, fps);
+#line 152 "TimeSystem.vala"
+       if (self->priv->small_pixel_frames == self->priv->medium_pixel_frames) {
+#line 820 "TimeSystem.c"
+               gint i;
+#line 153 "TimeSystem.vala"
+               i = self->priv->medium_pixel_frames;
+#line 155 "TimeSystem.vala"
+               while (TRUE) {
+#line 155 "TimeSystem.vala"
+                       if (!((i = i - 1) > 0)) {
+#line 155 "TimeSystem.vala"
+                               break;
+#line 830 "TimeSystem.c"
+                       }
+#line 156 "TimeSystem.vala"
+                       if ((self->priv->medium_pixel_frames % i) == 0) {
+#line 157 "TimeSystem.vala"
+                               self->priv->small_pixel_frames = i;
+#line 158 "TimeSystem.vala"
+                               break;
+#line 838 "TimeSystem.c"
+                       }
+               }
+       }
+#line 163 "TimeSystem.vala"
+       self->priv->pixels_per_frame = MODEL_TIME_SYSTEM_BASE (self)->pixels_per_second / ((float) fps);
+#line 164 "TimeSystem.vala"
+       MODEL_TIME_SYSTEM_BASE (self)->pixel_snap_time = model_time_system_xsize_to_time (MODEL_TIME_SYSTEM (self), MODEL_TIME_SYSTEM_BASE_PIXEL_SNAP_INTERVAL);
+#line 846 "TimeSystem.c"
+}
+
+
+#line 167 "TimeSystem.vala"
+static gint model_timecode_time_system_real_frame_to_xsize (ModelTimeSystem* base, gint frame) {
+#line 852 "TimeSystem.c"
+       ModelTimecodeTimeSystem * self;
+       gint result = 0;
+       self = MODEL_TIMECODE_TIME_SYSTEM (base);
+       result = (gint) (frame * self->priv->pixels_per_frame);
+#line 168 "TimeSystem.vala"
+       return result;
+#line 859 "TimeSystem.c"
+}
+
+
+#line 171 "TimeSystem.vala"
+static gint model_timecode_time_system_real_xsize_to_frame (ModelTimeSystem* base, gint xsize) {
+#line 865 "TimeSystem.c"
+       ModelTimecodeTimeSystem * self;
+       gint result = 0;
+       self = MODEL_TIMECODE_TIME_SYSTEM (base);
+       result = (gint) (xsize / self->priv->pixels_per_frame);
+#line 172 "TimeSystem.vala"
+       return result;
+#line 872 "TimeSystem.c"
+}
+
+
+#line 175 "TimeSystem.vala"
+static gint model_timecode_time_system_real_get_start_token (ModelTimeSystem* base, gint xsize) {
+#line 878 "TimeSystem.c"
+       ModelTimecodeTimeSystem * self;
+       gint result = 0;
+       gint start_frame;
+       self = MODEL_TIMECODE_TIME_SYSTEM (base);
+#line 176 "TimeSystem.vala"
+       start_frame = model_time_system_xsize_to_frame (MODEL_TIME_SYSTEM (self), xsize);
+#line 885 "TimeSystem.c"
+       result = self->priv->large_pixel_frames * (start_frame / self->priv->large_pixel_frames);
+#line 177 "TimeSystem.vala"
+       return result;
+#line 889 "TimeSystem.c"
+}
+
+
+#line 180 "TimeSystem.vala"
+static gint model_timecode_time_system_real_get_next_position (ModelTimeSystem* base, gint token) {
+#line 895 "TimeSystem.c"
+       ModelTimecodeTimeSystem * self;
+       gint result = 0;
+       self = MODEL_TIMECODE_TIME_SYSTEM (base);
+       result = token + self->priv->small_pixel_frames;
+#line 181 "TimeSystem.vala"
+       return result;
+#line 902 "TimeSystem.c"
+}
+
+
+#line 184 "TimeSystem.vala"
+static char* model_timecode_time_system_real_get_display_string (ModelTimeSystem* base, gint frame) {
+#line 908 "TimeSystem.c"
+       ModelTimecodeTimeSystem * self;
+       char* result = NULL;
+       self = MODEL_TIMECODE_TIME_SYSTEM (base);
+#line 185 "TimeSystem.vala"
+       if ((frame % self->priv->large_pixel_frames) == 0) {
+#line 914 "TimeSystem.c"
+               TimeCode _tmp1_;
+               TimeCode _tmp0_ = {0};
+               result = time_code_to_string ((_tmp1_ = (frame_to_time (frame, &self->frame_rate_fraction, &_tmp0_), _tmp0_), &_tmp1_));
+#line 186 "TimeSystem.vala"
+               return result;
+#line 920 "TimeSystem.c"
+       }
+       result = NULL;
+#line 188 "TimeSystem.vala"
+       return result;
+#line 925 "TimeSystem.c"
+}
+
+
+#line 191 "TimeSystem.vala"
+static gint model_timecode_time_system_real_get_pixel_height (ModelTimeSystem* base, gint frame) {
+#line 931 "TimeSystem.c"
+       ModelTimecodeTimeSystem * self;
+       gint result = 0;
+       self = MODEL_TIMECODE_TIME_SYSTEM (base);
+#line 192 "TimeSystem.vala"
+       if ((frame % self->priv->medium_pixel_frames) == 0) {
+#line 937 "TimeSystem.c"
+               gboolean _tmp0_ = FALSE;
+#line 193 "TimeSystem.vala"
+               if (self->priv->medium_pixel_frames == self->priv->small_pixel_frames) {
+#line 941 "TimeSystem.c"
+                       gboolean _tmp1_ = FALSE;
+#line 194 "TimeSystem.vala"
+                       if (self->priv->medium_pixel_frames != self->priv->large_pixel_frames) {
+#line 195 "TimeSystem.vala"
+                               _tmp1_ = (frame % self->priv->large_pixel_frames) != 0;
+#line 947 "TimeSystem.c"
+                       } else {
+#line 194 "TimeSystem.vala"
+                               _tmp1_ = FALSE;
+#line 951 "TimeSystem.c"
+                       }
+#line 194 "TimeSystem.vala"
+                       _tmp0_ = _tmp1_;
+#line 955 "TimeSystem.c"
+               } else {
+#line 193 "TimeSystem.vala"
+                       _tmp0_ = FALSE;
+#line 959 "TimeSystem.c"
+               }
+#line 193 "TimeSystem.vala"
+               if (_tmp0_) {
+#line 963 "TimeSystem.c"
+                       result = 2;
+#line 196 "TimeSystem.vala"
+                       return result;
+#line 967 "TimeSystem.c"
+               } else {
+                       result = 6;
+#line 199 "TimeSystem.vala"
+                       return result;
+#line 972 "TimeSystem.c"
+               }
+       } else {
+               result = 2;
+#line 202 "TimeSystem.vala"
+               return result;
+#line 978 "TimeSystem.c"
+       }
+}
+
+
+#line 206 "TimeSystem.vala"
+static gint* model_timecode_time_system_real_get_timeline_seconds (ModelTimeSystemBase* base, int* result_length1) {
+#line 985 "TimeSystem.c"
+       ModelTimecodeTimeSystem * self;
+       gint* result = NULL;
+       gint* _tmp0_ = NULL;
+       gint* _tmp1_;
+       self = MODEL_TIMECODE_TIME_SYSTEM (base);
+       result = (_tmp1_ = (_tmp0_ = g_new0 (gint, 15), _tmp0_[0] = 1, _tmp0_[1] = 2, _tmp0_[2] = 5, _tmp0_[3] = 10, _tmp0_[4] = 15, _tmp0_[5] = 20, _tmp0_[6] = 30, _tmp0_[7] = 60, _tmp0_[8] = 120, _tmp0_[9] = 300, _tmp0_[10] = 600, _tmp0_[11] = 900, _tmp0_[12] = 1200, _tmp0_[13] = 1800, _tmp0_[14] = 3600, _tmp0_), *result_length1 = 15, _tmp1_);
+#line 207 "TimeSystem.vala"
+       return result;
+#line 994 "TimeSystem.c"
+}
+
+
+#line 94 "TimeSystem.vala"
+ModelTimecodeTimeSystem* model_timecode_time_system_construct (GType object_type) {
+#line 1000 "TimeSystem.c"
+       ModelTimecodeTimeSystem * self;
+#line 94 "TimeSystem.vala"
+       self = (ModelTimecodeTimeSystem*) model_time_system_base_construct (object_type);
+#line 1004 "TimeSystem.c"
+       return self;
+}
+
+
+#line 94 "TimeSystem.vala"
+ModelTimecodeTimeSystem* model_timecode_time_system_new (void) {
+#line 94 "TimeSystem.vala"
+       return model_timecode_time_system_construct (MODEL_TYPE_TIMECODE_TIME_SYSTEM);
+#line 1013 "TimeSystem.c"
+}
+
+
+static void model_timecode_time_system_class_init (ModelTimecodeTimeSystemClass * klass) {
+       model_timecode_time_system_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_add_private (klass, sizeof (ModelTimecodeTimeSystemPrivate));
+       MODEL_TIME_SYSTEM_BASE_CLASS (klass)->correct_sub_second_value = model_timecode_time_system_real_correct_sub_second_value;
+       MODEL_TIME_SYSTEM_BASE_CLASS (klass)->get_timeline_seconds = model_timecode_time_system_real_get_timeline_seconds;
+       G_OBJECT_CLASS (klass)->finalize = model_timecode_time_system_finalize;
+}
+
+
+static void model_timecode_time_system_model_time_system_interface_init (ModelTimeSystemIface * iface) {
+       model_timecode_time_system_model_time_system_parent_iface = g_type_interface_peek_parent (iface);
+       iface->get_time_string = model_timecode_time_system_real_get_time_string;
+       iface->get_time_duration = model_timecode_time_system_real_get_time_duration;
+       iface->calculate_pixel_step = model_timecode_time_system_real_calculate_pixel_step;
+       iface->frame_to_xsize = model_timecode_time_system_real_frame_to_xsize;
+       iface->xsize_to_frame = model_timecode_time_system_real_xsize_to_frame;
+       iface->get_start_token = model_timecode_time_system_real_get_start_token;
+       iface->get_next_position = model_timecode_time_system_real_get_next_position;
+       iface->get_display_string = model_timecode_time_system_real_get_display_string;
+       iface->get_pixel_height = model_timecode_time_system_real_get_pixel_height;
+       iface->xpos_to_time = (gint64 (*)(ModelTimeSystem* ,gint)) model_time_system_base_xpos_to_time;
+       iface->xsize_to_time = (gint64 (*)(ModelTimeSystem* ,gint)) model_time_system_base_xsize_to_time;
+       iface->time_to_xpos = (gint (*)(ModelTimeSystem* ,gint64)) model_time_system_base_time_to_xpos;
+       iface->get_pixel_snap_time = (gint64 (*)(ModelTimeSystem*)) model_time_system_base_get_pixel_snap_time;
+       iface->time_to_xsize = (gint (*)(ModelTimeSystem* ,gint64)) model_time_system_base_time_to_xsize;
+       iface->get_pixel_percentage = (float (*)(ModelTimeSystem*)) model_time_system_base_get_pixel_percentage;
+}
+
+
+static void model_timecode_time_system_instance_init (ModelTimecodeTimeSystem * self) {
+       Fraction _tmp0_ = {0};
+       self->priv = MODEL_TIMECODE_TIME_SYSTEM_GET_PRIVATE (self);
+       self->priv->small_pixel_frames = 0;
+       self->priv->medium_pixel_frames = 0;
+       self->priv->large_pixel_frames = 0;
+       self->frame_rate_fraction = (fraction_init (&_tmp0_, 30000, 1001), _tmp0_);
+}
+
+
+static void model_timecode_time_system_finalize (GObject* obj) {
+       ModelTimecodeTimeSystem * self;
+       self = MODEL_TIMECODE_TIME_SYSTEM (obj);
+       G_OBJECT_CLASS (model_timecode_time_system_parent_class)->finalize (obj);
+}
+
+
+GType model_timecode_time_system_get_type (void) {
+       static volatile gsize model_timecode_time_system_type_id__volatile = 0;
+       if (g_once_init_enter (&model_timecode_time_system_type_id__volatile)) {
+               static const GTypeInfo g_define_type_info = { sizeof (ModelTimecodeTimeSystemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) model_timecode_time_system_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ModelTimecodeTimeSystem), 0, (GInstanceInitFunc) model_timecode_time_system_instance_init, NULL };
+               static const GInterfaceInfo model_time_system_info = { (GInterfaceInitFunc) model_timecode_time_system_model_time_system_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
+               GType model_timecode_time_system_type_id;
+               model_timecode_time_system_type_id = g_type_register_static (MODEL_TYPE_TIME_SYSTEM_BASE, "ModelTimecodeTimeSystem", &g_define_type_info, 0);
+               g_type_add_interface_static (model_timecode_time_system_type_id, MODEL_TYPE_TIME_SYSTEM, &model_time_system_info);
+               g_once_init_leave (&model_timecode_time_system_type_id__volatile, model_timecode_time_system_type_id);
+       }
+       return model_timecode_time_system_type_id__volatile;
+}
+
+
+#line 212 "TimeSystem.vala"
+void model_tempo_information_get_time_signature (ModelTempoInformation* self, Fraction* result) {
+#line 212 "TimeSystem.vala"
+       MODEL_TEMPO_INFORMATION_GET_INTERFACE (self)->get_time_signature (self, result);
+#line 1081 "TimeSystem.c"
+}
+
+
+#line 213 "TimeSystem.vala"
+gint model_tempo_information_get_bpm (ModelTempoInformation* self) {
+#line 213 "TimeSystem.vala"
+       return MODEL_TEMPO_INFORMATION_GET_INTERFACE (self)->get_bpm (self);
+#line 1089 "TimeSystem.c"
+}
+
+
+static void model_tempo_information_base_init (ModelTempoInformationIface * iface) {
+       static gboolean initialized = FALSE;
+       if (!initialized) {
+               initialized = TRUE;
+               g_signal_new ("time_signature_changed", MODEL_TYPE_TEMPO_INFORMATION, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__BOXED, G_TYPE_NONE, 1, TYPE_FRACTION);
+               g_signal_new ("bpm_changed", MODEL_TYPE_TEMPO_INFORMATION, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
+       }
+}
+
+
+GType model_tempo_information_get_type (void) {
+       static volatile gsize model_tempo_information_type_id__volatile = 0;
+       if (g_once_init_enter (&model_tempo_information_type_id__volatile)) {
+               static const GTypeInfo g_define_type_info = { sizeof (ModelTempoInformationIface), (GBaseInitFunc) model_tempo_information_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
+               GType model_tempo_information_type_id;
+               model_tempo_information_type_id = g_type_register_static (G_TYPE_INTERFACE, "ModelTempoInformation", &g_define_type_info, 0);
+               g_once_init_leave (&model_tempo_information_type_id__volatile, model_tempo_information_type_id);
+       }
+       return model_tempo_information_type_id__volatile;
+}
+
+
+#line 249 "TimeSystem.vala"
+static void _model_bar_beat_time_system_on_bpm_changed_model_tempo_information_bpm_changed (ModelTempoInformation* _sender, gint bpm, gpointer self) {
+#line 1117 "TimeSystem.c"
+       model_bar_beat_time_system_on_bpm_changed (self, bpm);
+}
+
+
+#line 243 "TimeSystem.vala"
+static void _model_bar_beat_time_system_on_time_signature_changed_model_tempo_information_time_signature_changed (ModelTempoInformation* _sender, Fraction* time_signature, gpointer self) {
+#line 1124 "TimeSystem.c"
+       model_bar_beat_time_system_on_time_signature_changed (self, time_signature);
+}
+
+
+#line 235 "TimeSystem.vala"
+ModelBarBeatTimeSystem* model_bar_beat_time_system_construct (GType object_type, ModelTempoInformation* tempo_information) {
+#line 1131 "TimeSystem.c"
+       ModelBarBeatTimeSystem * self;
+       Fraction _tmp0_ = {0};
+#line 235 "TimeSystem.vala"
+       g_return_val_if_fail (MODEL_IS_TEMPO_INFORMATION (tempo_information), NULL);
+#line 235 "TimeSystem.vala"
+       self = (ModelBarBeatTimeSystem*) model_time_system_base_construct (object_type);
+#line 236 "TimeSystem.vala"
+       self->priv->bpm = model_tempo_information_get_bpm (tempo_information);
+#line 237 "TimeSystem.vala"
+       self->priv->time_signature = (model_tempo_information_get_time_signature (tempo_information, &_tmp0_), _tmp0_);
+#line 238 "TimeSystem.vala"
+       g_signal_connect_object (tempo_information, "bpm-changed", (GCallback) _model_bar_beat_time_system_on_bpm_changed_model_tempo_information_bpm_changed, self, 0);
+#line 239 "TimeSystem.vala"
+       g_signal_connect_object (tempo_information, "time-signature-changed", (GCallback) _model_bar_beat_time_system_on_time_signature_changed_model_tempo_information_time_signature_changed, self, 0);
+#line 240 "TimeSystem.vala"
+       model_bar_beat_time_system_set_constants (self);
+#line 1148 "TimeSystem.c"
+       return self;
+}
+
+
+#line 235 "TimeSystem.vala"
+ModelBarBeatTimeSystem* model_bar_beat_time_system_new (ModelTempoInformation* tempo_information) {
+#line 235 "TimeSystem.vala"
+       return model_bar_beat_time_system_construct (MODEL_TYPE_BAR_BEAT_TIME_SYSTEM, tempo_information);
+#line 1157 "TimeSystem.c"
+}
+
+
+#line 243 "TimeSystem.vala"
+static void model_bar_beat_time_system_on_time_signature_changed (ModelBarBeatTimeSystem* self, Fraction* time_signature) {
+#line 243 "TimeSystem.vala"
+       g_return_if_fail (MODEL_IS_BAR_BEAT_TIME_SYSTEM (self));
+#line 244 "TimeSystem.vala"
+       logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_time_signature_changed");
+#line 245 "TimeSystem.vala"
+       self->priv->time_signature = *time_signature;
+#line 246 "TimeSystem.vala"
+       model_bar_beat_time_system_set_constants (self);
+#line 1171 "TimeSystem.c"
+}
+
+
+#line 249 "TimeSystem.vala"
+static void model_bar_beat_time_system_on_bpm_changed (ModelBarBeatTimeSystem* self, gint bpm) {
+#line 249 "TimeSystem.vala"
+       g_return_if_fail (MODEL_IS_BAR_BEAT_TIME_SYSTEM (self));
+#line 250 "TimeSystem.vala"
+       logging_emit (G_OBJECT (self), LOGGING_FACILITY_SIGNAL_HANDLERS, LOGGING_LEVEL_INFO, "on_bpm_changed");
+#line 251 "TimeSystem.vala"
+       self->priv->bpm = bpm;
+#line 252 "TimeSystem.vala"
+       model_bar_beat_time_system_set_constants (self);
+#line 1185 "TimeSystem.c"
+}
+
+
+#line 255 "TimeSystem.vala"
+static void model_bar_beat_time_system_set_constants (ModelBarBeatTimeSystem* self) {
+#line 255 "TimeSystem.vala"
+       g_return_if_fail (MODEL_IS_BAR_BEAT_TIME_SYSTEM (self));
+#line 256 "TimeSystem.vala"
+       self->priv->bars_per_minute = self->priv->bpm / ((float) self->priv->time_signature.numerator);
+#line 257 "TimeSystem.vala"
+       self->priv->bars_per_second = self->priv->bars_per_minute / 60.0f;
+#line 259 "TimeSystem.vala"
+       self->priv->sixteenths_per_beat = 16 / self->priv->time_signature.denominator;
+#line 260 "TimeSystem.vala"
+       self->priv->sixteenths_per_bar = self->priv->time_signature.numerator * self->priv->sixteenths_per_beat;
+#line 261 "TimeSystem.vala"
+       g_signal_emit_by_name (MODEL_TIME_SYSTEM (self), "geometry-changed");
+#line 1203 "TimeSystem.c"
+}
+
+
+#line 264 "TimeSystem.vala"
+static gint model_bar_beat_time_system_real_correct_sub_second_value (ModelTimeSystemBase* base, float bars, gint div, gint unused) {
+#line 1209 "TimeSystem.c"
+       ModelBarBeatTimeSystem * self;
+       gint result = 0;
+       gint sixteenths;
+       self = MODEL_BAR_BEAT_TIME_SYSTEM (base);
+#line 265 "TimeSystem.vala"
+       sixteenths = (gint) (self->priv->sixteenths_per_bar * bars);
+#line 267 "TimeSystem.vala"
+       if (sixteenths == 0) {
+#line 1218 "TimeSystem.c"
+               result = 1;
+#line 268 "TimeSystem.vala"
+               return result;
+#line 1222 "TimeSystem.c"
+       }
+#line 271 "TimeSystem.vala"
+       if (sixteenths > self->priv->sixteenths_per_beat) {
+#line 1226 "TimeSystem.c"
+               result = self->priv->sixteenths_per_beat;
+#line 272 "TimeSystem.vala"
+               return result;
+#line 1230 "TimeSystem.c"
+       }
+#line 275 "TimeSystem.vala"
+       if (sixteenths > 2) {
+#line 1234 "TimeSystem.c"
+               result = 2;
+#line 276 "TimeSystem.vala"
+               return result;
+#line 1238 "TimeSystem.c"
+       }
+       result = 1;
+#line 279 "TimeSystem.vala"
+       return result;
+#line 1243 "TimeSystem.c"
+}
+
+
+#line 282 "TimeSystem.vala"
+static char* model_bar_beat_time_system_beats_to_string (ModelBarBeatTimeSystem* self, gint total_sixteenths, gboolean maximum_resolution, gboolean zero_based) {
+#line 1249 "TimeSystem.c"
+       char* result = NULL;
+       gint number_of_measures;
+       gint number_of_beats;
+       gint number_of_sixteenths;
+       float pixels_per_bar;
+       float pixels_per_large_gap;
+       gboolean _tmp0_ = FALSE;
+#line 282 "TimeSystem.vala"
+       g_return_val_if_fail (MODEL_IS_BAR_BEAT_TIME_SYSTEM (self), NULL);
+#line 284 "TimeSystem.vala"
+       number_of_measures = (total_sixteenths / self->priv->sixteenths_per_beat) / self->priv->time_signature.numerator;
+#line 287 "TimeSystem.vala"
+       number_of_beats = (total_sixteenths / self->priv->sixteenths_per_beat) % self->priv->time_signature.numerator;
+#line 288 "TimeSystem.vala"
+       number_of_sixteenths = total_sixteenths % self->priv->sixteenths_per_beat;
+#line 289 "TimeSystem.vala"
+       if (!zero_based) {
+#line 290 "TimeSystem.vala"
+               number_of_measures = number_of_measures + 1;
+#line 291 "TimeSystem.vala"
+               number_of_beats = number_of_beats + 1;
+#line 292 "TimeSystem.vala"
+               number_of_sixteenths = number_of_sixteenths + 1;
+#line 1273 "TimeSystem.c"
+       }
+#line 294 "TimeSystem.vala"
+       pixels_per_bar = MODEL_TIME_SYSTEM_BASE (self)->pixels_per_second / self->priv->bars_per_second;
+#line 295 "TimeSystem.vala"
+       pixels_per_large_gap = self->priv->large_pixel_sixteenth * self->priv->pixels_per_sixteenth;
+#line 296 "TimeSystem.vala"
+       if (maximum_resolution) {
+#line 296 "TimeSystem.vala"
+               _tmp0_ = TRUE;
+#line 1283 "TimeSystem.c"
+       } else {
+               gboolean _tmp1_ = FALSE;
+#line 297 "TimeSystem.vala"
+               if (pixels_per_large_gap < (self->priv->pixels_per_sixteenth * self->priv->sixteenths_per_beat)) {
+#line 298 "TimeSystem.vala"
+                       _tmp1_ = number_of_sixteenths > 1;
+#line 1290 "TimeSystem.c"
+               } else {
+#line 297 "TimeSystem.vala"
+                       _tmp1_ = FALSE;
+#line 1294 "TimeSystem.c"
+               }
+#line 297 "TimeSystem.vala"
+               _tmp0_ = _tmp1_;
+#line 1298 "TimeSystem.c"
+       }
+#line 296 "TimeSystem.vala"
+       if (_tmp0_) {
+#line 1302 "TimeSystem.c"
+               result = g_strdup_printf ("%d.%d.%d", number_of_measures, number_of_beats, number_of_sixteenths);
+#line 299 "TimeSystem.vala"
+               return result;
+#line 1306 "TimeSystem.c"
+       } else {
+               gboolean _tmp2_ = FALSE;
+#line 300 "TimeSystem.vala"
+               if (pixels_per_large_gap < pixels_per_bar) {
+#line 300 "TimeSystem.vala"
+                       _tmp2_ = number_of_beats > 1;
+#line 1313 "TimeSystem.c"
+               } else {
+#line 300 "TimeSystem.vala"
+                       _tmp2_ = FALSE;
+#line 1317 "TimeSystem.c"
+               }
+#line 300 "TimeSystem.vala"
+               if (_tmp2_) {
+#line 1321 "TimeSystem.c"
+                       result = g_strdup_printf ("%d.%d", number_of_measures, number_of_beats);
+#line 301 "TimeSystem.vala"
+                       return result;
+#line 1325 "TimeSystem.c"
+               } else {
+                       result = g_strdup_printf ("%d", number_of_measures);
+#line 303 "TimeSystem.vala"
+                       return result;
+#line 1330 "TimeSystem.c"
+               }
+       }
+}
+
+
+#line 307 "TimeSystem.vala"
+static char* model_bar_beat_time_system_real_get_time_string (ModelTimeSystem* base, gint64 the_time) {
+#line 1338 "TimeSystem.c"
+       ModelBarBeatTimeSystem * self;
+       char* result = NULL;
+       double beats_per_second;
+       double sixteenths_per_second;
+       double sixteenths_per_nanosecond;
+       gint total_beats;
+       self = MODEL_BAR_BEAT_TIME_SYSTEM (base);
+#line 308 "TimeSystem.vala"
+       beats_per_second = self->priv->bpm / 60.0;
+#line 309 "TimeSystem.vala"
+       sixteenths_per_second = self->priv->sixteenths_per_beat * beats_per_second;
+#line 310 "TimeSystem.vala"
+       sixteenths_per_nanosecond = sixteenths_per_second / GST_SECOND;
+#line 311 "TimeSystem.vala"
+       total_beats = (gint) (the_time * sixteenths_per_nanosecond);
+#line 1354 "TimeSystem.c"
+       result = model_bar_beat_time_system_beats_to_string (self, total_beats, TRUE, FALSE);
+#line 312 "TimeSystem.vala"
+       return result;
+#line 1358 "TimeSystem.c"
+}
+
+
+#line 315 "TimeSystem.vala"
+static char* model_bar_beat_time_system_real_get_time_duration (ModelTimeSystem* base, gint64 the_time) {
+#line 1364 "TimeSystem.c"
+       ModelBarBeatTimeSystem * self;
+       char* result = NULL;
+       double beats_per_second;
+       double sixteenths_per_second;
+       double sixteenths_per_nanosecond;
+       gint total_beats;
+       gboolean _tmp0_ = FALSE;
+       self = MODEL_BAR_BEAT_TIME_SYSTEM (base);
+#line 316 "TimeSystem.vala"
+       beats_per_second = self->priv->bpm / 60.0;
+#line 317 "TimeSystem.vala"
+       sixteenths_per_second = self->priv->sixteenths_per_beat * beats_per_second;
+#line 318 "TimeSystem.vala"
+       sixteenths_per_nanosecond = sixteenths_per_second / GST_SECOND;
+#line 319 "TimeSystem.vala"
+       total_beats = (gint) (the_time * sixteenths_per_nanosecond);
+#line 320 "TimeSystem.vala"
+       if (total_beats == 0) {
+#line 320 "TimeSystem.vala"
+               _tmp0_ = the_time > 0;
+#line 1385 "TimeSystem.c"
+       } else {
+#line 320 "TimeSystem.vala"
+               _tmp0_ = FALSE;
+#line 1389 "TimeSystem.c"
+       }
+#line 320 "TimeSystem.vala"
+       if (_tmp0_) {
+#line 322 "TimeSystem.vala"
+               total_beats = 1;
+#line 1395 "TimeSystem.c"
+       }
+       result = model_bar_beat_time_system_beats_to_string (self, total_beats, TRUE, TRUE);
+#line 324 "TimeSystem.vala"
+       return result;
+#line 1400 "TimeSystem.c"
+}
+
+
+#line 327 "TimeSystem.vala"
+static void model_bar_beat_time_system_real_calculate_pixel_step (ModelTimeSystem* base, float inc, float pixel_min, float pixel_div) {
+#line 1406 "TimeSystem.c"
+       ModelBarBeatTimeSystem * self;
+       gint pixels_per_large;
+       gint pixels_per_medium;
+       gint pixels_per_small;
+       float pixels_per_bar;
+       self = MODEL_BAR_BEAT_TIME_SYSTEM (base);
+#line 328 "TimeSystem.vala"
+       pixels_per_large = 80;
+#line 329 "TimeSystem.vala"
+       pixels_per_medium = 40;
+#line 330 "TimeSystem.vala"
+       pixels_per_small = 20;
+#line 332 "TimeSystem.vala"
+       MODEL_TIME_SYSTEM_BASE (self)->pixel_percentage = MODEL_TIME_SYSTEM_BASE (self)->pixel_percentage + inc;
+#line 333 "TimeSystem.vala"
+       if (MODEL_TIME_SYSTEM_BASE (self)->pixel_percentage < 0.0f) {
+#line 334 "TimeSystem.vala"
+               MODEL_TIME_SYSTEM_BASE (self)->pixel_percentage = 0.0f;
+#line 1425 "TimeSystem.c"
+       } else {
+#line 335 "TimeSystem.vala"
+               if (MODEL_TIME_SYSTEM_BASE (self)->pixel_percentage > 1.0f) {
+#line 336 "TimeSystem.vala"
+                       MODEL_TIME_SYSTEM_BASE (self)->pixel_percentage = 1.0f;
+#line 1431 "TimeSystem.c"
+               }
+       }
+#line 339 "TimeSystem.vala"
+       MODEL_TIME_SYSTEM_BASE (self)->pixels_per_second = pixel_min * powf (pixel_div, MODEL_TIME_SYSTEM_BASE (self)->pixel_percentage);
+#line 340 "TimeSystem.vala"
+       pixels_per_bar = MODEL_TIME_SYSTEM_BASE (self)->pixels_per_second / self->priv->bars_per_second;
+#line 341 "TimeSystem.vala"
+       self->priv->large_pixel_sixteenth = model_time_system_base_correct_seconds_value (MODEL_TIME_SYSTEM_BASE (self), pixels_per_large / pixels_per_bar, 0, self->priv->sixteenths_per_bar);
+#line 344 "TimeSystem.vala"
+       self->priv->medium_pixel_sixteenth = model_time_system_base_correct_seconds_value (MODEL_TIME_SYSTEM_BASE (self), pixels_per_medium / pixels_per_bar, self->priv->large_pixel_sixteenth, self->priv->sixteenths_per_bar);
+#line 346 "TimeSystem.vala"
+       self->priv->small_pixel_sixteenth = model_time_system_base_correct_seconds_value (MODEL_TIME_SYSTEM_BASE (self), pixels_per_small / pixels_per_bar, self->priv->medium_pixel_sixteenth, self->priv->sixteenths_per_bar);
+#line 348 "TimeSystem.vala"
+       if (self->priv->small_pixel_sixteenth == self->priv->medium_pixel_sixteenth) {
+#line 1446 "TimeSystem.c"
+               gint i;
+#line 349 "TimeSystem.vala"
+               i = self->priv->medium_pixel_sixteenth;
+#line 351 "TimeSystem.vala"
+               while (TRUE) {
+#line 351 "TimeSystem.vala"
+                       if (!((i = i - 1) > 0)) {
+#line 351 "TimeSystem.vala"
+                               break;
+#line 1456 "TimeSystem.c"
+                       }
+#line 352 "TimeSystem.vala"
+                       if ((self->priv->medium_pixel_sixteenth % i) == 0) {
+#line 353 "TimeSystem.vala"
+                               self->priv->small_pixel_sixteenth = i;
+#line 354 "TimeSystem.vala"
+                               break;
+#line 1464 "TimeSystem.c"
+                       }
+               }
+       }
+#line 359 "TimeSystem.vala"
+       self->priv->pixels_per_sixteenth = pixels_per_bar / ((float) self->priv->sixteenths_per_bar);
+#line 360 "TimeSystem.vala"
+       MODEL_TIME_SYSTEM_BASE (self)->pixel_snap_time = model_time_system_xsize_to_time (MODEL_TIME_SYSTEM (self), MODEL_TIME_SYSTEM_BASE_PIXEL_SNAP_INTERVAL);
+#line 1472 "TimeSystem.c"
+}
+
+
+#line 363 "TimeSystem.vala"
+static gint model_bar_beat_time_system_real_frame_to_xsize (ModelTimeSystem* base, gint frame) {
+#line 1478 "TimeSystem.c"
+       ModelBarBeatTimeSystem * self;
+       gint result = 0;
+       self = MODEL_BAR_BEAT_TIME_SYSTEM (base);
+       result = (gint) (frame * self->priv->pixels_per_sixteenth);
+#line 364 "TimeSystem.vala"
+       return result;
+#line 1485 "TimeSystem.c"
+}
+
+
+#line 367 "TimeSystem.vala"
+static gint model_bar_beat_time_system_real_xsize_to_frame (ModelTimeSystem* base, gint xsize) {
+#line 1491 "TimeSystem.c"
+       ModelBarBeatTimeSystem * self;
+       gint result = 0;
+       self = MODEL_BAR_BEAT_TIME_SYSTEM (base);
+       result = (gint) (xsize / self->priv->pixels_per_sixteenth);
+#line 368 "TimeSystem.vala"
+       return result;
+#line 1498 "TimeSystem.c"
+}
+
+
+#line 371 "TimeSystem.vala"
+static gint model_bar_beat_time_system_real_get_start_token (ModelTimeSystem* base, gint xsize) {
+#line 1504 "TimeSystem.c"
+       ModelBarBeatTimeSystem * self;
+       gint result = 0;
+       gint start_frame;
+       self = MODEL_BAR_BEAT_TIME_SYSTEM (base);
+#line 372 "TimeSystem.vala"
+       start_frame = model_time_system_xsize_to_frame (MODEL_TIME_SYSTEM (self), xsize);
+#line 1511 "TimeSystem.c"
+       result = self->priv->large_pixel_sixteenth * (start_frame / self->priv->large_pixel_sixteenth);
+#line 373 "TimeSystem.vala"
+       return result;
+#line 1515 "TimeSystem.c"
+}
+
+
+#line 376 "TimeSystem.vala"
+static gint model_bar_beat_time_system_real_get_next_position (ModelTimeSystem* base, gint token) {
+#line 1521 "TimeSystem.c"
+       ModelBarBeatTimeSystem * self;
+       gint result = 0;
+       self = MODEL_BAR_BEAT_TIME_SYSTEM (base);
+       result = token + self->priv->small_pixel_sixteenth;
+#line 377 "TimeSystem.vala"
+       return result;
+#line 1528 "TimeSystem.c"
+}
+
+
+#line 380 "TimeSystem.vala"
+static char* model_bar_beat_time_system_real_get_display_string (ModelTimeSystem* base, gint frame) {
+#line 1534 "TimeSystem.c"
+       ModelBarBeatTimeSystem * self;
+       char* result = NULL;
+       self = MODEL_BAR_BEAT_TIME_SYSTEM (base);
+#line 381 "TimeSystem.vala"
+       if ((frame % self->priv->large_pixel_sixteenth) == 0) {
+#line 1540 "TimeSystem.c"
+               result = model_bar_beat_time_system_beats_to_string (self, frame, FALSE, FALSE);
+#line 382 "TimeSystem.vala"
+               return result;
+#line 1544 "TimeSystem.c"
+       }
+       result = NULL;
+#line 384 "TimeSystem.vala"
+       return result;
+#line 1549 "TimeSystem.c"
+}
+
+
+#line 387 "TimeSystem.vala"
+static gint model_bar_beat_time_system_real_get_pixel_height (ModelTimeSystem* base, gint frame) {
+#line 1555 "TimeSystem.c"
+       ModelBarBeatTimeSystem * self;
+       gint result = 0;
+       self = MODEL_BAR_BEAT_TIME_SYSTEM (base);
+#line 388 "TimeSystem.vala"
+       if ((frame % self->priv->medium_pixel_sixteenth) == 0) {
+#line 1561 "TimeSystem.c"
+               gboolean _tmp0_ = FALSE;
+#line 389 "TimeSystem.vala"
+               if (self->priv->medium_pixel_sixteenth == self->priv->small_pixel_sixteenth) {
+#line 1565 "TimeSystem.c"
+                       gboolean _tmp1_ = FALSE;
+#line 390 "TimeSystem.vala"
+                       if (self->priv->medium_pixel_sixteenth != self->priv->large_pixel_sixteenth) {
+#line 391 "TimeSystem.vala"
+                               _tmp1_ = (frame % self->priv->large_pixel_sixteenth) != 0;
+#line 1571 "TimeSystem.c"
+                       } else {
+#line 390 "TimeSystem.vala"
+                               _tmp1_ = FALSE;
+#line 1575 "TimeSystem.c"
+                       }
+#line 390 "TimeSystem.vala"
+                       _tmp0_ = _tmp1_;
+#line 1579 "TimeSystem.c"
+               } else {
+#line 389 "TimeSystem.vala"
+                       _tmp0_ = FALSE;
+#line 1583 "TimeSystem.c"
+               }
+#line 389 "TimeSystem.vala"
+               if (_tmp0_) {
+#line 1587 "TimeSystem.c"
+                       result = 2;
+#line 392 "TimeSystem.vala"
+                       return result;
+#line 1591 "TimeSystem.c"
+               } else {
+                       result = 6;
+#line 395 "TimeSystem.vala"
+                       return result;
+#line 1596 "TimeSystem.c"
+               }
+       } else {
+               result = 2;
+#line 398 "TimeSystem.vala"
+               return result;
+#line 1602 "TimeSystem.c"
+       }
+}
+
+
+static gint* _vala_array_dup1 (gint* self, int length) {
+       return g_memdup (self, length * sizeof (gint));
+}
+
+
+#line 402 "TimeSystem.vala"
+static gint* model_bar_beat_time_system_real_get_timeline_seconds (ModelTimeSystemBase* base, int* result_length1) {
+#line 1614 "TimeSystem.c"
+       ModelBarBeatTimeSystem * self;
+       gint* result = NULL;
+       gint* _tmp0_;
+       gint* _tmp1_;
+       self = MODEL_BAR_BEAT_TIME_SYSTEM (base);
+       result = (_tmp1_ = (_tmp0_ = self->priv->timeline_bars, (_tmp0_ == NULL) ? ((gpointer) _tmp0_) : _vala_array_dup1 (_tmp0_, self->priv->timeline_bars_length1)), *result_length1 = self->priv->timeline_bars_length1, _tmp1_);
+#line 403 "TimeSystem.vala"
+       return result;
+#line 1623 "TimeSystem.c"
+}
+
+
+static void model_bar_beat_time_system_class_init (ModelBarBeatTimeSystemClass * klass) {
+       model_bar_beat_time_system_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_add_private (klass, sizeof (ModelBarBeatTimeSystemPrivate));
+       MODEL_TIME_SYSTEM_BASE_CLASS (klass)->correct_sub_second_value = model_bar_beat_time_system_real_correct_sub_second_value;
+       MODEL_TIME_SYSTEM_BASE_CLASS (klass)->get_timeline_seconds = model_bar_beat_time_system_real_get_timeline_seconds;
+       G_OBJECT_CLASS (klass)->finalize = model_bar_beat_time_system_finalize;
+}
+
+
+static void model_bar_beat_time_system_model_time_system_interface_init (ModelTimeSystemIface * iface) {
+       model_bar_beat_time_system_model_time_system_parent_iface = g_type_interface_peek_parent (iface);
+       iface->get_time_string = model_bar_beat_time_system_real_get_time_string;
+       iface->get_time_duration = model_bar_beat_time_system_real_get_time_duration;
+       iface->calculate_pixel_step = model_bar_beat_time_system_real_calculate_pixel_step;
+       iface->frame_to_xsize = model_bar_beat_time_system_real_frame_to_xsize;
+       iface->xsize_to_frame = model_bar_beat_time_system_real_xsize_to_frame;
+       iface->get_start_token = model_bar_beat_time_system_real_get_start_token;
+       iface->get_next_position = model_bar_beat_time_system_real_get_next_position;
+       iface->get_display_string = model_bar_beat_time_system_real_get_display_string;
+       iface->get_pixel_height = model_bar_beat_time_system_real_get_pixel_height;
+       iface->xpos_to_time = (gint64 (*)(ModelTimeSystem* ,gint)) model_time_system_base_xpos_to_time;
+       iface->xsize_to_time = (gint64 (*)(ModelTimeSystem* ,gint)) model_time_system_base_xsize_to_time;
+       iface->time_to_xpos = (gint (*)(ModelTimeSystem* ,gint64)) model_time_system_base_time_to_xpos;
+       iface->get_pixel_snap_time = (gint64 (*)(ModelTimeSystem*)) model_time_system_base_get_pixel_snap_time;
+       iface->time_to_xsize = (gint (*)(ModelTimeSystem* ,gint64)) model_time_system_base_time_to_xsize;
+       iface->get_pixel_percentage = (float (*)(ModelTimeSystem*)) model_time_system_base_get_pixel_percentage;
+}
+
+
+static void model_bar_beat_time_system_instance_init (ModelBarBeatTimeSystem * self) {
+       gint* _tmp1_ = NULL;
+       self->priv = MODEL_BAR_BEAT_TIME_SYSTEM_GET_PRIVATE (self);
+       self->priv->small_pixel_sixteenth = 0;
+       self->priv->medium_pixel_sixteenth = 0;
+       self->priv->large_pixel_sixteenth = 0;
+       self->priv->timeline_bars = (_tmp1_ = g_new0 (gint, 15), _tmp1_[0] = 1, _tmp1_[1] = 2, _tmp1_[2] = 4, _tmp1_[3] = 8, _tmp1_[4] = 16, _tmp1_[5] = 24, _tmp1_[6] = 32, _tmp1_[7] = 64, _tmp1_[8] = 128, _tmp1_[9] = 256, _tmp1_[10] = 512, _tmp1_[11] = 768, _tmp1_[12] = 1024, _tmp1_[13] = 2048, _tmp1_[14] = 3192, _tmp1_);
+       self->priv->timeline_bars_length1 = 15;
+       self->priv->_timeline_bars_size_ = self->priv->timeline_bars_length1;
+}
+
+
+static void model_bar_beat_time_system_finalize (GObject* obj) {
+       ModelBarBeatTimeSystem * self;
+       self = MODEL_BAR_BEAT_TIME_SYSTEM (obj);
+       self->priv->timeline_bars = (g_free (self->priv->timeline_bars), NULL);
+       G_OBJECT_CLASS (model_bar_beat_time_system_parent_class)->finalize (obj);
+}
+
+
+GType model_bar_beat_time_system_get_type (void) {
+       static volatile gsize model_bar_beat_time_system_type_id__volatile = 0;
+       if (g_once_init_enter (&model_bar_beat_time_system_type_id__volatile)) {
+               static const GTypeInfo g_define_type_info = { sizeof (ModelBarBeatTimeSystemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) model_bar_beat_time_system_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ModelBarBeatTimeSystem), 0, (GInstanceInitFunc) model_bar_beat_time_system_instance_init, NULL };
+               static const GInterfaceInfo model_time_system_info = { (GInterfaceInitFunc) model_bar_beat_time_system_model_time_system_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
+               GType model_bar_beat_time_system_type_id;
+               model_bar_beat_time_system_type_id = g_type_register_static (MODEL_TYPE_TIME_SYSTEM_BASE, "ModelBarBeatTimeSystem", &g_define_type_info, 0);
+               g_type_add_interface_static (model_bar_beat_time_system_type_id, MODEL_TYPE_TIME_SYSTEM, &model_time_system_info);
+               g_once_init_leave (&model_bar_beat_time_system_type_id__volatile, model_bar_beat_time_system_type_id);
+       }
+       return model_bar_beat_time_system_type_id__volatile;
+}
+
+
+
+static void g_cclosure_user_marshal_VOID__BOXED (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
+       typedef void (*GMarshalFunc_VOID__BOXED) (gpointer data1, gpointer arg_1, gpointer data2);
+       register GMarshalFunc_VOID__BOXED callback;
+       register GCClosure * cc;
+       register gpointer data1, data2;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (n_param_values == 2);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_VOID__BOXED) (marshal_data ? marshal_data : cc->callback);
+       callback (data1, g_value_get_boxed (param_values + 1), data2);
+}
+
+
+