private midiInStart ( HMIDIIN hMidiIn ) : MMRESULT | ||
hMidiIn | HMIDIIN | |
Résultat | MMRESULT |
public void StartReceiving(Clock clock, bool handleSysEx) { if (isInsideInputHandler) { throw new InvalidOperationException("Device is receiving."); } lock (this) { CheckOpen(); CheckNotReceiving(); #region SysEx if (handleSysEx) { LongMsgBuffers.Add(CreateLongMsgBuffer()); } #endregion CheckReturnCode(Win32API.midiInStart(handle)); isReceiving = true; this.clock = clock; } }
/// <summary> /// Starts this input device receiving messages. /// </summary> /// <param name="clock">If non-null, the clock's <see cref="Clock.Time"/> property will /// be used to assign a timestamp to each incoming message. If null, timestamps will be in /// seconds since StartReceiving() was called.</param> /// <exception cref="InvalidOperationException">The device is not open or is already /// receiving. /// </exception> /// <exception cref="DeviceException">The device cannot start receiving.</exception> /// <remarks> /// <para>This method launches a background thread to listen for input events, and as events /// are received, the event handlers are invoked on that background thread. Event handlers /// should be written to work from a background thread. (For example, if they want to /// update the GUI, they may need to BeginInvoke to arrange for GUI updates to happen on /// the correct thread.)</para> /// <para>The background thread which is created by this method is joined (shut down) in /// <see cref="StopReceiving"/>.</para> /// </remarks> public void StartReceiving(Clock clock) { if (isInsideInputHandler) { throw new InvalidOperationException("Device is receiving."); } lock (this) { CheckOpen(); CheckNotReceiving(); CheckReturnCode(Win32API.midiInStart(handle)); isReceiving = true; this.clock = clock; } }