@@ -27,7 +27,7 @@ public void Process(OrnamentationItem item)
27
27
currentNote . OrnamentationType = configuration . OrnamentationType ;
28
28
}
29
29
30
- private List < BaroquenNote > GetOrnamentations ( BaroquenNote currentNote , BaroquenNote ? nextNote )
30
+ private IEnumerable < BaroquenNote > GetOrnamentations ( BaroquenNote currentNote , BaroquenNote ? nextNote )
31
31
{
32
32
var shouldInvert = configuration . ShouldInvertTranslations ( ( currentNote , nextNote ) ) ;
33
33
@@ -37,35 +37,18 @@ private List<BaroquenNote> GetOrnamentations(BaroquenNote currentNote, BaroquenN
37
37
38
38
var notes = compositionConfiguration . Scale . GetNotes ( ) ;
39
39
40
- var ornamentations = new List < BaroquenNote > ( ) ;
41
-
42
- for ( var i = 0 ; i < configuration . Translations . Length ; i ++ )
43
- {
44
- var translation = configuration . Translations [ i ] ;
45
-
46
- var ornamentationIndex = shouldInvert && configuration . TranslationInversionIndices . Contains ( i )
40
+ return configuration . Translations
41
+ . Select ( ( translation , translationIndex ) => shouldInvert && configuration . TranslationInversionIndices . Contains ( translationIndex )
47
42
? translationPivot - translation
48
- : translationPivot + translation ;
49
-
50
- var note = notes [ ornamentationIndex ] ;
51
- var timespan = musicalTimeSpanCalculator . CalculateOrnamentationTimeSpan ( configuration . OrnamentationType , compositionConfiguration . Meter , i ) ;
52
-
53
- ornamentations . Add ( new BaroquenNote ( currentNote . Instrument , note , timespan ) ) ;
54
- }
55
-
56
- // var ornamentations = configuration.Translations
57
- // .Select((translation, translationIndex) => shouldInvert && configuration.TranslationInversionIndices.Contains(translationIndex)
58
- // ? translationPivot - translation
59
- // : translationPivot + translation
60
- // )
61
- // .Select(noteIndex => notes[noteIndex])
62
- // .Select((note, ornamentationStep) =>
63
- // new BaroquenNote(
64
- // currentNote.Instrument,
65
- // note,
66
- // musicalTimeSpanCalculator.CalculateOrnamentationTimeSpan(configuration.OrnamentationType, compositionConfiguration.Meter, ornamentationStep)
67
- // )
68
- // );
69
- return ornamentations ;
43
+ : translationPivot + translation
44
+ )
45
+ . Select ( noteIndex => notes [ noteIndex ] )
46
+ . Select ( ( note , ornamentationStep ) =>
47
+ new BaroquenNote (
48
+ currentNote . Instrument ,
49
+ note ,
50
+ musicalTimeSpanCalculator . CalculateOrnamentationTimeSpan ( configuration . OrnamentationType , compositionConfiguration . Meter , ornamentationStep )
51
+ )
52
+ ) ;
70
53
}
71
54
}
0 commit comments