コード例 #1
0
 /// <summary>
 /// Gets the instance.
 /// </summary>
 /// <returns>The instance.</returns>
 public static IMidiOutAdapter GetInstance()
 {
     lock (Lock)
     {
         return(_midiOutAdapter ?? (_midiOutAdapter = new MidiOutAdapter()));
     }
 }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MidiOutModelBinding"/> class.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="midiOutAdapter">The midi out adapter.</param>
        public MidiOutModelBinding(AirCompModel model, IMidiOutAdapter midiOutAdapter)
        {
            _model          = model;
            _midiOutAdapter = midiOutAdapter;

            _model.NoteOn          += NoteOnHandler;
            _model.NoteOff         += NoteOffHandler;
            _model.AllNotesOff     += AllNotesOffHandler;
            _model.PropertyChanged += PropertyChangedHandler;
        }
コード例 #3
0
ファイル: App.xaml.cs プロジェクト: BernhardSchmitt/AirComp
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup" /> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs" /> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var config = LoadConfig();

            _midiOutAdapter      = MidiOutAdapterFactory.GetInstance();
            _model               = SetupModel(config, _midiOutAdapter);
            _midiOutModelBinding = SetupMidiOutBinding(_model, _midiOutAdapter);
            _model.InitOutDevice();
            ShowUi(_model);
        }
コード例 #4
0
ファイル: App.xaml.cs プロジェクト: BernhardSchmitt/AirComp
        /// <summary>
        /// Setups the business model.
        /// </summary>
        /// <param name="config">The configuration.</param>
        /// <param name="adapter">The MIDI out adapter.</param>
        /// <returns>
        /// The created model.
        /// </returns>
        private static AirCompModel SetupModel(CompConfig config, IMidiOutAdapter adapter)
        {
            var model = new AirCompModel(config, adapter.GetMidiOutDevices(), adapter.GetMidiOutChannels());

            try
            {
                // Without connected leap motion we recieve an exception here - move on
                model.InitializeControllerDevice();
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception);
            }
            return(model);
        }
コード例 #5
0
ファイル: App.xaml.cs プロジェクト: BernhardSchmitt/AirComp
 /// <summary>
 /// Setups the binding of the MIDI out adapter to the model.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <param name="adapter">The adapter.</param>
 /// <returns>
 /// The created adapter.
 /// </returns>
 private static MidiOutModelBinding SetupMidiOutBinding(AirCompModel model, IMidiOutAdapter adapter)
 {
     return(new MidiOutModelBinding(model, adapter));
 }