Esempio n. 1
0
        /// <summary>
        /// Starts playing of the MIDI data. This method is non-blocking.
        /// </summary>
        /// <exception cref="ObjectDisposedException">The current <see cref="Playback"/> is disposed.</exception>
        /// <exception cref="MidiDeviceException">An error occurred on device.</exception>
        public void Start()
        {
            EnsureIsNotDisposed();

            if (_clock.IsRunning)
            {
                return;
            }

            OutputDevice?.PrepareForEventsSending();
            StopStartNotes();
            _clock.Start();

            OnStarted();
        }
Esempio n. 2
0
        /// <summary>
        /// Starts playing of the MIDI data. This method is non-blocking.
        /// </summary>
        /// <exception cref="ObjectDisposedException">The current <see cref="Playback"/> is disposed.</exception>
        /// <exception cref="MidiDeviceException">An error occurred on device.</exception>
        public void Start()
        {
            EnsureIsNotDisposed();

            if (OutputDevice == null)
            {
                throw new InvalidOperationException("Output device is not set.");
            }

            if (_clock.IsRunning)
            {
                return;
            }

            OutputDevice.PrepareForEventsSending();
            StopStartNotes();
            _clock.Start();

            OnStarted();
        }
Esempio n. 3
0
        /// <summary>
        /// Starts playing of the MIDI data. This method is non-blocking.
        /// </summary>
        /// <exception cref="ObjectDisposedException">The current <see cref="Playback"/> is disposed.</exception>
        /// <exception cref="MidiDeviceException">An error occurred on device.</exception>
        public void Start()
        {
            EnsureIsNotDisposed();

            if (_clock.IsRunning)
            {
                return;
            }

            if (!_hasBeenStarted)
            {
                MoveToStart();
            }

            OutputDevice?.PrepareForEventsSending();
            SendTrackedData();
            StopStartNotes();
            _clock.Start();

            _hasBeenStarted = true;
            OnStarted();
        }
Esempio n. 4
0
        public void Start()
        {
            EnsureIsNotDisposed();

            if (_clock.IsRunning)
            {
                return;
            }

            _outputDevice.PrepareForEventsSending();

            foreach (var noteOnEvent in _noteOnEvents.Values)
            {
                _outputDevice.SendEvent(noteOnEvent);
            }
            _noteOnEvents.Clear();

            _clock.Start();
            IsRunning = true;
        }
        /// <summary>
        /// Starts current times watching.
        /// </summary>
        /// <exception cref="ObjectDisposedException">The current <see cref="PlaybackCurrentTimeWatcher"/>
        /// is disposed.</exception>
        public void Start()
        {
            EnsureIsNotDisposed();

            _clock.Start();
        }