Files
RushMidi.Library/MidiDevice.cs
T
2025-05-13 00:34:26 +03:00

20 lines
691 B
C#

using System.Runtime.InteropServices;
using System.Text;
namespace RushMidiLibrary {
public class MidiDevice {
protected void CheckMMResult(MidiApiWindows.MMRESULT errorCode) {
if(errorCode != MidiApiWindows.MMRESULT.MMSYSERR_NOERROR) {
StringBuilder errorMessage = new StringBuilder(128);
errorCode = MidiApiWindows.midiInGetErrorText(errorCode, errorMessage);
if (errorCode != MidiApiWindows.MMRESULT.MMSYSERR_NOERROR) {
throw new MidiDeviceException("Unknown error");
}
throw new MidiDeviceException(errorMessage.ToString());
}
}
}
}