예제 #1
0
        public MidiPerformance(IMidiLink midiLink, MidiValueStrategy valueStrategy = MidiValueStrategy.Raw)
        {
            // null is ok
            _midiLink = midiLink;

            _instances.Add(new WeakReference <MidiPerformance>(this));
            ValueStrategy = valueStrategy;

            _pitchBend = ValueStrategy == MidiValueStrategy.Normalized ? 0f : RAW_PITCHBEND_SCALE;

            // TODO I think I need to supress this attachment in design mode
            _midiLink.AttachListener(this);
        }
예제 #2
0
        public Keyboard(IMidiLink midiLink)
        {
            if (midiLink == null)
            {
                throw new ArgumentNullException("midiLink");
            }
            _midiLink = midiLink;

            InitializeComponent();
            SizeChanged += HandleSizeChanged;

            if (!this.IsInDesignMode())
            {
                _midiLink.AttachListener(this);
            }
        }