OLD | NEW |
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 1997--2019 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1997--2019 Han-Wen Nienhuys <hanwen@xs4all.nl> |
5 | 5 |
6 LilyPond is free software: you can redistribute it and/or modify | 6 LilyPond is free software: you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
8 the Free Software Foundation, either version 3 of the License, or | 8 the Free Software Foundation, either version 3 of the License, or |
9 (at your option) any later version. | 9 (at your option) any later version. |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 #include "warn.hh" | 22 #include "warn.hh" |
23 #include "translator-group.hh" | 23 #include "translator-group.hh" |
24 #include "global-context.hh" | 24 #include "global-context.hh" |
25 #include "moment.hh" | 25 #include "moment.hh" |
26 #include "lily-imports.hh" | 26 #include "lily-imports.hh" |
27 | 27 |
28 void | 28 void |
29 Timing_translator::stop_translation_timestep () | 29 Timing_translator::stop_translation_timestep () |
30 { | 30 { |
31 Global_context *global = get_global_context (); | |
32 | |
33 if (to_boolean (get_property ("timing")) | 31 if (to_boolean (get_property ("timing")) |
34 && !to_boolean (get_property ("skipBars"))) | 32 && !to_boolean (get_property ("skipBars"))) |
35 { | 33 { |
36 Moment barleft = (measure_length () - measure_position (context ())); | 34 Moment barleft = (measure_length () - measure_position (context ())); |
37 Moment now = now_mom (); | 35 Moment now = now_mom (); |
38 | 36 |
39 if (barleft > Moment (0)) | 37 if (barleft > Moment (0)) |
40 { | 38 { |
41 Moment nextmom = now + barleft; | 39 Moment nextmom = now + barleft; |
42 nextmom.grace_part_ = Rational (0); | 40 nextmom.grace_part_ = Rational (0); |
43 global->add_moment_to_process (nextmom); | 41 find_global_context ()->add_moment_to_process (nextmom); |
44 } | 42 } |
45 } | 43 } |
46 } | 44 } |
47 | 45 |
48 void | 46 void |
49 Timing_translator::initialize () | 47 Timing_translator::initialize () |
50 { | 48 { |
51 Context *timing = unsmob<Context> | 49 Context *timing = unsmob<Context> |
52 (Lily::ly_context_find (context ()->self_scm (), ly_symbol2scm ("Timing"))); | 50 (Lily::ly_context_find (context ()->self_scm (), ly_symbol2scm ("Timing"))); |
53 if (timing != context ()) | 51 if (timing != context ()) |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 } | 144 } |
147 | 145 |
148 Timing_translator::Timing_translator (Context *c) | 146 Timing_translator::Timing_translator (Context *c) |
149 : Translator (c) | 147 : Translator (c) |
150 { | 148 { |
151 } | 149 } |
152 | 150 |
153 void | 151 void |
154 Timing_translator::start_translation_timestep () | 152 Timing_translator::start_translation_timestep () |
155 { | 153 { |
156 Global_context *global = get_global_context (); | 154 Global_context *global = find_global_context (); |
157 | 155 |
158 Moment now = global->now_mom (); | 156 Moment now = global->now_mom (); |
159 Moment dt = now - global->previous_moment (); | 157 Moment dt = now - global->previous_moment (); |
160 if (dt < Moment (0)) | 158 if (dt < Moment (0)) |
161 { | 159 { |
162 programming_error ("moving backwards in time"); | 160 programming_error ("moving backwards in time"); |
163 dt = 0; | 161 dt = 0; |
164 } | 162 } |
165 else if (dt.main_part_.is_infinity ()) | 163 else if (dt.main_part_.is_infinity ()) |
166 { | 164 { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 "timeSignatureFraction ", | 248 "timeSignatureFraction ", |
251 | 249 |
252 /* write */ | 250 /* write */ |
253 "baseMoment " | 251 "baseMoment " |
254 "currentBarNumber " | 252 "currentBarNumber " |
255 "internalBarNumber " | 253 "internalBarNumber " |
256 "measureLength " | 254 "measureLength " |
257 "measurePosition " | 255 "measurePosition " |
258 "timeSignatureFraction " | 256 "timeSignatureFraction " |
259 ); | 257 ); |
OLD | NEW |