コード例 #1
0
        /// <summary>
        /// Maps to a MIDI message if it can, or returns null.
        /// </summary>
        /// <param name="osc">The OSC message to map</param>
        /// <param name="mapping">The mapping used to generate this packet.</param>
        public MidiMessage Map(OscDataMessage osc, out OscToMidiMap mapping)
        {
            // find a mapping that can convert this osc
            mapping = FindMapping(osc.Address, osc.Source);
            if (mapping == null)
            {
                return(null);
            }

            // build midi
            var ret = new MidiMessage();

            ret.Type  = mapping.MidiType;
            ret.Pitch = mapping.GetMidiNote(osc.Address);
            ret.Value = mapping.GetMidiValue(osc.Value);
            return(ret);
        }