Beispiel #1
0
        private static IReadOnlyCollection <Articulation> TranslateImpl(KeySwitchModel source)
        {
            var articulations = new List <Articulation>();

            foreach (var i in source.Articulations)
            {
                List <IMidiMessage> noteOn        = new List <IMidiMessage>();
                List <IMidiMessage> controlChange = new List <IMidiMessage>();
                List <IMidiMessage> programChange = new List <IMidiMessage>();

                ConvertMessageList(i.MidiMessage.NoteOn, noteOn, IMidiNoteOnFactory.Default);
                ConvertMessageList(i.MidiMessage.ControlChange, controlChange, IMidiControlChangeFactory.Default);
                ConvertMessageList(i.MidiMessage.ProgramChange, programChange, IMidiProgramChangeFactory.Default);

                var articulation = IArticulationFactory.Default.Create(
                    i.Name,
                    noteOn,
                    controlChange,
                    programChange,
                    i.ExtraData
                    );

                articulations.Add(articulation);
            }

            return(articulations);
        }
Beispiel #2
0
        public static KeySwitch Translate(KeySwitchModel model)
        {
            var articulations = TranslateImpl(model);

            return(IKeySwitchFactory.Default.Create(
                       model.Id,
                       model.Author,
                       model.Description,
                       model.Created,
                       model.LastUpdated,
                       model.DeveloperName,
                       model.ProductName,
                       model.InstrumentName,
                       articulations,
                       model.ExtraData
                       ));
        }