示例#1
0
 /// <summary>
 /// Resets the MIDI out device
 /// </summary>
 public void Reset()
 {
     MmException.Try(MidiInterop.midiOutReset(hMidiOut), "midiOutReset");
 }
示例#2
0
 /// <summary>
 /// Sends a MIDI message to the MIDI out device
 /// </summary>
 /// <param name="message">The message to send</param>
 public void Send(int message)
 {
     MmException.Try(MidiInterop.midiOutShortMsg(hMidiOut, message), "midiOutShortMsg");
 }
示例#3
0
 /// <summary>
 /// Opens a specified MIDI out device
 /// </summary>
 /// <param name="deviceNo">The device number</param>
 public MidiOut(int deviceNo)
 {
     this.callback = new MidiInterop.MidiOutCallback(Callback);
     MmException.Try(MidiInterop.midiOutOpen(out hMidiOut, (IntPtr)deviceNo, callback, IntPtr.Zero, MidiInterop.CALLBACK_FUNCTION), "midiOutOpen");
 }
示例#4
0
 public void StopRecording()
 {
     this.recording = false;
     this.callbackEvent.Set();
     MmException.Try(WaveInterop.waveInStop(this.waveInHandle), "waveInStop");
 }
示例#5
0
 private void OpenWaveInDevice()
 {
     this.CloseWaveInDevice();
     MmException.Try(WaveInterop.waveInOpenWindow(out this.waveInHandle, (IntPtr)this.DeviceNumber, this.WaveFormat, this.callbackEvent.SafeWaitHandle.DangerousGetHandle(), IntPtr.Zero, WaveInterop.WaveInOutOpenFlags.CallbackEvent), "waveInOpen");
     this.CreateBuffers();
 }
示例#6
0
文件: WaveIn.cs 项目: zhangx3000/GFF
 private void OpenWaveInDevice()
 {
     this.CloseWaveInDevice();
     MmException.Try(this.callbackInfo.WaveInOpen(out this.waveInHandle, this.DeviceNumber, this.WaveFormat, this.callback), "waveInOpen");
     this.CreateBuffers();
 }
示例#7
0
 public static IEnumerable <AcmDriver> EnumerateAcmDrivers()
 {
     AcmDriver.drivers = new List <AcmDriver>();
     MmException.Try(AcmInterop.acmDriverEnum(new AcmInterop.AcmDriverEnumCallback(AcmDriver.DriverEnumCallback), IntPtr.Zero, (AcmDriverEnumFlags)0), "acmDriverEnum");
     return(AcmDriver.drivers);
 }
示例#8
0
 /// <summary>
 /// Sends a MIDI out message
 /// </summary>
 /// <param name="message">Message</param>
 /// <param name="param1">Parameter 1</param>
 /// <param name="param2">Parameter 2</param>
 public void SendDriverMessage(int message, int param1, int param2)
 {
     MmException.Try(MidiInterop.midiOutMessage(hMidiOut, message, (IntPtr)param1, (IntPtr)param2), "midiOutMessage");
 }
 /// <summary>
 /// Stop the MIDI in device
 /// </summary>
 public void Stop()
 {
     MmException.Try(MidiInterop.midiInStop(hMidiIn), "midiInStop");
 }
示例#10
0
 /// <summary>
 /// Start the MIDI in device
 /// </summary>
 public void Start()
 {
     MmException.Try(MidiInterop.midiInStart(hMidiIn), "midiInStart");
 }
示例#11
0
 /// <summary>
 /// Stop recording
 /// </summary>
 public void StopRecording()
 {
     recording = false;
     this.callbackEvent.Set(); // signal the thread to exit
     MmException.Try(WaveInterop.waveInStop(waveInHandle), "waveInStop");
 }
示例#12
0
 public void Reuse()
 {
     MmException.Try(WaveInterop.waveInUnprepareHeader(this.waveInHandle, this.header, Marshal.SizeOf(this.header)), "waveUnprepareHeader");
     MmException.Try(WaveInterop.waveInPrepareHeader(this.waveInHandle, this.header, Marshal.SizeOf(this.header)), "waveInPrepareHeader");
     MmException.Try(WaveInterop.waveInAddBuffer(this.waveInHandle, this.header, Marshal.SizeOf(this.header)), "waveInAddBuffer");
 }