BASS.NET API for the Un4seen BASS Audio LibraryBassMidiBASS_MIDI_FontUnpack Method BASS.NET API for the Un4seen BASS Audio Library
Produces a decompressed version of a packed soundfont.

Unicode version only here (BASS_UNICODE will be used automatically).

Namespace: Un4seen.Bass.AddOn.Midi
Assembly: Bass.Net (in Bass.Net.dll) Version:

public static bool BASS_MIDI_FontUnpack(
	int handle,
	string outfile


Type: SystemInt32
The soundfont to unpack.
Type: SystemString
Filename for the unpacked soundfont.

Return Value

Type: Boolean
If successful, the is returned, else is returned. Use BASS_ErrorGetCode to get the error code.

To unpack a soundfont, the appropriate BASS add-on needs to be loaded (via BASS_PluginLoad(String)) to decode the samples. For example, if the samples are FLAC encoded, BASSFLAC would need to be loaded. BASS also needs to have been initialized, using BASS_Init(Int32, Int32, BASSInit, IntPtr, IntPtr). For just unpacking a soundfont, the "no sound" device could be used.

A soundfont should not be unpacked while it is being used to render any MIDI streams, as that could delay the rendering. BASS_MIDI_FontGetInfo(Int32, BASS_MIDI_FONTINFO) can be used to check if a soundfont is packed.

ERROR CODEDescription
BASS_ERROR_HANDLEhandle is not valid.
BASS_ERROR_NOTAVAILThe soundfont is not packed.
BASS_ERROR_INITBASS_Init(Int32, Int32, BASSInit, IntPtr, IntPtr) has not been successfully called - it needs to be to decode the samples.
BASS_ERROR_CODECThe appropriate add-on to decode the samples is not loaded.
BASS_ERROR_CREATECouldn't create the output file, outfile.
BASS_ERROR_UNKNOWNSome other mystery problem!


Unpack a FLAC encoded soundfont:
' load FLAC plugin
' open soundfont
Dim handle As Integer = BassMidi.BASS_MIDI_FontInit("afile.sf2pack")
' produce unpacked version
BassMidi.BASS_MIDI_FontUnpack(handle, "afile.sf2")
// load FLAC plugin
// open soundfont
int handle = BassMidi.BASS_MIDI_FontInit("afile.sf2pack");
// produce unpacked version
BassMidi.BASS_MIDI_FontUnpack(handle, "afile.sf2");
See Also