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) 2004--2011 Han-Wen Nienhuys | 4 Copyright (C) 2004--2011 Han-Wen Nienhuys |
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 bool busy_; | 58 bool busy_; |
59 bool notice_busy_; | 59 bool notice_busy_; |
60 | 60 |
61 bool try_process (Music_iterator *i, Moment m); | 61 bool try_process (Music_iterator *i, Moment m); |
62 | 62 |
63 Music_iterator *first_iter_; | 63 Music_iterator *first_iter_; |
64 Music_iterator *second_iter_; | 64 Music_iterator *second_iter_; |
65 Moment start_moment_; | 65 Moment start_moment_; |
66 | 66 |
67 SCM split_list_; | 67 SCM split_list_; |
| 68 SCM direction_; |
| 69 SCM directionOne_; |
| 70 SCM directionTwo_; |
| 71 SCM horizontalShiftOne_; |
| 72 SCM horizontalShiftTwo_; |
68 | 73 |
69 Stream_event *unisono_event_; | 74 Stream_event *unisono_event_; |
70 Stream_event *solo_one_event_; | 75 Stream_event *solo_one_event_; |
71 Stream_event *solo_two_event_; | 76 Stream_event *solo_two_event_; |
72 Stream_event *mmrest_event_; | 77 Stream_event *mmrest_event_; |
73 | 78 |
74 enum Status | 79 enum Status |
75 { | 80 { |
76 APART, | 81 APART, |
77 TOGETHER, | 82 TOGETHER, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 Part_combine_iterator::Part_combine_iterator () | 131 Part_combine_iterator::Part_combine_iterator () |
127 { | 132 { |
128 mmrest_event_ = 0; | 133 mmrest_event_ = 0; |
129 unisono_event_ = 0; | 134 unisono_event_ = 0; |
130 solo_two_event_ = 0; | 135 solo_two_event_ = 0; |
131 solo_one_event_ = 0; | 136 solo_one_event_ = 0; |
132 | 137 |
133 first_iter_ = 0; | 138 first_iter_ = 0; |
134 second_iter_ = 0; | 139 second_iter_ = 0; |
135 split_list_ = SCM_EOL; | 140 split_list_ = SCM_EOL; |
| 141 direction_ = SCM_BOOL_F; |
| 142 directionOne_ = scm_from_int (1); |
| 143 directionTwo_ = scm_from_int (-1); |
| 144 horizontalShiftOne_ = scm_from_int (0); |
| 145 horizontalShiftTwo_ = scm_from_int (1); |
136 state_ = APART; | 146 state_ = APART; |
137 playing_state_ = APART; | 147 playing_state_ = APART; |
138 last_playing_ = APART; | 148 last_playing_ = APART; |
139 | 149 |
140 busy_ = false; | 150 busy_ = false; |
141 notice_busy_ = false; | 151 notice_busy_ = false; |
142 } | 152 } |
143 | 153 |
144 void | 154 void |
145 Part_combine_iterator::derived_mark () const | 155 Part_combine_iterator::derived_mark () const |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 state_ = APART; | 352 state_ = APART; |
343 substitute_both (CONTEXT_ONE, CONTEXT_TWO); | 353 substitute_both (CONTEXT_ONE, CONTEXT_TWO); |
344 } | 354 } |
345 } | 355 } |
346 | 356 |
347 void | 357 void |
348 Part_combine_iterator::construct_children () | 358 Part_combine_iterator::construct_children () |
349 { | 359 { |
350 start_moment_ = get_outlet ()->now_mom (); | 360 start_moment_ = get_outlet ()->now_mom (); |
351 split_list_ = get_music ()->get_property ("split-list"); | 361 split_list_ = get_music ()->get_property ("split-list"); |
| 362 direction_ = get_music ()->get_property ("direction"); |
| 363 if (is_direction (direction_)) |
| 364 { |
| 365 directionOne_ = direction_; |
| 366 directionTwo_ = direction_; |
| 367 if (scm_is_true (scm_negative_p (direction_))) |
| 368 { |
| 369 horizontalShiftOne_ = scm_from_int (1); |
| 370 horizontalShiftTwo_ = scm_from_int (0); |
| 371 } |
| 372 } |
352 | 373 |
353 Context *c = get_outlet (); | 374 Context *c = get_outlet (); |
354 | 375 |
355 for (int i = 0; i < NUM_OUTLETS; i++) | 376 for (int i = 0; i < NUM_OUTLETS; i++) |
356 { | 377 { |
357 SCM type = (i == CONTEXT_NULL) ? ly_symbol2scm ("Devnull") : ly_symbol2scm
("Voice"); | 378 SCM type = (i == CONTEXT_NULL) ? ly_symbol2scm ("Devnull") : ly_symbol2scm
("Voice"); |
358 /* find context below c: otherwise we may create new staff for each voice
*/ | 379 /* find context below c: otherwise we may create new staff for each voice
*/ |
359 c = c->find_create_context (type, outlet_names_[i], SCM_EOL); | 380 c = c->find_create_context (type, outlet_names_[i], SCM_EOL); |
360 handles_[i].set_context (c); | 381 handles_[i].set_context (c); |
361 if (c->is_alias (ly_symbol2scm ("Voice"))) | 382 if (c->is_alias (ly_symbol2scm ("Voice"))) |
362 c->event_source ()->add_listener (GET_LISTENER (set_busy), ly_symbol2scm
("music-event")); | 383 c->event_source ()->add_listener (GET_LISTENER (set_busy), ly_symbol2scm
("music-event")); |
363 } | 384 } |
364 | 385 |
365 SCM lst = get_music ()->get_property ("elements"); | 386 SCM lst = get_music ()->get_property ("elements"); |
366 Context *one = handles_[CONTEXT_ONE].get_context (); | 387 Context *one = handles_[CONTEXT_ONE].get_context (); |
367 set_context (one); | 388 set_context (one); |
368 first_iter_ = unsmob_iterator (get_iterator (unsmob_music (scm_car (lst)))); | 389 first_iter_ = unsmob_iterator (get_iterator (unsmob_music (scm_car (lst)))); |
369 Context *two = handles_[CONTEXT_TWO].get_context (); | 390 Context *two = handles_[CONTEXT_TWO].get_context (); |
370 set_context (two); | 391 set_context (two); |
371 second_iter_ = unsmob_iterator (get_iterator (unsmob_music (scm_cadr (lst)))); | 392 second_iter_ = unsmob_iterator (get_iterator (unsmob_music (scm_cadr (lst)))); |
| 393 Context *shared = handles_[CONTEXT_SHARED].get_context (); |
| 394 set_context (shared); |
372 | 395 |
373 /* Mimic all settings of voiceOne/voiceTwo for the two separate voices...*/ | 396 /* Mimic all settings of voiceOne/voiceTwo for the two separate voices...*/ |
374 /* FIXME: Is there any way to use the definition of \voiceOne/\voiceTwo | 397 /* FIXME: Is there any way to use the definition of \voiceOne/\voiceTwo |
375 directly??? */ | 398 directly??? */ |
376 char const *syms[] | 399 char const *syms[] |
377 = | 400 = |
378 { | 401 { |
379 "Stem", | 402 "Stem", |
380 "DynamicLineSpanner", | 403 "DynamicLineSpanner", |
381 "Tie", | 404 "Tie", |
382 "Dots", | 405 "Dots", |
383 "Rest", | 406 "Rest", |
384 "Slur", | 407 "Slur", |
385 "TextScript", | 408 "TextScript", |
386 "Script", | 409 "Script", |
387 0 | 410 0 |
388 }; | 411 }; |
389 | 412 |
390 for (char const **p = syms; *p; p++) | 413 for (char const **p = syms; *p; p++) |
391 { | 414 { |
392 SCM sym = ly_symbol2scm (*p); | 415 SCM sym = ly_symbol2scm (*p); |
393 execute_pushpop_property (one, sym, | 416 execute_pushpop_property (one, sym, |
394 ly_symbol2scm ("direction"), scm_from_int (1)); | 417 ly_symbol2scm ("direction"), directionOne_); |
395 | 418 |
396 execute_pushpop_property (two, sym, | 419 execute_pushpop_property (two, sym, |
397 ly_symbol2scm ("direction"), scm_from_int (-1)); | 420 ly_symbol2scm ("direction"), directionTwo_); |
| 421 |
| 422 if (scm_is_number (direction_)) |
| 423 execute_pushpop_property (shared, sym, |
| 424 » » » » ly_symbol2scm ("direction"), direction_); |
398 } | 425 } |
399 /* Handle horizontal shifts for crossing notes */ | 426 /* Handle horizontal shifts for crossing notes */ |
400 execute_pushpop_property (one, ly_symbol2scm ("NoteColumn"), | 427 execute_pushpop_property (one, ly_symbol2scm ("NoteColumn"), |
401 ly_symbol2scm ("horizontal-shift"), scm_from_int (0)
); | 428 ly_symbol2scm ("horizontal-shift"), horizontalShiftO
ne_); |
402 execute_pushpop_property (two, ly_symbol2scm ("NoteColumn"), | 429 execute_pushpop_property (two, ly_symbol2scm ("NoteColumn"), |
403 ly_symbol2scm ("horizontal-shift"), scm_from_int (1)
); | 430 ly_symbol2scm ("horizontal-shift"), horizontalShiftT
wo_); |
404 /* Also handle MultiMeasureRest positions for voice 1/2 */ | 431 /* Also handle MultiMeasureRest positions for voice 1/2 */ |
405 execute_pushpop_property (one, ly_symbol2scm ("MultiMeasureRest"), | 432 execute_pushpop_property (one, ly_symbol2scm ("MultiMeasureRest"), |
406 ly_symbol2scm ("staff-position"), scm_from_int (4)); | 433 ly_symbol2scm ("staff-position"), scm_from_int (4)); |
407 execute_pushpop_property (two, ly_symbol2scm ("MultiMeasureRest"), | 434 execute_pushpop_property (two, ly_symbol2scm ("MultiMeasureRest"), |
408 ly_symbol2scm ("staff-position"), scm_from_int (-4))
; | 435 ly_symbol2scm ("staff-position"), scm_from_int (-4))
; |
409 | 436 |
410 } | 437 } |
411 | 438 |
412 IMPLEMENT_LISTENER (Part_combine_iterator, set_busy); | 439 IMPLEMENT_LISTENER (Part_combine_iterator, set_busy); |
413 void | 440 void |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 } | 513 } |
487 | 514 |
488 if (second_iter_->ok ()) | 515 if (second_iter_->ok ()) |
489 { | 516 { |
490 if (try_process (second_iter_, m)) | 517 if (try_process (second_iter_, m)) |
491 last_playing_ = SOLO2; | 518 last_playing_ = SOLO2; |
492 } | 519 } |
493 } | 520 } |
494 | 521 |
495 IMPLEMENT_CTOR_CALLBACK (Part_combine_iterator); | 522 IMPLEMENT_CTOR_CALLBACK (Part_combine_iterator); |
OLD | NEW |