public unsafe void OpenData(ReadOnlySpan <byte> data) { fixed(byte *ptr = data) { Check(AdlMidiImports.adl_openData(_device, ptr, (uint)data.Length)); } }
public Instrument GetInstrument(uint index) { var result = AdlMidiImports.adl_getInstrument(_device, ref _bank, index, out var instrument); if (result < 0) { throw new InvalidOperationException(); } return(instrument); }
public BankId GetBankId() { var result = AdlMidiImports.adl_getBankId(_device, ref _bank, out var id); if (result < 0) { throw new InvalidOperationException(); } return(id); }
int Check(int result) { if (result >= 0) { return(result); } var error = AdlMidiImports.adl_errorInfo(_device); throw new InvalidOperationException(error); }
public static MidiPlayer Init(long sampleRate = DefaultChipSampleRate) { var midiPlayer = AdlMidiImports.adl_init(sampleRate); if (midiPlayer == IntPtr.Zero) { throw new InvalidOperationException(ErrorString()); } return(new MidiPlayer(midiPlayer)); }
public void Reset() => AdlMidiImports.adl_reset(_device);
public void Close() => AdlMidiImports.adl_close(_device);
public void OpenFile(string filePath) => Check(AdlMidiImports.adl_openFile(_device, filePath));
public static string[] GetBankNames() => AdlMidiImports.adl_getBankNames();
public static int GetBankCount() => AdlMidiImports.adl_getBanksCount();
public static string ErrorString() => AdlMidiImports.adl_errorString();
public static Version LinkedVersion() { var version = AdlMidiImports.adl_linkedVersion(); return(new Version(version.Major, version.Minor, version.Patch)); }
public static string LinkedLibraryVersion() => AdlMidiImports.adl_linkedLibraryVersion();
public int LoadEmbeddedBank(int num) { return(AdlMidiImports.adl_loadEmbeddedBank(_device, ref _bank, num)); }
public int SetInstrument(uint index, ref Instrument ins) { return(AdlMidiImports.adl_setInstrument(_device, ref _bank, index, ref ins)); }
public int RemoveBank() { return(AdlMidiImports.adl_removeBank(_device, ref _bank)); }